|
1 // Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description:Unit test case to test CompareToLastStoredImsi() |
|
14 // |
|
15 |
|
16 /** |
|
17 @file |
|
18 @test |
|
19 @internalComponent - Internal Symbian test code |
|
20 */ |
|
21 |
|
22 #include "tcmd_step_publishsimownedandchanged.h" |
|
23 #include "ssmcustomcmdfactory.h" |
|
24 |
|
25 // class under test |
|
26 #include "cmdpublishSimOwnedAndChanged.h" |
|
27 |
|
28 // helper class |
|
29 #include "activestopper.h" |
|
30 #include "ssmdebug.h" |
|
31 #include <ssm/ssmuiproviderdll.h> |
|
32 #include <ssm/startupdomainpskeys.h> |
|
33 #include <ssm/starterdomaincrkeys.h> |
|
34 #include <e32property.h> |
|
35 #include <centralrepository.h> |
|
36 |
|
37 |
|
38 /** |
|
39 * Used for storing the IMSI code of current SIM card. This is needed for |
|
40 * determining if SIM card has changed from the previous boot. |
|
41 * Key value is an descriptor containing the IMSI code. |
|
42 */ |
|
43 const TUint32 KSSMStoredImsi = 0x00000001; |
|
44 const TUid KCRUidSSMVals = {0x2001d2aa}; |
|
45 |
|
46 CCustomCmdTestPublishSimOwnedAndChanged::~CCustomCmdTestPublishSimOwnedAndChanged() |
|
47 { |
|
48 delete iSimCustomCmd; |
|
49 } |
|
50 |
|
51 CCustomCmdTestPublishSimOwnedAndChanged::CCustomCmdTestPublishSimOwnedAndChanged() |
|
52 { |
|
53 SetTestStepName(KTCCustomCmdTestPublishSimOwnedAndChanged); |
|
54 } |
|
55 |
|
56 TVerdict CCustomCmdTestPublishSimOwnedAndChanged::doTestStepL() |
|
57 { |
|
58 INFO_PRINTF1(_L("Entering test for publish startup mode custom command")); |
|
59 __UHEAP_MARK; |
|
60 |
|
61 TRAPD(err, doTestRetrieveSubscriberIdFromCentrepL()); |
|
62 TEST(err == KErrNone); |
|
63 |
|
64 __UHEAP_MARKEND; |
|
65 INFO_PRINTF1(_L("Leaving test for publish startup mode custom command")); |
|
66 return TestStepResult(); |
|
67 } |
|
68 |
|
69 /** |
|
70 Test CaseID DEVSRVS-SSREFPLUGINS-CUSTCMD-31 |
|
71 */ |
|
72 |
|
73 void CCustomCmdTestPublishSimOwnedAndChanged::doTestRetrieveSubscriberIdFromCentrepL() |
|
74 { |
|
75 INFO_PRINTF1(_L("Setting the Subscriber ID in Central Repository")); |
|
76 |
|
77 _LIT(KSubscriberID1 , "1"); |
|
78 _LIT(KSubscriberID2 , "2"); |
|
79 RMobilePhone::TMobilePhoneSubscriberId aFirstValue(KSubscriberID1); |
|
80 RMobilePhone::TMobilePhoneSubscriberId aSecondValue(KSubscriberID2); |
|
81 DEBUGPRINT2A("Current IMSI: %S", &aFirstValue); |
|
82 CRepository* repository = CRepository::NewLC(KCRUidSSMVals); |
|
83 User::LeaveIfError(repository->Set(KSSMStoredImsi, aFirstValue)); |
|
84 INFO_PRINTF1(_L("Retrieving the value from Certrep and setting the Subscriber ID again")); |
|
85 TInt simChangedValue = 0; |
|
86 simChangedValue=iSimCustomCmd->CompareToLastStoredImsi(aFirstValue); |
|
87 TEST(!simChangedValue); |
|
88 INFO_PRINTF1(_L("Setting the Subscriber ID to a new value and comparing with the old one")); |
|
89 simChangedValue=iSimCustomCmd->CompareToLastStoredImsi(aSecondValue); |
|
90 TEST(simChangedValue); |
|
91 CleanupStack::PopAndDestroy(repository); |
|
92 } |
|
93 |