|
1 // Copyright (c) 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 // System Include |
|
15 // |
|
16 // |
|
17 |
|
18 /** |
|
19 @file |
|
20 @internalTechnology |
|
21 */ |
|
22 |
|
23 // User Includes |
|
24 // Test Server |
|
25 #include "TestScriptTestServer.h" |
|
26 #include "ctesthttpclientstep.h" |
|
27 // Test steps |
|
28 |
|
29 _LIT(KTestScriptHTTPClientAPIStep, "httpserviceapiteststep"); |
|
30 _LIT(KServerName, "httpserviceapitest"); |
|
31 |
|
32 /** |
|
33 Static factory constructor. Creates and returns instance of the test server |
|
34 @internalTechnology |
|
35 @test |
|
36 @return A pointer to the newly created CTestScriptTestServer object |
|
37 */ |
|
38 CTestScriptTestServer* CTestScriptTestServer::NewL() |
|
39 { |
|
40 // Construct the server |
|
41 CTestScriptTestServer* server = new(ELeave) CTestScriptTestServer(); |
|
42 CleanupStack::PushL(server); |
|
43 |
|
44 // CServer base class call |
|
45 // Name the server using the system-wide unique string |
|
46 // Clients use this to create server sessions. |
|
47 server->StartL(KServerName); |
|
48 |
|
49 CleanupStack::Pop(server); |
|
50 return server; |
|
51 } |
|
52 |
|
53 /** |
|
54 Destructor. Closes the arrays. |
|
55 @internalTechnology |
|
56 @test |
|
57 */ |
|
58 CTestScriptTestServer::~CTestScriptTestServer() |
|
59 { |
|
60 |
|
61 } |
|
62 |
|
63 |
|
64 LOCAL_C void MainL() |
|
65 { |
|
66 // For platform security |
|
67 #if (defined __DATA_CAGING__) |
|
68 RProcess().DataCaging(RProcess::EDataCagingOn); |
|
69 RProcess().SecureApi(RProcess::ESecureApiOn); |
|
70 #endif |
|
71 CActiveScheduler* sched = NULL; |
|
72 sched = new(ELeave) CActiveScheduler; |
|
73 CActiveScheduler::Install(sched); |
|
74 CTestScriptTestServer* server = NULL; |
|
75 |
|
76 // Create the test-server |
|
77 TRAPD(err, server = CTestScriptTestServer::NewL()); |
|
78 |
|
79 if(!err) |
|
80 { |
|
81 // Sync with the client and enter the active scheduler |
|
82 RProcess::Rendezvous(KErrNone); |
|
83 sched->Start(); |
|
84 } |
|
85 delete server; |
|
86 delete sched; |
|
87 } |
|
88 |
|
89 GLDEF_C TInt E32Main() |
|
90 { |
|
91 __UHEAP_MARK; |
|
92 CTrapCleanup* cleanup = CTrapCleanup::New(); |
|
93 if (cleanup == NULL) |
|
94 { |
|
95 return KErrNoMemory; |
|
96 } |
|
97 TInt err = KErrNone; |
|
98 TRAP(err, MainL()); |
|
99 delete cleanup; |
|
100 __UHEAP_MARKEND; |
|
101 return KErrNone; |
|
102 } |
|
103 |
|
104 CTestStep* CTestScriptTestServer::CreateTestStep(const TDesC& aStepName) |
|
105 { |
|
106 CTestStep* testStep = NULL; |
|
107 |
|
108 if (aStepName == KTestScriptHTTPClientAPIStep) |
|
109 { |
|
110 testStep = new CTestHttpClientStep; |
|
111 } |
|
112 |
|
113 return testStep; |
|
114 } |