|
1 // Copyright (c) 2007-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 // |
|
15 |
|
16 |
|
17 #include <e32std.h> |
|
18 #include "tsysstart2_procmon.h" |
|
19 #include "testprocgood.h" |
|
20 #include "testapps.h" |
|
21 |
|
22 |
|
23 CAppFwkSysStart2TestStepProcMon::CAppFwkSysStart2TestStepProcMon() |
|
24 { |
|
25 SetTestStepName(KCTestCaseProcMon); |
|
26 } |
|
27 |
|
28 |
|
29 |
|
30 /** |
|
31 Old Test CaseID APPFWK-SYSSTART-0081 |
|
32 New Test CaseID DEVSRVS-SYSSTART-STARTUP2-0081 |
|
33 */ |
|
34 |
|
35 TVerdict CAppFwkSysStart2TestStepProcMon::doTestStepL() |
|
36 { |
|
37 |
|
38 // The test process should have been started, as indicated in tsysstart2-procmon_emulator.rss |
|
39 TFullName name; |
|
40 RProcess process; |
|
41 CleanupClosePushL( process ); |
|
42 |
|
43 |
|
44 if( ProcessExists(KTestProcGood, name) && (KErrNone == process.Open(name)) ) |
|
45 { |
|
46 INFO_PRINTF1( _L("The test-process was started successfully (as a server) at startup") ); |
|
47 INFO_PRINTF1( _L("Now Kill() the test-process and wait for the throttle time") ); |
|
48 |
|
49 |
|
50 process.Kill( KSysStart2TestKillCode ); |
|
51 process.Close(); |
|
52 User::After( KThrottleTime ); |
|
53 |
|
54 |
|
55 if( ProcessExists(KTestProcGood, name) ) |
|
56 { |
|
57 INFO_PRINTF1( _L("The test-process has correctly been restarted") ); |
|
58 |
|
59 // Tell the test-server process to cancel monitoring Then dispose of it |
|
60 // and establish that it has not been re-started. |
|
61 LogonAndCancelMonL(); |
|
62 INFO_PRINTF1( _L("Monitoring of the test-process has been cancelled") ); |
|
63 |
|
64 process.Open( name ); |
|
65 process.Kill( KSysStart2TestKillCode ); |
|
66 User::After( KThrottleTime ); |
|
67 |
|
68 if( !ProcessExists(KTestProcGood, name) ) |
|
69 { |
|
70 INFO_PRINTF1( _L("The test-process has been killed and correctly _not restarted") ); |
|
71 SetTestStepResult( EPass ); |
|
72 } |
|
73 else |
|
74 { |
|
75 ERR_PRINTF1( _L("The test-process has been killed and _incorrectly restarted") ); |
|
76 SetTestStepResult( EFail ); |
|
77 } |
|
78 |
|
79 } |
|
80 |
|
81 } |
|
82 else |
|
83 { |
|
84 INFO_PRINTF1(_L("The test-process was not started or a handle could not be opened on it")); |
|
85 |
|
86 SetTestStepResult( EFail ); |
|
87 } |
|
88 |
|
89 CleanupStack::PopAndDestroy( &process ); |
|
90 |
|
91 return TestStepResult(); |
|
92 } |
|
93 |