|
1 // Copyright (c) 2004-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: |
|
14 // __ACTION_INFO_BEGIN__ |
|
15 // [Action Name] |
|
16 // CountImapAccountsInArray |
|
17 // [Action Parameters] |
|
18 // accountArray <input>: TImapAccounts |
|
19 // numberToMatch <input>: Number to match count of array objects |
|
20 // Note : TImapAccounts is defined as typedef RArray<TIMAP4AccountId> TImapAccounts |
|
21 // see TMtfTestParameterType.h for definition and parameter implementation |
|
22 // [Action Description] |
|
23 // CountImapAccountsInArray Test Action is intended to count the number of objects in |
|
24 // an TImapAccounts array and compare them against the provided number. Test action fails |
|
25 // if count and number do not match. |
|
26 // [APIs Used] |
|
27 // TImapAccounts::Count |
|
28 // __ACTION_INFO_END__ |
|
29 // |
|
30 // |
|
31 |
|
32 #include <cemailaccounts.h> |
|
33 |
|
34 #include "CMtfTestActionCountImapAccountsInArray.h" |
|
35 #include "TMtfTestParameterType.h" |
|
36 #include "CMtfTestCase.h" |
|
37 #include "CMtfTestActionParameters.h" |
|
38 |
|
39 /** |
|
40 Function : NewL |
|
41 Description : |
|
42 @internalTechnology |
|
43 @param : aTestCase - CMtfTestCase for the CMtfTestAction base class |
|
44 @param : aActionParams - CMtfTestActionParameters |
|
45 @return : CMtfTestAction* - a base class pointer to the newly created CMtfTestActionGetImapAccounts object |
|
46 @pre none |
|
47 @post none |
|
48 */ |
|
49 CMtfTestAction* CMtfTestActionCountImapAccountsInArray::NewL(CMtfTestCase& aTestCase,CMtfTestActionParameters* aActionParameters) |
|
50 { |
|
51 CMtfTestActionCountImapAccountsInArray* self = new (ELeave) CMtfTestActionCountImapAccountsInArray(aTestCase); |
|
52 CleanupStack::PushL(self); |
|
53 self->ConstructL(aActionParameters); |
|
54 CleanupStack::Pop(self); |
|
55 return self; |
|
56 } |
|
57 |
|
58 /** |
|
59 Function : CMtfTestActionGetImapAccounts |
|
60 Description : Constructor |
|
61 @internalTechnology |
|
62 @param : aTestCase - CMtfTestCase for the CMtfTestAction base class |
|
63 @return : N/A |
|
64 @pre none |
|
65 @post none |
|
66 */ |
|
67 CMtfTestActionCountImapAccountsInArray::CMtfTestActionCountImapAccountsInArray(CMtfTestCase& aTestCase) : CMtfSynchronousTestAction(aTestCase) |
|
68 { |
|
69 } |
|
70 |
|
71 /** |
|
72 Function : ~CMtfTestActionGetImapAccounts |
|
73 Description : Destructor |
|
74 @internalTechnology |
|
75 @param : |
|
76 @return : |
|
77 @pre |
|
78 @post |
|
79 */ |
|
80 CMtfTestActionCountImapAccountsInArray::~CMtfTestActionCountImapAccountsInArray() |
|
81 { |
|
82 } |
|
83 |
|
84 /** |
|
85 Function : ExecuteActionL |
|
86 Description : Entry point for the this test action in the test framework |
|
87 @internalTechnology |
|
88 @param : none |
|
89 @return : void |
|
90 @pre none |
|
91 @post none |
|
92 */ |
|
93 void CMtfTestActionCountImapAccountsInArray::ExecuteActionL() |
|
94 { |
|
95 TestCase().INFO_PRINTF2(_L("Test Action %S start..."), &KTestActionCountImapAccountsInArray); |
|
96 TInt numberToMatch = ObtainValueParameterL<TInt>(TestCase(), ActionParameters().Parameter(0)); |
|
97 |
|
98 CEmailAccounts *account = CEmailAccounts::NewLC(); |
|
99 RArray<TImapAccount> arrayImapAccounts; |
|
100 account->GetImapAccountsL(arrayImapAccounts); |
|
101 TInt count = arrayImapAccounts.Count(); |
|
102 |
|
103 CleanupStack::PopAndDestroy(account); |
|
104 arrayImapAccounts.Reset(); |
|
105 |
|
106 if (count != numberToMatch) |
|
107 { |
|
108 // failed |
|
109 TestCase().ERR_PRINTF3(_L("Number of IMAP accounts do not match ! expected = %d actual = %d"), |
|
110 numberToMatch, count ); |
|
111 TestCase().SetTestStepResult(EFail); |
|
112 } |
|
113 TestCase().INFO_PRINTF2(_L("Number of IMAP accounts matched value = %d !"), numberToMatch ); |
|
114 TestCase().INFO_PRINTF2(_L("Test Action %S completed."), &KTestActionCountImapAccountsInArray); |
|
115 TestCase().ActionCompletedL(*this); |
|
116 |
|
117 } |