|
1 /* |
|
2 * Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of the License "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * CTestStep derived implementation |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 |
|
21 #include "tAuthSvrStep.h" |
|
22 |
|
23 #include "authserver/authclient.h" |
|
24 #include "authserver/authmgrclient.h" |
|
25 |
|
26 CTAuthSvrCheck::CTAuthSvrCheck() |
|
27 /** |
|
28 Constructor |
|
29 */ |
|
30 { |
|
31 // Call base class method to set up the human readable name for logging |
|
32 SetTestStepName(KTAuthSvrCheck); |
|
33 } |
|
34 |
|
35 TVerdict CTAuthSvrCheck::doTestStepL() |
|
36 /** |
|
37 @return - TVerdict code |
|
38 Override of base class pure virtual |
|
39 |
|
40 */ |
|
41 { |
|
42 |
|
43 __UHEAP_MARK; // Check for memory leaks |
|
44 |
|
45 SetTestStepResult(EPass); |
|
46 |
|
47 InitAuthServerFromFileL(); // Set things like 'iSupportsDefaultData' and 'DefaultPlugin' |
|
48 |
|
49 //----------------------------------------------------------------------------------------------------- |
|
50 //Connect to the AuthServer |
|
51 AuthServer::RAuthClient authClient1; |
|
52 //User::LeaveIfError(authClient1.Connect()); |
|
53 |
|
54 TInt connectVal = authClient1.Connect(); |
|
55 if (KErrNotFound == connectVal) |
|
56 { |
|
57 //Retry after a delay |
|
58 TTimeIntervalMicroSeconds32 timeInterval = 2000; //2 Milliseconds |
|
59 User::After(timeInterval); |
|
60 connectVal = authClient1.Connect(); |
|
61 } |
|
62 if (KErrNone != connectVal) |
|
63 { |
|
64 ERR_PRINTF2(_L("Unable to start a session or other connection error. Err = %d"), connectVal); |
|
65 User::LeaveIfError(connectVal); |
|
66 } |
|
67 CleanupClosePushL(authClient1); |
|
68 |
|
69 //Check that the default identity has been created |
|
70 //Call the Enumerate Identity API |
|
71 AuthServer::RIdentityIdArray idList; |
|
72 TRAPD(res1, authClient1.IdentitiesL(idList)); |
|
73 CleanupClosePushL(idList); |
|
74 |
|
75 if(KErrNone != res1) |
|
76 { |
|
77 ERR_PRINTF2(_L("authClient::IdentitiesL() performed a Leave with code %d"), res1 ); |
|
78 } |
|
79 else |
|
80 { |
|
81 //Retrieve the expected information from the ini file |
|
82 TInt expNumIdentities; |
|
83 |
|
84 if(GetIntFromConfig(ConfigSection(),_L("NumIdentities"), expNumIdentities) != EFalse) // the tag 'NumIdentities' was present |
|
85 { |
|
86 //Do the compare |
|
87 if (idList.Count() != expNumIdentities) |
|
88 { |
|
89 ERR_PRINTF3(_L("expNumIdentities differs from expected, Expected = %d, Number of Identities = %d"), expNumIdentities, idList.Count()); |
|
90 SetTestStepResult(EFail); |
|
91 } |
|
92 } |
|
93 |
|
94 // Check the status of a plugin compared to what was expected |
|
95 CheckSpecifiedPluginStatusConnectedL(authClient1); |
|
96 } |
|
97 CleanupStack::PopAndDestroy(&idList); |
|
98 CleanupStack::PopAndDestroy(&authClient1); |
|
99 |
|
100 __UHEAP_MARKEND; |
|
101 return TestStepResult(); |
|
102 } |