|
1 /* |
|
2 * Copyright (c) 2005-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 |
|
20 |
|
21 /** |
|
22 @file |
|
23 */ |
|
24 |
|
25 #include "t_unifiedcertstorewritablecertstorecount.h" |
|
26 #include "t_input.h" |
|
27 #include "t_certstoredefs.h" |
|
28 #include "t_certstoreout.h" |
|
29 |
|
30 CTestAction* CUnifiedCertStoreWritableCertStoreCount::NewL(RFs& aFs, |
|
31 CConsoleBase& aConsole, |
|
32 Output& aOut, |
|
33 const TTestActionSpec& aTestActionSpec) |
|
34 { |
|
35 CUnifiedCertStoreWritableCertStoreCount* self = |
|
36 new(ELeave) CUnifiedCertStoreWritableCertStoreCount(aFs, aConsole, aOut); |
|
37 CleanupStack::PushL(self); |
|
38 self->ConstructL(aTestActionSpec); |
|
39 CleanupStack::Pop(self); |
|
40 return self; |
|
41 } |
|
42 |
|
43 CUnifiedCertStoreWritableCertStoreCount::~CUnifiedCertStoreWritableCertStoreCount() |
|
44 { |
|
45 } |
|
46 |
|
47 CUnifiedCertStoreWritableCertStoreCount::CUnifiedCertStoreWritableCertStoreCount(RFs& aFs, CConsoleBase& aConsole, |
|
48 Output& aOut) |
|
49 : CUnifiedCertStoreCount(aFs, aConsole, aOut) |
|
50 { |
|
51 } |
|
52 |
|
53 void CUnifiedCertStoreWritableCertStoreCount::ConstructL(const TTestActionSpec& aTestActionSpec) |
|
54 { |
|
55 CUnifiedCertStoreCount::ConstructL(aTestActionSpec); |
|
56 |
|
57 TInt err = KErrNone; |
|
58 TInt pos = 0; |
|
59 iStoreIndex = Input::ParseElement(aTestActionSpec.iActionBody, KStoreIndexStart, KStoreIndexEnd, pos, err); |
|
60 iExpectCount = Input::ParseElement(aTestActionSpec.iActionResult, KNumberOfStoresStart, KNumberOfStoresEnd, pos, err); |
|
61 } |
|
62 |
|
63 void CUnifiedCertStoreWritableCertStoreCount::DoPerformAction() |
|
64 { |
|
65 TLex8 lexi(iStoreIndex); |
|
66 TUid iIndex; |
|
67 TInt index = lexi.Val(iIndex.iUid); |
|
68 if (index != KErrNone) |
|
69 { |
|
70 User::Panic(_L("CUnifiedCertStoreCertStoreCount"), 1); |
|
71 } |
|
72 iCount = UnifiedCertStore(iIndex.iUid).WritableCertStoreCount(); |
|
73 |
|
74 TLex8 lex(iExpectCount); |
|
75 TUid uid; |
|
76 TInt iu = lex.Val(uid.iUid); |
|
77 if (iu != KErrNone) |
|
78 { |
|
79 User::Panic(_L("CUnifiedCertStoreCertStoreCount"), 1); |
|
80 } |
|
81 if (iCount == uid.iUid) |
|
82 { |
|
83 iResult = ETrue; |
|
84 } |
|
85 else |
|
86 { |
|
87 iResult = EFalse; |
|
88 } |
|
89 } |
|
90 |
|
91 void CUnifiedCertStoreWritableCertStoreCount::DoWriteResult() |
|
92 { |
|
93 iConsole.Printf(_L("\tNumber of writable stores:")); |
|
94 iOut.writeString(_L("\tNumber of writable stores: ")); |
|
95 } |