|
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 // DeletePopAccounts |
|
17 // [Action Parameters] |
|
18 // Index input Tint |
|
19 // Note : TPopAccounts is defined as typedef RArray<TPOP3Account> TPopAccounts |
|
20 // see TMtfTestParameterType.h for definition and parameter implementation |
|
21 // [Action Description] |
|
22 // DeletePopAccounts Test Action is intended to delete the POP accounts from the |
|
23 // Central Repository. This Test Action takes TPOP3Account array and an index |
|
24 // value as input parameters. If an integer value is provided for the index, |
|
25 // the POP account at the specified index will be deleted. In case of default |
|
26 // value (-1) provided as index, all the POP accounts will be deleted. |
|
27 // [APIs Used] |
|
28 // CEmailAccounts::DeletePopAccountL |
|
29 // __ACTION_INFO_END__ |
|
30 // |
|
31 // |
|
32 |
|
33 // system #includes |
|
34 #include <cemailaccounts.h> |
|
35 |
|
36 // user #includes |
|
37 #include "CMtfTestActionDeletePopAccounts.h" |
|
38 #include "TMtfTestParameterType.h" |
|
39 #include "CMtfTestCase.h" |
|
40 #include "CMtfTestActionParameters.h" |
|
41 |
|
42 /** |
|
43 Function : NewL |
|
44 Description : |
|
45 @internalTechnology |
|
46 @param : aTestCase - CMtfTestCase for the CMtfTestAction base class |
|
47 @param : aActionParams - CMtfTestActionParameters |
|
48 @return : CMtfTestAction* - a base class pointer to the newly created CMtfTestActionDeletePopAccounts object |
|
49 @pre none |
|
50 @post none |
|
51 */ |
|
52 CMtfTestAction* CMtfTestActionDeletePopAccounts::NewL(CMtfTestCase& aTestCase,CMtfTestActionParameters* aActionParameters) |
|
53 { |
|
54 CMtfTestActionDeletePopAccounts* self = new (ELeave) CMtfTestActionDeletePopAccounts(aTestCase); |
|
55 CleanupStack::PushL(self); |
|
56 self->ConstructL(aActionParameters); |
|
57 CleanupStack::Pop(self); |
|
58 return self; |
|
59 } |
|
60 |
|
61 /** |
|
62 Function : CMtfTestActionDeletePopAccounts |
|
63 Description : Constructor |
|
64 @internalTechnology |
|
65 @param : aTestCase - CMtfTestCase for the CMtfTestAction base class |
|
66 @return : N/A |
|
67 @pre none |
|
68 @post none |
|
69 */ |
|
70 CMtfTestActionDeletePopAccounts::CMtfTestActionDeletePopAccounts(CMtfTestCase& aTestCase) : CMtfSynchronousTestAction(aTestCase) |
|
71 { |
|
72 } |
|
73 |
|
74 /** |
|
75 Function : ~CMtfTestActionDeletePopAccounts |
|
76 Description : Destructor |
|
77 @internalTechnology |
|
78 @param : |
|
79 @return : |
|
80 @pre |
|
81 @post |
|
82 */ |
|
83 CMtfTestActionDeletePopAccounts::~CMtfTestActionDeletePopAccounts() |
|
84 { |
|
85 } |
|
86 |
|
87 /** |
|
88 Function : ExecuteActionL |
|
89 Description : Entry point for the this test action in the test framework |
|
90 @internalTechnology |
|
91 @param : none |
|
92 @return : void |
|
93 @pre none |
|
94 @post none |
|
95 */ |
|
96 void CMtfTestActionDeletePopAccounts::ExecuteActionL() |
|
97 { |
|
98 TestCase().INFO_PRINTF2(_L("Test Action %S start..."), &KTestActionDeletePopAccounts); |
|
99 TInt paramDefaultIndex = ObtainValueParameterL<TInt>( TestCase(),ActionParameters().Parameter(0), -1 ); |
|
100 CEmailAccounts* accounts = CEmailAccounts::NewLC(); |
|
101 RArray<TPopAccount> arrayPopAccounts; |
|
102 CleanupClosePushL(arrayPopAccounts); |
|
103 accounts->GetPopAccountsL(arrayPopAccounts); |
|
104 |
|
105 if ( paramDefaultIndex >= 0 ) |
|
106 { |
|
107 // Delete the specified id. |
|
108 accounts->DeletePopAccountL(arrayPopAccounts[paramDefaultIndex]); |
|
109 arrayPopAccounts.Remove(paramDefaultIndex); |
|
110 } |
|
111 else if ( paramDefaultIndex == -1 ) |
|
112 { |
|
113 // Assume delete all the indexs |
|
114 TInt count = arrayPopAccounts.Count(); |
|
115 TestCase().INFO_PRINTF2(_L("CMtfTestActionDeletePopAccounts deleting all accounts count = %d"), count ); |
|
116 |
|
117 for( TInt i = 0; i < count; i++ ) |
|
118 { |
|
119 TPopAccount id = arrayPopAccounts[i]; |
|
120 accounts->DeletePopAccountL(id); |
|
121 } |
|
122 |
|
123 } |
|
124 else |
|
125 { // Bad value. |
|
126 TestCase().ERR_PRINTF1(_L("DeletePopAccounts : Index value must be -1 or greater than 0\n")); |
|
127 TestCase().SetTestStepResult(EFail); |
|
128 } |
|
129 |
|
130 CleanupStack::PopAndDestroy( 2, accounts ); |
|
131 TestCase().INFO_PRINTF2(_L("Test Action %S completed."), &KTestActionDeletePopAccounts); |
|
132 TestCase().ActionCompletedL(*this); |
|
133 } |
|
134 |
|
135 |