1 // Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies). |
1 // Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). |
2 // All rights reserved. |
2 // All rights reserved. |
3 // This component and the accompanying materials are made available |
3 // This component and the accompanying materials are made available |
4 // under the terms of "Eclipse Public License v1.0" |
4 // under the terms of "Eclipse Public License v1.0" |
5 // which accompanies this distribution, and is available |
5 // which accompanies this distribution, and is available |
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
18 @test |
18 @test |
19 @internalComponent - Internal Symbian test code |
19 @internalComponent - Internal Symbian test code |
20 */ |
20 */ |
21 |
21 |
22 #include "sysmontesthelper.h" |
22 #include "sysmontesthelper.h" |
23 #include <e32property.h> |
|
24 |
23 |
25 const TUint32 KRestartExeCount = 38; |
|
26 |
24 |
27 TInt MainL() |
25 TInt MainL() |
28 { |
26 { |
29 RDebug::Print(_L("appfwk-sysmon-0038: MainL")); |
27 RDebug::Print(_L("appfwk-sysmon-0038: MainL")); |
30 |
28 |
31 TInt err = RProperty::Define(KTestSysMon, KRestartExeCount, RProperty::EInt); |
|
32 RDebug::Printf("Defining P&S key with key %d returns with err %d", err, KRestartExeCount); |
|
33 TInt runCount = 0; |
29 TInt runCount = 0; |
34 CCommandLineArguments* args = CCommandLineArguments::NewLC(); |
30 CCommandLineArguments* args = CCommandLineArguments::NewLC(); |
35 runCount = CSysMonTestHelper::ReadRunCountL(args->Arg(0)); |
31 runCount = CSysMonTestHelper::ReadRunCountL(args->Arg(0)); |
36 CSysMonTestHelper::IncrementRunCountL(args->Arg(0)); |
32 CSysMonTestHelper::IncrementRunCountL(args->Arg(0)); |
37 CleanupStack::PopAndDestroy(args); |
33 CleanupStack::PopAndDestroy(args); |
45 RSysMonSession sysmon; |
41 RSysMonSession sysmon; |
46 sysmon.OpenL(); |
42 sysmon.OpenL(); |
47 CleanupClosePushL(sysmon); |
43 CleanupClosePushL(sysmon); |
48 TTime time1(); |
44 TTime time1(); |
49 |
45 |
50 CStartupProperties* props = CStartupProperties::NewLC(_L("tsysmon_app_failcount2failwait_slave.exe"), _L("38")); |
46 CStartupProperties* props = CStartupProperties::NewLC(_L("tsysmon_app_failcount2failwait_slave.exe"), _L("APPFWK-SYSMON-0038")); |
51 props->SetMonitored(ETrue); |
47 props->SetMonitored(ETrue); |
52 props->SetStartupType(EStartProcess); |
48 props->SetStartupType(EStartProcess); |
53 props->SetStartMethod(EWaitForStart); |
49 props->SetStartMethod(EWaitForStart); |
54 props->SetNoOfRetries(1); |
50 props->SetNoOfRetries(1); |
55 props->SetTimeout(0); |
51 props->SetTimeout(0); |
56 props->SetRecoveryParams(EIgnoreOnFailure, 0); |
52 props->SetRecoveryParams(EIgnoreOnFailure, 0); |
57 |
53 |
58 RProcess slave1; |
54 RProcess slave1; |
59 slave1.Create(_L("tsysmon_app_failcount2failwait_slave.exe"), _L("APPFWK-SYSMON-0038")); |
55 slave1.Create(_L("tsysmon_app_failcount2failwait_slave.exe"), _L("APPFWK-SYSMON-0038")); |
60 CleanupClosePushL(slave1); |
56 CleanupClosePushL(slave1); |
61 TRequestStatus status; |
57 slave1.Resume(); |
62 slave1.Rendezvous(status); |
|
63 slave1.Resume(); |
|
64 User::WaitForRequest(status); |
|
65 |
58 |
66 // Register with SysMon |
59 // Register with SysMon |
67 sysmon.MonitorL(*props, slave1); |
60 sysmon.MonitorL(*props, slave1); |
68 slave1.Terminate(KErrNone); |
61 slave1.Terminate(KErrNone); |
69 |
62 |