|
1 // Copyright (c) 2003-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 // SendAsSendMessage |
|
17 // [Action Parameters] |
|
18 // RSendAsMessage paramSendAsMessage <input>: Reference to the RSendAsMessage object |
|
19 // TInt paramSendMessageConfirmed <input>: 0 if the send operation is not a confirmed operation, 1 if the send operation has to be a confirmed operation. Default value is 0. |
|
20 // TInt paramCancelSendMessage <input>: 0 if the send operation need not be canceled, 1 if the send operation has to be canceled. Default value is 0. |
|
21 // [Action Description] |
|
22 // SendAsSendMessage Test Action is intended to request the Send-As server to send the message. |
|
23 // [APIs Used] |
|
24 // RSendAsMessage::SendMessage (TRequestStatus& aStatus) |
|
25 // RSendAsMessage::SendMessageConfirmed (TRequestStatus& aStatus) |
|
26 // __ACTION_INFO_END__ |
|
27 // |
|
28 // |
|
29 |
|
30 /** |
|
31 @file |
|
32 */ |
|
33 |
|
34 #include "sendas2.h" |
|
35 #include "CMtfTestActionSendAsSendMessage.h" |
|
36 #include "CMtfTestCase.h" |
|
37 #include "CMtfTestActionParameters.h" |
|
38 #include "MtfTestActionUtilsUser.h" |
|
39 |
|
40 CMtfTestAction* CMtfTestActionSendAsSendMessage::NewL(CMtfTestCase& aTestCase,CMtfTestActionParameters* aActionParameters) |
|
41 { |
|
42 CMtfTestActionSendAsSendMessage* self = new (ELeave) CMtfTestActionSendAsSendMessage(aTestCase); |
|
43 CleanupStack::PushL(self); |
|
44 self->ConstructL(aActionParameters); |
|
45 CleanupStack::Pop(); |
|
46 return self; |
|
47 } |
|
48 |
|
49 |
|
50 CMtfTestActionSendAsSendMessage::CMtfTestActionSendAsSendMessage(CMtfTestCase& aTestCase) |
|
51 : CMtfTestAction(aTestCase) |
|
52 { |
|
53 } |
|
54 |
|
55 |
|
56 CMtfTestActionSendAsSendMessage::~CMtfTestActionSendAsSendMessage() |
|
57 { |
|
58 } |
|
59 |
|
60 |
|
61 void CMtfTestActionSendAsSendMessage::ExecuteActionL() |
|
62 { |
|
63 TestCase().INFO_PRINTF2(_L("Test Action %S start..."), &KTestActionSendAsSendMessage); |
|
64 iSendAsMessage = ObtainValueParameterL<RSendAsMessage>(TestCase(),ActionParameters().Parameter(0)); |
|
65 TInt paramConfirmedSend = ObtainValueParameterL<TInt>(TestCase(),ActionParameters().Parameter(1), EFalse); |
|
66 TInt paramCancelSend = ObtainValueParameterL<TInt>(TestCase(),ActionParameters().Parameter(2), EFalse); |
|
67 |
|
68 CActiveScheduler::Add (this); |
|
69 |
|
70 TInt err = KErrNone; |
|
71 |
|
72 if(paramConfirmedSend) |
|
73 { |
|
74 TRAP(err, iSendAsMessage.SendMessageConfirmed(iStatus)); |
|
75 } |
|
76 else |
|
77 { |
|
78 TRAP(err, iSendAsMessage.SendMessage(iStatus)); |
|
79 } |
|
80 |
|
81 if(paramCancelSend) |
|
82 { |
|
83 TRAP(err, iSendAsMessage.Cancel()); |
|
84 } |
|
85 |
|
86 SetActive(); |
|
87 TestCase().INFO_PRINTF2(_L("Test Action %S completed."), &KTestActionSendAsSendMessage); |
|
88 } |
|
89 |
|
90 void CMtfTestActionSendAsSendMessage::DoCancel() |
|
91 { |
|
92 iSendAsMessage.Cancel(); |
|
93 } |
|
94 |
|
95 void CMtfTestActionSendAsSendMessage::RunL() |
|
96 { |
|
97 TSendAsProgress sendAsProgress; |
|
98 TInt errorCode = KErrNone; |
|
99 |
|
100 if (iStatus == KErrNone) |
|
101 { |
|
102 iSendAsMessage.ProgressL(sendAsProgress); |
|
103 errorCode = sendAsProgress.iError; |
|
104 } |
|
105 else |
|
106 { |
|
107 errorCode = iStatus.Int(); |
|
108 } |
|
109 |
|
110 if(ActionParameters().Count() == 4) |
|
111 { |
|
112 StoreParameterL<TInt>(TestCase(),errorCode,ActionParameters().Parameter(3)); |
|
113 } |
|
114 else |
|
115 { |
|
116 User::LeaveIfError(errorCode); |
|
117 } |
|
118 |
|
119 TestCase().INFO_PRINTF2(_L("Test Action %S completed."), &KTestActionSendAsSendMessage); |
|
120 TestCase().ActionCompletedL(*this); |
|
121 } |
|
122 |