os/persistentdata/traceservices/tracefw/ulogger/unit_test/te-server/uloggerservertest4step.cpp
Update contrib.
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 "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".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
17 @file UloggerServerTest4Step.cpp
22 #include "uloggerservertest4step.h"
23 #include "te_uloggerservertestsuitedefs.h"
24 #include "uloggerwatcher.h"
25 #include "uloggerdatatypes.h"
30 CUloggerServerTest4Step::~CUloggerServerTest4Step()
38 CUloggerServerTest4Step::CUloggerServerTest4Step()
43 SetTestStepName(KUloggerServerTest4Step);
46 TVerdict CUloggerServerTest4Step::doTestStepPreambleL()
48 * @return - TVerdict code
49 * Override of base class virtual
52 INFO_PRINTF1(_L("****This is unit test for CControlFramework class****"));
53 iScheduler = new (ELeave) CActiveScheduler();
54 CActiveScheduler::Install(iScheduler);
56 RPointerArray<TPluginConfiguration> controlPluginSettings;
57 INFO_PRINTF1(_L("INFO: building plugin allocator with input plugin..."));
58 TRAPD(err, iPluginAllocator = CPluginAllocator::NewL(KFileTestPluginTest(), KUsbTestPluginTest()));
59 INFO_PRINTF1(_L("INFO: plugin allocator created"));
62 MInputPlugin* inputPlugin = iPluginAllocator->GetInputPlugin();
65 iCF = CInputFramework::NewL(inputPlugin, controlPluginSettings, this);
66 iMan = new CInputData();
70 INFO_PRINTF1(_L("INFO: input pluigin not avaiable."));
77 INFO_PRINTF1(_L("plugin allocator not fully created - skiping step."));
83 SetTestStepResult(EPass);
84 return TestStepResult();
88 TVerdict CUloggerServerTest4Step::doTestStepL()
90 * @return - TVerdict code
91 * Override of base class pure virtual
92 * Our implementation only gets called if the base class doTestStepPreambleL() did
93 * not leave. That being the case, the current test result value will be EPass.
97 if (TestStepResult()==EPass)
101 iErrors += Test1L(); //CControlFramework::StartReading + StopReading
102 iErrors += Test2L(); //CControlFramework:: testing functionality of passing and translating commands
106 res.AppendFormat(_L("%d errors"), iErrors);
107 INFO_PRINTF1(_L("****Results****"));
110 SetTestStepResult(EPass);
112 SetTestStepResult(EFail);
115 SetTestStepResult(EPass);
118 return TestStepResult();
123 TVerdict CUloggerServerTest4Step::doTestStepPostambleL()
125 * @return - TVerdict code
126 * Override of base class virtual
137 delete iPluginAllocator;
138 iPluginAllocator = NULL;
143 return TestStepResult();
147 ControlData* CUloggerServerTest4Step::ProcessCommandL(TCommand /*aOpCode*/, RArray<TPtrC8> &aArguments)
149 INFO_PRINTF1(_L("****Incominng parameters:****"));
150 for(TInt i=0; i<aArguments.Count(); i++)
153 b.Copy(aArguments[i]);
157 return iMan->CreatePackage((void*)"-5",2);
160 void CUloggerServerTest4Step::DoPostProcessing(TCommand /*aCmd*/)
165 TInt CUloggerServerTest4Step::Test1L()
169 INFO_PRINTF1(_L("****Testing CControlFramework::StartReading****"));
170 TInt errCode = iCF->StartReading();
172 buf.AppendFormat(_L("code returned from method: %d"), errCode);
175 INFO_PRINTF1(_L("****Testing CControlFramework::StopReading****"));
182 void CUloggerServerTest4Step::TestFunctionalityL(const TDesC8& aCommand)
184 ControlData* cData = NULL;
185 cData = iMan->CreatePackage( (void*)aCommand.Ptr(), aCommand.Length());
186 iCF->iDataPtr.Zero();
187 iCF->iDataPtr.Copy((const TUint8*)cData, iMan->GetSize(cData));
188 iCF->iStatus = KErrNone;
194 TInt CUloggerServerTest4Step::Test2L()
197 INFO_PRINTF1(_L("****Testing CControlFramework functionality****"));
199 INFO_PRINTF1(_L("start command:"));
200 TestFunctionalityL(_L8("-r"));
202 INFO_PRINTF1(_L("stop command:"));
203 TestFunctionalityL(_L8("-q"));
205 INFO_PRINTF1(_L("set f1 command:"));
206 TestFunctionalityL(_L8("-ef 4 5 6 7"));
208 INFO_PRINTF1(_L("set f2 command:"));
209 TestFunctionalityL(_L8("-es 114 115 1116 111117"));
211 INFO_PRINTF1(_L("set ps command:"));
212 TestFunctionalityL(_L8("-ec uloggerfileplugin output_path e:\\test.ulog"));
214 INFO_PRINTF1(_L("set ia command:"));
215 TestFunctionalityL(_L8("-ei uloggerusbplugin"));