|
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 // LaunchScheduleMessageExe |
|
17 // [Action Parameters] |
|
18 // None |
|
19 // [Action Description] |
|
20 // Launches ScheduleMessage.exe. |
|
21 // [APIs Used] |
|
22 // RProcess::Create |
|
23 // RProcess::Resume |
|
24 // RProcess::Close |
|
25 // __ACTION_INFO_END__ |
|
26 // |
|
27 // |
|
28 |
|
29 // System includes |
|
30 #include <msvstd.h> |
|
31 #include <e32std.h> |
|
32 #include <imcmutil.h> |
|
33 #include <e32cmn.h> |
|
34 |
|
35 // User includes |
|
36 #include "CMtfTestActionLaunchScheduleMessageExe.h" |
|
37 #include "CMtfTestCase.h" |
|
38 #include "CMtfTestActionParameters.h" |
|
39 |
|
40 |
|
41 // Path of the SchSendExe.exe |
|
42 _LIT(KMsvScheduleMessage, "schedulemessage.exe"); |
|
43 |
|
44 // UID of LaunchSchSendExe.exe |
|
45 const TUid KMsvScheduleMessageUid = {0x10204284}; |
|
46 |
|
47 /** |
|
48 Function : NewL |
|
49 Description :Creates a new CMtfTestActionLaunchScheduleMessageExe object |
|
50 @internalTechnology |
|
51 @param : aTestCase :Reference to the Test case |
|
52 @param : aActionParams :Test Action parameters |
|
53 @return : CMtfTestAction* :a base class pointer to the newly created object |
|
54 @pre none |
|
55 @post none |
|
56 */ |
|
57 CMtfTestAction* CMtfTestActionLaunchScheduleMessageExe::NewL(CMtfTestCase& aTestCase,CMtfTestActionParameters* aActionParameters) |
|
58 { |
|
59 CMtfTestActionLaunchScheduleMessageExe* self = new (ELeave) CMtfTestActionLaunchScheduleMessageExe(aTestCase); |
|
60 CleanupStack::PushL(self); |
|
61 self->ConstructL(aActionParameters); |
|
62 CleanupStack::Pop(self); |
|
63 return self; |
|
64 } |
|
65 |
|
66 |
|
67 /** |
|
68 Function : CMtfTestActionLaunchScheduleMessageExe |
|
69 Description : Constructor |
|
70 @internalTechnology |
|
71 @param : aTestCase - CMtfTestCase for the CMtfTestAction base class |
|
72 @pre none |
|
73 @post none |
|
74 */ |
|
75 CMtfTestActionLaunchScheduleMessageExe::CMtfTestActionLaunchScheduleMessageExe(CMtfTestCase& aTestCase) |
|
76 : CMtfSynchronousTestAction(aTestCase) |
|
77 { |
|
78 } |
|
79 |
|
80 |
|
81 /** |
|
82 Function : ~CMtfTestActionLaunchScheduleMessageExe |
|
83 Description : Destructor |
|
84 @internalTechnology |
|
85 */ |
|
86 CMtfTestActionLaunchScheduleMessageExe::~CMtfTestActionLaunchScheduleMessageExe() |
|
87 { |
|
88 } |
|
89 |
|
90 |
|
91 /** |
|
92 Function : ExecuteActionL |
|
93 Description : Launches the ScheduleMessage.exe and verifies the result of process |
|
94 completion. If the process fails, then the test action is failed |
|
95 @internalTechnology |
|
96 @param : none |
|
97 @return : void |
|
98 @pre : |
|
99 @post : none |
|
100 */ |
|
101 void CMtfTestActionLaunchScheduleMessageExe::ExecuteActionL() |
|
102 { |
|
103 TestCase().INFO_PRINTF2(_L("Test Action %S start..."), &KTestActionLaunchScheduleMessageExe); |
|
104 if((TestCase().TestStepResult()) == EPass) |
|
105 { |
|
106 // Create process |
|
107 RProcess process; |
|
108 TBuf<20> cmdString; |
|
109 User::LeaveIfError(process.Create(KMsvScheduleMessage,cmdString, TUidType(KNullUid, |
|
110 KNullUid, KMsvScheduleMessageUid))); |
|
111 TestCase().INFO_PRINTF2(_L("RProcess::Create() is successful %S "), &KTestActionLaunchScheduleMessageExe); |
|
112 |
|
113 // Make the process eligible for execution |
|
114 TRequestStatus status = KRequestPending; |
|
115 process.Logon(status); |
|
116 process.Resume(); |
|
117 |
|
118 // Wait for the process completion |
|
119 User::WaitForRequest(status); |
|
120 |
|
121 // Check the exit reason of the process.If Panic occurs, the return value is set |
|
122 // to KErrGeneral |
|
123 TInt returnValue = (process.ExitType() == EExitPanic)? KErrGeneral: status.Int(); |
|
124 process.Close(); |
|
125 |
|
126 TestCase().INFO_PRINTF3(_L("Test Action %S completed with %d"), &KTestActionLaunchScheduleMessageExe, returnValue); |
|
127 |
|
128 if(returnValue != KErrNone) |
|
129 { |
|
130 // Error or Panic has occured, fail the Test Action |
|
131 TestCase().SetTestStepResult(EFail); |
|
132 } |
|
133 TestCase().ActionCompletedL(*this); |
|
134 } |
|
135 } |