diff -r 000000000000 -r e686773b3f54 pimprotocols/phonebooksync/Test/TE_PhBkSync/TestDoSynchronisationSteps.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pimprotocols/phonebooksync/Test/TE_PhBkSync/TestDoSynchronisationSteps.cpp Tue Feb 02 10:12:17 2010 +0200 @@ -0,0 +1,1402 @@ +// Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// This contains PhbkSync API DoSynchronisation() related Unit Test Steps +// +// + + +#include "TE_PhBkSyncBase.h" +#include "TestDoSynchronisationSteps.h" + + +/** + * Test synchronisation with a partially full Global/GSM ADN phonebook. + * + * It is assumed that server been connected/started by Open step. + */ +// +// Test step1 -- Test#10 in Unit Test Spec. Doc. // +// +CPhbkSyncDoSynchronisationTest_01::CPhbkSyncDoSynchronisationTest_01() + { + // store the name of this test step + SetTestStepName(_L("PhbkSyncDoSynchronisationTest_01")); + } + +CPhbkSyncDoSynchronisationTest_01::~CPhbkSyncDoSynchronisationTest_01() + { + } + +TVerdict CPhbkSyncDoSynchronisationTest_01::doTestStepL( ) + { + // 1. destroy the default .ini file if it exists + DestroyDefaultIniFileL(); + + // 2. load the partially full Global/GSM ADN phonebook from cfg file + SetSimTsyTestNumberL(10); // see [test10] in configuration file + + // 3. set mode as EManual for the tested phonebook only. + // If the current is EManual, then override it anyway. + User::LeaveIfError(iSession.SetSyncMode(RPhoneBookSession::EManual, KUidIccGlobalAdnPhonebook)); + CheckSyncModeL(RPhoneBookSession::EManual, KUidIccGlobalAdnPhonebook); + + CheckCacheStateInvalidL(KUidIccGlobalAdnPhonebook); + + // 4. do synchronisation + DoSyncL(KUidIccGlobalAdnPhonebook, KErrNone); + + // 5. check the expected behaviour + CheckCacheStateValidL(KUidIccGlobalAdnPhonebook); + + return TestStepResult(); + } + +/** + * Test synchronisation with a partially full USIM ADN phonebook. + * + * It is assumed that server been connected/started by Open step. + */ +// +// Test step2 -- Test#11 in Unit Test Spec. Doc. // +// +CPhbkSyncDoSynchronisationTest_02::CPhbkSyncDoSynchronisationTest_02() + { + // store the name of this test step + SetTestStepName(_L("PhbkSyncDoSynchronisationTest_02")); + } + +CPhbkSyncDoSynchronisationTest_02::~CPhbkSyncDoSynchronisationTest_02() + { + } + +TVerdict CPhbkSyncDoSynchronisationTest_02::doTestStepL( ) + { + // 1. load the partially full USIM ADN phonebook from cfg file + SetSimTsyTestNumberL(11); // see [test11] in configuration file + + // 2. set mode as EManual for the tested phonebook only + User::LeaveIfError(iSession.SetSyncMode(RPhoneBookSession::EManual, KUidUsimAppAdnPhonebook)); + CheckSyncModeL(RPhoneBookSession::EManual, KUidUsimAppAdnPhonebook); + + // 3. do synchronisation + DoSyncL(KUidUsimAppAdnPhonebook, KErrNone); + + // 4. check the expected behaviour + CheckCacheStateValidL(KUidUsimAppAdnPhonebook); + + return TestStepResult(); + } + +/** + * Test synchronisation with a partially full Global/GSM SDN phonebook. + * + * It is assumed that server been connected/started by Open step. + */ +// +// Test step3 -- Test#12 in Unit Test Spec. Doc. // +// +CPhbkSyncDoSynchronisationTest_03::CPhbkSyncDoSynchronisationTest_03() + { + // store the name of this test step + SetTestStepName(_L("PhbkSyncDoSynchronisationTest_03")); + } + +CPhbkSyncDoSynchronisationTest_03::~CPhbkSyncDoSynchronisationTest_03() + { + } + +TVerdict CPhbkSyncDoSynchronisationTest_03::doTestStepL( ) + { + // 1. load the partially full Global/GSM SDN phonebook from cfg file + SetSimTsyTestNumberL(12); // see [test12] in configuration file + + // 2. set mode as EManual for the tested phonebook only + User::LeaveIfError(iSession.SetSyncMode(RPhoneBookSession::EManual, KUidIccGlobalSdnPhonebook)); + CheckSyncModeL(RPhoneBookSession::EManual, KUidIccGlobalSdnPhonebook); + + // 3. do synchronisation + DoSyncL(KUidIccGlobalSdnPhonebook, KErrNone); + + // 4. check the expected behaviour + + return TestStepResult(); + } + +/** + * Test synchronisation with a partially full Global/GSM LND phonebook. + * + * It is assumed that server been connected/started by Open step. + */ +// +// Test step4 -- Test#13 in Unit Test Spec. Doc. // +// +CPhbkSyncDoSynchronisationTest_04::CPhbkSyncDoSynchronisationTest_04() + { + // store the name of this test step + SetTestStepName(_L("PhbkSyncDoSynchronisationTest_04")); + } + +CPhbkSyncDoSynchronisationTest_04::~CPhbkSyncDoSynchronisationTest_04() + { + } + +TVerdict CPhbkSyncDoSynchronisationTest_04::doTestStepL( ) + { + // 1. load the partially full Global/GSM LND phonebook from cfg file + SetSimTsyTestNumberL(13); // see [test13] in configuration file + + // 2. set mode as EManual for the tested phonebook only + User::LeaveIfError(iSession.SetSyncMode(RPhoneBookSession::EManual, KUidIccGlobalLndPhonebook)); + CheckSyncModeL(RPhoneBookSession::EManual, KUidIccGlobalLndPhonebook); + + // 3. do synchronisation + DoSyncL(KUidIccGlobalLndPhonebook, KErrNone); + + // 4. check the expected behaviour + CheckCacheStateValidL(KUidIccGlobalLndPhonebook); + + return TestStepResult(); + } + +/** + * Test synchronisation with a full Global/GSM ADN phonebook. + * + * It is assumed that server been connected/started by Open step. + */ +// +// Test step5 -- Test#14 in Unit Test Spec. Doc. // +// +CPhbkSyncDoSynchronisationTest_05::CPhbkSyncDoSynchronisationTest_05() + { + // store the name of this test step + SetTestStepName(_L("PhbkSyncDoSynchronisationTest_05")); + } + +CPhbkSyncDoSynchronisationTest_05::~CPhbkSyncDoSynchronisationTest_05() + { + } + +TVerdict CPhbkSyncDoSynchronisationTest_05::doTestStepL( ) + { + // 1. load the full Global/GSM ADN phonebook from cfg file + SetSimTsyTestNumberL(14); // see [test14] in configuration file + + // 2. set mode as EManual for the tested phonebook only + User::LeaveIfError(iSession.SetSyncMode(RPhoneBookSession::EManual, KUidIccGlobalAdnPhonebook)); + CheckSyncModeL(RPhoneBookSession::EManual, KUidIccGlobalAdnPhonebook); + + // 3. do synchronisation + DoSyncL(KUidIccGlobalAdnPhonebook, KErrNone); + + // 4. check the expected behaviour + CheckCacheStateValidL(KUidIccGlobalAdnPhonebook); + + return TestStepResult(); + } + +/** + * Test synchronisation with a full USIM ADN phonebook. + * + * It is assumed that server been connected/started by Open step. + */ +// +// Test step6 -- Test#15 in Unit Test Spec. Doc. // +// +CPhbkSyncDoSynchronisationTest_06::CPhbkSyncDoSynchronisationTest_06() + { + // store the name of this test step + SetTestStepName(_L("PhbkSyncDoSynchronisationTest_06")); + } + +CPhbkSyncDoSynchronisationTest_06::~CPhbkSyncDoSynchronisationTest_06() + { + } + +TVerdict CPhbkSyncDoSynchronisationTest_06::doTestStepL( ) + { + // 1. load the full USIM ADN phonebook from cfg file + SetSimTsyTestNumberL(15); // see [test15] in configuration file + + // 2. set mode as EManual for the tested phonebook only + User::LeaveIfError(iSession.SetSyncMode(RPhoneBookSession::EManual, KUidUsimAppAdnPhonebook)); + CheckSyncModeL(RPhoneBookSession::EManual, KUidUsimAppAdnPhonebook); + + // 3. do synchronisation + DoSyncL(KUidUsimAppAdnPhonebook, KErrNone); + + // 4. check the expected behaviour + CheckCacheStateValidL(KUidUsimAppAdnPhonebook); + + return TestStepResult(); + } + +/** + * Test synchronisation with a full SDN phonebook. + * + * It is assumed that server been connected/started by Open step. + */ +// +// Test step7 -- Test#16 in Unit Test Spec. Doc. // +// +CPhbkSyncDoSynchronisationTest_07::CPhbkSyncDoSynchronisationTest_07() + { + // store the name of this test step + SetTestStepName(_L("PhbkSyncDoSynchronisationTest_07")); + } + +CPhbkSyncDoSynchronisationTest_07::~CPhbkSyncDoSynchronisationTest_07() + { + } + +TVerdict CPhbkSyncDoSynchronisationTest_07::doTestStepL( ) + { + // 1. load the full SDN phonebook from cfg file + SetSimTsyTestNumberL(16); // see [test16] in configuration file + + // 2. set mode as EManual for the tested phonebook only + User::LeaveIfError(iSession.SetSyncMode(RPhoneBookSession::EManual, KUidIccGlobalSdnPhonebook)); + CheckSyncModeL(RPhoneBookSession::EManual, KUidIccGlobalSdnPhonebook); + + // 3. do synchronisation + DoSyncL(KUidIccGlobalSdnPhonebook, KErrNone); + + // 4. check the expected behaviour + CheckCacheStateValidL(KUidIccGlobalSdnPhonebook); + + return TestStepResult(); + } + +/** + * Test synchronisation with a full LND phonebook. + * + * It is assumed that server been connected/started by Open step. + */ +// +// Test step8 -- Test#17 in Unit Test Spec. Doc. // +// +CPhbkSyncDoSynchronisationTest_08::CPhbkSyncDoSynchronisationTest_08() + { + // store the name of this test step + SetTestStepName(_L("PhbkSyncDoSynchronisationTest_08")); + } + +CPhbkSyncDoSynchronisationTest_08::~CPhbkSyncDoSynchronisationTest_08() + { + } + +TVerdict CPhbkSyncDoSynchronisationTest_08::doTestStepL( ) + { + // 1. load the full LND phonebook from cfg file + SetSimTsyTestNumberL(17); // see [test17] in configuration file + + // 2. set mode as EManual for the tested phonebook only + User::LeaveIfError(iSession.SetSyncMode(RPhoneBookSession::EManual, KUidIccGlobalLndPhonebook)); + CheckSyncModeL(RPhoneBookSession::EManual, KUidIccGlobalLndPhonebook); + + // 3. do synchronisation + DoSyncL(KUidIccGlobalLndPhonebook, KErrNone); + + // 4. check the expected behaviour + CheckCacheStateValidL(KUidIccGlobalLndPhonebook); + + return TestStepResult(); + } + +/** + * Test synchronisation with all full supported phonebooks. + * + * It is assumed that server been connected/started by Open step. + */ +// +// Test step9 -- Test#18 in Unit Test Spec. Doc. // +// +CPhbkSyncDoSynchronisationTest_09::CPhbkSyncDoSynchronisationTest_09() + { + // store the name of this test step + SetTestStepName(_L("PhbkSyncDoSynchronisationTest_09")); + } + +CPhbkSyncDoSynchronisationTest_09::~CPhbkSyncDoSynchronisationTest_09() + { + } + +TVerdict CPhbkSyncDoSynchronisationTest_09::doTestStepL( ) + { + // 1. load the full LND phonebook from cfg file + SetSimTsyTestNumberL(18); // see [test18] in configuration file + + // 2. set mode as EManual for all supported phonebooks + TInt i(0); + for (i=0; i512 characters which will + * lead to overflow when phbksync is doing the batch reading. + * + * Following are the limits imposed by TSY: + * 1. 100 -- max. number of digits/characters allowed for phonenumber + * 2. 241 -- max. number of characters/digits allowed for name + * + * Following is the limit imposed by PhBkSync: + * 1. 512 -- the max. size of the buffer used when doing batch read + * + * It is assumed that server been connected/started by Open step. + */ +// +// Test step11 -- Test#20 in Unit Test Spec. Doc. // +// +CPhbkSyncDoSynchronisationTest_11::CPhbkSyncDoSynchronisationTest_11() + { + // store the name of this test step + SetTestStepName(_L("PhbkSyncDoSynchronisationTest_11")); + } + +CPhbkSyncDoSynchronisationTest_11::~CPhbkSyncDoSynchronisationTest_11() + { + } + +TVerdict CPhbkSyncDoSynchronisationTest_11::doTestStepL( ) + { + // 1. load Global/GSM ADN phonebook which has one entry > 512 + SetSimTsyTestNumberL(20); // see [test20] in configuration file + + // 2. set mode as EManual for all supported phonebooks + User::LeaveIfError(iSession.SetSyncMode(RPhoneBookSession::EManual, KUidIccGlobalAdnPhonebook)); + CheckSyncModeL(RPhoneBookSession::EManual, KUidIccGlobalAdnPhonebook); + + // 3. do synchronisation +// DoSyncL(KUidIccGlobalAdnPhonebook, KErrOverflow); // synchronisation fails + + // there is a bug in TSY which returns KErrArgumnet rather than KErrOverflow + DoSyncL(KUidIccGlobalAdnPhonebook, KErrArgument); // synchronisation fails + + // 4. check the expected behaviour + CheckCacheStateErrorL(KUidIccGlobalAdnPhonebook); + + return TestStepResult(); + } + +/** + * This test is similar to Test#20. + * The difference is that the overflow is caused by large phone number + * and additional numbers rather than by names in Test#20. + * + * It is assumed that server been connected/started by Open step. + */ +// +// Test step12 -- Test#21 in Unit Test Spec. Doc.// +// +CPhbkSyncDoSynchronisationTest_12::CPhbkSyncDoSynchronisationTest_12() + { + // store the name of this test step + SetTestStepName(_L("PhbkSyncDoSynchronisationTest_12")); + } + +CPhbkSyncDoSynchronisationTest_12::~CPhbkSyncDoSynchronisationTest_12() + { + } + +TVerdict CPhbkSyncDoSynchronisationTest_12::doTestStepL( ) + { + // 1. load USIM App ADN phonebook which has ane entry whose tel number field > 255 + SetSimTsyTestNumberL(21); // see [test21] in configuration file + + // 2. set mode as EManual for all supported phonebooks + User::LeaveIfError(iSession.SetSyncMode(RPhoneBookSession::EManual, KUidUsimAppAdnPhonebook)); + CheckSyncModeL(RPhoneBookSession::EManual, KUidUsimAppAdnPhonebook); + + // 3. do synchronisation +// DoSyncL(KUidUsimAppAdnPhonebook, KErrOverflow); // synchronisation fails + + // there is a bug in TSY which returns KErrArgumnet rather than KErrOverflow + DoSyncL(KUidUsimAppAdnPhonebook, KErrArgument); // synchronisation fails + + // 4. check the expected behaviour + CheckCacheStateErrorL(KUidUsimAppAdnPhonebook); + + return TestStepResult(); + } + +/** + * Test synchronisation with a corrupted USIM. + * + * It is assumed that server been connected/started by Open step. + */ +// +// Test step13 -- Test#22 in Unit Test Spec. Doc. // +// +CPhbkSyncDoSynchronisationTest_13::CPhbkSyncDoSynchronisationTest_13() + { + // store the name of this test step + SetTestStepName(_L("PhbkSyncDoSynchronisationTest_13")); + } + +CPhbkSyncDoSynchronisationTest_13::~CPhbkSyncDoSynchronisationTest_13() + { + } + +TVerdict CPhbkSyncDoSynchronisationTest_13::doTestStepL( ) + { + // 1. load the currupted USIM App ADN phonebook + SetSimTsyTestNumberL(22); // see [test22] in configuration file + + // 2. set mode as EManual for all supported phonebooks + User::LeaveIfError(iSession.SetSyncMode(RPhoneBookSession::EManual, KUidUsimAppAdnPhonebook)); + CheckSyncModeL(RPhoneBookSession::EManual, KUidUsimAppAdnPhonebook); + + // 3. do synchronisation + // To simply ignore the error generated by DoSynchronisation since + // we cannot guarantee the phonebook synchroniser server will give + // us the error KErrBadHandle defined in the cfg. file. + // However, we do know the error code != KErrNone + DoSyncL(KUidUsimAppAdnPhonebook, KErrBadHandle, ETrue); // ignore the result + + // 4. check the expected behaviour + CheckCacheStateErrorL(KUidUsimAppAdnPhonebook); + + return TestStepResult(); + } + +/** + * Test synchronisation of a phonebook containing entries + * that are "read-only". + * Note that SDN and LND phonebooks are read-only by default. + */ +// +// Test step14 -- Test#23 in Unit Test Spec. Doc. // +// +CPhbkSyncDoSynchronisationTest_14::CPhbkSyncDoSynchronisationTest_14() + { + // store the name of this test step + SetTestStepName(_L("PhbkSyncDoSynchronisationTest_14")); + } + +CPhbkSyncDoSynchronisationTest_14::~CPhbkSyncDoSynchronisationTest_14() + { + } + +TVerdict CPhbkSyncDoSynchronisationTest_14::doTestStepL( ) + { + // 1. change the mode as EManual for all phonebooks anc check it. + TInt i(0); + for (i=0; i