|
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 // SendAsCloseAndSendMessage |
|
17 // [Action Parameters] |
|
18 // RSendAsMessage paramRSendAsMessage <input> : Reference of the RSendAsMessage object |
|
19 // TInt closeAndSendMessageConfirmed <input> : 0 if the Close and Send Message |
|
20 // operation is not a confirmed operation, |
|
21 // 1 if the Close and Send Message operation |
|
22 // has to be a confirmed operation. Default value is 0 |
|
23 // ErrorCode <output>: (Optional) Returned error code, if not requested then code will |
|
24 // leave if not KErrNone |
|
25 // [Action Description] |
|
26 // Test Action is intended to request sending the message and closing the RSendAsMessage |
|
27 // object. The Send-As server performs a confirmed or unconfirmed Close and Send Message |
|
28 // operation based on the flag provided as second input parameter to the Test Action. |
|
29 // Default action is to perform an unconfirmed Close and Send Message operation. |
|
30 // [APIs Used] |
|
31 // RSendAsMessage::CloseAndSendMessage () |
|
32 // RSendAsMessage::CloseAndSendMessageConfirmed () |
|
33 // __ACTION_INFO_END__ |
|
34 // |
|
35 // |
|
36 |
|
37 /** |
|
38 @file |
|
39 @internalTechnology |
|
40 */ |
|
41 |
|
42 // User include |
|
43 #include "CMtfTestActionSendAsCloseAndSendMessage.h" |
|
44 #include "CMtfTestCase.h" |
|
45 #include "CMtfTestActionParameters.h" |
|
46 #include "sendas2.h" |
|
47 |
|
48 |
|
49 /** |
|
50 NewL() |
|
51 Constructs a CMtfTestActionSendAsCloseAndSendMessage object. |
|
52 Uses two phase construction and leaves nothing on the CleanupStack. |
|
53 @internalTechnology |
|
54 @param aTestCase Test Case to which this Test Action belongs |
|
55 @param aActionParameters Action parameters, must not be NULL |
|
56 @return Created object of type CMtfTestActionSendAsCloseAndSendMessage |
|
57 @pre None |
|
58 @post CMtfTestActionSendAsCloseAndSendMessage object is created |
|
59 */ |
|
60 CMtfTestAction* CMtfTestActionSendAsCloseAndSendMessage:: |
|
61 NewL(CMtfTestCase& aTestCase,CMtfTestActionParameters* aActionParameters) |
|
62 { |
|
63 CMtfTestActionSendAsCloseAndSendMessage* self = |
|
64 new (ELeave) CMtfTestActionSendAsCloseAndSendMessage(aTestCase); |
|
65 |
|
66 CleanupStack::PushL(self); |
|
67 self->ConstructL(aActionParameters); |
|
68 CleanupStack::Pop(self); |
|
69 return self; |
|
70 } |
|
71 |
|
72 |
|
73 /** |
|
74 CMtfTestActionSendAsCloseAndSendMessage constructor |
|
75 Calls the base class' constructor |
|
76 @internalTechnology |
|
77 @param aTestCase Test Case to which this Test Action belongs |
|
78 @pre None |
|
79 @post None |
|
80 */ |
|
81 CMtfTestActionSendAsCloseAndSendMessage::CMtfTestActionSendAsCloseAndSendMessage(CMtfTestCase& aTestCase) |
|
82 : CMtfSynchronousTestAction(aTestCase) |
|
83 { |
|
84 } |
|
85 |
|
86 /** |
|
87 Function : ~CMtfTestActionSendAsCloseAndSendMessage |
|
88 Description : Destructor |
|
89 @internalTechnology |
|
90 @param : |
|
91 @return : |
|
92 @pre |
|
93 @post |
|
94 */ |
|
95 CMtfTestActionSendAsCloseAndSendMessage::~CMtfTestActionSendAsCloseAndSendMessage() |
|
96 { |
|
97 } |
|
98 |
|
99 /** |
|
100 ExecuteActionL |
|
101 Obtains the parameters for the test action. |
|
102 @internalTechnology |
|
103 @pre None |
|
104 @post None |
|
105 @leave System wide errors |
|
106 */ |
|
107 void CMtfTestActionSendAsCloseAndSendMessage::ExecuteActionL() |
|
108 { |
|
109 TestCase().INFO_PRINTF2(_L("Test Action %S start..."), &KTestActionSendAsCloseAndSendMessage); |
|
110 RSendAsMessage paramRSendAsMessage = ObtainValueParameterL<RSendAsMessage>(TestCase(),ActionParameters().Parameter(0)); |
|
111 TInt paramCloseAndSendMessageConfirmed = ObtainValueParameterL<TInt>(TestCase(),ActionParameters().Parameter(1), EFalse); |
|
112 |
|
113 TInt err = KErrNone; |
|
114 |
|
115 if (paramCloseAndSendMessageConfirmed) |
|
116 { |
|
117 TRAP(err,paramRSendAsMessage.SendMessageConfirmedAndCloseL()); |
|
118 } |
|
119 else |
|
120 { |
|
121 TRAP(err,paramRSendAsMessage.SendMessageAndCloseL()); |
|
122 } |
|
123 |
|
124 if( ActionParameters().Count() > 2 ) |
|
125 { |
|
126 StoreParameterL<TInt>(TestCase(),err,ActionParameters().Parameter(2)); |
|
127 } |
|
128 |
|
129 TestCase().INFO_PRINTF2(_L("Test Action %S completed."), &KTestActionSendAsCloseAndSendMessage); |
|
130 TestCase().ActionCompletedL(*this); |
|
131 } |
|
132 |