|
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 // SendAsSaveMessageAndClose |
|
17 // [Action Parameters] |
|
18 // RSendAsMessage sendAsMessage <input> : RSendAsMessage object |
|
19 // [Action Description] |
|
20 // Saves the message in to Drafts folder and closes the message handle |
|
21 // [APIs Used] |
|
22 // RSendAsMessage::SendAsSaveMessageAndClose() |
|
23 // __ACTION_INFO_END__ |
|
24 // |
|
25 // |
|
26 |
|
27 /** |
|
28 @file |
|
29 @internalTechnology |
|
30 */ |
|
31 |
|
32 |
|
33 // User include |
|
34 #include "CMtfTestActionSendAsSaveMessageAndClose.h" |
|
35 #include "CMtfTestCase.h" |
|
36 #include "CMtfTestActionParameters.h" |
|
37 |
|
38 |
|
39 /** |
|
40 NewL() |
|
41 Constructs a SendAsSendAsSaveMessageAndClose object. |
|
42 Uses two phase construction and leaves nothing on the CleanupStack. |
|
43 @internalTechnology |
|
44 @param aTestCase Test Case to which this Test Action belongs |
|
45 @param aActionParameters Action parameters, must not be NULL |
|
46 @return Created object of type SendAsSaveMessageAndClose |
|
47 @pre None |
|
48 @post SendAsSaveMessageAndClose object is created |
|
49 */ |
|
50 CMtfTestAction* CMtfTestActionSendAsSaveMessageAndClose:: |
|
51 NewL(CMtfTestCase& aTestCase,CMtfTestActionParameters* aActionParameters) |
|
52 { |
|
53 CMtfTestActionSendAsSaveMessageAndClose* self = |
|
54 new (ELeave) CMtfTestActionSendAsSaveMessageAndClose(aTestCase); |
|
55 |
|
56 CleanupStack::PushL(self); |
|
57 self->ConstructL(aActionParameters); |
|
58 CleanupStack::Pop(self); |
|
59 return self; |
|
60 } |
|
61 |
|
62 |
|
63 /** |
|
64 SendAsSaveMessageAndClose constructor |
|
65 Calls the base class' constructor |
|
66 @internalTechnology |
|
67 @param aTestCase Test Case to which this Test Action belongs |
|
68 @pre None |
|
69 @post None |
|
70 */ |
|
71 CMtfTestActionSendAsSaveMessageAndClose::CMtfTestActionSendAsSaveMessageAndClose(CMtfTestCase& aTestCase) |
|
72 : CMtfSynchronousTestAction(aTestCase) |
|
73 { |
|
74 } |
|
75 |
|
76 /** |
|
77 Function : ~CMtfTestActionSendAsSaveMessageAndClose |
|
78 Description : Destructor |
|
79 @internalTechnology |
|
80 @param : |
|
81 @return : |
|
82 @pre |
|
83 @post |
|
84 */ |
|
85 CMtfTestActionSendAsSaveMessageAndClose::~CMtfTestActionSendAsSaveMessageAndClose() |
|
86 { |
|
87 } |
|
88 |
|
89 /** |
|
90 ExecuteActionL |
|
91 Saves the message in the Drafts folder and closes the message |
|
92 @internalTechnology |
|
93 @pre None |
|
94 @post None |
|
95 @leave System wide errors |
|
96 */ |
|
97 void CMtfTestActionSendAsSaveMessageAndClose::ExecuteActionL() |
|
98 { |
|
99 if((TestCase().TestStepResult()) == EPass) |
|
100 { |
|
101 TestCase().INFO_PRINTF2(_L("Test Action %S start..."), &KTestActionSendAsSaveMessageAndClose); |
|
102 |
|
103 // Get Test action input parameters |
|
104 RSendAsMessage paramSendAsMessage = ObtainValueParameterL<RSendAsMessage>(TestCase(), |
|
105 ActionParameters().Parameter(0)); |
|
106 |
|
107 // Save and close the message |
|
108 TRAPD(err, paramSendAsMessage.SaveMessageAndCloseL()); |
|
109 |
|
110 if (err == KErrNone) |
|
111 { |
|
112 TestCase().INFO_PRINTF1(_L("Save and Close of message was successful")); |
|
113 } |
|
114 else |
|
115 { |
|
116 TestCase().ERR_PRINTF2(_L("Save and Close of message failed with error %d"), err); |
|
117 TestCase().SetTestStepResult(EFail); |
|
118 } |
|
119 |
|
120 TestCase().INFO_PRINTF2(_L("Test Action %S completed."), &KTestActionSendAsSaveMessageAndClose); |
|
121 } |
|
122 TestCase().ActionCompletedL(*this); |
|
123 } |
|
124 |