|
1 // Copyright (c) 2007-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 the License "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 // Implements the test server of the Streaming CAF test harness |
|
15 // |
|
16 // |
|
17 |
|
18 #include "tscafserver.h" // TEF Test Server |
|
19 #include "tscafstep.h" // TEF Steps Test Code |
|
20 #include "tstaunittest.h" |
|
21 #include "tkeystreamsink.h" |
|
22 #include "tpostacquisition.h" |
|
23 #include "tipsec.h" |
|
24 #include "treferenceagent.h" |
|
25 #include "startupcommsstep.h" |
|
26 |
|
27 // Consumer interface test steps |
|
28 #include "tkeystreamdecoderconstruct.h" |
|
29 #include "tkeystreamdecoderattributes.h" |
|
30 #include "tmultikeystreamdecoders.h" |
|
31 |
|
32 // Utility Steps |
|
33 #include "tsetuprightsobjects.h" |
|
34 |
|
35 CScafServer* CScafServer::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 CScafServer* server = new (ELeave) CScafServer(); |
|
43 CleanupStack::PushL(server); |
|
44 User::LeaveIfError(server->iFs.Connect()); |
|
45 User::LeaveIfError(server->iFs.ShareProtected()); |
|
46 User::LeaveIfError(server->iFs.CreatePrivatePath(server->iFs.GetSystemDrive())); |
|
47 server->ConstructL(KStaServerName); |
|
48 CleanupStack::Pop(server); |
|
49 return server; |
|
50 } |
|
51 |
|
52 CScafServer::~CScafServer() |
|
53 /** |
|
54 Destructor. |
|
55 */ |
|
56 { |
|
57 iFs.Close(); |
|
58 } |
|
59 |
|
60 LOCAL_C void MainL() |
|
61 /** |
|
62 * Secure variant |
|
63 * Much simpler, uses the new Rendezvous() call to sync with the client |
|
64 */ |
|
65 { |
|
66 |
|
67 CActiveScheduler *sched = new(ELeave) CActiveScheduler; |
|
68 CActiveScheduler::Install(sched); |
|
69 |
|
70 CScafServer* server = NULL; |
|
71 |
|
72 // Create the CTestServer derived server |
|
73 TRAPD(err,server = CScafServer::NewL()); |
|
74 if(!err) |
|
75 { |
|
76 // Sync with the client and enter the active scheduler |
|
77 RProcess::Rendezvous(KErrNone); |
|
78 sched->Start(); |
|
79 } |
|
80 |
|
81 delete server; |
|
82 delete sched; |
|
83 } |
|
84 |
|
85 GLDEF_C TInt E32Main() |
|
86 /** |
|
87 * @return - Standard Epoc error code on process exit |
|
88 * Process entry point. Called by client using RProcess API |
|
89 */ |
|
90 { |
|
91 __UHEAP_MARK; |
|
92 CTrapCleanup* cleanup = CTrapCleanup::New(); |
|
93 if(cleanup == NULL) |
|
94 { |
|
95 return KErrNoMemory; |
|
96 } |
|
97 TRAPD(err,MainL()); |
|
98 delete cleanup; |
|
99 __UHEAP_MARKEND; |
|
100 return err; |
|
101 } |
|
102 |
|
103 |
|
104 CTestStep* CScafServer::CreateTestStep(const TDesC& aStepName) |
|
105 /** |
|
106 Creates a new test step. |
|
107 @param aStepName The name of the requested test step. |
|
108 @return A pointer to the object of the requested test step. |
|
109 */ |
|
110 { |
|
111 // Initialise test step object to NULL if no TEF steps are assigned |
|
112 CTestStep* testStep = NULL; |
|
113 |
|
114 if(aStepName == KScafTestAgentServerStep) |
|
115 testStep = new CScafTestAgentServer(*this); |
|
116 else if (aStepName == KScafKeyStreamSinkStep) |
|
117 testStep = new CScafKeyStreamSink(*this); |
|
118 else if (aStepName == KScafConcurrentKeyStreamSinksStep) |
|
119 testStep = new CScafConcurrentKeyStreamSinks(*this); |
|
120 else if (aStepName == KScafPostAcquisitionStep) |
|
121 testStep = new CScafPostAcquisition(*this); |
|
122 else if (aStepName == KScafSetupRightsObjectsStep) |
|
123 testStep = new CScafSetupRightsObjects(*this); |
|
124 else if (aStepName == KScafKeyStreamDecoderConstruct) |
|
125 testStep = new CScafKeyStreamDecoderConstruct(*this); |
|
126 else if (aStepName == KScafKeyStreamDecoderAttributes) |
|
127 testStep = new CScafKeyStreamDecoderAttributes(*this); |
|
128 else if (aStepName == KScafMultiKeyStreamDecoders) |
|
129 testStep = new CScafMultiKeyStreamDecoders(*this); |
|
130 else if (aStepName == KStartupCommsStep) |
|
131 testStep = new CStartupCommsStep(); |
|
132 // IPSec tests |
|
133 else if (aStepName == KScafIpSec) |
|
134 testStep = new CScafIpSec(*this); |
|
135 else if (aStepName == KScafIpSecDecoderIntegration) |
|
136 testStep = new CScafIpSecDecoderIntegration(*this); |
|
137 else if (aStepName == KScafIpSecSadbVerification) |
|
138 testStep = new CScafIpSecSadbVerification(*this); |
|
139 else if (aStepName == KScafIpSecSadbVerificationConcurrency) |
|
140 testStep = new CScafIpSecSadbVerificationConcurrency(*this); |
|
141 else if (aStepName == KScafIpSecNegative) |
|
142 testStep = new CScafIpSecNegative(*this); |
|
143 else if (aStepName == KScafIpSecMultipleSinks) |
|
144 testStep = new CScafIpSecMultipleSinks(*this); |
|
145 else if (aStepName == KScafIpSecAlgorithmChange) |
|
146 testStep = new CScafIpSecAlgorithmChange(*this); |
|
147 else if (aStepName == KScafIpSecSARemoval) |
|
148 testStep = new CScafIpSecSARemoval(*this); |
|
149 //Reference agent test |
|
150 else if (aStepName == KScafRefAgent) |
|
151 testStep = new CScafRefAgent(*this); |
|
152 |
|
153 return testStep; |
|
154 } |