719
|
1 |
// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
|
|
2 |
// All rights reserved.
|
|
3 |
// This component and the accompanying materials are made available
|
872
|
4 |
// under the terms of the License "Eclipse Public License v1.0"
|
719
|
5 |
// which accompanies this distribution, and is available
|
872
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
719
|
7 |
//
|
|
8 |
// Initial Contributors:
|
|
9 |
// Nokia Corporation - initial contribution.
|
|
10 |
//
|
|
11 |
// Contributors:
|
|
12 |
//
|
|
13 |
// Description:
|
|
14 |
// [TestStep Name]
|
|
15 |
// CheckPopSNAPSetting
|
|
16 |
// [Paramaters]
|
|
17 |
// PopAccountName :Name of the Pop account.
|
|
18 |
// ExpectedSNAPDefinition :ETrue => A SNAP has expected to been provisioned for the POP account.
|
|
19 |
// EFalse => A SNAP has not expected to been provisioned for the POP account.
|
|
20 |
// ExpectedSNAPPreference :Expected SNAP ID (Assuming the SNAP has been defined for the POP a/c)
|
|
21 |
// This parameter can be ignored if the "ExpectedSNAPDefinition" is EFalse.
|
|
22 |
// Checks the provisioned SNAP information for the POP account.
|
|
23 |
//
|
|
24 |
//
|
|
25 |
|
|
26 |
//User includes
|
|
27 |
#include "T_CheckPopSNAPSetting.h"
|
|
28 |
#include <t_utils.h>
|
|
29 |
#include <t_utilsenumconverter.h>
|
|
30 |
#include <t_utilscentralrepository.h>
|
|
31 |
|
|
32 |
//Epoc include
|
|
33 |
#include <iapprefs.h>
|
|
34 |
|
|
35 |
//Literals used
|
|
36 |
_LIT(KPopAccountName,"PopAccountName");
|
|
37 |
_LIT(KSNAPDefined,"ExpectedSNAPDefinition");
|
|
38 |
_LIT(KSNAPPreference,"ExpectedSNAPPreference");
|
|
39 |
|
|
40 |
/**
|
|
41 |
Function : CT_MsgCheckPopSNAPSetting
|
|
42 |
Description : Constructor
|
|
43 |
@param : aSharedDataPOP Reference to CT_MsgSharedDataPop
|
|
44 |
@return : N/A
|
|
45 |
*/
|
|
46 |
CT_MsgCheckPopSNAPSetting::CT_MsgCheckPopSNAPSetting(CT_MsgSharedDataPop& aSharedDataPOP)
|
|
47 |
:CT_MsgSyncStepPOP(aSharedDataPOP)
|
|
48 |
{
|
|
49 |
SetTestStepName(KCheckPopSNAPSetting);
|
|
50 |
}
|
|
51 |
|
|
52 |
/**
|
|
53 |
Function : ReadIni
|
|
54 |
Description :Reads the corresponding .ini file and returns EPass or EFail if any of the inputs are missing
|
|
55 |
@return : TBool
|
|
56 |
*/
|
|
57 |
TBool CT_MsgCheckPopSNAPSetting::ReadIni()
|
|
58 |
{
|
|
59 |
TBool result = ETrue;
|
|
60 |
|
|
61 |
if(!GetStringFromConfig(ConfigSection(), KPopAccountName, iPopAccountName))
|
|
62 |
{
|
|
63 |
ERR_PRINTF1(_L("Pop account name is not specified"));
|
|
64 |
SetTestStepResult(EFail);
|
|
65 |
result = EFalse;
|
|
66 |
}
|
|
67 |
|
|
68 |
if(!GetBoolFromConfig(ConfigSection(), KSNAPDefined, iExpectedSNAPDefinition))
|
|
69 |
{
|
|
70 |
ERR_PRINTF1(_L("An expected \"ETrue\" or \"EFalse\" boolean value is not specified for the SNAP definition"));
|
|
71 |
SetTestStepResult(EFail);
|
|
72 |
result = EFalse;
|
|
73 |
}
|
|
74 |
|
|
75 |
return result;
|
|
76 |
}
|
|
77 |
|
|
78 |
/**
|
|
79 |
Function : doTestStepL
|
|
80 |
Description : Checks the provisioned SNAP information for the POP account settings of a test case.
|
|
81 |
@return : TVerdict - Test step result
|
|
82 |
*/
|
|
83 |
TVerdict CT_MsgCheckPopSNAPSetting::doTestStepL()
|
|
84 |
{
|
|
85 |
INFO_PRINTF1(_L("Test Step : CheckPopSNAPSetting"));
|
|
86 |
if(ReadIni())
|
|
87 |
{
|
|
88 |
CEmailAccounts* accounts = CEmailAccounts::NewL();
|
|
89 |
CleanupStack::PushL(accounts);
|
|
90 |
|
|
91 |
CImIAPPreferences* popIapPrefs = CImIAPPreferences::NewLC();
|
|
92 |
|
|
93 |
TPopAccount popAccountId;
|
|
94 |
CT_MsgUtilsCentralRepository::GetPopAccountL((TDes&)iPopAccountName,popAccountId);
|
|
95 |
|
|
96 |
accounts->LoadPopIapSettingsL(popAccountId, *popIapPrefs);
|
|
97 |
|
|
98 |
TBool actualSNAPDefintion = popIapPrefs->SNAPDefined();
|
|
99 |
|
|
100 |
if (actualSNAPDefintion == iExpectedSNAPDefinition)
|
|
101 |
{
|
|
102 |
if (actualSNAPDefintion)
|
|
103 |
{
|
|
104 |
TInt expectedSNAPPreference = 0;
|
|
105 |
if(!GetIntFromConfig(ConfigSection(), KSNAPPreference, expectedSNAPPreference))
|
|
106 |
{
|
|
107 |
ERR_PRINTF1(_L("An expected SNAP ID value is not specified"));
|
|
108 |
SetTestStepResult(EFail);
|
|
109 |
CleanupStack::PopAndDestroy(2,accounts); // popIapPrefs, accounts
|
|
110 |
return TestStepResult();
|
|
111 |
}
|
|
112 |
TInt actualSNAPPreference = popIapPrefs->SNAPPreference();
|
|
113 |
|
|
114 |
if (actualSNAPPreference != expectedSNAPPreference)
|
|
115 |
{
|
|
116 |
ERR_PRINTF3(_L("Actual SNAP ID [%d] does not equal Expected SNAP ID [%d]"),actualSNAPPreference,expectedSNAPPreference);
|
|
117 |
SetTestStepResult(EFail);
|
|
118 |
}
|
|
119 |
else
|
|
120 |
{
|
|
121 |
INFO_PRINTF3(_L("Actual SNAP ID [%d] equals Expected SNAP ID [%d]"),actualSNAPPreference,expectedSNAPPreference);
|
|
122 |
}
|
|
123 |
}
|
|
124 |
}
|
|
125 |
else
|
|
126 |
{
|
|
127 |
ERR_PRINTF3(_L("Actual SNAP Defintion [%d] does not equal Expected SNAP Defintion [%d]"),actualSNAPDefintion,iExpectedSNAPDefinition);
|
|
128 |
SetTestStepResult(EFail);
|
|
129 |
}
|
|
130 |
|
|
131 |
CleanupStack::PopAndDestroy(2,accounts); // popIapPrefs, accounts
|
|
132 |
}
|
|
133 |
return TestStepResult();
|
|
134 |
}
|