|
1 /* |
|
2 * Copyright (c) 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 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include "authwriteuserdata.h" |
|
20 #include <e32def.h> |
|
21 |
|
22 _LIT(KAuthWriteUserDataSecName, "Auth WriteUserData APIs test"); |
|
23 |
|
24 using namespace AuthServer; |
|
25 |
|
26 CAuthWriteUserDataSecTest* CAuthWriteUserDataSecTest::NewL() |
|
27 { |
|
28 CAuthWriteUserDataSecTest* self=new(ELeave) CAuthWriteUserDataSecTest(); |
|
29 CleanupStack::PushL(self); |
|
30 self->ConstructL(); |
|
31 CleanupStack::Pop(self); |
|
32 return self; |
|
33 } |
|
34 |
|
35 CAuthWriteUserDataSecTest::CAuthWriteUserDataSecTest() |
|
36 { |
|
37 SetCapabilityRequired(ECapabilityWriteUserData); |
|
38 } |
|
39 |
|
40 void CAuthWriteUserDataSecTest::ConstructL() |
|
41 { |
|
42 SetNameL(KAuthWriteUserDataSecName); |
|
43 } |
|
44 |
|
45 void CAuthWriteUserDataSecTest::RunTestL() |
|
46 { |
|
47 AuthServer::RAuthMgrClient authMgrClient; |
|
48 User::LeaveIfError(authMgrClient.Connect()); |
|
49 CleanupClosePushL(authMgrClient); |
|
50 |
|
51 TInt err(0); |
|
52 TIdentityId id = 34567890; |
|
53 |
|
54 TRAP(err, authMgrClient.SetIdentityStringL(id, KAuthWriteUserDataSecName)); |
|
55 CheckFailL(err, _L("AuthServer::SetIdentityStringL().")); |
|
56 |
|
57 TRAP(err, DoTestL(authMgrClient)); |
|
58 CheckFailL(err, _L("AuthServer::TrainPlugin().")); |
|
59 |
|
60 TPluginId pluginId = 11113100; |
|
61 TRAP(err, authMgrClient.ForgetPluginL(id, pluginId)); |
|
62 CheckFailL(err, _L("AuthServer::ForgetPluginL().")); |
|
63 |
|
64 CleanupStack::PopAndDestroy(&authMgrClient); |
|
65 } |
|
66 |
|
67 void CAuthWriteUserDataSecTest::DoTestL(AuthServer::RAuthMgrClient& aAuthMgrClient) |
|
68 { |
|
69 TRequestStatus status; |
|
70 TIdentityId id = 34567890; |
|
71 TPluginId pluginId = 11113100; |
|
72 |
|
73 aAuthMgrClient.TrainPlugin(id, pluginId, status); |
|
74 User::WaitForRequest(status); |
|
75 |
|
76 User::LeaveIfError(status.Int()); |
|
77 } |