|
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 // ChangeDefaultPopService |
|
17 // [Action Parameters] |
|
18 // serviceId <input>: TMsvId. Service ID to set as default. |
|
19 // popClientMtm <input>: CPop3ClientMtm |
|
20 // [Action Description] |
|
21 // ChangeDefaultPopService Test Action is intended to change the default POP3 |
|
22 // service to serviceId. |
|
23 // [APIs Used] |
|
24 // CPop3ClientMtm::ChangeDefaultServiceL |
|
25 // __ACTION_INFO_END__ |
|
26 // |
|
27 // |
|
28 |
|
29 // system #includes |
|
30 #include <popcmtm.h> |
|
31 |
|
32 // user #includes |
|
33 #include "CMtfTestActionChangeDefaultPopService.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* CMtfTestActionChangeDefaultPopService::NewL(CMtfTestCase& aTestCase,CMtfTestActionParameters* aActionParameters) |
|
49 { |
|
50 CMtfTestActionChangeDefaultPopService* self = new (ELeave) CMtfTestActionChangeDefaultPopService(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 CMtfTestActionChangeDefaultPopService::CMtfTestActionChangeDefaultPopService(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 CMtfTestActionChangeDefaultPopService::~CMtfTestActionChangeDefaultPopService() |
|
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 CMtfTestActionChangeDefaultPopService::ExecuteActionL() |
|
93 { |
|
94 |
|
95 TestCase().INFO_PRINTF2(_L("Test Action %S start..."), &KTestActionChangeDefaultPopService); |
|
96 TMsvId serviceId = ObtainValueParameterL<TMsvId>(TestCase(), ActionParameters().Parameter(0)); |
|
97 CPop3ClientMtm* popClientMtm = ObtainParameterReferenceL<CPop3ClientMtm>(TestCase(), ActionParameters().Parameter(1)); |
|
98 |
|
99 TRAPD( error, popClientMtm->ChangeDefaultServiceL(serviceId) ); |
|
100 |
|
101 if (error != KErrNone) |
|
102 { |
|
103 TestCase().ERR_PRINTF2(_L("Failed to change POP3 default service error(%d)"), error); |
|
104 TestCase().SetTestStepResult(EFail); |
|
105 } |
|
106 else |
|
107 { |
|
108 TestCase().INFO_PRINTF2(_L("Test Action %S completed."), &KTestActionChangeDefaultPopService); |
|
109 } |
|
110 |
|
111 |
|
112 TestCase().ActionCompletedL(*this); |
|
113 } |
|
114 |
|
115 |