|
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 @file |
|
18 @test |
|
19 @internalComponent - Internal Symbian test code |
|
20 */ |
|
21 |
|
22 #include <startupproperties.h> |
|
23 |
|
24 #include "startsafe.h" |
|
25 #include "tstartsafe_proctimeout.h" |
|
26 #include "testappslow.h" |
|
27 #include "testapps.h" |
|
28 |
|
29 const TInt KProcTimeoutWaitTime = 300; |
|
30 |
|
31 /** |
|
32 Old Test CaseID APPFWK-STARTSAFE-0003 |
|
33 New Test CaseID DEVSRVS-SHMA-STARTSAFE-0003 |
|
34 */ |
|
35 |
|
36 TVerdict CAppFwkStartSafeTestStepProcTimeout::doTestStepL( void ) |
|
37 { |
|
38 |
|
39 CStartSafe *startSafe = CStartSafe::NewL(); |
|
40 CleanupStack::PushL(startSafe); |
|
41 |
|
42 CStartupProperties *prop = CStartupProperties::NewL(); |
|
43 CleanupStack::PushL(prop); |
|
44 |
|
45 RProcess proc; |
|
46 CleanupClosePushL( proc ); |
|
47 |
|
48 prop->SetFileParamsL( KTestAppSlow, KNullDesC ); |
|
49 prop->SetStartupType( EStartProcess ); |
|
50 prop->SetStartMethod( EWaitForStart); |
|
51 prop->SetNoOfRetries( 0 ); |
|
52 prop->SetTimeout( KProcTimeoutWaitTime ); |
|
53 |
|
54 |
|
55 TInt tried = 0; |
|
56 |
|
57 INFO_PRINTF2( _L("Start the process and wait %d milliseconds"), KProcTimeoutWaitTime ); |
|
58 |
|
59 TRAPD( err, startSafe->StartL(*prop, proc, tried) ); |
|
60 |
|
61 if ( err == KErrTimedOut ) |
|
62 { |
|
63 SetTestStepResult( EPass ); |
|
64 INFO_PRINTF1( _L("Process timed out. Test passed") ); |
|
65 } |
|
66 else |
|
67 { |
|
68 SetTestStepResult( EFail ); |
|
69 ERR_PRINTF1( _L("Timeout did not happen - Test Failed") ); |
|
70 |
|
71 TPtrC procNamePtr = proc.FileName().Right( KTestAppSlow().Length() ); |
|
72 // Check that the process is the app we think it is. |
|
73 if( 0 == procNamePtr.Compare( KTestAppSlow()) ) |
|
74 { |
|
75 proc.Kill( KErrNone ); |
|
76 } |
|
77 |
|
78 } |
|
79 |
|
80 |
|
81 CleanupStack::PopAndDestroy( 3, startSafe ); |
|
82 |
|
83 return TestStepResult(); |
|
84 } |
|
85 |
|
86 |
|
87 |
|
88 CAppFwkStartSafeTestStepProcTimeout::CAppFwkStartSafeTestStepProcTimeout() |
|
89 { |
|
90 SetTestStepName(KCTestCaseProcTimeout); |
|
91 } |