|
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_appstart.h" |
|
26 #include "testapps.h" |
|
27 |
|
28 /** |
|
29 Old Test CaseID APPFWK-STARTSAFE-0002 |
|
30 New Test CaseID DEVSRVS-SHMA-STARTSAFE-0002 |
|
31 */ |
|
32 |
|
33 TVerdict CAppFwkStartSafeTestStepAppStart::doTestStepL() |
|
34 { |
|
35 |
|
36 CStartSafe *startSafe = CStartSafe::NewL(); |
|
37 CleanupStack::PushL( startSafe ); |
|
38 |
|
39 CStartupProperties *prop = CStartupProperties::NewL(); |
|
40 CleanupStack::PushL( prop ); |
|
41 |
|
42 RProcess proc; |
|
43 CleanupClosePushL( proc ); |
|
44 |
|
45 prop->SetFileParamsL( KTestAppGood, KNullDesC ); |
|
46 prop->SetStartupType( EStartApp ); |
|
47 prop->SetStartMethod( EFireAndForget ); |
|
48 // Tell StartSafe we intend to monitor in order that it provides the process handle |
|
49 // (so we can Kill() it) |
|
50 prop->SetMonitored( ETrue ); |
|
51 |
|
52 |
|
53 TInt tried = 0; |
|
54 |
|
55 INFO_PRINTF1( _L("Start the Test Application") ); |
|
56 TRAPD( err, startSafe->StartL(*prop, proc, tried) ); |
|
57 |
|
58 // Originally there was a delay (2s) here. TKAS |
|
59 |
|
60 // Ensure that the process's name is that of the test-app. |
|
61 TPtrC procNamePtr = proc.FileName().Right( KTestAppGood().Length() ); |
|
62 TInt nameComparison = procNamePtr.Compare( KTestAppGood() ); |
|
63 |
|
64 if ( (KErrNone == err) && (0 == nameComparison) ) |
|
65 { |
|
66 INFO_PRINTF2( _L("Application \"%S\" started correctly"), &procNamePtr ); |
|
67 |
|
68 SetTestStepResult( EPass ); |
|
69 INFO_PRINTF1( _L("Test passed") ); |
|
70 } |
|
71 else |
|
72 { |
|
73 ERR_PRINTF1( _L("Test failed") ); |
|
74 |
|
75 SetTestStepResult( EFail ); |
|
76 } |
|
77 |
|
78 // Dispose of the test-app. |
|
79 if( 0 == nameComparison ) |
|
80 { |
|
81 proc.Kill( KErrNone ); |
|
82 } |
|
83 |
|
84 |
|
85 CleanupStack::PopAndDestroy( 3, startSafe ); |
|
86 |
|
87 return TestStepResult(); |
|
88 } |
|
89 |
|
90 |
|
91 |
|
92 CAppFwkStartSafeTestStepAppStart::CAppFwkStartSafeTestStepAppStart() |
|
93 { |
|
94 SetTestStepName( KCTestCaseAppStart ); |
|
95 } |