|
1 // Copyright (c) 2006-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 the License "Symbian Foundation License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // [TestStep Name] |
|
15 // CheckChildrenCountPop |
|
16 // [Paramaters] |
|
17 // PopAccountName : Name of the Pop account |
|
18 // ExpectedChildrenCount : Expected number of children to be present in the |
|
19 // folder |
|
20 // Obtains a selection of the children entries under the Pop account and obtains its count. |
|
21 // Checks if children count is as expected. If the count does not match, the test step |
|
22 // fails. |
|
23 // [APIs Used] |
|
24 // CMsvEntry::SetEntryL |
|
25 // CMsvEntry::ChildrenL |
|
26 // CMsvEntry::SetSortTypeL |
|
27 // TMsvSelectionOrdering::SetShowInvisibleEntries |
|
28 // |
|
29 // |
|
30 |
|
31 |
|
32 |
|
33 /** |
|
34 @file |
|
35 */ |
|
36 |
|
37 |
|
38 // User includes |
|
39 #include "T_CheckChildrenCountPop.h" |
|
40 #include <t_utils.h> |
|
41 #include <t_utilscentralrepository.h> |
|
42 |
|
43 |
|
44 //epoc includes |
|
45 #include <msvids.h> |
|
46 |
|
47 |
|
48 // Literals used |
|
49 _LIT(KPopAccountName,"PopAccountName"); |
|
50 _LIT(KExpCount,"Expectedcount"); |
|
51 |
|
52 |
|
53 /** |
|
54 CT_MsgCheckChildrenCountPop() |
|
55 Sets the teststep name to KCheckChildrenCountPop |
|
56 |
|
57 @param aSharedDataPOP |
|
58 Data shared across the POP test steps. Ex. Session |
|
59 */ |
|
60 CT_MsgCheckChildrenCountPop::CT_MsgCheckChildrenCountPop(CT_MsgSharedDataPop& aSharedDataPOP) |
|
61 : CT_MsgSyncStepPOP(aSharedDataPOP) |
|
62 { |
|
63 SetTestStepName(KCheckChildrenCountPop); |
|
64 } |
|
65 |
|
66 |
|
67 /** |
|
68 ~CT_MsgCheckChildrenCountPop() |
|
69 Destructor |
|
70 */ |
|
71 CT_MsgCheckChildrenCountPop::~CT_MsgCheckChildrenCountPop() |
|
72 { |
|
73 } |
|
74 |
|
75 |
|
76 /** |
|
77 doTestStepL() |
|
78 Reads the remote foldername and the expected count from the ini file. |
|
79 Obtains the count of the children entries under the given folder. |
|
80 Verifies whether the expected count read from the ini file |
|
81 matches with the actual count.Fails if the count does not match |
|
82 |
|
83 @return |
|
84 Returns the test step result |
|
85 */ |
|
86 TVerdict CT_MsgCheckChildrenCountPop::doTestStepL() |
|
87 { |
|
88 INFO_PRINTF1(_L("Test Step :CheckChildrenCountPop ")); |
|
89 |
|
90 // Read the POP account name from the ini file |
|
91 TPtrC popAccountName; |
|
92 if(!GetStringFromConfig(ConfigSection(), KPopAccountName, popAccountName)) |
|
93 { |
|
94 ERR_PRINTF1(_L("POP account name is not specified")); |
|
95 SetTestStepResult(EFail); |
|
96 } |
|
97 else |
|
98 { |
|
99 // Retrieving the POP service Id based on the account name read from ini |
|
100 TMsvId popServiceId = CT_MsgUtilsCentralRepository::GetPopServiceIdL((TDes&) popAccountName); |
|
101 if(popServiceId == KMsvNullIndexEntryId) |
|
102 { |
|
103 ERR_PRINTF1(_L("Invalid Pop account name specified")); |
|
104 SetTestStepResult(EFail); |
|
105 } |
|
106 else |
|
107 { |
|
108 TInt expectedChildrenCount; |
|
109 // Read the expected children count from ini file |
|
110 if(!GetIntFromConfig(ConfigSection(), KExpCount, expectedChildrenCount)) |
|
111 { |
|
112 ERR_PRINTF1(_L("Expected number of children in the POP account not specified")); |
|
113 SetTestStepResult(EFail); |
|
114 } |
|
115 else |
|
116 { |
|
117 // Create a selection of the children entries under the given folder and verify the count |
|
118 CMsvEntrySelection* childrenSelection = |
|
119 CT_MsgUtils::CreateChildrenSelectionL(iSharedDataPOP.iSession, popServiceId); |
|
120 CleanupStack::PushL(childrenSelection); |
|
121 |
|
122 TInt actualCount = childrenSelection->Count(); |
|
123 |
|
124 if (expectedChildrenCount != actualCount) |
|
125 { |
|
126 ERR_PRINTF3(_L("Children count is not equal to expected count, expected : %d, actual: %d "),expectedChildrenCount, actualCount); |
|
127 SetTestStepResult(EFail); |
|
128 } |
|
129 else |
|
130 { |
|
131 INFO_PRINTF3(_L("Children count is equal to expected count, expected : %d, actual: %d "),expectedChildrenCount, actualCount); |
|
132 } |
|
133 CleanupStack::PopAndDestroy(childrenSelection); |
|
134 } |
|
135 } |
|
136 } |
|
137 return TestStepResult(); |
|
138 } |