|
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 // GetPopAccountInArray |
|
17 // [Action Parameters] |
|
18 // indexNumber <input>: Index of account to get |
|
19 // accountId <output>: TPOP3Account ID |
|
20 // Note : TPopAccounts is defined as typedef RArray<TPOP3AccountId> TPopAccounts |
|
21 // see TMtfTestParameterType.h for definition and parameter implementation |
|
22 // [Action Description] |
|
23 // GetPopAccountInArray Test Action is intended to get a TPOP3AccountId specified |
|
24 // by indexNumebr from an TPopAccounts array. |
|
25 // [APIs Used] |
|
26 // __ACTION_INFO_END__ |
|
27 // |
|
28 // |
|
29 |
|
30 |
|
31 #include <cemailaccounts.h> |
|
32 |
|
33 #include "CMtfTestActionGetPopAccountInArray.h" |
|
34 #include "TMtfTestParameterType.h" |
|
35 #include "CMtfTestCase.h" |
|
36 #include "CMtfTestActionParameters.h" |
|
37 |
|
38 /** |
|
39 Function : NewL |
|
40 Description : |
|
41 @internalTechnology |
|
42 @param : aTestCase - CMtfTestCase for the CMtfTestAction base class |
|
43 @param : aActionParams - CMtfTestActionParameters |
|
44 @return : CMtfTestAction* - a base class pointer to the newly created CMtfTestActionGetPopAccounts object |
|
45 @pre none |
|
46 @post none |
|
47 */ |
|
48 CMtfTestAction* CMtfTestActionGetPopAccountInArray::NewL(CMtfTestCase& aTestCase,CMtfTestActionParameters* aActionParameters) |
|
49 { |
|
50 CMtfTestActionGetPopAccountInArray* self = new (ELeave) CMtfTestActionGetPopAccountInArray(aTestCase); |
|
51 CleanupStack::PushL(self); |
|
52 self->ConstructL(aActionParameters); |
|
53 CleanupStack::Pop(self); |
|
54 return self; |
|
55 } |
|
56 |
|
57 /** |
|
58 Function : CMtfTestActionGetPopAccounts |
|
59 Description : Constructor |
|
60 @internalTechnology |
|
61 @param : aTestCase - CMtfTestCase for the CMtfTestAction base class |
|
62 @return : N/A |
|
63 @pre none |
|
64 @post none |
|
65 */ |
|
66 CMtfTestActionGetPopAccountInArray::CMtfTestActionGetPopAccountInArray(CMtfTestCase& aTestCase) : CMtfSynchronousTestAction(aTestCase) |
|
67 { |
|
68 } |
|
69 |
|
70 /** |
|
71 Function : ~CMtfTestActionGetPopAccounts |
|
72 Description : Destructor |
|
73 @internalTechnology |
|
74 @param : |
|
75 @return : |
|
76 @pre |
|
77 @post |
|
78 */ |
|
79 CMtfTestActionGetPopAccountInArray::~CMtfTestActionGetPopAccountInArray() |
|
80 { |
|
81 } |
|
82 |
|
83 /** |
|
84 Function : ExecuteActionL |
|
85 Description : Entry point for the this test action in the test framework |
|
86 @internalTechnology |
|
87 @param : none |
|
88 @return : void |
|
89 @pre none |
|
90 @post none |
|
91 */ |
|
92 void CMtfTestActionGetPopAccountInArray::ExecuteActionL() |
|
93 { |
|
94 TestCase().INFO_PRINTF2(_L("Test Action %S start..."), &KTestActionGetPopAccountInArray); |
|
95 TInt indexNumber = ObtainValueParameterL<TInt>(TestCase(), ActionParameters().Parameter(0)); |
|
96 CEmailAccounts* accounts = CEmailAccounts::NewLC(); |
|
97 RArray<TPopAccount> accountArray; |
|
98 CleanupClosePushL(accountArray); |
|
99 accounts->GetPopAccountsL(accountArray); |
|
100 |
|
101 // make sure we're not out of range |
|
102 if (indexNumber >= 0 && indexNumber < accountArray.Count()) |
|
103 { |
|
104 TPopAccount id = accountArray[indexNumber]; |
|
105 StoreParameterL<TPopAccount>( TestCase(), id, ActionParameters().Parameter(1)); |
|
106 } |
|
107 else |
|
108 { |
|
109 TestCase().ERR_PRINTF1(_L("Index is out of range!")); |
|
110 TestCase().SetTestStepResult(EFail); |
|
111 } |
|
112 |
|
113 CleanupStack::PopAndDestroy( 2, accounts ); |
|
114 TestCase().INFO_PRINTF2(_L("Test Action %S completed."), &KTestActionGetPopAccountInArray); |
|
115 |
|
116 TestCase().ActionCompletedL(*this); |
|
117 } |