|
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 // Contains main DLL entry point for dll and definition of test suite class. |
|
15 // |
|
16 // |
|
17 |
|
18 // EPOC includes |
|
19 #include <e32base.h> |
|
20 #include <es_sock.h> |
|
21 |
|
22 #include "TestSuiteIPC.h" |
|
23 #include "Test01IPCStreamConnection.h" |
|
24 #include "Test02IPCSimpleDataTransfer.h" |
|
25 #include "Test03IPCLongDataTransfer.h" |
|
26 #include "Test04IPCMultithreadedDataTransfer.h" |
|
27 #include "Test05IPCIllegalOperations.h" |
|
28 #include "Test06IPCTestSelect.h" |
|
29 #include "Test07IPCDataTransferMemoryLeak.h" |
|
30 #include "Test08IPCOpenSocketMemoryLeak.h" |
|
31 |
|
32 |
|
33 _LIT(KServerName,"TE_IPCTest"); |
|
34 // __EDIT_ME__ - Use your own server class name |
|
35 CTestServerIPC* CTestServerIPC::NewL() |
|
36 /** |
|
37 * @return - Instance of the test server |
|
38 * Called inside the MainL() function to create and start the |
|
39 * CTestServer derived server. |
|
40 */ |
|
41 { |
|
42 CTestServerIPC * server = new (ELeave) CTestServerIPC(); |
|
43 CleanupStack::PushL(server); |
|
44 |
|
45 // Either use a StartL or ConstructL, the latter will permit |
|
46 // Server Logging. |
|
47 |
|
48 //server->StartL(KServerName); |
|
49 server-> ConstructL(KServerName); |
|
50 CleanupStack::Pop(server); |
|
51 return server; |
|
52 } |
|
53 |
|
54 // EKA2 much simpler |
|
55 // Just an E32Main and a MainL() |
|
56 LOCAL_C void MainL() |
|
57 /** |
|
58 * Much simpler, uses the new Rendezvous() call to sync with the client |
|
59 */ |
|
60 { |
|
61 // Leave the hooks in for platform security |
|
62 #if (defined __DATA_CAGING__) |
|
63 RProcess().DataCaging(RProcess::EDataCagingOn); |
|
64 RProcess().SecureApi(RProcess::ESecureApiOn); |
|
65 #endif |
|
66 CActiveScheduler* sched=NULL; |
|
67 sched=new(ELeave) CActiveScheduler; |
|
68 CActiveScheduler::Install(sched); |
|
69 |
|
70 CTestServerIPC* server = NULL; |
|
71 // Create the CTestServer derived server |
|
72 |
|
73 TRAPD(err,server = CTestServerIPC::NewL()); |
|
74 if(!err) |
|
75 { |
|
76 // Sync with the client and enter the active scheduler |
|
77 RProcess::Rendezvous(KErrNone); |
|
78 sched->Start(); |
|
79 } |
|
80 delete server; |
|
81 delete sched; |
|
82 } |
|
83 |
|
84 // Only a DLL on emulator for typhoon and earlier |
|
85 |
|
86 GLDEF_C TInt E32Main() |
|
87 /** |
|
88 * @return - Standard Epoc error code on exit |
|
89 */ |
|
90 { |
|
91 CTrapCleanup* cleanup = CTrapCleanup::New(); |
|
92 if(cleanup == NULL) |
|
93 { |
|
94 return KErrNoMemory; |
|
95 } |
|
96 TRAPD(err,MainL()); |
|
97 delete cleanup; |
|
98 return err; |
|
99 } |
|
100 |
|
101 // Create a thread in the calling process |
|
102 // Emulator typhoon and earlier |
|
103 |
|
104 CTestServerIPC::CTestServerIPC() |
|
105 { |
|
106 } |
|
107 |
|
108 CTestServerIPC::~CTestServerIPC() |
|
109 { |
|
110 } |
|
111 |
|
112 |
|
113 CTestStep* CTestServerIPC::CreateTestStep(const TDesC& aStepName) |
|
114 /** |
|
115 * @return - A CTestStep derived instance |
|
116 * Implementation of CTestServer pure virtual |
|
117 */ |
|
118 { |
|
119 START_TEST_STEP_LIST |
|
120 ADD_TEST_STEP(CTest01IPCStreamConnection) |
|
121 ADD_TEST_STEP(CTest02IPCSimpleDataTransfer) |
|
122 ADD_TEST_STEP(CTest03IPCLongDataTransfer) |
|
123 ADD_TEST_STEP(CTest04IPCMultithreadedDataTransfer) |
|
124 ADD_TEST_STEP(CTest05IPCIllegalOperations) |
|
125 ADD_TEST_STEP(CTest06IPCTestSelect) |
|
126 ADD_TEST_STEP(CTest07IPCDataTransferMemoryLeak) |
|
127 ADD_TEST_STEP(CTest08IPCOpenSocketMemoryLeak) |
|
128 END_TEST_STEP_LIST |
|
129 } |
|
130 |
|
131 |