|
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_appstartapparcinit.h" |
|
26 #include "testapps.h" |
|
27 |
|
28 |
|
29 /** |
|
30 Old Test CaseID APPFWK-STARTSAFE-0012 |
|
31 New Test CaseID DEVSRVS-SYSSTART-STARTSAFE-0012 |
|
32 */ |
|
33 |
|
34 TVerdict CAppFwkStartSafeTestStepAppStartAppArcInit::doTestStepL( void ) |
|
35 { |
|
36 |
|
37 CStartSafe* startSafe = CStartSafe::NewL(); |
|
38 CleanupStack::PushL( startSafe ); |
|
39 |
|
40 CStartupProperties* prop = CStartupProperties::NewL(); |
|
41 CleanupStack::PushL( prop ); |
|
42 |
|
43 RProcess proc; |
|
44 CleanupClosePushL( proc ); |
|
45 |
|
46 prop->SetFileParamsL( KTestAppGood, KNullDesC ); |
|
47 prop->SetStartupType( EStartApp ); |
|
48 prop->SetStartMethod( EDeferredWaitForStart ); |
|
49 |
|
50 |
|
51 TRequestStatus startupTRS; |
|
52 TRequestStatus apparcSessionTRS; |
|
53 |
|
54 INFO_PRINTF1(_L("Starting the Test-App process asynchronously")); |
|
55 |
|
56 startSafe->StartL( *prop, proc, startupTRS ); |
|
57 |
|
58 User::WaitForRequest( startupTRS ); |
|
59 INFO_PRINTF2( _L("Rendezvous completed with %d"), startupTRS.Int() ); |
|
60 |
|
61 // StartL should have left if it was unsuccessful, |
|
62 // but ensure that the process's name is that of the test-app. |
|
63 TPtrC procNamePtr = proc.FileName().Right( KTestAppGood().Length() ); |
|
64 TInt nameComparison = procNamePtr.Compare( KTestAppGood() ); |
|
65 |
|
66 if( 0 == nameComparison ) |
|
67 { |
|
68 INFO_PRINTF2( _L("Application \"%S\" started correctly"), &procNamePtr ); |
|
69 } |
|
70 else |
|
71 { |
|
72 ERR_PRINTF1( _L("Application-start unsuccessful. Test not completed") ); |
|
73 |
|
74 SetTestStepResult( EFail ); |
|
75 return TestStepResult(); |
|
76 } |
|
77 |
|
78 startSafe->InitAppArcServer( apparcSessionTRS ); // try to initiate apparc, to see if that causes any problems |
|
79 User::WaitForRequest( apparcSessionTRS ); |
|
80 |
|
81 |
|
82 if ( ( startupTRS == KErrNone) && ( apparcSessionTRS == KErrNone) ) |
|
83 { |
|
84 SetTestStepResult( EPass ); |
|
85 INFO_PRINTF1( _L("Test passed") ); |
|
86 // Dispose of the test-app |
|
87 proc.Kill( KErrNone ); |
|
88 } |
|
89 else |
|
90 { |
|
91 SetTestStepResult( EFail ); |
|
92 ERR_PRINTF3( _L("Test failed.startupTRS = %d apparcSessionTRS = %d "), startupTRS.Int(), apparcSessionTRS.Int() ); |
|
93 } |
|
94 |
|
95 |
|
96 CleanupStack::PopAndDestroy( 3, startSafe ); |
|
97 |
|
98 return TestStepResult(); |
|
99 } |
|
100 |
|
101 |
|
102 |
|
103 CAppFwkStartSafeTestStepAppStartAppArcInit::CAppFwkStartSafeTestStepAppStartAppArcInit() |
|
104 { |
|
105 SetTestStepName(KCTestCaseAppStartAppArcInit); |
|
106 } |