|
1 // Copyright (c) 2005-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 // Test cases for the socket class |
|
15 // for (WINS && !EKA2) versions will be xxxServer.Dll and require a thread to be started |
|
16 // in the process of the client. The client initialises the server by calling the |
|
17 // one and only ordinal. |
|
18 // |
|
19 // |
|
20 |
|
21 /** |
|
22 @file TestSuiteESockSSA.cpp |
|
23 */ |
|
24 #include "TestSuiteESockSSA.h" |
|
25 #include "TestStepESockSSA.h" |
|
26 #include "ESockSSA_Step1.h" |
|
27 |
|
28 _LIT(KServerName,"TE_ESockSSA"); |
|
29 |
|
30 CTestServerESockSSA* CTestServerESockSSA::NewL() |
|
31 /** |
|
32 @return - Instance of the test server |
|
33 Called inside the MainL() function to create and start the |
|
34 CTestServer derived server. |
|
35 */ |
|
36 { |
|
37 CTestServerESockSSA * server = new (ELeave) CTestServerESockSSA(); |
|
38 CleanupStack::PushL(server); |
|
39 |
|
40 // ConstructL will permit |
|
41 // Server Logging. |
|
42 |
|
43 server-> ConstructL(KServerName); |
|
44 CleanupStack::Pop(server); |
|
45 return server; |
|
46 } |
|
47 |
|
48 LOCAL_C void MainL() |
|
49 /** |
|
50 Much simpler, uses the new Rendezvous() call to sync with the client |
|
51 */ |
|
52 { |
|
53 // Leave the hooks in for platform security |
|
54 #if (defined __DATA_CAGING__) |
|
55 RProcess().DataCaging(RProcess::EDataCagingOn); |
|
56 RProcess().SecureApi(RProcess::ESecureApiOn); |
|
57 #endif |
|
58 CActiveScheduler* sched=NULL; |
|
59 sched=new(ELeave) CActiveScheduler; |
|
60 CActiveScheduler::Install(sched); |
|
61 |
|
62 CTestServerESockSSA* server = NULL; |
|
63 // Create the CTestServer derived server |
|
64 |
|
65 TRAPD(err,server = CTestServerESockSSA::NewL()); |
|
66 if(!err) |
|
67 { |
|
68 // Sync with the client and enter the active scheduler |
|
69 RProcess::Rendezvous(KErrNone); |
|
70 sched->Start(); |
|
71 } |
|
72 delete server; |
|
73 delete sched; |
|
74 } |
|
75 |
|
76 GLDEF_C TInt E32Main() |
|
77 /** |
|
78 @return - Standard Epoc error code on exit |
|
79 */ |
|
80 { |
|
81 CTrapCleanup* cleanup = CTrapCleanup::New(); |
|
82 if(cleanup == NULL) |
|
83 { |
|
84 return KErrNoMemory; |
|
85 } |
|
86 TRAP_IGNORE(MainL()); |
|
87 delete cleanup; |
|
88 return KErrNone; |
|
89 } |
|
90 |
|
91 |
|
92 CTestServerESockSSA::CTestServerESockSSA() |
|
93 { |
|
94 } |
|
95 |
|
96 CTestServerESockSSA::~CTestServerESockSSA() |
|
97 { |
|
98 } |
|
99 |
|
100 |
|
101 CTestStep* CTestServerESockSSA::CreateTestStep(const TDesC& aStepName) |
|
102 /** |
|
103 @return - A CTestStep derived instance |
|
104 Implementation of CTestServer pure virtual |
|
105 */ |
|
106 { |
|
107 START_TEST_STEP_LIST |
|
108 ADD_TEST_STEP(CESockSSATest1) |
|
109 ADD_TEST_STEP(CESockSSATest2) |
|
110 ADD_TEST_STEP(CESockSSATest3) |
|
111 ADD_TEST_STEP(CESockSSATest4) |
|
112 ADD_TEST_STEP(CESockSSATest5) |
|
113 END_TEST_STEP_LIST |
|
114 } |
|
115 |
|
116 |
|
117 |