|
1 // Copyright (c) 2006-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 "trestartsys_server.h" |
|
23 #include "trestartsys_abort.h" |
|
24 #include "trestartsys_withmode.h" |
|
25 |
|
26 _LIT(KServerName, "trestartsys_server"); |
|
27 |
|
28 CRestartSysTestServer* CRestartSysTestServer::NewLC() |
|
29 { |
|
30 CRestartSysTestServer* server = new (ELeave) CRestartSysTestServer(); |
|
31 CleanupStack::PushL(server); |
|
32 server->StartL(KServerName); |
|
33 return server; |
|
34 } |
|
35 |
|
36 static void MainL() |
|
37 { |
|
38 CActiveScheduler* sched = new(ELeave) CActiveScheduler; |
|
39 CleanupStack::PushL(sched); |
|
40 CActiveScheduler::Install(sched); |
|
41 |
|
42 // Create the CTestServer derived server |
|
43 CRestartSysTestServer* server = CRestartSysTestServer::NewLC(); |
|
44 RProcess::Rendezvous(KErrNone); |
|
45 sched->Start(); |
|
46 |
|
47 CleanupStack::PopAndDestroy(server); |
|
48 CleanupStack::PopAndDestroy(sched); |
|
49 } |
|
50 |
|
51 TInt E32Main() |
|
52 { |
|
53 __UHEAP_MARK; |
|
54 |
|
55 CTrapCleanup* cleanup = CTrapCleanup::New(); |
|
56 TInt err = KErrNoMemory; |
|
57 if(cleanup) |
|
58 { |
|
59 TRAP(err, MainL()); |
|
60 delete cleanup; |
|
61 } |
|
62 |
|
63 __UHEAP_MARKEND; |
|
64 return err; |
|
65 } |
|
66 |
|
67 CTestStep* CRestartSysTestServer::CreateTestStep(const TDesC& aStepName) |
|
68 { |
|
69 #ifdef __WINS__ //Restart is currently supported on HW only |
|
70 RDebug::Printf("Test %S not executed. Restart is currently not supported in emulator.", &aStepName); |
|
71 return NULL; |
|
72 #endif |
|
73 |
|
74 CTestStep* testStep = NULL; |
|
75 if (aStepName == KRestartSysAbort) |
|
76 { |
|
77 testStep = new CRestartSysAbort(aStepName); |
|
78 } |
|
79 else if (aStepName == KRestartSysWithMode) |
|
80 { |
|
81 testStep = new CRestartSysWithMode(aStepName); |
|
82 } |
|
83 else |
|
84 { |
|
85 RDebug::Printf("Unknown restartsys teststep %S", &aStepName); |
|
86 } |
|
87 |
|
88 return testStep; |
|
89 } |
|
90 |