|
1 // Copyright (c) 2004-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 |
|
18 // EPOC includes |
|
19 #include <e32base.h> |
|
20 |
|
21 // Test system includes |
|
22 //#include "TestStepSocket.h" |
|
23 #include "TE_EIntSockServer.h" |
|
24 #include "TE_EIntSockTestStep.h" |
|
25 |
|
26 |
|
27 // EKA2 much simpler |
|
28 // Just an E32Main and a MainL() |
|
29 LOCAL_C void MainL() |
|
30 /** |
|
31 * Much simpler, uses the new Rendezvous() call to sync with the client |
|
32 */ |
|
33 { |
|
34 // Leave the hooks in for platform security |
|
35 #if (defined __DATA_CAGING__) |
|
36 RProcess().DataCaging(RProcess::EDataCagingOn); |
|
37 RProcess().SecureApi(RProcess::ESecureApiOn); |
|
38 #endif |
|
39 CActiveScheduler* sched=NULL; |
|
40 sched=new(ELeave) CActiveScheduler; |
|
41 CActiveScheduler::Install(sched); |
|
42 |
|
43 CTestServer* server = NULL; |
|
44 // Create the CTestServer derived server |
|
45 |
|
46 TRAPD(err,server = CTestEIntSockServer::NewL()); |
|
47 if(!err) |
|
48 { |
|
49 // Sync with the client and enter the active scheduler |
|
50 RProcess::Rendezvous(KErrNone); |
|
51 sched->Start(); |
|
52 } |
|
53 delete server; |
|
54 delete sched; |
|
55 } |
|
56 |
|
57 // Only a DLL on emulator for typhoon and earlier |
|
58 |
|
59 GLDEF_C TInt E32Main() |
|
60 /** |
|
61 * @return - Standard Epoc error code on exit |
|
62 */ |
|
63 { |
|
64 CTrapCleanup* cleanup = CTrapCleanup::New(); |
|
65 if(cleanup == NULL) |
|
66 { |
|
67 return KErrNoMemory; |
|
68 } |
|
69 TRAP_IGNORE(MainL()); |
|
70 delete cleanup; |
|
71 return KErrNone; |
|
72 } |
|
73 |
|
74 // Create a thread in the calling process |
|
75 // Emulator typhoon and earlier |
|
76 |
|
77 //--------------------------------------------------------------------------------------------------------------------------- |
|
78 |
|
79 |
|
80 CTestServer* CTestEIntSockServer::NewL() |
|
81 { |
|
82 CTestEIntSockServer* server = new(ELeave) CTestEIntSockServer; |
|
83 CleanupStack::PushL(server); |
|
84 server->ConstructL(KServerName); |
|
85 // server->StartL(KServerName); |
|
86 CleanupStack::Pop(server); |
|
87 return server; |
|
88 } |
|
89 |
|
90 CTestEIntSockServer::~CTestEIntSockServer() |
|
91 { |
|
92 } |
|
93 |
|
94 CTestEIntSockServer::CTestEIntSockServer() |
|
95 { |
|
96 } |
|
97 |
|
98 CTestStep* CTestEIntSockServer::CreateTestStep(const TDesC& aStepName) |
|
99 { |
|
100 // removed ELeave as harness will test ptr. This is more efficient |
|
101 // than using TRAP_IGNORE |
|
102 CEIntSockTestStep* ret = new CEIntSockTestStep; |
|
103 if(ret) |
|
104 { |
|
105 ret->SetTestStepName(aStepName); |
|
106 } |
|
107 return ret; |
|
108 } |
|
109 |