|
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 |
|
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 // CheckSmtpBMSetting |
|
16 // [Paramaters] |
|
17 // SmtpAccountName :Name of the Smtp account. |
|
18 // ExpectedBMSupport :ETrue => Bearer mobility is expected to be supported by the SMTP service. |
|
19 // EFalse => Bearer mobility is not expected to be supported by the SMTP service. |
|
20 // Checks if bearer mobility is supported by the SMTP service. |
|
21 // |
|
22 // |
|
23 |
|
24 //User includes |
|
25 #include "T_CheckSmtpBMSetting.h" |
|
26 #include <t_utils.h> |
|
27 #include <t_utilsenumconverter.h> |
|
28 #include <t_utilscentralrepository.h> |
|
29 |
|
30 //Epoc include |
|
31 #include <iapprefs.h> |
|
32 |
|
33 //Literals used |
|
34 _LIT(KSmtpAccountName,"SmtpAccountName"); |
|
35 _LIT(KExpectedBMSupport,"ExpectedBMSupport"); |
|
36 |
|
37 /** |
|
38 Function : CT_MsgCheckSmtpBMSetting |
|
39 Description : Constructor |
|
40 @param : aSharedDataSMTP Reference to CT_MsgSharedDataSmtp |
|
41 @return : N/A |
|
42 */ |
|
43 CT_MsgCheckSmtpBMSetting::CT_MsgCheckSmtpBMSetting(CT_MsgSharedDataSmtp& aSharedDataSMTP) |
|
44 :CT_MsgSyncStepSMTP(aSharedDataSMTP) |
|
45 { |
|
46 SetTestStepName(KCheckSmtpBMSetting); |
|
47 } |
|
48 |
|
49 /** |
|
50 Function : ReadIni |
|
51 Description :Reads the corresponding .ini file and returns EPass or EFail if any of the inputs are missing |
|
52 @return : TBool |
|
53 */ |
|
54 TBool CT_MsgCheckSmtpBMSetting::ReadIni() |
|
55 { |
|
56 TBool result = ETrue; |
|
57 |
|
58 if(!GetStringFromConfig(ConfigSection(), KSmtpAccountName, iSmtpAccountName)) |
|
59 { |
|
60 ERR_PRINTF1(_L("Smtp account name is not specified")); |
|
61 SetTestStepResult(EFail); |
|
62 result = EFalse; |
|
63 } |
|
64 |
|
65 if(!GetBoolFromConfig(ConfigSection(), KExpectedBMSupport, iExpectedBMSupport)) |
|
66 { |
|
67 ERR_PRINTF1(_L("An expected \"ETrue\" or \"EFalse\" boolean value is not specified for BM support")); |
|
68 SetTestStepResult(EFail); |
|
69 result = EFalse; |
|
70 } |
|
71 |
|
72 return result; |
|
73 } |
|
74 |
|
75 /** |
|
76 Function : doTestStepL |
|
77 Description : Checks the provisioned BM support for the SMTP account settings of a test case. |
|
78 @return : TVerdict - Test step result |
|
79 */ |
|
80 TVerdict CT_MsgCheckSmtpBMSetting::doTestStepL() |
|
81 { |
|
82 INFO_PRINTF1(_L("Test Step : CheckSmtpBMSetting")); |
|
83 if(ReadIni()) |
|
84 { |
|
85 CEmailAccounts* accounts = CEmailAccounts::NewL(); |
|
86 CleanupStack::PushL(accounts); |
|
87 |
|
88 CImSmtpSettings* smtpSettings = new(ELeave) CImSmtpSettings(); |
|
89 CleanupStack::PushL(smtpSettings); |
|
90 |
|
91 TSmtpAccount smtpAccountId; |
|
92 CT_MsgUtilsCentralRepository::GetSmtpAccountL((TDes&)iSmtpAccountName, smtpAccountId); |
|
93 |
|
94 accounts->LoadSmtpSettingsL(smtpAccountId, *smtpSettings); |
|
95 |
|
96 TBool actualBMSupport = smtpSettings->BearerMobility(); |
|
97 |
|
98 if (actualBMSupport == iExpectedBMSupport) |
|
99 { |
|
100 INFO_PRINTF3(_L("Actual Bearer Mobility Support [%d] does equals Expected Bearer Mobility Support [%d]"),actualBMSupport,iExpectedBMSupport); |
|
101 } |
|
102 else |
|
103 { |
|
104 ERR_PRINTF3(_L("Actual Bearer Mobility Support [%d] does not equal Expected Bearer Mobility Support [%d]"),actualBMSupport,iExpectedBMSupport); |
|
105 SetTestStepResult(EFail); |
|
106 } |
|
107 |
|
108 CleanupStack::PopAndDestroy(2,accounts); // smtpSettings, accounts |
|
109 } |
|
110 return TestStepResult(); |
|
111 } |