|
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 // ChangeDefaultImapService |
|
17 // [Action Parameters] |
|
18 // serviceId <input>: TMsvId. Service ID to set as default. |
|
19 // imapClientMtm <input>: CImap4ClientMtm |
|
20 // [Action Description] |
|
21 // ChangeDefaultImapService Test Action is intended to change the default IMAP4 |
|
22 // service to serviceId. |
|
23 // [APIs Used] |
|
24 // CImap4ClientMtm::ChangeDefaultServiceL |
|
25 // __ACTION_INFO_END__ |
|
26 // |
|
27 // |
|
28 |
|
29 #include <impcmtm.h> |
|
30 |
|
31 #include "CMtfTestActionChangeDefaultImapService.h" |
|
32 #include "TMtfTestParameterType.h" |
|
33 #include "CMtfTestCase.h" |
|
34 #include "CMtfTestActionParameters.h" |
|
35 |
|
36 /** |
|
37 Function : NewL |
|
38 Description : |
|
39 @internalTechnology |
|
40 @param : aTestCase - CMtfTestCase for the CMtfTestAction base class |
|
41 @param : aActionParams - CMtfTestActionParameters |
|
42 @return : CMtfTestAction* - a base class pointer to the newly created CMtfTestActionChangeDefaultImapService object |
|
43 @pre none |
|
44 @post none |
|
45 */ |
|
46 CMtfTestAction* CMtfTestActionChangeDefaultImapService::NewL(CMtfTestCase& aTestCase,CMtfTestActionParameters* aActionParameters) |
|
47 { |
|
48 CMtfTestActionChangeDefaultImapService* self = new (ELeave) CMtfTestActionChangeDefaultImapService(aTestCase); |
|
49 CleanupStack::PushL(self); |
|
50 self->ConstructL(aActionParameters); |
|
51 CleanupStack::Pop(self); |
|
52 return self; |
|
53 } |
|
54 |
|
55 /** |
|
56 Function : CMtfTestActionChangeDefaultImapService |
|
57 Description : Constructor |
|
58 @internalTechnology |
|
59 @param : aTestCase - CMtfTestCase for the CMtfTestAction base class |
|
60 @return : N/A |
|
61 @pre none |
|
62 @post none |
|
63 */ |
|
64 CMtfTestActionChangeDefaultImapService::CMtfTestActionChangeDefaultImapService(CMtfTestCase& aTestCase) : CMtfSynchronousTestAction(aTestCase) |
|
65 { |
|
66 } |
|
67 |
|
68 /** |
|
69 Function : ~CMtfTestActionChangeDefaultImapService |
|
70 Description : Destructor |
|
71 @internalTechnology |
|
72 @param : |
|
73 @return : |
|
74 @pre |
|
75 @post |
|
76 */ |
|
77 CMtfTestActionChangeDefaultImapService::~CMtfTestActionChangeDefaultImapService() |
|
78 { |
|
79 } |
|
80 |
|
81 /** |
|
82 Function : ExecuteActionL |
|
83 Description : Entry point for the this test action in the test framework |
|
84 @internalTechnology |
|
85 @param : none |
|
86 @return : void |
|
87 @pre none |
|
88 @post none |
|
89 */ |
|
90 void CMtfTestActionChangeDefaultImapService::ExecuteActionL() |
|
91 { |
|
92 TestCase().INFO_PRINTF2(_L("Test Action %S start..."), &KTestActionChangeDefaultImapService); |
|
93 TMsvId serviceId = ObtainValueParameterL<TMsvId>(TestCase(), ActionParameters().Parameter(0)); |
|
94 CImap4ClientMtm* imapClientMtm = ObtainParameterReferenceL<CImap4ClientMtm>(TestCase(), ActionParameters().Parameter(1)); |
|
95 |
|
96 TRAPD( error, imapClientMtm->ChangeDefaultServiceL(serviceId) ); |
|
97 |
|
98 if (error != KErrNone) |
|
99 { |
|
100 // Failed KErrNotFound=(-1) |
|
101 TestCase().ERR_PRINTF2(_L("Failed to change IMAP4 default service error(%d)"), error); |
|
102 TestCase().SetTestStepResult(EFail); |
|
103 } |
|
104 |
|
105 TestCase().INFO_PRINTF2(_L("Test Action %S completed."), &KTestActionChangeDefaultImapService); |
|
106 TestCase().ActionCompletedL(*this); |
|
107 |
|
108 } |
|
109 |
|
110 |