# HG changeset patch # User Dremov Kirill (Nokia-D-MSW/Tampere) # Date 1286973706 -10800 # Node ID dde4619868dc72f68b625f5b9806ae3c88c004ba # Parent 703a2b94c06cb95f06126ab633c425035bf54773 Revision: 201038 Kit: 201041 diff -r 703a2b94c06c -r dde4619868dc tsrc/group/bld.inf --- a/tsrc/group/bld.inf Wed Sep 15 13:20:24 2010 +0300 +++ b/tsrc/group/bld.inf Wed Oct 13 15:41:46 2010 +0300 @@ -19,30 +19,16 @@ PRJ_PLATFORMS DEFAULT -//build files for Stub Framework - - //build files for shortlinkconn #include "../../../shortlinkconn/localconnectivityservice/lcstylustap/tsrc/LcStylusTapTest/group/bld.inf" #include "../../../shortlinkconn/localconnectivityservice/generichid/tsrc/GenericHidTest/group/bld.inf" //build files for usb +#include "../../usbclasses/msmmplugin/tsrc/MsmmPluginTest/group/bld.inf" #include "../../usbuis/usbui/tsrc/USBUiApiTest/group/bld.inf" #include "../../usbuis/usbuinotif/tsrc/USBUiNotifApiTest/group/bld.inf" +#include "../../usbclasses/usbhidclassdriver/tsrc/UsbHidClassDriverTest/group/bld.inf" -#include "../../usbclasses/usbhidclassdriver/tsrc/UsbHidClassDriverTest/group/bld.inf" -#include "../../usbclasses/msmmplugin/tsrc/MsmmPluginTest/group/bld.inf" -#include "../../usbclasses/usbbasicpersonality/tsrc/UsbBasicPersonalityTest/group/bld.inf" -//#include "../../usbclasses/usbosdescriptorhandler/tsrc/UsbOsDescriptorHandlerTest/group/bld.inf" -//#include "../../usbclasses/usbmscpersonality/tsrc/UsbMscPersonalityTest/group/bld.inf" -#include "../../usbclasses/usbobexclasscontroller/tsrc/UsbObexClassControllerTest/group/bld.inf" - -//#include "../../usbengines/usbotgwatcher/tsrc/UsbOtgWatcherTest/group/bld.inf" -#include "../../usbengines/usblocodplugin/tsrc/USBLocodPluginTest/group/bld.inf" -#include "../../usbengines/usbremotepersonality/tsrc/USBRemotePersonalityTest/group/bld.inf" -//#include "../../usbengines/usbwatcher/tsrc/UsbWatcherTest/group/bld.inf" - -#include "../../usbservices_plat/usb_personality_plugin_api/tsrc/usbpersonalitypluginapitest/group/bld.inf" PRJ_EXPORTS diff -r 703a2b94c06c -r dde4619868dc tsrc/testtools/stubsrv/bwins/apibehavioru.def --- a/tsrc/testtools/stubsrv/bwins/apibehavioru.def Wed Sep 15 13:20:24 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,9 +0,0 @@ -EXPORTS - ??0TApiBehavior@@QAE@II@Z @ 1 NONAME ; TApiBehavior::TApiBehavior(unsigned int, unsigned int) - ?MatchId@TApiBehavior@@QBEHII@Z @ 2 NONAME ; int TApiBehavior::MatchId(unsigned int, unsigned int) const - ?MatchId@TApiBehavior@@QBEHABV1@@Z @ 3 NONAME ; int TApiBehavior::MatchId(class TApiBehavior const &) const - ??0TApiBehavior@@QAE@IIHHABVTDesC8@@@Z @ 4 NONAME ; TApiBehavior::TApiBehavior(unsigned int, unsigned int, int, int, class TDesC8 const &) - ??8TApiBehavior@@QBEHABV0@@Z @ 5 NONAME ; int TApiBehavior::operator==(class TApiBehavior const &) const - ??9TApiBehavior@@QBEHABV0@@Z @ 6 NONAME ; int TApiBehavior::operator!=(class TApiBehavior const &) const - ??0TApiBehavior@@QAE@XZ @ 7 NONAME ; TApiBehavior::TApiBehavior(void) - diff -r 703a2b94c06c -r dde4619868dc tsrc/testtools/stubsrv/bwins/stubberu.def --- a/tsrc/testtools/stubsrv/bwins/stubberu.def Wed Sep 15 13:20:24 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,9 +0,0 @@ -EXPORTS - ?InvokeApiCancel@CStubber@@QAEXXZ @ 1 NONAME ; void CStubber::InvokeApiCancel(void) - ?DeleteBehaviors@CStubber@@QAEXII@Z @ 2 NONAME ; void CStubber::DeleteBehaviors(unsigned int, unsigned int) - ?NewL@CStubber@@SAPAV1@XZ @ 3 NONAME ; class CStubber * CStubber::NewL(void) - ?InvokeApi@CStubber@@QAEXAAVTApiBehavior@@W4TApiInvokeMode@@@Z @ 4 NONAME ; void CStubber::InvokeApi(class TApiBehavior &, enum TApiInvokeMode) - ??1CStubber@@UAE@XZ @ 5 NONAME ; CStubber::~CStubber(void) - ?InvokeApiL@CStubber@@QAEXAAVMApiInvoker@@IIW4TApiInvokeMode@@@Z @ 6 NONAME ; void CStubber::InvokeApiL(class MApiInvoker &, unsigned int, unsigned int, enum TApiInvokeMode) - ?EnqueBehavior@CStubber@@QAEXABVTApiBehavior@@H@Z @ 7 NONAME ; void CStubber::EnqueBehavior(class TApiBehavior const &, int) - diff -r 703a2b94c06c -r dde4619868dc tsrc/testtools/stubsrv/eabi/apibehavioru.def --- a/tsrc/testtools/stubsrv/eabi/apibehavioru.def Wed Sep 15 13:20:24 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,12 +0,0 @@ -EXPORTS - _ZN12TApiBehaviorC1Ejj @ 1 NONAME - _ZN12TApiBehaviorC1EjjiiRK6TDesC8 @ 2 NONAME - _ZN12TApiBehaviorC1Ev @ 3 NONAME - _ZN12TApiBehaviorC2Ejj @ 4 NONAME - _ZN12TApiBehaviorC2EjjiiRK6TDesC8 @ 5 NONAME - _ZN12TApiBehaviorC2Ev @ 6 NONAME - _ZNK12TApiBehavior7MatchIdERKS_ @ 7 NONAME - _ZNK12TApiBehavior7MatchIdEjj @ 8 NONAME - _ZNK12TApiBehavioreqERKS_ @ 9 NONAME - _ZNK12TApiBehaviorneERKS_ @ 10 NONAME - diff -r 703a2b94c06c -r dde4619868dc tsrc/testtools/stubsrv/eabi/stubberu.def --- a/tsrc/testtools/stubsrv/eabi/stubberu.def Wed Sep 15 13:20:24 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,11 +0,0 @@ -EXPORTS - _ZN8CStubber10InvokeApiLER11MApiInvokerjj14TApiInvokeMode @ 1 NONAME - _ZN8CStubber13EnqueBehaviorERK12TApiBehaviori @ 2 NONAME - _ZN8CStubber15DeleteBehaviorsEjj @ 3 NONAME - _ZN8CStubber15InvokeApiCancelEv @ 4 NONAME - _ZN8CStubber4NewLEv @ 5 NONAME - _ZN8CStubber9InvokeApiER12TApiBehavior14TApiInvokeMode @ 6 NONAME - _ZN8CStubberD0Ev @ 7 NONAME - _ZN8CStubberD1Ev @ 8 NONAME - _ZN8CStubberD2Ev @ 9 NONAME - diff -r 703a2b94c06c -r dde4619868dc tsrc/testtools/stubsrv/group/apibehavior.mmp --- a/tsrc/testtools/stubsrv/group/apibehavior.mmp Wed Sep 15 13:20:24 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,31 +0,0 @@ -/* -* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -CAPABILITY All -Tcb - -TARGET apibehavior.dll -TARGETTYPE dll - -UID 0x1000008d 0xE0000092 - -SOURCEPATH ../src -SOURCE apibehavior.cpp - -USERINCLUDE ../inc -SYSTEMINCLUDE /epoc32/include - -LIBRARY euser.lib diff -r 703a2b94c06c -r dde4619868dc tsrc/testtools/stubsrv/group/bld.inf --- a/tsrc/testtools/stubsrv/group/bld.inf Wed Sep 15 13:20:24 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,34 +0,0 @@ -/* -* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -PRJ_PLATFORMS -DEFAULT - -PRJ_EXPORTS - -PRJ_TESTEXPORTS -../inc/apibehavior.h /epoc32/include/mw/stubsrv/apibehavior.h -../inc/stubber.h /epoc32/include/mw/stubsrv/stubber.h -../inc/stubsrvconst.h /epoc32/include/mw/stubsrv/stubsrvconst.h -../rom/stubsrv.iby /epoc32/rom/include/core/mw/stubsrv.iby - -PRJ_MMPFILES - -PRJ_TESTMMPFILES -apibehavior.mmp -stubber.mmp -stubsrv.mmp \ No newline at end of file diff -r 703a2b94c06c -r dde4619868dc tsrc/testtools/stubsrv/group/stubber.mmp --- a/tsrc/testtools/stubsrv/group/stubber.mmp Wed Sep 15 13:20:24 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,33 +0,0 @@ -/* -* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -CAPABILITY All -Tcb - -TARGET stubber.dll -TARGETTYPE dll - -UID 0x1000008d 0xE0000091 - -SOURCEPATH ../src -SOURCE stubclient.cpp -SOURCE stubber.cpp - -USERINCLUDE ../inc -SYSTEMINCLUDE /epoc32/include /epoc32/include/stubsrv - -LIBRARY euser.lib -LIBRARY apibehavior.lib diff -r 703a2b94c06c -r dde4619868dc tsrc/testtools/stubsrv/group/stubsrv.mmp --- a/tsrc/testtools/stubsrv/group/stubsrv.mmp Wed Sep 15 13:20:24 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,38 +0,0 @@ -/* -* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -CAPABILITY All -Tcb - -TARGET stubsrv.exe -TARGETTYPE exe - -UID 0x1000008d 0xE0000090 - -// EPOCHEAPSIZE 0x500 0x400000 - -SOURCEPATH ../src -SOURCE stubsrv.cpp -SOURCE stubsrvsession.cpp -SOURCE stubsrvapiexecutor.cpp - -USERINCLUDE ../inc -SYSTEMINCLUDE /epoc32/include /epoc32/include/platform/ /epoc32/include/stubsrv - -LIBRARY euser.lib -LIBRARY apibehavior.lib - - diff -r 703a2b94c06c -r dde4619868dc tsrc/testtools/stubsrv/inc/apibehavior.h --- a/tsrc/testtools/stubsrv/inc/apibehavior.h Wed Sep 15 13:20:24 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,137 +0,0 @@ -/* -* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifndef APIBEHAVIOR_H -#define APIBEHAVIOR_H - -#include - -const TInt KApiOutputSize = 512; - -/** - * The specification of the behavior of an API. - */ -NONSHARABLE_CLASS(TApiBehavior) -{ -public: - - /** - * Constructs by default. - * Members are initialized to: - * iLib: 0 - * iApi: 0 - * iCompleteCode: 0. - * iAsyncCompleteCode: 0. - * iOutput: KNullDes8. - */ - IMPORT_C TApiBehavior(); - - /** - * Constructs by specified. - * @param aLib the library identifier - * @param aApi the API identifier - * - * Other members are initialized to: - * iCompleteCode: 0. - * iAsyncCompleteCode: 0. - * iOutput: KNullDes8. - */ - IMPORT_C TApiBehavior(TUint aLib, TUint aApi); - - /** - * Construct by specified. - * - * @param aLib the library identifier - * @param aApi the API identifier - * @param aCompleteCode the expected completion code of the API call - * @param aAsyncCompleteCode the expected asynchronous completion code of the API call - * @param aOutput the expected output - */ - IMPORT_C TApiBehavior(TUint aLib, TUint aApi, - TInt aCompleteCode, TInt aAsyncCompleteCode, - const TDesC8& aOutput); - - /** - * Compares if the identifiers of this API match with the specified. - * @param aLib the library identifier - * @param aApi the APi identifier - * - * @return ETrue if the ids match; EFalse otherwise. - */ - IMPORT_C TBool MatchId(TUint aLib, TUint aApi) const; - - /** - * Compares if the identifiers of this API match with the identifiers of the specified. - * @param aLib the library identifier - * @param aApi the APi identifier - * - * @return ETrue if the ids match; EFalse otherwise. - */ - IMPORT_C TBool MatchId(const TApiBehavior& aBeh) const; - - /** - * Operator == - * - * @return ETrue if if the content of this is identical with the specified; EFalse otherwise. - */ - IMPORT_C TBool operator==(const TApiBehavior& aBeh) const; - - /** - * Operator != - * - * @return ETrue if if the content of this is different with the specified; EFalse otherwise. - */ - IMPORT_C TBool operator!=(const TApiBehavior& aBeh) const; - -public: - - /** - * The identifier of the library that provides this API - */ - TUint iLib; - - /** - * The identifier of this API in the library. - * - * iLib and iApi identify a unique API in the scope of testing framework. - */ - TUint iApi; - - /** - * The completion code of the API call, either the return error code if - * the function returns one or the leave code if the function is leavable. - * This should be ignored by void type APIs. - */ - TInt iCompleteCode; - - /** - * The completion code of asynchronous service provided by this API. - * This should be ignored by synchronous API. - */ - TInt iAsyncCompleteCode; - - /** - * The expected output of this API. - */ - TBuf8 iOutput; - }; - -typedef TPckgBuf TApiBehaviorPckgBuf; -typedef TPckg TApiBehaviorPckg; - -#endif - diff -r 703a2b94c06c -r dde4619868dc tsrc/testtools/stubsrv/inc/stubber.h --- a/tsrc/testtools/stubsrv/inc/stubber.h Wed Sep 15 13:20:24 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,124 +0,0 @@ -/* -* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifndef STUBBER_H -#define STUBBER_H - -#include -#include -#include - -class RStubClient; - -class MApiInvoker -{ -public: - virtual void InvokeApiComplete(const TApiBehavior& aBeh) = 0; -}; - -NONSHARABLE_CLASS(CStubber) : public CActive - { -public: - - IMPORT_C static CStubber* NewL(); - - IMPORT_C ~CStubber(); - - /** - * Queues an API behavior specification to Stub server. - * - * This method is called by API behavior controllers, e.g. a module test, to specify the next expected - * behavior of an API. When InvokeApi() is called, the first queued behavior matching - * the lib identifier and API identifier will be extracted and returned. - * - * @param aApi an API behavior. - * @param aExeDuration, specifies the execution time of InvokeApi() in microseconds. - * value less than 0 means never completing InvokeApi(); - * value 0 means completing InvokeApi() asap; - * value 1000000 means InvokeApi() takes 1 sec execution time; - * and so on. - */ - IMPORT_C void EnqueBehavior(const TApiBehavior& aBeh, TInt aExeDuration = 0); - - /** - * Deletes all queued behaviors of the specified API. - * - * @param aLib the identifier of a stub - * @param aApi the identifier of the API - */ - IMPORT_C void DeleteBehaviors(TUint aLib, TUint aApi); - - /** - * Invokes an API. - * - * If there is a queued behavior for this API, Stub server will perform according to the execution setting; - * otherwise stub server will act according to the specified mode. - * - * @param aBeh contains the lib and API identifiers when passed in; - * will contain the behavior at complete. - * @param aMode the mode to be used if no queued behavior is found for the specified API; - * In case of ECompleteIfNoBehaviorSet mode, stub server will complete this function - * immediately and return a default TApiBehavior(TUint, TUint); - * stub server will keep this function call pending until a behavior is queued if the mode - * is ESuspendIfBehaviorSet. - */ - IMPORT_C void InvokeApi(TApiBehavior& aBeh, TApiInvokeMode aMode = ECompleteIfNoBehaviorSet); - - /** - * asynchronous version of InvokeAPI(), MApiInvoker::InvokeApiComplete will be called when - * this opeation is completed by stub server - * - * Only one InvokeApiL is allowed at a time. - * - * Leaves if the completion code in the behavior to be extracted is not KErrNone. - * - * @param aLib the identifier of a stub - * @param aApi the identifier of the API - * @param aMode the mode to be used if no queued behavior is found for the specified API; - * In case of ECompleteIfNoBehaviorSet mode, stub server will complete this function - * immediately and return a default TApiBehavior(TUint, TUint); - * stub server will keep this function call pending until a behavior is queued if the mode - * is ESuspendIfBehaviorSet. - */ - IMPORT_C void InvokeApiL(MApiInvoker& aInvoker, TUint aLib, TUint aApi, TApiInvokeMode aMode = ECompleteIfNoBehaviorSet); - - /** - * Cancels InvokeApi() - */ - IMPORT_C void InvokeApiCancel(); - -protected: - void RunL(); - void DoCancel(); - TInt RunError(TInt aReason); - -protected: - CStubber(); - - void ConstructL(); - -protected: - MApiInvoker* iInvoker; - - TApiBehavior iBeh; - TApiBehaviorPckg iBehPckg; - - RStubClient* iClient; - }; - -#endif // STUBBER_H - diff -r 703a2b94c06c -r dde4619868dc tsrc/testtools/stubsrv/inc/stubclient.h --- a/tsrc/testtools/stubsrv/inc/stubclient.h Wed Sep 15 13:20:24 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,103 +0,0 @@ -/* -* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifndef STUBCLIENT_H -#define STUBCLIENT_H - -#include -#include -#include - -class RStubClient : public RSessionBase - { - -public: - - /** - * Queues an API behavior specification to Stub server. - * - * This method is called by API behavior controllers, e.g. a module test, to specify the next expected - * behavior of an API. When InvokeApi() is called, the first queued behavior matching - * the lib identifier and API identifier will be extracted and returned. - * - * @param aApi an API behavior. - * @param aExeDuration, specifies the execution time of InvokeApi() in microseconds. - * value less than 0 means never completing InvokeApi(); - * value 0 means completing InvokeApi() asap; - * value 1000000 means InvokeApi() takes 1 sec execution time; - * and so on. - */ - void EnqueBehavior(const TApiBehavior& aBeh, TInt aExeDuration = 0); - - /** - * Deletes all queued behaviors of the specified API. - * - * @param aLib the identifier of a stub - * @param aApi the identifier of the API - */ - void DeleteBehaviors(TUint aLib, TUint aApi); - - /** - * Invokes an API. - * - * If there is a queued behavior for this API, stub server will perform according to the execution setting; - * otherwise stub server will act according to the specified mode. - * - * @param aBehPckg contains the lib and API identifiers when passed in; - * will contain the behavior at complete. - * @param aMode the mode to be used if no queued behavior is found for the specified API; - * In case of ECompleteIfNoBehaviorSet mode, stub server will complete this function - * immediately and return a default TApiBehavior(TUint, TUint); - * stub server will keep this function call pending until a behavior is queued if the mode - * is ESuspendIfBehaviorSet. - */ - void InvokeApi(TApiBehaviorPckg& aBehPckg, TApiInvokeMode aMode); - - /** - * asynchronous version of InvokeAPI(). - * - * Leaves if the completion code in the behavior is not KErrNone - */ - void InvokeApiL(TApiBehaviorPckg& aBehPckg, TRequestStatus& aStatus, TApiInvokeMode aMode); - - /** - * Cancels InvokeApi() - * @param aLib the identifier of library which provides the API - * @param aApi the identifier of the API - */ - void InvokeApiCancel(TUint aLib, TUint aApi); - -public: - - /** - * @return Version information about the server - */ - TVersion Version() const; - - /** - * Establishes a session with stub server. - * @return error code - */ - TInt Connect(); - -private: - - void CheckSession(); - - }; - -#endif // STUBCLIENT_H diff -r 703a2b94c06c -r dde4619868dc tsrc/testtools/stubsrv/inc/stubclientsrv.h --- a/tsrc/testtools/stubsrv/inc/stubclientsrv.h Wed Sep 15 13:20:24 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,40 +0,0 @@ -/* -* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifndef CLIENTSERVER_H -#define CLIENTSERVER_H - -_LIT(KStubSrvName, "stubsrv"); - -const TUid KStubSrvUid3 = {0xE0000090}; - -const TInt KStubSrvMajorVersionNumber = 1; -const TInt KStubSrvMinorVersionNumber = 1; -const TInt KStubSrvBuildNumber = 0; - -enum TIpcConstant - { - EStubSrvEnqueApiBehavior, - EStubSrvDeleteApiBehaviors, - EStubSrvInvokeApi, - EStubSrvInvokeApiCancel, - EStubSrvGetApiCompletionCode, - EStubSrvInvalidIpc, - }; - -#endif - diff -r 703a2b94c06c -r dde4619868dc tsrc/testtools/stubsrv/inc/stubsrv.h --- a/tsrc/testtools/stubsrv/inc/stubsrv.h Wed Sep 15 13:20:24 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,102 +0,0 @@ -/* -* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifndef STUBSRV_H -#define STUBSRV_H - -#include -#include -#include -#include "stubclientsrv.h" - -enum TStubfPanic - { - EStubfBadRequest = 100000, - EStubfBadDescriptor, - EStubfNotCompletedApis, - EStubfBadMessage, - EStubfNoLimitedMessage, - EStubfClassMemberVariableIsNull, - EStubfClassMemberVariableIsNotNull, - EMainSchedulerError, - EStubfApiAlreadyStarted, - EStubfApiNotStarted, - }; - -class CStubSrvSess; - -NONSHARABLE_CLASS(CStubSrv) : public CPolicyServer - { - -public: - - static CStubSrv* NewLC(); - - ~CStubSrv(); - -public: - - void StartShutdownTimerIfNoSessions(); - - TInt ClientOpened(CStubSrvSess& aSession); - - void ClientClosed(CStubSrvSess& aSession); - - void EnqueueL(const RMessage2& aMessage); - - void DeleteQueues(const RMessage2& aMessage); - - TInt Dequeue(TApiBehavior& aBeh, TInt& aExeDuration, TInt aTransactionId); - - void GetApiCompleteCodeL(const RMessage2& aMessage); - -private: - - CSession2* NewSessionL(const TVersion& aVersion, const RMessage2& aMessage) const; - -private: - - CStubSrv(TInt aPriority); - - void ConstructL(); - - void CancelShutdownTimer(); - - static TInt TimerFired(TAny* aThis); - -private: - class TApiQueueItem - { - public: - TApiBehavior iBeh; - TInt iExeDuration; - TInt iTransactionId; - }; - -private: - - CPeriodic* iTimer; - - RPointerArray iSessions; - - RPointerArray iBehQueue; - TInt iTransctionUnique; - }; - -#endif - - diff -r 703a2b94c06c -r dde4619868dc tsrc/testtools/stubsrv/inc/stubsrvapiexecutor.h --- a/tsrc/testtools/stubsrv/inc/stubsrvapiexecutor.h Wed Sep 15 13:20:24 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,76 +0,0 @@ -/* -* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifndef C_STUBFAPISPEC_H -#define C_STUBFAPISPEC_H - -#include -#include -#include "stubsrvconst.h" - -class CStubSrvSess; - -class CApiExecutor : public CActive - { - -public: - - static CApiExecutor* NewL(); - - virtual ~CApiExecutor(); - - const TApiBehavior& ApiBehavior() const; - - TApiInvokeMode Mode() const; - - void ExecuteL(const RMessage2& aMessage, CStubSrvSess& aSession, TUint aLib, TUint aApi); - - void ExecuteL(const RMessage2& aMessage, CStubSrvSess& aSession, const TApiBehavior& aBeh, TInt aExeDuration); - - void Resume(const TApiBehavior& aBeh, TInt aExeDuration); - -private: - - void RunL(); - - TInt RunError(TInt aReason); - - void DoCancel(); - -private: - - CApiExecutor(); - - void ConstructL(); - -private: - - CStubSrvSess* iSess; // The associated client who started this API. - TApiBehavior iBeh; - - TApiInvokeMode iMode; - - TInt iTimeout; - - RTimer iTimer; - - RMessage2 iMessage; - }; - -#endif // C_STUBFAPISPEC_H - -// End of File diff -r 703a2b94c06c -r dde4619868dc tsrc/testtools/stubsrv/inc/stubsrvconst.h --- a/tsrc/testtools/stubsrv/inc/stubsrvconst.h Wed Sep 15 13:20:24 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,29 +0,0 @@ -/* -* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifndef STUBCONSTANTS_H -#define STUBCONSTANTS_H - -enum TApiInvokeMode - { - ECompleteIfNoBehaviorSet, - ESuspendIfNoBehaviorSet, - }; - - -#endif - diff -r 703a2b94c06c -r dde4619868dc tsrc/testtools/stubsrv/inc/stubsrvsecuritypolicy.h --- a/tsrc/testtools/stubsrv/inc/stubsrvsecuritypolicy.h Wed Sep 15 13:20:24 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,53 +0,0 @@ -/* -* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifndef SERVER_SECURITYPOLICY_H -#define SERVER_SECURITYPOLICY_H - -#include "stubclientsrv.h" - -const TInt KStubSrvIpcRanges[] = - { - 0, - EStubSrvInvalidIpc, - }; - -const TInt KStubSrvIpcRangeCount = sizeof(KStubSrvIpcRanges) / sizeof(TInt); - -const TUint8 KStubSrvElementsIndex[KStubSrvIpcRangeCount] = - { - 0, - CPolicyServer::ENotSupported - }; - -const CPolicyServer::TPolicyElement KStubSrvElements[] = - { - {TSecurityPolicy::EAlwaysPass, CPolicyServer::EFailClient}, - }; - -const CPolicyServer::TPolicy KStubSrvPolicy = - { - CPolicyServer::EAlwaysPass, - KStubSrvIpcRangeCount, - KStubSrvIpcRanges, - KStubSrvElementsIndex, - KStubSrvElements - }; - -#endif - - diff -r 703a2b94c06c -r dde4619868dc tsrc/testtools/stubsrv/inc/stubsrvsession.h --- a/tsrc/testtools/stubsrv/inc/stubsrvsession.h Wed Sep 15 13:20:24 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,64 +0,0 @@ -/* -* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifndef SESSION_H -#define SESSION_H - -#include -#include - -class CStubSrv; -class CApiExecutor; - -/** -* CStubSrvSess class represent session on server side -* -*/ -NONSHARABLE_CLASS(CStubSrvSess) : public CSession2 - { -public: - - static CStubSrvSess* NewL(CStubSrv& aServer); - - ~CStubSrvSess(); - - void InvokeApiComplete(); - - TInt ConsumeApiBehavior(const TApiBehavior& aBeh, TInt aExeDuration); - -private: - - void ServiceL(const RMessage2& aMessage); - - void DispatchMessageL(const RMessage2& aMessage); - - -private: - - CStubSrvSess(CStubSrv& aServer); - - void ConstructL(); - -private: - CStubSrv& iServer; - - CApiExecutor* iExecutor; - }; - -#endif // SESSION_H - -// End of File diff -r 703a2b94c06c -r dde4619868dc tsrc/testtools/stubsrv/rom/stubsrv.iby --- a/tsrc/testtools/stubsrv/rom/stubsrv.iby Wed Sep 15 13:20:24 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,25 +0,0 @@ -/* -* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifndef STUBSRV_IBY -#define STUBSRV_IBY - -file=ABI_DIR\BUILD_DIR\apibehavior.dll SHARED_LIB_DIR\apibehavior.dll -file=ABI_DIR\BUILD_DIR\stubber.dll SHARED_LIB_DIR\stubber.dll -file=ABI_DIR\BUILD_DIR\stubsrv.exe PROGRAMS_DIR\stubsrv.exe - -#endif diff -r 703a2b94c06c -r dde4619868dc tsrc/testtools/stubsrv/src/apibehavior.cpp --- a/tsrc/testtools/stubsrv/src/apibehavior.cpp Wed Sep 15 13:20:24 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,60 +0,0 @@ -/* -* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#include "apibehavior.h" - -EXPORT_C TApiBehavior::TApiBehavior() - : iLib(0), iApi(0), iCompleteCode(0), iAsyncCompleteCode(0), iOutput(KNullDesC8) - { - } - -EXPORT_C TApiBehavior::TApiBehavior(TUint aLib, TUint aApi) - : iLib(aLib), iApi(aApi), iCompleteCode(0), iAsyncCompleteCode(0), iOutput(KNullDesC8) - { - } - -EXPORT_C TApiBehavior::TApiBehavior(TUint aLib, TUint aApi, - TInt aCompleteCode, TInt aAsyncCompleteCode, const TDesC8& aOutput) - : iLib(aLib), iApi(aApi), iCompleteCode(aCompleteCode), - iAsyncCompleteCode(aAsyncCompleteCode), iOutput(aOutput) - { - } - -EXPORT_C TBool TApiBehavior::MatchId(TUint aLib, TUint aApi) const - { - return iLib == aLib && iApi == aApi; - } - -EXPORT_C TBool TApiBehavior::MatchId(const TApiBehavior& aBeh) const - { - return MatchId(aBeh.iLib, aBeh.iApi); - } - -EXPORT_C TBool TApiBehavior::operator==(const TApiBehavior& aBeh) const - { - return - (iLib == aBeh.iLib && - iApi == aBeh.iApi && - iCompleteCode == aBeh.iCompleteCode && - iAsyncCompleteCode == aBeh.iAsyncCompleteCode && - iOutput == aBeh.iOutput); - } - -EXPORT_C TBool TApiBehavior::operator!=(const TApiBehavior& aBeh) const - { - return !(*this == aBeh); - } diff -r 703a2b94c06c -r dde4619868dc tsrc/testtools/stubsrv/src/stubber.cpp --- a/tsrc/testtools/stubsrv/src/stubber.cpp Wed Sep 15 13:20:24 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,102 +0,0 @@ -/* -* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#include "stubber.h" -#include "stubclient.h" - - -EXPORT_C CStubber* CStubber::NewL() - { - CStubber* self = new (ELeave) CStubber(); - CleanupStack::PushL(self); - self->ConstructL(); - CleanupStack::Pop(self); - return self; - } - -EXPORT_C CStubber::~CStubber() - { - Cancel(); - if (iClient) - iClient->Close(); - delete iClient; - } - -EXPORT_C void CStubber::EnqueBehavior(const TApiBehavior& aBeh, TInt aExeDuration) - { - iClient->EnqueBehavior(aBeh, aExeDuration); - } - -EXPORT_C void CStubber::DeleteBehaviors(TUint aLib, TUint aApi) - { - iClient->DeleteBehaviors(aLib, aApi); - } - -EXPORT_C void CStubber::InvokeApi(TApiBehavior& aBeh, TApiInvokeMode aMode) - { - aBeh = TApiBehavior(aBeh.iLib, aBeh.iApi); - TApiBehaviorPckg pckg(aBeh); - iClient->InvokeApi(pckg, aMode); - } - -EXPORT_C void CStubber::InvokeApiL(MApiInvoker& aInvoker, TUint aLib, TUint aApi, TApiInvokeMode aMode) - { - if (IsActive()) - { - User::Panic(_L("Stubber"), KErrInUse); - } - iInvoker = &aInvoker; - iBeh = TApiBehavior(aLib, aApi); - iClient->InvokeApiL(iBehPckg, iStatus, aMode); - SetActive(); - } - -EXPORT_C void CStubber::InvokeApiCancel() - { - Cancel(); - } - -void CStubber::RunL() - { - if (iStatus != KErrNone) - { - iBeh.iAsyncCompleteCode = iStatus.Int(); - } - iInvoker->InvokeApiComplete(iBeh); - } - -void CStubber::DoCancel() - { - iClient->InvokeApiCancel(iBeh.iLib, iBeh.iApi); - } - -TInt CStubber::RunError(TInt /*aReason*/) - { - return KErrNone; - } - -CStubber::CStubber() : - CActive(EPriorityStandard), iBehPckg(iBeh) - { - CActiveScheduler::Add(this); - } - -void CStubber::ConstructL() - { - iClient = new (ELeave) RStubClient(); - User::LeaveIfError(iClient->Connect()); - } diff -r 703a2b94c06c -r dde4619868dc tsrc/testtools/stubsrv/src/stubclient.cpp --- a/tsrc/testtools/stubsrv/src/stubclient.cpp Wed Sep 15 13:20:24 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,102 +0,0 @@ -/* -* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#include -#include "stubclient.h" -#include "stubclientsrv.h" - -_LIT(KStubSrvExe, "stubsrv.exe"); -static TInt ClientStart() - { - RProcess server; - TInt r = server.Create(KStubSrvExe, KNullDesC, TUidType(KNullUid, KNullUid, KStubSrvUid3)); - if (r!=KErrNone) - return r; - TRequestStatus stat; - server.Rendezvous(stat); - if (stat != KRequestPending) - server.Kill(0); - else - server.Resume(); - User::WaitForRequest(stat); - r = (server.ExitType() == EExitPanic) ? KErrGeneral : stat.Int(); - server.Close(); - return r; - } - -void RStubClient::EnqueBehavior(const TApiBehavior& aBeh, TInt aExeDuration) - { - CheckSession(); - TApiBehaviorPckgBuf buf(aBeh); - (void) SendReceive(EStubSrvEnqueApiBehavior, TIpcArgs(&buf, aExeDuration)); - } - -void RStubClient::DeleteBehaviors(TUint aLib, TUint aApi) - { - CheckSession(); - (void) SendReceive(EStubSrvDeleteApiBehaviors, TIpcArgs(aLib, aApi)); - } - -void RStubClient::InvokeApi(TApiBehaviorPckg& aBehPckg, TApiInvokeMode aMode) - { - CheckSession(); - (void) SendReceive(EStubSrvInvokeApi, TIpcArgs(&aBehPckg, aMode, 0)); - } - -void RStubClient::InvokeApiL(TApiBehaviorPckg& aBehPckg, TRequestStatus& aStatus, TApiInvokeMode aMode) - { - CheckSession(); - TInt transctionId = 0; - TPckg transpckg(transctionId); - TInt err = SendReceive(EStubSrvGetApiCompletionCode, TIpcArgs(aBehPckg().iLib, aBehPckg().iApi, &transpckg)); - if (err) - { - User::Leave(err); - } - SendReceive(EStubSrvInvokeApi, TIpcArgs(&aBehPckg, aMode, transctionId), aStatus); - } - -void RStubClient::InvokeApiCancel(TUint aLib, TUint aApi) - { - CheckSession(); - (void) SendReceive(EStubSrvInvokeApiCancel, TIpcArgs(aLib, aApi)); - } - -TInt RStubClient::Connect() - { - TInt retVal = CreateSession(KStubSrvName, Version()); - if (retVal) - { - retVal = ClientStart(); - if (!retVal) - retVal = CreateSession(KStubSrvName, Version()); - } - return retVal; - } - -TVersion RStubClient::Version() const - { - return(TVersion(KStubSrvMajorVersionNumber, KStubSrvMinorVersionNumber, KStubSrvBuildNumber)); - } - -_LIT(KPanicCat, "!Stubsrv"); - -void RStubClient::CheckSession() - { - if (!Handle()) - User::Panic(KPanicCat, KErrBadHandle); - } diff -r 703a2b94c06c -r dde4619868dc tsrc/testtools/stubsrv/src/stubsrv.cpp --- a/tsrc/testtools/stubsrv/src/stubsrv.cpp Wed Sep 15 13:20:24 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,201 +0,0 @@ -/* -* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#include "stubsrv.h" -#include "stubsrvsession.h" -#include "stubsrvapiexecutor.h" -#include "apibehavior.h" -#include "stubsrvsecuritypolicy.h" - -CStubSrv::CStubSrv(TInt aPriority) - :CPolicyServer(aPriority, KStubSrvPolicy) - { - } - -CStubSrv* CStubSrv::NewLC() - { - CStubSrv* self = new (ELeave) CStubSrv(EPriorityNormal); - CleanupStack::PushL(self); - self->StartL(KStubSrvName); - self->ConstructL(); - return self; - } - -CStubSrv::~CStubSrv() - { - iBehQueue.ResetAndDestroy(); - iBehQueue.Close(); - iSessions.Close(); - delete iTimer; - } - -const TInt KShutdownDelay = 1000000; - -void CStubSrv::StartShutdownTimerIfNoSessions() - { - if (iSessions.Count() == 0 && !iTimer->IsActive()) - { - iTimer->Start(KShutdownDelay, 0, TCallBack(CStubSrv::TimerFired, this)); - } - } - -TInt CStubSrv::ClientOpened(CStubSrvSess& aSession) - { - return iSessions.Append(&aSession); - } - -void CStubSrv::ClientClosed(CStubSrvSess& aSession) - { - const TUint sessCount = iSessions.Count(); - for ( TUint ii = 0 ; ii < sessCount ; ++ii ) - { - if ( iSessions[ii] == &aSession ) - { - iSessions.Remove(ii); - break; - } - } - StartShutdownTimerIfNoSessions(); - } - -void CStubSrv::EnqueueL(const RMessage2& aMessage) - { - TApiBehaviorPckgBuf buf; - aMessage.ReadL(0, buf); - TInt duration = aMessage.Int1(); - - TInt sesss = iSessions.Count(); - for (TInt i = 0; i < sesss; i++) - { - TInt err = iSessions[i]->ConsumeApiBehavior(buf(), duration); - if (err == KErrNone) - { - return; - } - } - TApiQueueItem* item = new (ELeave) TApiQueueItem(); - item->iBeh = buf(); - item->iExeDuration = duration; - item->iTransactionId = 0; - CleanupStack::PushL(item); - iBehQueue.AppendL(item); - CleanupStack::Pop(item); - } - -void CStubSrv::DeleteQueues(const RMessage2& aMessage) - { - TUint lib = aMessage.Int0(); - TUint api = aMessage.Int1(); - TInt count = iBehQueue.Count(); - for (TInt i = count - 1; i >= 0; i--) - { - if (iBehQueue[i]->iBeh.MatchId(lib, api)) - { - delete iBehQueue[i]; - iBehQueue.Remove(i); - } - } - } - -TInt CStubSrv::Dequeue(TApiBehavior& aBeh, TInt& aExeDuration, TInt aTransactionId) - { - TInt count = iBehQueue.Count(); - for (TInt i = 0; i < count; i++) - { - if (iBehQueue[i]->iBeh.MatchId(aBeh.iLib, aBeh.iApi) && - aTransactionId == iBehQueue[i]->iTransactionId) - { - aBeh = iBehQueue[i]->iBeh; - aExeDuration = iBehQueue[i]->iExeDuration; - delete iBehQueue[i]; - iBehQueue.Remove(i); - return KErrNone; - } - } - return KErrNotFound; - } - -void CStubSrv::GetApiCompleteCodeL(const RMessage2& aMessage) - { - TUint lib = aMessage.Int0(); - TUint api = aMessage.Int1(); - TInt count = iBehQueue.Count(); - for (TInt i = 0; i < count; i++) - { - if (iBehQueue[i]->iBeh.MatchId(lib, api)) - { - iBehQueue[i]->iTransactionId = iTransctionUnique++; - TPckgBuf buf(iBehQueue[i]->iTransactionId); - aMessage.WriteL(2, buf); - aMessage.Complete(iBehQueue[i]->iBeh.iCompleteCode); - return; - } - } - aMessage.Complete(0); - } - -void CStubSrv::ConstructL() - { - iTimer = CPeriodic::NewL(CActive::EPriorityStandard); - } - -CSession2* CStubSrv::NewSessionL(const TVersion& aVersion, const RMessage2& /*aMessage*/) const - { - TVersion v(KStubSrvMajorVersionNumber, KStubSrvMinorVersionNumber, KStubSrvBuildNumber); - if ( !User::QueryVersionSupported(v, aVersion) ) - User::Leave(KErrNotSupported); - CStubSrvSess* session = CStubSrvSess::NewL(const_cast(*this)); - const_cast(this)->CancelShutdownTimer(); - return session; - } - -void CStubSrv::CancelShutdownTimer() - { - iTimer->Cancel(); - } - -TInt CStubSrv::TimerFired(TAny* /*aThis*/) - { - CActiveScheduler::Stop(); - return KErrNone; - } - -static void RunServerL() - { - static_cast(User::LeaveIfError(User::RenameThread(KStubSrvName))); - CActiveScheduler* scheduler = new(ELeave) CActiveScheduler; - CleanupStack::PushL(scheduler); - CActiveScheduler::Install(scheduler); - CStubSrv::NewLC(); - RProcess::Rendezvous(KErrNone); - CActiveScheduler::Start(); - CleanupStack::PopAndDestroy(2, scheduler); - } - -GLDEF_C TInt E32Main() - { - TInt ret = KErrNoMemory; - __UHEAP_MARK; - CTrapCleanup* cleanup = CTrapCleanup::New(); - if (cleanup) - { - TRAP(ret, RunServerL()); - delete cleanup; - } - __UHEAP_MARKEND; - return ret; - } diff -r 703a2b94c06c -r dde4619868dc tsrc/testtools/stubsrv/src/stubsrvapiexecutor.cpp --- a/tsrc/testtools/stubsrv/src/stubsrvapiexecutor.cpp Wed Sep 15 13:20:24 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,138 +0,0 @@ -/* -* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -// INCLUDE FILES - -#include "stubsrvapiexecutor.h" -#include "stubsrvsession.h" - -CApiExecutor* CApiExecutor::NewL() - { - CApiExecutor* self = new (ELeave) CApiExecutor(); - CleanupStack::PushL(self); - self->ConstructL(); - CleanupStack::Pop(self); - return self; - } - -CApiExecutor::~CApiExecutor() - { - Cancel(); - iTimer.Close(); - if (iMessage.Handle()) - { - iMessage.Complete(KErrCancel); - } - } - -const TApiBehavior& CApiExecutor::ApiBehavior() const - { - return iBeh; - } - -TApiInvokeMode CApiExecutor::Mode() const - { - return iMode; - } - -void CApiExecutor::ExecuteL(const RMessage2& aMessage, CStubSrvSess& aSession, TUint aLib, TUint aApi) - { - iMessage = aMessage; - iSess = &aSession; - iBeh = TApiBehavior(aLib, aApi); - iMode = (TApiInvokeMode) iMessage.Int1(); - if (iMode == ECompleteIfNoBehaviorSet) - { - TRequestStatus* status = &iStatus; - User::RequestComplete(status, KErrNone); - SetActive(); - } - } - -void CApiExecutor::ExecuteL(const RMessage2& aMessage, CStubSrvSess& aSession, const TApiBehavior& aBeh, TInt aExeDuration) - { - iMessage = aMessage; - iSess = &aSession; - iMode = ECompleteIfNoBehaviorSet; - iBeh = aBeh; - iTimeout = aExeDuration; - if (iTimeout == 0) - { - TRequestStatus* status = &iStatus; - User::RequestComplete(status, KErrNone); - SetActive(); - } - else if (iTimeout > 0) - { - iTimer.After(iStatus, iTimeout); - SetActive(); - } - } - -void CApiExecutor::Resume(const TApiBehavior& aBeh, TInt aExeDuration) - { - iBeh = aBeh; - iTimeout = aExeDuration; - iMode = ECompleteIfNoBehaviorSet; - if (iTimeout == 0) - { - TRequestStatus* status = &iStatus; - User::RequestComplete(status, KErrNone); - SetActive(); - } - else if (iTimeout > 0) - { - iTimer.After(iStatus, iTimeout); - SetActive(); - } - } - -void CApiExecutor::RunL() - { - TInt err = KErrNone; - TApiBehaviorPckgBuf pckg(iBeh); - err = iMessage.Write(0, pckg); - iMessage.Complete(err); - iSess->InvokeApiComplete(); - } - -TInt CApiExecutor::RunError(TInt /*aReason*/) - { - return KErrNone; - } - -void CApiExecutor::DoCancel() - { - iTimer.Cancel(); - if (iMessage.Handle()) - { - iMessage.Complete(KErrCancel); - } - } - -CApiExecutor::CApiExecutor() - : CActive(CActive::EPriorityStandard) - { - CActiveScheduler::Add(this); - } - -void CApiExecutor::ConstructL() - { - iTimer.CreateLocal(); - } - - diff -r 703a2b94c06c -r dde4619868dc tsrc/testtools/stubsrv/src/stubsrvsession.cpp --- a/tsrc/testtools/stubsrv/src/stubsrvsession.cpp Wed Sep 15 13:20:24 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,135 +0,0 @@ -/* -* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -// INCLUDE FILES -#include "stubsrvsession.h" -#include "stubsrv.h" -#include "stubsrvapiexecutor.h" -#include "stubclientsrv.h" - -CStubSrvSess* CStubSrvSess::NewL(CStubSrv& aServer) - { - CStubSrvSess* self = new (ELeave) CStubSrvSess (aServer); - CleanupStack::PushL(self); - self->ConstructL(); - CleanupStack::Pop(self); - return self; - } - -CStubSrvSess::~CStubSrvSess() - { - delete iExecutor; - iServer.ClientClosed(*this); - } - -void CStubSrvSess::InvokeApiComplete() - { - delete iExecutor; - iExecutor = NULL; - } - -TInt CStubSrvSess::ConsumeApiBehavior(const TApiBehavior& aBeh, TInt aExeDuration) - { - if (iExecutor && iExecutor->Mode() == ESuspendIfNoBehaviorSet && - iExecutor->ApiBehavior().MatchId(aBeh)) - { - iExecutor->Resume(aBeh, aExeDuration); - return KErrNone; - } - return KErrNotFound; - } - -void CStubSrvSess::ServiceL(const RMessage2& aMessage) - { - TRAPD(err, DispatchMessageL( aMessage )); - if (err != KErrNone) - { - aMessage.Panic(KStubSrvName, err); - } - } - -void CStubSrvSess::DispatchMessageL(const RMessage2& aMessage) - { - switch (aMessage.Function()) - { - case EStubSrvEnqueApiBehavior: - { - iServer.EnqueueL(aMessage); - aMessage.Complete(KErrNone); - break; - } - case EStubSrvDeleteApiBehaviors: - { - iServer.DeleteQueues(aMessage); - aMessage.Complete(KErrNone); - break; - } - case EStubSrvInvokeApi: - { - if (iExecutor) - { - aMessage.Panic(KStubSrvName, EStubfApiAlreadyStarted); - break; - } - TApiBehavior beh; - TApiBehaviorPckg pckg(beh); - aMessage.ReadL(0, pckg); - TInt transactionId = aMessage.Int2(); - TInt dur = 0; - TInt err = iServer.Dequeue(beh, dur, transactionId); - iExecutor = CApiExecutor::NewL(); - if (err) - { - iExecutor->ExecuteL(aMessage, *this, beh.iLib, beh.iApi); - } - else - { - iExecutor->ExecuteL(aMessage, *this, beh, dur); - } - break; - } - case EStubSrvInvokeApiCancel: - { - delete iExecutor; - iExecutor = NULL; - aMessage.Complete(KErrNone); - break; - } - case EStubSrvGetApiCompletionCode: - { - iServer.GetApiCompleteCodeL(aMessage); - break; - } - default: - { - aMessage.Panic(KStubSrvName, EStubfBadRequest); - break; - } - } - } - -CStubSrvSess::CStubSrvSess(CStubSrv& aServer) : iServer(aServer) - { - } - -void CStubSrvSess::ConstructL() - { - iServer.ClientOpened(*this); - } - - -// End of File diff -r 703a2b94c06c -r dde4619868dc tsrc/testtools/usbman_stub/group/bld.inf --- a/tsrc/testtools/usbman_stub/group/bld.inf Wed Sep 15 13:20:24 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,19 +0,0 @@ -/* -* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - - - diff -r 703a2b94c06c -r dde4619868dc tsrc/testtools/usbman_stub/logger/bwins/usbloggeru.def --- a/tsrc/testtools/usbman_stub/logger/bwins/usbloggeru.def Wed Sep 15 13:20:24 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,17 +0,0 @@ -EXPORTS - ??0TFunctionLogger@@QAE@ABVTDesC8@@0PAX@Z @ 1 NONAME ; TFunctionLogger::TFunctionLogger(class TDesC8 const &, class TDesC8 const &, void *) - ??1TFunctionLogger@@QAE@XZ @ 2 NONAME ; TFunctionLogger::~TFunctionLogger(void) - ?Close@CUsbLog@@SAXXZ @ 3 NONAME ; void CUsbLog::Close(void) - ?Connect@CUsbLog@@SAHXZ @ 4 NONAME ; int CUsbLog::Connect(void) - ?HexDump@CUsbLog@@SAXABVTDesC8@@PBG1PBEH@Z @ 5 NONAME ; void CUsbLog::HexDump(class TDesC8 const &, unsigned short const *, unsigned short const *, unsigned char const *, int) - ?VerboseLeaveIfErrorL@@YAXABVTDesC8@@PADHH@Z @ 6 NONAME ; void VerboseLeaveIfErrorL(class TDesC8 const &, char *, int, int) - ?VerbosePanic@@YAXABVTDesC8@@PADHHPAEABVTDesC16@@@Z @ 7 NONAME ; void VerbosePanic(class TDesC8 const &, char *, int, int, unsigned char *, class TDesC16 const &) - ?Write@CUsbLog@@SAXABVTDesC8@@0@Z @ 8 NONAME ; void CUsbLog::Write(class TDesC8 const &, class TDesC8 const &) - ?Write@CUsbLog@@SAXABVTDesC8@@ABVTDesC16@@@Z @ 9 NONAME ; void CUsbLog::Write(class TDesC8 const &, class TDesC16 const &) - ?WriteFormat@CUsbLog@@SAXABVTDesC8@@V?$TRefByValue@$$CBVTDesC16@@@@AAY00PAC@Z @ 10 NONAME ; void CUsbLog::WriteFormat(class TDesC8 const &, class TRefByValue, signed char * [1] &) - ?WriteFormat@CUsbLog@@SAXABVTDesC8@@V?$TRefByValue@$$CBVTDesC16@@@@ZZ @ 11 NONAME ; void CUsbLog::WriteFormat(class TDesC8 const &, class TRefByValue, ...) - ?WriteFormat@CUsbLog@@SAXABVTDesC8@@V?$TRefByValue@$$CBVTDesC8@@@@AAY00PAC@Z @ 12 NONAME ; void CUsbLog::WriteFormat(class TDesC8 const &, class TRefByValue, signed char * [1] &) - ?WriteFormat@CUsbLog@@SAXABVTDesC8@@V?$TRefByValue@$$CBVTDesC8@@@@ZZ @ 13 NONAME ; void CUsbLog::WriteFormat(class TDesC8 const &, class TRefByValue, ...) - ?VerboseLeaveL@@YAXABVTDesC8@@PADHH@Z @ 14 NONAME ; void VerboseLeaveL(class TDesC8 const &, char *, int, int) - ?VerboseMsgPanic@@YAXABVTDesC8@@PADHABVRMessage2@@ABVTDesC16@@H@Z @ 15 NONAME ; void VerboseMsgPanic(class TDesC8 const &, char *, int, class RMessage2 const &, class TDesC16 const &, int) - diff -r 703a2b94c06c -r dde4619868dc tsrc/testtools/usbman_stub/logger/eabi/usbloggeru.def --- a/tsrc/testtools/usbman_stub/logger/eabi/usbloggeru.def Wed Sep 15 13:20:24 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,19 +0,0 @@ -EXPORTS - _Z12VerbosePanicRK6TDesC8PciiPhRK7TDesC16 @ 1 NONAME - _Z20VerboseLeaveIfErrorLRK6TDesC8Pcii @ 2 NONAME - _ZN15TFunctionLoggerC1ERK6TDesC8S2_Pv @ 3 NONAME - _ZN15TFunctionLoggerC2ERK6TDesC8S2_Pv @ 4 NONAME - _ZN15TFunctionLoggerD1Ev @ 5 NONAME - _ZN15TFunctionLoggerD2Ev @ 6 NONAME - _ZN7CUsbLog11WriteFormatERK6TDesC811TRefByValueIK7TDesC16ERSt9__va_list @ 7 NONAME - _ZN7CUsbLog11WriteFormatERK6TDesC811TRefByValueIK7TDesC16Ez @ 8 NONAME - _ZN7CUsbLog11WriteFormatERK6TDesC811TRefByValueIS1_ERSt9__va_list @ 9 NONAME - _ZN7CUsbLog11WriteFormatERK6TDesC811TRefByValueIS1_Ez @ 10 NONAME - _ZN7CUsbLog5CloseEv @ 11 NONAME - _ZN7CUsbLog5WriteERK6TDesC8RK7TDesC16 @ 12 NONAME - _ZN7CUsbLog5WriteERK6TDesC8S2_ @ 13 NONAME - _ZN7CUsbLog7ConnectEv @ 14 NONAME - _ZN7CUsbLog7HexDumpERK6TDesC8PKtS4_PKhi @ 15 NONAME - _Z13VerboseLeaveLRK6TDesC8Pcii @ 16 NONAME - _Z15VerboseMsgPanicRK6TDesC8PciRK9RMessage2RK7TDesC16i @ 17 NONAME - diff -r 703a2b94c06c -r dde4619868dc tsrc/testtools/usbman_stub/logger/group/bld.inf --- a/tsrc/testtools/usbman_stub/logger/group/bld.inf Wed Sep 15 13:20:24 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,28 +0,0 @@ -/* -* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* Logging engine for USB. -* -*/ - -/** - @file -*/ - -PRJ_TESTEXPORTS -//../public/usblogger.h SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(usb/usblogger.h) -//usblogger.mmh /epoc32/include/usb/usblogger.mmh - -PRJ_TESTMMPFILES -//usblogger.MMP diff -r 703a2b94c06c -r dde4619868dc tsrc/testtools/usbman_stub/logger/group/usblogger.mmh --- a/tsrc/testtools/usbman_stub/logger/group/usblogger.mmh Wed Sep 15 13:20:24 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,60 +0,0 @@ -/* -* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* Logging engine for USB. -* -*/ - -// Uncomment next line to temporarily engage logging for release builds. -#define __FLOGGER_UREL -// Comment next line to temporarily disengage logging for debug builds -#define __FLOGGER_UDEB - -// Determine whether, and how, flogger is to be included -#ifdef __FLOGGER_UREL - #ifdef __FLOGGER_UDEB - #define __FLOGGER_INCLUDED - MACRO __FLOG_UREL - #endif -#endif -#ifdef __FLOGGER_UREL - #ifndef __FLOGGER_UDEB - #define __FLOGGER_INCLUDED - MACRO __FLOG_UREL - MACRO __FLOG_NO_UDEB - #endif -#endif -#ifndef __FLOGGER_UREL - #ifndef __FLOGGER_UDEB - MACRO __FLOG_NO_UDEB - #endif -#endif -#ifndef __FLOGGER_UREL - #ifdef __FLOGGER_UDEB - #define __FLOGGER_INCLUDED - #define __FLOGGER_DEBUGGERLIBRARY - #endif -#endif - - -#ifdef __FLOGGER_INCLUDED - #ifndef __FLOGGER_SUPPRESS_LIBRARY - #ifdef __FLOGGER_DEBUGGERLIBRARY - DEBUGLIBRARY usblogger.lib - #else - LIBRARY usblogger.lib - #endif - #endif -#endif - diff -r 703a2b94c06c -r dde4619868dc tsrc/testtools/usbman_stub/logger/group/usblogger.mmp --- a/tsrc/testtools/usbman_stub/logger/group/usblogger.mmp Wed Sep 15 13:20:24 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,44 +0,0 @@ -/* -* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* Logging engine for USB. -* -*/ - -/** - @file -*/ - -target usblogger.dll - -CAPABILITY All -Tcb -TARGETTYPE dll - -uid 0x1000008d 0x10281A7D - -// MACRO __USB_DEBUG_RDEBUG__ -// Define this macro to get output through the serial port (COM0) - -SOURCEPATH ../src -SOURCE usblogger.cpp - -OS_LAYER_SYSTEMINCLUDE_SYMBIAN - -library euser.lib - -VENDORID 0x70000001 - -#include - -UNPAGED diff -r 703a2b94c06c -r dde4619868dc tsrc/testtools/usbman_stub/logger/public/usblogger.h --- a/tsrc/testtools/usbman_stub/logger/public/usblogger.h Wed Sep 15 13:20:24 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,184 +0,0 @@ -/* -* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* Logging engine for USB. -* -*/ - -/** - @file - @internalTechnology -*/ - - -#ifndef LOGGER_H -#define LOGGER_H - -#include - -// Control function entry and exit logging using a compile-time switch. -#define __LOG_FUNCTIONS__ - -class TFunctionLogger; - -#ifndef __COMMSDEBUGUTILITY_H__ // comms-infras/commsdebugutility.h not included -#ifdef _DEBUG // If this is a debug build... -// Set flogging active. -#define __FLOG_ACTIVE -#endif -#endif - -#ifdef __FLOG_ACTIVE -#define IF_FLOGGING(a) a -#else -#define IF_FLOGGING(a) -#endif - -_LIT8(KDefaultLogFile, "USB"); - -#ifdef __FLOG_ACTIVE -#define LEAVEIFERRORL(a) VerboseLeaveIfErrorL(KLogComponent, __FILE__, __LINE__, a) -#define LEAVEL(a) VerboseLeaveL(KLogComponent, __FILE__, __LINE__, a) -#define _USB_PANIC(CAT, CODE) VerbosePanic(KLogComponent, __FILE__, __LINE__, CODE, (TText8*)#CODE, CAT) -#define PANIC_MSG(msg, cat, code) VerboseMsgPanic(KLogComponent, __FILE__, __LINE__, msg, cat, code); -#define FLOG(a) CUsbLog::Write(KDefaultLogFile, a); -#define FTRACE(a) {a;} -#define LOGTEXT(text) CUsbLog::Write(KLogComponent, text); -#define LOGTEXT2(text, a) CUsbLog::WriteFormat(KLogComponent, text, a); -#define LOGTEXT3(text, a, b) CUsbLog::WriteFormat(KLogComponent, text, a, b); -#define LOGTEXT4(text, a, b, c) CUsbLog::WriteFormat(KLogComponent, text, a, b, c); -#define LOGTEXT5(text, a, b, c, d) CUsbLog::WriteFormat(KLogComponent, text, a, b, c, d); -#define LOGTEXT6(text, a, b, c, d, e) CUsbLog::WriteFormat(KLogComponent, text, a, b, c, d, e); -#define LOGTEXT7(text, a, b, c, d, e, f) CUsbLog::WriteFormat(KLogComponent, text, a, b, c, d, e, f); -#define LOGHEXDESC(desc) CUsbLog::HexDump(KLogComponent, 0, 0, desc.Ptr() , desc.Length()); -#define LOGHEXRAW(data, len) CUsbLog::HexDump(KLogComponent, 0, 0, data, len); -#else -#define LEAVEIFERRORL(a) static_cast(User::LeaveIfError(a)) -#define LEAVEL(a) User::Leave(a) -#define _USB_PANIC(CAT, CODE) User::Panic(CAT, CODE) -#define PANIC_MSG(msg, cat, code) msg.Panic(cat, code); -#define FLOG(a) -#define FTRACE(a) -#define LOGTEXT(text) -#define LOGTEXT2(text, a) -#define LOGTEXT3(text, a, b) -#define LOGTEXT4(text, a, b, c) -#define LOGTEXT5(text, a, b, c, d) -#define LOGTEXT6(text, a, b, c, d, e) -#define LOGTEXT7(text, a, b, c, d, e, f) -#define LOGHEXDESC(desc) -#define LOGHEXRAW(data, len) -#endif // __FLOG_ACTIVE - -#define FORCED_LOG_FUNC TFunctionLogger __instrument(KLogComponent, TPtrC8((TUint8*)__PRETTY_FUNCTION__), (TAny*)this); -#define FORCED_LOG_STATIC_FUNC_ENTRY TFunctionLogger __instrument(KLogComponent, TPtrC8((TUint8*)__PRETTY_FUNCTION__), (TAny*)NULL); - -#if ( defined __FLOG_ACTIVE && defined __LOG_FUNCTIONS__ ) -#define LOG_LINE CUsbLog::Write(KLogComponent, KNullDesC8()); -#define LOG_FUNC FORCED_LOG_FUNC -#define LOG_STATIC_FUNC_ENTRY FORCED_LOG_STATIC_FUNC_ENTRY -#else -#define LOG_LINE -#define LOG_FUNC -#define LOG_STATIC_FUNC_ENTRY -#endif - - - -NONSHARABLE_CLASS(CUsbLog) : public CBase - { -public: - IMPORT_C static TInt Connect(); - IMPORT_C static void Close(); - - IMPORT_C static void Write(const TDesC8& aCmpt, const TDesC8& aText); - IMPORT_C static void WriteFormat(const TDesC8& aCmpt, TRefByValue aFmt, ...); - IMPORT_C static void WriteFormat(const TDesC8& aCmpt, TRefByValue aFmt, VA_LIST& aList); - IMPORT_C static void Write(const TDesC8& aCmpt, const TDesC16& aText); - IMPORT_C static void WriteFormat(const TDesC8& aCmpt, TRefByValue aFmt, ...); - IMPORT_C static void WriteFormat(const TDesC8& aCmpt, TRefByValue aFmt, VA_LIST& aList); - IMPORT_C static void HexDump(const TDesC8& aCmpt, const TText* aHeader, const TText* aMargin, const TUint8* aPtr, TInt aLen); - }; - - -#ifndef NO_FPRINT -inline void FPrint(const TRefByValue IF_FLOGGING(aFmt), ...) - { -#ifdef __FLOG_ACTIVE - VA_LIST list; - VA_START(list,aFmt); - CUsbLog::WriteFormat(KDefaultLogFile, aFmt, list); -#endif - } -#endif - - -#ifndef NO_FHEX_PTR -inline void FHex(const TUint8* IF_FLOGGING(aPtr), TInt IF_FLOGGING(aLen)) - { -#ifdef __FLOG_ACTIVE - CUsbLog::HexDump(KDefaultLogFile, 0, 0, aPtr, aLen); -#endif - } -#endif - - -#ifndef NO_FHEX_DESC -inline void FHex(const TDesC8& IF_FLOGGING(aDes)) - { -#ifdef __FLOG_ACTIVE - FHex(aDes.Ptr(), aDes.Length()); -#endif - } -#endif - - -IMPORT_C void VerboseLeaveIfErrorL(const TDesC8& aCpt, - char* aFile, - TInt aLine, - TInt aReason); - -IMPORT_C void VerboseLeaveL(const TDesC8& aCpt, - char* aFile, - TInt aLine, - TInt aReason); - -IMPORT_C void VerbosePanic(const TDesC8& aCpt, - char* aFile, - TInt aLine, - TInt aPanicCode, - TText8* aPanicName, - const TDesC& aPanicCategory); - -IMPORT_C void VerboseMsgPanic(const TDesC8& aCpt, - char* aFile, - TInt aLine, - const RMessage2& aMsg, - const TDesC& aCat, - TInt aPanicCode); - - -NONSHARABLE_CLASS(TFunctionLogger) - { -public: - IMPORT_C TFunctionLogger(const TDesC8& aCpt, const TDesC8& aString, TAny* aThis); - IMPORT_C ~TFunctionLogger(); - -private: - TPtrC8 iCpt; - TPtrC8 iString; - }; - -#endif // LOGGER_H - diff -r 703a2b94c06c -r dde4619868dc tsrc/testtools/usbman_stub/logger/src/usblogger.cpp --- a/tsrc/testtools/usbman_stub/logger/src/usblogger.cpp Wed Sep 15 13:20:24 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,601 +0,0 @@ -/* -* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* Logging engine for USB. -* -*/ - -/** - @file - @internalTechnology -*/ - - -#include -#include -#include - - -#ifdef __USB_DEBUG_RDEBUG__ -#include -const TInt KUSBLogBufferSize=255; -class TUSBFlogOverflow8 : public TDes8Overflow - { -public: - void Overflow(TDes8& /*aDes*/) { } - }; - -class TUSBFlogOverflow16 : public TDes16Overflow - { -public: - void Overflow(TDes16& /*aDes*/) { } - }; -void __CUsbLog_DoHexDump(const TDesC8& aCmpt, const TDesC8& aData, const TDesC8& aHeader, const TDesC8& aMargin); -#endif //__USB_DEBUG_RDEBUG__ - - - - -#ifdef __FLOG_ACTIVE -_LIT8(KSubsystem, "USB"); -_LIT8(KLogCmpt, "logengine"); -#endif - - -NONSHARABLE_CLASS(TLogData) - { - public: -#ifdef __FLOG_ACTIVE - TLogData(); - - void SetLogTags(const TDesC8& aCmpt); - - TInt iAccessCount; - - RFileLogger iLogEngine; - TBuf8 iCurrentComponent; -#endif - }; - - -#ifdef __FLOG_ACTIVE -TLogData::TLogData() - : iAccessCount(0), iCurrentComponent(KNullDesC8) - {} - -void TLogData::SetLogTags(const TDesC8& aCmpt) - { - if (aCmpt != iCurrentComponent) - { - iLogEngine.SetLogTags(KSubsystem, aCmpt.Left(KMaxTagLength)); - iCurrentComponent = aCmpt.Left(KMaxTagLength); - } - } -#endif - -#define GETLOG TLogData* __logger = static_cast(Dll::Tls()); - - - -EXPORT_C /*static*/ TInt CUsbLog::Connect() - { -#ifdef __FLOG_ACTIVE - GETLOG; - - if (!__logger) - { - - CUsbLog::Write(KLogCmpt, _L8("Opening new logger connection")); - __logger = new TLogData(); - if (!__logger) - { - CUsbLog::Write(KLogCmpt, _L8("Opening logger connection failed, no memory")); - return KErrNoMemory; - } - - __logger->iLogEngine.Connect(); - Dll::SetTls(__logger); - } - - __logger->iAccessCount++; - CUsbLog::WriteFormat(KLogCmpt, _L8("Opening -- %d instances now open"), __logger->iAccessCount); - - return KErrNone; -#else - return KErrNotSupported; -#endif - } - - -EXPORT_C /*static*/ void CUsbLog::Close() - { -#ifdef __FLOG_ACTIVE - GETLOG; - - if (__logger) - { - TInt& count = __logger->iAccessCount; - - if (count) - { - count--; - CUsbLog::WriteFormat(KLogCmpt, _L8("Closing -- %d instance(s) left open"), count); - if (!count) - { - __logger->iLogEngine.Close(); - delete __logger; - Dll::SetTls(NULL); - CUsbLog::Write(KLogCmpt, _L8("Fully closed and deleted, now flogging statically.")); - } - } - else - { - CUsbLog::Write(KLogCmpt, _L8("Not closing -- not opened")); - } - } -#endif - } - - -EXPORT_C /*static*/ void CUsbLog::Write(const TDesC8& IF_FLOGGING(aCmpt), const TDesC8& IF_FLOGGING(aText)) - { -#ifdef __FLOG_ACTIVE - GETLOG; - -#ifdef __USB_DEBUG_RDEBUG__ - TBuf8 buf; - RThread thread; - buf.AppendFormat(_L8("%S\t%S\t%LX\t%S\r\n"), &KSubsystem(), &aCmpt, thread.Id().Id(), &aText); - RDebug::RawPrint(buf); -#endif // __USB_DEBUG_RDEBUG - - if (__logger) - { - __logger->SetLogTags(aCmpt); - __logger->iLogEngine.Write(aText); - } - else - { - RFileLogger::Write(KSubsystem, aCmpt, aText); - } -#endif - } - - -EXPORT_C /*static*/ void CUsbLog::WriteFormat(const TDesC8& IF_FLOGGING(aCmpt), TRefByValue IF_FLOGGING(aFmt), ...) - { -#ifdef __FLOG_ACTIVE - VA_LIST list; - VA_START(list, aFmt); - - GETLOG; - -#ifdef __USB_DEBUG_RDEBUG__ - TUSBFlogOverflow8 objFlogBody8; - TBuf8 buf; - RThread thread; - buf.AppendFormat(_L8("%S\t%S\t%LX\t"), &KSubsystem(), &aCmpt, thread.Id().Id()); - buf.AppendFormatList(aFmt, list, &objFlogBody8); - buf.Append(_L8("\r\n")); - RDebug::RawPrint(buf); -#endif // __USB_DEBUG_RDEBUG - - if (__logger) - { - __logger->SetLogTags(aCmpt); - __logger->iLogEngine.WriteFormat(aFmt, list); - } - else - { - RFileLogger::WriteFormat(KSubsystem, aCmpt, aFmt, list); - } -#endif - } - - -EXPORT_C /*static*/ void CUsbLog::WriteFormat(const TDesC8& IF_FLOGGING(aCmpt), TRefByValue IF_FLOGGING(aFmt), VA_LIST& IF_FLOGGING(aList)) - { -#ifdef __FLOG_ACTIVE - GETLOG; - -#ifdef __USB_DEBUG_RDEBUG__ - TUSBFlogOverflow8 objFlogBody8; - TBuf8 buf; - RThread thread; - buf.AppendFormat(_L8("%S\t%S\t%LX\t"), &KSubsystem(), &aCmpt, thread.Id().Id()); - buf.AppendFormatList(aFmt, aList, &objFlogBody8); - buf.Append(_L8("\r\n")); - RDebug::RawPrint(buf); -#endif // __USB_DEBUG_RDEBUG - - if (__logger) - { - __logger->SetLogTags(aCmpt); - __logger->iLogEngine.WriteFormat(aFmt, aList); - } - else - { - RFileLogger::WriteFormat(KSubsystem, aCmpt, aFmt, aList); - } -#endif - } - - -EXPORT_C /*static*/ void CUsbLog::Write(const TDesC8& IF_FLOGGING(aCmpt), const TDesC16& IF_FLOGGING(aText)) - { -#ifdef __FLOG_ACTIVE - GETLOG; - -#ifdef __USB_DEBUG_RDEBUG__ - TBuf16 buf; - buf.AppendFormat(_L16("(TDesC16): %S\r\n"), &aText); - RDebug::RawPrint(buf); -#endif // __USB_DEBUG_RDEBUG - - if (__logger) - { - __logger->SetLogTags(aCmpt); - __logger->iLogEngine.Write(aText); - } - else - { - RFileLogger::WriteFormat(KSubsystem, aCmpt, aText); - } -#endif - } - - -EXPORT_C /*static*/ void CUsbLog::WriteFormat(const TDesC8& IF_FLOGGING(aCmpt), TRefByValue IF_FLOGGING(aFmt), ...) - { -#ifdef __FLOG_ACTIVE - VA_LIST list; - VA_START(list, aFmt); - - GETLOG; - -#ifdef __USB_DEBUG_RDEBUG__ - TUSBFlogOverflow16 objFlogBody16; - TBuf16 wideBuf; - wideBuf.Append(_L16("(TDesC16): ")); - wideBuf.AppendFormatList(aFmt, list, &objFlogBody16); - wideBuf.Append(_L16("\r\n")); - RDebug::RawPrint(wideBuf); -#endif // __USB_DEBUG_RDEBUG - - if (__logger) - { - __logger->SetLogTags(aCmpt); - __logger->iLogEngine.WriteFormat(aFmt, list); - } - else - { - RFileLogger::WriteFormat(KSubsystem, aCmpt, aFmt, list); - } -#endif - } - - -EXPORT_C /*static*/ void CUsbLog::WriteFormat(const TDesC8& IF_FLOGGING(aCmpt), TRefByValue IF_FLOGGING(aFmt), VA_LIST& IF_FLOGGING(aList)) - { -#ifdef __FLOG_ACTIVE - GETLOG; - -#ifdef __USB_DEBUG_RDEBUG__ - TUSBFlogOverflow16 objFlogBody16; - TBuf16 wideBuf; - wideBuf.Append(_L16("(TDesC16): ")); - wideBuf.AppendFormatList(aFmt, aList, &objFlogBody16); - wideBuf.Append(_L16("\r\n")); - RDebug::RawPrint(wideBuf); -#endif // __USB_DEBUG_RDEBUG - - if (__logger) - { - __logger->SetLogTags(aCmpt); - __logger->iLogEngine.WriteFormat(aFmt, aList); - } - else - { - RFileLogger::WriteFormat(KSubsystem, aCmpt, aFmt, aList); - } -#endif - } - - -EXPORT_C /*static*/ void CUsbLog::HexDump(const TDesC8& IF_FLOGGING(aCmpt), const TText* IF_FLOGGING(aHeader), const TText* IF_FLOGGING(aMargin), const TUint8* IF_FLOGGING(aPtr), TInt IF_FLOGGING(aLen)) - { -#ifdef __FLOG_ACTIVE - GETLOG; - -#ifdef __USB_DEBUG_RDEBUG__ - __CUsbLog_DoHexDump(aCmpt, TPtrC8(aPtr, aLen), TPtrC8(NULL,0), TPtrC8(NULL,0)); -#endif // __USB_DEBUG_RDEBUG - - if (__logger) - { - __logger->SetLogTags(aCmpt); - __logger->iLogEngine.HexDump(aHeader, aMargin, aPtr, aLen); - } - else - { - RFileLogger::HexDump(KSubsystem, aCmpt, TPtrC8(aPtr, aLen), KNullDesC8); - } -#endif - } - - -#ifdef __USB_DEBUG_RDEBUG__ - -#define BLANK _S("") -const TInt KHexDumpWidth=16; ///< Number of bytes written per line when formatting as hex. -const TInt KLowestPrintableCharacter = 32; ///< In Hex output, replace chars below space with a dot. -const TInt KHighestPrintableCharacter = 126; ///< In Hex output, replace chars above 7-bits with a dot. - -_LIT8(KFirstFormatString8,"%04x : "); ///< Format string used in Hexdump to format first part: header and byte numbers. -_LIT8(KSecondFormatString8,"%02x "); ///< Format string used in Hexdump to format mid part: each of the 16 bytes as hex -_LIT8(KThirdFormatString8,"%c"); ///< Format string used in Hexdump to format the last part: each of the 16 bytes as characters -_LIT8(KThreeSpaces8," "); ///< Format string used in Hexdump to define padding between first and mid parts -_LIT8(KTwoSpaces8," "); ///< Format string used in Hexdump to define padding between hex and char bytes. -const TText8 KFullStopChar8='.'; - -void __CUsbLog_DoHexDump(const TDesC8& aCmpt, const TDesC8& aData, const TDesC8& aHeader, const TDesC8& aMargin) - { -#ifdef __FLOG_ACTIVE - HBufC8* marginStr = NULL; - TBuf8 buf; - TInt aRemainingLen = aData.Length(); - TInt aHeaderLen = aHeader.Length(); - TUSBFlogOverflow8 objFlogBody8; - - if (aData.Length()==0) // nothing to do - { - return; - } - - - if (aHeaderLen > 0) - { - - if (aMargin.Length() == 0) - { - marginStr = HBufC8::New(aHeader.Length()); - if (marginStr == NULL) - { - return; // abort if No memory - } - TPtr8 marginStrPtr(marginStr->Des()); - marginStrPtr.AppendFill(' ',aHeader.Length()); - } - else - { - marginStr = aMargin.Alloc(); - } - } - - - - TUint blockStartPos = 0; - while (aRemainingLen>0) - { - RThread thread; - buf.AppendFormat(_L8("%S\t%S\t%LX\t"), &KSubsystem(), &aCmpt, thread.Id().Id()); - TInt blockLength = (aRemainingLen>KHexDumpWidth ? KHexDumpWidth : aRemainingLen); - - // write the header/margin and print in hex which bytes we are about to write - if (blockStartPos == 0) - { - if (aHeaderLen > 0) - { - buf.Append(aHeader); - } - buf.AppendFormat(KFirstFormatString8,&objFlogBody8, blockStartPos); - } - else - { - if (marginStr) - { - buf.Append(*marginStr); - } - buf.AppendFormat(KFirstFormatString8,&objFlogBody8,blockStartPos); - } - - TInt bytePos; - // write the bytes as hex - for (bytePos = 0; bytePos < blockLength; bytePos++) - { - buf.AppendFormat(KSecondFormatString8,aData[blockStartPos + bytePos]); - } - while (bytePos++ < KHexDumpWidth) - { - buf.Append(KThreeSpaces8); - } - buf.Append(KTwoSpaces8); - // print the bytes as characters, or full stops if outside printable range - for (bytePos = 0; bytePos < blockLength; bytePos++) - { - buf.AppendFormat(KThirdFormatString8,(aData[blockStartPos + bytePos] < KLowestPrintableCharacter || aData[blockStartPos + bytePos] > KHighestPrintableCharacter) ? KFullStopChar8 : aData[blockStartPos + bytePos]); - } - - buf.Append(_L8("\r\n")); - RDebug::RawPrint(buf); - - buf.SetLength(0); - aRemainingLen -= blockLength; - blockStartPos += blockLength; - } - delete marginStr; -#endif // __FLOG_ACTIVE - } - - - -#endif // __USB_DEBUG_RDEBUG - - -/** -Leave (if error) verbosely- log name of file and line number just before -leaving. -@param aFile The file we're leaving from. -@param aLine The line number we're leaving from. -@param aReason The leave code. -*/ -EXPORT_C void VerboseLeaveIfErrorL(const TDesC8& IF_FLOGGING(aCpt), - char* IF_FLOGGING(aFile), - TInt IF_FLOGGING(aLine), - TInt aReason) - { - // only leave negative value - if ( aReason >= 0 ) - { - return; - } - -#ifdef __FLOG_ACTIVE - _LIT8(KLeavePrefix, "LEAVE: "); - - TPtrC8 fullFileName((const TUint8*)aFile); - TPtrC8 fileName(fullFileName.Ptr()+fullFileName.LocateReverse('\\')+1); - - TBuf8<256> buf; - buf.Append(KLeavePrefix); - buf.AppendFormat(_L8("aReason = %d [file %S, line %d]"), aReason, &fileName, - aLine); - CUsbLog::Write(aCpt, buf); -#endif - - // finally - User::Leave(aReason); - } - -/** -Leave verbosely- log name of file and line number just before -leaving. -@param aFile The file we're leaving from. -@param aLine The line number we're leaving from. -@param aReason The leave code. -*/ -EXPORT_C void VerboseLeaveL(const TDesC8& IF_FLOGGING(aCpt), - char* IF_FLOGGING(aFile), - TInt IF_FLOGGING(aLine), - TInt aReason) - { -#ifdef __FLOG_ACTIVE - _LIT8(KLeavePrefix, "LEAVE: "); - - TPtrC8 fullFileName((const TUint8*)aFile); - TPtrC8 fileName(fullFileName.Ptr()+fullFileName.LocateReverse('\\')+1); - - TBuf8<256> buf; - buf.Append(KLeavePrefix); - buf.AppendFormat(_L8("aReason = %d [file %S, line %d]"), aReason, &fileName, - aLine); - CUsbLog::Write(aCpt, buf); -#endif - - // finally - User::Leave(aReason); - } - -/** -Panic verbosely- log name of file and line number just before panicking. -@param aFile The file that's panicking. -@param aLine The line number that's panicking. -@param aReason The panic code. -@param aPanicName The text of the panic code. -@param aPanicCategory The panic category. -*/ -EXPORT_C void VerbosePanic(const TDesC8& IF_FLOGGING(aCpt), - char* IF_FLOGGING(aFile), - TInt IF_FLOGGING(aLine), - TInt aPanicCode, - TText8* IF_FLOGGING(aPanicName), - const TDesC& aPanicCategory) - { -#ifdef __FLOG_ACTIVE - _LIT8(KPanicPrefix, "PANIC: code "); - - TPtrC8 fullFileName((const TUint8*)aFile); - TPtrC8 fileName(fullFileName.Ptr()+fullFileName.LocateReverse('\\')+1); - - TBuf8<256> buf; - buf.Append(KPanicPrefix); - buf.AppendFormat(_L8("%d = %s [file %S, line %d]"), - aPanicCode, - aPanicName, - &fileName, - aLine); - CUsbLog::Write(aCpt, buf); -#endif - - // finally - User::Panic(aPanicCategory, aPanicCode); - } - - -/** -Panic the given message verbosely- log name of file and line number just -before panicking. -@param aMsg Message to panic. -@param aFile The file that's panicking. -@param aLine The line number that's panicking. -@param aReason The panic code. -@param aPanicName The text of the panic code. -@param aPanicCategory The panic category. -*/ -EXPORT_C void VerboseMsgPanic(const TDesC8& IF_FLOGGING(aCpt), - char* IF_FLOGGING(aFile), - TInt IF_FLOGGING(aLine), - const RMessage2& aMsg, - const TDesC& aCat, - TInt aPanicCode) - { -#ifdef __FLOG_ACTIVE - _LIT8(KPanicPrefix, "PANICKING CLIENT: code "); - - TPtrC8 fullFileName((const TUint8*)aFile); - TPtrC8 fileName(fullFileName.Ptr()+fullFileName.LocateReverse('\\')+1); - - TBuf8<256> buf; - buf.Append(KPanicPrefix); - buf.AppendFormat(_L8("%d [file %S, line %d]"), - aPanicCode, - &fileName, - aLine); - CUsbLog::Write(aCpt, buf); -#endif - // finally - aMsg.Panic(aCat, aPanicCode); - } - -#ifdef __FLOG_ACTIVE -_LIT8(KInstrumentIn, ">>%S this = [0x%08x]"); -_LIT8(KInstrumentOut, "<<%S"); -#endif - -EXPORT_C TFunctionLogger::TFunctionLogger(const TDesC8& IF_FLOGGING(aCpt), const TDesC8& IF_FLOGGING(aString), TAny* IF_FLOGGING(aThis)) - { -#ifdef __FLOG_ACTIVE - iCpt.Set(aCpt); - iString.Set(aString); - CUsbLog::WriteFormat(iCpt, KInstrumentIn, &iString, aThis); -#endif - } - -EXPORT_C TFunctionLogger::~TFunctionLogger() - { -#ifdef __FLOG_ACTIVE - CUsbLog::WriteFormat(iCpt, KInstrumentOut, &iString); -#endif - } - diff -r 703a2b94c06c -r dde4619868dc tsrc/testtools/usbman_stub/usbman/bld.inf --- a/tsrc/testtools/usbman_stub/usbman/bld.inf Wed Sep 15 13:20:24 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,18 +0,0 @@ -/* -* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#include "client/group/bld.inf" diff -r 703a2b94c06c -r dde4619868dc tsrc/testtools/usbman_stub/usbman/client/bwins/usbman_over_dummyusbdiu.def --- a/tsrc/testtools/usbman_stub/usbman/client/bwins/usbman_over_dummyusbdiu.def Wed Sep 15 13:20:24 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,52 +0,0 @@ -EXPORTS - ??0RUsb@@QAE@XZ @ 1 NONAME ; RUsb::RUsb(void) - ??1RUsb@@QAE@XZ @ 2 NONAME ; RUsb::~RUsb(void) - ?BusDrop@RUsb@@QAEHXZ @ 3 NONAME ; int RUsb::BusDrop(void) - ?BusRespondSrp@RUsb@@QAEHXZ @ 4 NONAME ; int RUsb::BusRespondSrp(void) - ?BusRequest@RUsb@@QAEHXZ @ 5 NONAME ; int RUsb::BusRequest(void) - ?CancelInterest@RUsb@@QAEHW4TUsbReqType@1@@Z @ 6 NONAME ; int RUsb::CancelInterest(enum RUsb::TUsbReqType) - ?ClassSupported@RUsb@@QAEHHVTUid@@AAH@Z @ 7 NONAME ; int RUsb::ClassSupported(int, class TUid, int &) - ?Connect@RUsb@@QAEHXZ @ 8 NONAME ; int RUsb::Connect(void) - ?DeviceStateNotification@RUsb@@QAEXIAAW4TUsbDeviceState@@AAVTRequestStatus@@@Z @ 9 NONAME ; void RUsb::DeviceStateNotification(unsigned int, enum TUsbDeviceState &, class TRequestStatus &) - ?DeviceStateNotificationCancel@RUsb@@QAEXXZ @ 10 NONAME ; void RUsb::DeviceStateNotificationCancel(void) - ?DisableFunctionDriverLoading@RUsb@@QAEXXZ @ 11 NONAME ; void RUsb::DisableFunctionDriverLoading(void) - ?EnableFunctionDriverLoading@RUsb@@QAEHXZ @ 12 NONAME ; int RUsb::EnableFunctionDriverLoading(void) - ?GetCurrentPersonalityId@RUsb@@QAEHAAH@Z @ 13 NONAME ; int RUsb::GetCurrentPersonalityId(int &) - ?GetCurrentState@RUsb@@QAEHAAW4TUsbServiceState@@@Z @ 14 NONAME ; int RUsb::GetCurrentState(enum TUsbServiceState &) - ?GetDescription@RUsb@@QAEHHAAPAVHBufC16@@@Z @ 15 NONAME ; int RUsb::GetDescription(int, class HBufC16 * &) - ?GetDeviceState@RUsb@@QAEHAAW4TUsbDeviceState@@@Z @ 16 NONAME ; int RUsb::GetDeviceState(enum TUsbDeviceState &) - ?GetManufacturerStringDescriptor@RUsb@@QAEHIIAAV?$TBuf@$0IA@@@@Z @ 17 NONAME ; int RUsb::GetManufacturerStringDescriptor(unsigned int, unsigned int, class TBuf<128> &) - ?GetPersonalityIds@RUsb@@QAEHAAV?$RArray@H@@@Z @ 18 NONAME ; int RUsb::GetPersonalityIds(class RArray &) - ?GetProductStringDescriptor@RUsb@@QAEHIIAAV?$TBuf@$0IA@@@@Z @ 19 NONAME ; int RUsb::GetProductStringDescriptor(unsigned int, unsigned int, class TBuf<128> &) - ?GetServiceState@RUsb@@QAEHAAW4TUsbServiceState@@@Z @ 20 NONAME ; int RUsb::GetServiceState(enum TUsbServiceState &) - ?GetSupportedClasses@RUsb@@QAEHHAAV?$RArray@VTUid@@@@@Z @ 21 NONAME ; int RUsb::GetSupportedClasses(int, class RArray &) - ?GetSupportedLanguages@RUsb@@QAEHIAAV?$RArray@I@@@Z @ 22 NONAME ; int RUsb::GetSupportedLanguages(unsigned int, class RArray &) - ?HostEventNotification@RUsb@@QAEXAAVTRequestStatus@@AAVTDeviceEventInformation@@@Z @ 23 NONAME ; void RUsb::HostEventNotification(class TRequestStatus &, class TDeviceEventInformation &) - ?HostEventNotificationCancel@RUsb@@QAEXXZ @ 24 NONAME ; void RUsb::HostEventNotificationCancel(void) - ?MessageNotification@RUsb@@QAEXAAVTRequestStatus@@AAH@Z @ 25 NONAME ; void RUsb::MessageNotification(class TRequestStatus &, int &) - ?MessageNotificationCancel@RUsb@@QAEXXZ @ 26 NONAME ; void RUsb::MessageNotificationCancel(void) - ?ServiceStateNotification@RUsb@@QAEXAAW4TUsbServiceState@@AAVTRequestStatus@@@Z @ 27 NONAME ; void RUsb::ServiceStateNotification(enum TUsbServiceState &, class TRequestStatus &) - ?ServiceStateNotificationCancel@RUsb@@QAEXXZ @ 28 NONAME ; void RUsb::ServiceStateNotificationCancel(void) - ?SetCtlSessionMode@RUsb@@QAEHH@Z @ 29 NONAME ; int RUsb::SetCtlSessionMode(int) - ?Start@RUsb@@QAEXAAVTRequestStatus@@@Z @ 30 NONAME ; void RUsb::Start(class TRequestStatus &) - ?StartCancel@RUsb@@QAEXXZ @ 31 NONAME ; void RUsb::StartCancel(void) - ?StateNotification@RUsb@@QAEXIAAW4TUsbDeviceState@@AAVTRequestStatus@@@Z @ 32 NONAME ; void RUsb::StateNotification(unsigned int, enum TUsbDeviceState &, class TRequestStatus &) - ?StateNotificationCancel@RUsb@@QAEXXZ @ 33 NONAME ; void RUsb::StateNotificationCancel(void) - ?Stop@RUsb@@QAEXAAVTRequestStatus@@@Z @ 34 NONAME ; void RUsb::Stop(class TRequestStatus &) - ?Stop@RUsb@@QAEXXZ @ 35 NONAME ; void RUsb::Stop(void) - ?StopCancel@RUsb@@QAEXXZ @ 36 NONAME ; void RUsb::StopCancel(void) - ?TryStart@RUsb@@QAEXHAAVTRequestStatus@@@Z @ 37 NONAME ; void RUsb::TryStart(int, class TRequestStatus &) - ?TryStop@RUsb@@QAEXAAVTRequestStatus@@@Z @ 38 NONAME ; void RUsb::TryStop(class TRequestStatus &) - ?Version@RUsb@@QBE?AVTVersion@@XZ @ 39 NONAME ; class TVersion RUsb::Version(void) const - ?__DbgAlloc@RUsb@@QAEHXZ @ 40 NONAME ; int RUsb::__DbgAlloc(void) - ?__DbgCheckHeap@RUsb@@QAEHH@Z @ 41 NONAME ; int RUsb::__DbgCheckHeap(int) - ?__DbgFailNext@RUsb@@QAEHH@Z @ 42 NONAME ; int RUsb::__DbgFailNext(int) - ?__DbgMarkEnd@RUsb@@QAEHH@Z @ 43 NONAME ; int RUsb::__DbgMarkEnd(int) - ?__DbgMarkHeap@RUsb@@QAEHXZ @ 44 NONAME ; int RUsb::__DbgMarkHeap(void) - ?panic@@YAXXZ @ 45 NONAME ; void panic(void) - ?RequestSession@RUsb@@QAEHXZ @ 46 NONAME ; int RUsb::RequestSession(void) - ?BusClearError@RUsb@@QAEHXZ @ 47 NONAME ; int RUsb::BusClearError(void) - ?GetOtgDescriptor@RUsb@@QAEHIAAVTOtgDescriptor@@@Z @ 48 NONAME ; int RUsb::GetOtgDescriptor(unsigned int, class TOtgDescriptor &) - ?GetDetailedDescription@RUsb@@QAEHHAAPAVHBufC16@@@Z @ 49 NONAME ; int RUsb::GetDetailedDescription(int, class HBufC16 * &) - ?GetPersonalityProperty@RUsb@@QAEHHAAK@Z @ 50 NONAME ; int RUsb::GetPersonalityProperty(int, unsigned long &) - diff -r 703a2b94c06c -r dde4619868dc tsrc/testtools/usbman_stub/usbman/client/bwins/usbmanu.def --- a/tsrc/testtools/usbman_stub/usbman/client/bwins/usbmanu.def Wed Sep 15 13:20:24 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,52 +0,0 @@ -EXPORTS - ??0RUsb@@QAE@XZ @ 1 NONAME ; public: __thiscall RUsb::RUsb(void) - ??1RUsb@@QAE@XZ @ 2 NONAME ; public: __thiscall RUsb::~RUsb(void) - ?panic@@YAXXZ @ 3 NONAME ; public: static int __cdecl UsbMan::Run(class UsbMan::TSignal &) - ?Stop@RUsb@@QAEXXZ @ 4 NONAME ; public: void __thiscall RUsb::Stop(void) - ?Version@RUsb@@QBE?AVTVersion@@XZ @ 5 NONAME ; public: class TVersion __thiscall RUsb::Version(void)const - ?Connect@RUsb@@QAEHXZ @ 6 NONAME ; public: int __thiscall RUsb::Connect(void) - ?Start@RUsb@@QAEXAAVTRequestStatus@@@Z @ 7 NONAME ; public: void __thiscall RUsb::Start(class TRequestStatus &) - ?StateNotification@RUsb@@QAEXIAAW4TUsbDeviceState@@AAVTRequestStatus@@@Z @ 8 NONAME ; public: void __thiscall RUsb::StateNotification(unsigned int,enum TUsbDeviceState &,class TRequestStatus &) - ?GetCurrentState@RUsb@@QAEHAAW4TUsbServiceState@@@Z @ 9 NONAME ; public: int __thiscall RUsb::GetCurrentState(enum TUsbServiceState &) - ?StartCancel@RUsb@@QAEXXZ @ 10 NONAME ; public: void __thiscall RUsb::StartCancel(void) - ?StateNotificationCancel@RUsb@@QAEXXZ @ 11 NONAME ; public: void __thiscall RUsb::StateNotificationCancel(void) - ?GetDeviceState@RUsb@@QAEHAAW4TUsbDeviceState@@@Z @ 12 NONAME ; public: int __thiscall RUsb::GetDeviceState(enum TUsbDeviceState &) - ?ServiceStateNotification@RUsb@@QAEXAAW4TUsbServiceState@@AAVTRequestStatus@@@Z @ 13 NONAME ; public: void __thiscall RUsb::ServiceStateNotification(enum TUsbServiceState &,class TRequestStatus &) - ?ServiceStateNotificationCancel@RUsb@@QAEXXZ @ 14 NONAME ; public: void __thiscall RUsb::ServiceStateNotificationCancel(void) - ?Stop@RUsb@@QAEXAAVTRequestStatus@@@Z @ 15 NONAME ; public: void __thiscall RUsb::Stop(class TRequestStatus &) - ?StopCancel@RUsb@@QAEXXZ @ 16 NONAME ; public: void __thiscall RUsb::StopCancel(void) - ?DeviceStateNotification@RUsb@@QAEXIAAW4TUsbDeviceState@@AAVTRequestStatus@@@Z @ 17 NONAME ; public: void __thiscall RUsb::DeviceStateNotification(unsigned int,enum TUsbDeviceState &,class TRequestStatus &) - ?DeviceStateNotificationCancel@RUsb@@QAEXXZ @ 18 NONAME ; public: void __thiscall RUsb::DeviceStateNotificationCancel(void) - ?GetServiceState@RUsb@@QAEHAAW4TUsbServiceState@@@Z @ 19 NONAME ; public: int __thiscall RUsb::GetServiceState(enum TUsbServiceState &) - ?__DbgCheckHeap@RUsb@@QAEHH@Z @ 20 NONAME ; public: int __thiscall RUsb::__DbgCheckHeap(int) - ?__DbgFailNext@RUsb@@QAEHH@Z @ 21 NONAME ; public: int __thiscall RUsb::__DbgFailNext(int) - ?__DbgMarkEnd@RUsb@@QAEHH@Z @ 22 NONAME ; public: int __thiscall RUsb::__DbgMarkEnd(int) - ?__DbgMarkHeap@RUsb@@QAEHXZ @ 23 NONAME ; public: int __thiscall RUsb::__DbgMarkHeap(void) - ?CancelInterest@RUsb@@QAEHW4TUsbReqType@1@@Z @ 24 NONAME ; int RUsb::CancelInterest(enum RUsb::TUsbReqType) - ?ClassSupported@RUsb@@QAEHHVTUid@@AAH@Z @ 25 NONAME ; int RUsb::ClassSupported(int, class TUid, int &) - ?GetCurrentPersonalityId@RUsb@@QAEHAAH@Z @ 26 NONAME ; int RUsb::GetCurrentPersonalityId(int &) - ?GetDescription@RUsb@@QAEHHAAPAVHBufC16@@@Z @ 27 NONAME ; int RUsb::GetDescription(int, class HBufC16 * &) - ?GetPersonalityIds@RUsb@@QAEHAAV?$RArray@H@@@Z @ 28 NONAME ; int RUsb::GetPersonalityIds(class RArray &) - ?GetSupportedClasses@RUsb@@QAEHHAAV?$RArray@VTUid@@@@@Z @ 29 NONAME ; int RUsb::GetSupportedClasses(int, class RArray &) - ?TryStart@RUsb@@QAEXHAAVTRequestStatus@@@Z @ 30 NONAME ; void RUsb::TryStart(int, class TRequestStatus &) - ?TryStop@RUsb@@QAEXAAVTRequestStatus@@@Z @ 31 NONAME ; void RUsb::TryStop(class TRequestStatus &) - ?BusDrop@RUsb@@QAEHXZ @ 32 NONAME ; int RUsb::BusDrop(void) - ?BusRespondSrp@RUsb@@QAEHXZ @ 33 NONAME ; int RUsb::BusRespondSrp(void) - ?BusRequest@RUsb@@QAEHXZ @ 34 NONAME ; int RUsb::BusRequest(void) - ?DisableFunctionDriverLoading@RUsb@@QAEXXZ @ 35 NONAME ; void RUsb::DisableFunctionDriverLoading(void) - ?EnableFunctionDriverLoading@RUsb@@QAEHXZ @ 36 NONAME ; int RUsb::EnableFunctionDriverLoading(void) - ?GetManufacturerStringDescriptor@RUsb@@QAEHIIAAV?$TBuf@$0IA@@@@Z @ 37 NONAME ; int RUsb::GetManufacturerStringDescriptor(unsigned int, unsigned int, class TBuf<128> &) - ?GetProductStringDescriptor@RUsb@@QAEHIIAAV?$TBuf@$0IA@@@@Z @ 38 NONAME ; int RUsb::GetProductStringDescriptor(unsigned int, unsigned int, class TBuf<128> &) - ?GetSupportedLanguages@RUsb@@QAEHIAAV?$RArray@I@@@Z @ 39 NONAME ; int RUsb::GetSupportedLanguages(unsigned int, class RArray &) - ?HostEventNotification@RUsb@@QAEXAAVTRequestStatus@@AAVTDeviceEventInformation@@@Z @ 40 NONAME ; void RUsb::HostEventNotification(class TRequestStatus &, class TDeviceEventInformation &) - ?HostEventNotificationCancel@RUsb@@QAEXXZ @ 41 NONAME ; void RUsb::HostEventNotificationCancel(void) - ?MessageNotification@RUsb@@QAEXAAVTRequestStatus@@AAH@Z @ 42 NONAME ; void RUsb::MessageNotification(class TRequestStatus &, int &) - ?MessageNotificationCancel@RUsb@@QAEXXZ @ 43 NONAME ; void RUsb::MessageNotificationCancel(void) - ?SetCtlSessionMode@RUsb@@QAEHH@Z @ 44 NONAME ; int RUsb::SetCtlSessionMode(int) - ?__DbgAlloc@RUsb@@QAEHXZ @ 45 NONAME ; int RUsb::__DbgAlloc(void) - ?RequestSession@RUsb@@QAEHXZ @ 46 NONAME ; int RUsb::RequestSession(void) - ?BusClearError@RUsb@@QAEHXZ @ 47 NONAME ; int RUsb::BusClearError(void) - ?GetOtgDescriptor@RUsb@@QAEHIAAVTOtgDescriptor@@@Z @ 48 NONAME ; int RUsb::GetOtgDescriptor(unsigned int, class TOtgDescriptor &) - ?GetDetailedDescription@RUsb@@QAEHHAAPAVHBufC16@@@Z @ 49 NONAME ; int RUsb::GetDetailedDescription(int, class HBufC16 * &) - ?GetPersonalityProperty@RUsb@@QAEHHAAK@Z @ 50 NONAME ; int RUsb::GetPersonalityProperty(int, unsigned long &) - diff -r 703a2b94c06c -r dde4619868dc tsrc/testtools/usbman_stub/usbman/client/eabi/usbmanu.def --- a/tsrc/testtools/usbman_stub/usbman/client/eabi/usbmanu.def Wed Sep 15 13:20:24 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,54 +0,0 @@ -EXPORTS - _Z5panicv @ 1 NONAME - _ZN4RUsb10StopCancelEv @ 2 NONAME - _ZN4RUsb11StartCancelEv @ 3 NONAME - _ZN4RUsb12__DbgMarkEndEi @ 4 NONAME - _ZN4RUsb13__DbgFailNextEi @ 5 NONAME - _ZN4RUsb13__DbgMarkHeapEv @ 6 NONAME - _ZN4RUsb14GetDeviceStateER15TUsbDeviceState @ 7 NONAME - _ZN4RUsb14__DbgCheckHeapEi @ 8 NONAME - _ZN4RUsb15GetCurrentStateER16TUsbServiceState @ 9 NONAME - _ZN4RUsb15GetServiceStateER16TUsbServiceState @ 10 NONAME - _ZN4RUsb17StateNotificationEjR15TUsbDeviceStateR14TRequestStatus @ 11 NONAME - _ZN4RUsb23DeviceStateNotificationEjR15TUsbDeviceStateR14TRequestStatus @ 12 NONAME - _ZN4RUsb23StateNotificationCancelEv @ 13 NONAME - _ZN4RUsb24ServiceStateNotificationER16TUsbServiceStateR14TRequestStatus @ 14 NONAME - _ZN4RUsb29DeviceStateNotificationCancelEv @ 15 NONAME - _ZN4RUsb30ServiceStateNotificationCancelEv @ 16 NONAME - _ZN4RUsb4StopER14TRequestStatus @ 17 NONAME - _ZN4RUsb4StopEv @ 18 NONAME - _ZN4RUsb5StartER14TRequestStatus @ 19 NONAME - _ZN4RUsb7ConnectEv @ 20 NONAME - _ZN4RUsbC1Ev @ 21 NONAME - _ZN4RUsbC2Ev @ 22 NONAME - _ZN4RUsbD1Ev @ 23 NONAME - _ZN4RUsbD2Ev @ 24 NONAME - _ZNK4RUsb7VersionEv @ 25 NONAME - _ZN4RUsb14CancelInterestENS_11TUsbReqTypeE @ 26 NONAME - _ZN4RUsb14ClassSupportedEi4TUidRi @ 27 NONAME - _ZN4RUsb14GetDescriptionEiRP7HBufC16 @ 28 NONAME - _ZN4RUsb17GetPersonalityIdsER6RArrayIiE @ 29 NONAME - _ZN4RUsb19GetSupportedClassesEiR6RArrayI4TUidE @ 30 NONAME - _ZN4RUsb23GetCurrentPersonalityIdERi @ 31 NONAME - _ZN4RUsb7TryStopER14TRequestStatus @ 32 NONAME - _ZN4RUsb8TryStartEiR14TRequestStatus @ 33 NONAME - _ZN4RUsb13BusRespondSrpEv @ 34 NONAME - _ZN4RUsb10BusRequestEv @ 35 NONAME - _ZN4RUsb17SetCtlSessionModeEi @ 36 NONAME - _ZN4RUsb19MessageNotificationER14TRequestStatusRi @ 37 NONAME - _ZN4RUsb21GetSupportedLanguagesEjR6RArrayIjE @ 38 NONAME - _ZN4RUsb21HostEventNotificationER14TRequestStatusR23TDeviceEventInformation @ 39 NONAME - _ZN4RUsb25MessageNotificationCancelEv @ 40 NONAME - _ZN4RUsb26GetProductStringDescriptorEjjR4TBufILi128EE @ 41 NONAME - _ZN4RUsb27EnableFunctionDriverLoadingEv @ 42 NONAME - _ZN4RUsb27HostEventNotificationCancelEv @ 43 NONAME - _ZN4RUsb28DisableFunctionDriverLoadingEv @ 44 NONAME - _ZN4RUsb31GetManufacturerStringDescriptorEjjR4TBufILi128EE @ 45 NONAME - _ZN4RUsb7BusDropEv @ 46 NONAME - _ZN4RUsb10__DbgAllocEv @ 47 NONAME - _ZN4RUsb14RequestSessionEv @ 48 NONAME - _ZN4RUsb13BusClearErrorEv @ 49 NONAME - _ZN4RUsb16GetOtgDescriptorEjR14TOtgDescriptor @ 50 NONAME - _ZN4RUsb22GetDetailedDescriptionEiRP7HBufC16 @ 51 NONAME - _ZN4RUsb22GetPersonalityPropertyEiRm @ 52 NONAME - diff -r 703a2b94c06c -r dde4619868dc tsrc/testtools/usbman_stub/usbman/client/group/UsbManStub.pkg --- a/tsrc/testtools/usbman_stub/usbman/client/group/UsbManStub.pkg Wed Sep 15 13:20:24 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,58 +0,0 @@ -; -; Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -; All rights reserved. -; This component and the accompanying materials are made available -; under the terms of "Eclipse Public License v1.0" -; which accompanies this distribution, and is available -; at the URL "http://www.eclipse.org/legal/epl-v10.html". -; -; Initial Contributors: -; Nokia Corporation - initial contribution. -; -; Contributors: -; -; Description: -; - -; Languages -&EN - -; Provide value for uid -#{"UsbManStub"},(0x00000001),11,1,0,TYPE=SA, RU - -; Series60 product id for S60 5.1 -[0x10283160], 0, 0, 0, {"Series60ProductID"} - -; Localised Vendor name -%{"Nokia"} - -; Unique Vendor name -:"Nokia" - -; Logo -; None - -; Package signature - Optional -; None - -; Start of Package body - -; Condition blocks -; None - -; Options list -; None - -; Install files -"\epoc32\release\armv5\udeb\usbman.dll"-"c:\Sys\Bin\usbman.dll" - -; Embedded SIS -; None - -; End of Package body - -; PKG dependencies -; None - -; PKG capabilities -; None \ No newline at end of file diff -r 703a2b94c06c -r dde4619868dc tsrc/testtools/usbman_stub/usbman/client/group/UsbManStub_empty.pkg --- a/tsrc/testtools/usbman_stub/usbman/client/group/UsbManStub_empty.pkg Wed Sep 15 13:20:24 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,34 +0,0 @@ -; -; Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -; All rights reserved. -; This component and the accompanying materials are made available -; under the terms of "Eclipse Public License v1.0" -; which accompanies this distribution, and is available -; at the URL "http://www.eclipse.org/legal/epl-v10.html". -; -; Initial Contributors: -; Nokia Corporation - initial contribution. -; -; Contributors: -; -; Description: -; - - -; Languages -&EN - -; Provide value for uid -#{"UsbManStub"},(0x00000001),10,1,0,TYPE=SA - -; Series60 product id for S60 5.1 -;[0x10283160], 0, 0, 0, {"Series60ProductID"} - -; Localised Vendor name -%{"Nokia"} - -; Unique Vendor name -:"Nokia" - -;Files -""-"z:\sys\bin\usbman.dll" diff -r 703a2b94c06c -r dde4619868dc tsrc/testtools/usbman_stub/usbman/client/group/UsbManStub_empty.sis Binary file tsrc/testtools/usbman_stub/usbman/client/group/UsbManStub_empty.sis has changed diff -r 703a2b94c06c -r dde4619868dc tsrc/testtools/usbman_stub/usbman/client/group/Usbman.mmp --- a/tsrc/testtools/usbman_stub/usbman/client/group/Usbman.mmp Wed Sep 15 13:20:24 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,54 +0,0 @@ -/* -* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#include -/** - @file -*/ - -target usbman.dll -CAPABILITY All -Tcb -targettype dll - -// -// We have a laggard, ill-defined UID3 which must be kept -// for old platforms for BC. For newer platforms, we use -// KUidUsbmanClient = 0x101FE1DA -// - uid 0x1000008d 0x101fe1da - -sourcepath ../SRC -source RUsb.cpp - -USERINCLUDE ../inc -userinclude ../../server/public - -OS_LAYER_SYSTEMINCLUDE_SYMBIAN -MW_LAYER_SYSTEMINCLUDE - -SYSTEMINCLUDE /epoc32/include/mw/stubsrv - -library euser.lib -library efsrv.lib -LIBRARY stubber.lib -LIBRARY apibehavior.lib - -#include - -VENDORID 0x70000001 - -UNPAGED diff -r 703a2b94c06c -r dde4619868dc tsrc/testtools/usbman_stub/usbman/client/group/bld.inf --- a/tsrc/testtools/usbman_stub/usbman/client/group/bld.inf Wed Sep 15 13:20:24 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,28 +0,0 @@ -/* -* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -PRJ_TESTEXPORTS -//../public/usbman.h SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(usbman.h) -//../public/usbstates.h SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(usbstates.h) -../inc/usbmandll_stub.h /epoc32/include/mw/taf/usbmandll_stub.h - - -../rom/usbManStubSIS.iby /epoc32/rom/include/core/mw/usbman_stub.iby -UsbManStub_empty.sis /epoc32/data/z/system/install/UsbMan_stub.sis - -PRJ_TESTMMPFILES -//Usbman.mmp diff -r 703a2b94c06c -r dde4619868dc tsrc/testtools/usbman_stub/usbman/client/inc/usbmandll_stub.h --- a/tsrc/testtools/usbman_stub/usbman/client/inc/usbmandll_stub.h Wed Sep 15 13:20:24 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,40 +0,0 @@ -/* -* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifndef USBMANDLL_STUB_H_ -#define USBMANDLL_STUB_H_ - -static const TUint KUsbManStubAgentDll = 0x00000033; - -enum TUsbManStubAgentApi - { - EConnect, - EGetDeviceState, - EStart, - EStop, - ETryStartAsync, - ETryStopAsync, - EDeviceStateNotification, - EGetCurrentPersonalityId, - ECancelInterest, - EDeviceStateNotificationCancel, - EServiceState, - ESetCtlSessionMode, - EGetPersonalityProperty - }; - -#endif /*USBMANDLL_STUB_H_*/ diff -r 703a2b94c06c -r dde4619868dc tsrc/testtools/usbman_stub/usbman/client/public/usbman.h --- a/tsrc/testtools/usbman_stub/usbman/client/public/usbman.h Wed Sep 15 13:20:24 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,705 +0,0 @@ -/* -* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -/** - @file -*/ - -#ifndef __USBMAN_H__ -#define __USBMAN_H__ - -#include -#include -#include -#include - -// The propery of a personality is a bitmap, and bit 0 is used to identify -// whether a personality is hidden. -const TUint32 KUsbPersonalityPropertyHidden = 0x00000001; - -NONSHARABLE_CLASS(RUsb) : public RSessionBase -/** -The RUsb class implements the Symbian OS USB Management API RUsb - -@publishedPartner -@released -*/ - { -public: - - // Request types, the interest of which can be cancelled by clients - enum TUsbReqType - { - EStart, - EStop, - ETryStart, - ETryStop - }; - - /** - Constructor - - - @since 7.0 - - @publishedPartner - @released - */ - IMPORT_C RUsb(); - - /** - Destructor - - - @since 7.0 - - @publishedPartner - @released - */ - IMPORT_C ~RUsb(); - - /** - Extract the version of the server providing the RUsb API - - - @since 7.0 - - @return Version of the server - - @publishedPartner - @released - */ - IMPORT_C TVersion Version() const; - - /** - Connect the Handle to the Server - Must be called before all other methods except Version() - - - @since 7.0 - - @return KErrNone if successful, otherwise the error that occurred - - @publishedPartner - @released - */ - IMPORT_C TInt Connect(); - - /** - Start the device's USB service. Should not be called if the USB services - have already been started - Note: Asynchonous Version, outcome returned when the status is completed - - - @since 7.0 - @param aStatus Status to complete once the start operation has completed - @capability NetworkControl - - @publishedPartner - @released - */ - IMPORT_C void Start(TRequestStatus& aStatus); - - /** - Cancels the pending start operation of the device's USB service. - - - @since 7.0 - @capability NetworkControl - - @publishedPartner - @released - */ - IMPORT_C void StartCancel(); - - /** - Stops the device's USB service. Should not be called if the USB services - have not been started. This is the synchronous variant of this function. - This function is deprecated- use the asynchronous version. - - - @since 7.0 - @capability NetworkControl - - @publishedPartner - @released - */ - IMPORT_C void Stop(); - - /** - Stops the device's USB service. Should not be called if the USB services - have not been started. This is the asynchronous variant of this function. - - - @since 7.0s - @param aStatus Status to complete once the stop operation has completed - @capability NetworkControl - - @publishedPartner - @released - */ - IMPORT_C void Stop(TRequestStatus& aStatus); - - /** - Cancels the pending stop operation of the device's USB service. - - - @since 7.0s - @capability NetworkControl - - @publishedPartner - @released - */ - IMPORT_C void StopCancel(); - - /** - Get the current state of the device's USB service. - - - @since 7.0s - @param aState Set by the method to the current state of the USB service - - @return KErrNone if successful, otherwise the error that occurred - - @publishedPartner - @released - */ - IMPORT_C TInt GetServiceState(TUsbServiceState& aState); - - /** - Request to be notified of a change in service state of the USB device. The - request only completes when the service state changes. - - - @since 7.0s - @param aState State variable to be written to upon completion of the request - @param aStatus Status to complete when required state change occurs - - @publishedPartner - @released - */ - IMPORT_C void ServiceStateNotification( - TUsbServiceState& aState, - TRequestStatus& aStatus - ); - - /** - Cancel the outstanding service state notification request. - - - @since 7.0s - - @publishedPartner - @released - */ - IMPORT_C void ServiceStateNotificationCancel(); - - /** - Gets the current device state (eg. powered, configured...). - - - @since 7.0s - @param aState Set by the method to the current state of the USB device - @return KErrNone if successful, otherwise the error that occurred - - @publishedPartner - @released - */ - IMPORT_C TInt GetDeviceState(TUsbDeviceState& aState); - - /** - Request to be notified of a change in state of the USB device. - - - @since 7.0s - @param aStateMask State mask of the states the client is interested in - @param aState State variable to be written to upon completion of the request - @param aStatus Status to complete when required state change occurs - - @publishedPartner - @released - */ - IMPORT_C void DeviceStateNotification( - TUint aStateMask, - TUsbDeviceState& aState, - TRequestStatus& aStatus - ); - - /** - Cancel the outstanding device state notification request. - - - @since 7.0s - - @publishedPartner - @released - */ - IMPORT_C void DeviceStateNotificationCancel(); - - /** - Try to start the device's USB service. It starts the current personality - only if the service is in the idle state. Calling this API while the server - is in any other states has no any effect on the service state. - - Note: Asynchonous version, outcome returned when the status is completed - - @param aPersonalityId a personality id - @param aStatus Status to complete once the start operation has completed. - It may be one of the following: - KErrNotSupported - KErrAccessDenied - KErrServerBusy - KErrAbort - KErrNone - @capability NetworkControl - @publishedPartner - @released - */ - IMPORT_C void TryStart(TInt aPersonalityId, TRequestStatus& aStatus); - - /** - Try to stop the device's USB service. It stops the service only if the serice - is in the started state. Calling this API while the server is in the other states - has no any effect on the service state. - - Note: Asynchonous version, outcome returned when the status is completed - - @param aStatus Status to complete once the stop operation has completed. - It may be one of the following: - KErrNotSupported - KErrAccessDenied - KErrServerBusy - KErrNone - @capability NetworkControl - @publishedPartner - @released - */ - IMPORT_C void TryStop(TRequestStatus& aStatus); - - /** - Cancels the interest of the pending operation of the device's USB service, - either starting or stopping. The pending request will run to the completion. - The caller of this function receives a status of KErrCancel. - - @param aMessageId a message id to identify the request to be cancelled - @publishedPartner - @released - */ - IMPORT_C TInt CancelInterest(TUsbReqType aMessageId); - - /** - Gets the textual description of the personality identified by the aPersonalityId. - Caller is repsonsible for freeing up memories allocated to - aLocalizedPersonalityDescriptor. - - @param aPersonalityId a personality id - @param aLocalizedPersonalityDescriptor a localize text string - @return KErrNone if successful, otherwise the error that occurred - @publishedPartner - @released - */ - IMPORT_C TInt GetDescription(TInt aPersonalityId, HBufC*& aLocalizedPersonalityDescriptor); - - /** - Gets the current personality id of the device's USb service - - @param aPersonalityId set to the current personality of USB device - @return KErrNone if successful, otherwise the error that occurred - @publishedPartner - @released - */ - IMPORT_C TInt GetCurrentPersonalityId(TInt& aPersonalityId); - - /** - Gets supported classes by the given personality identified by the aPersonalityId - - @param aPersonalityId a personality id - @param aClassUids an array of class uids - @return KErrNone if successful, otherwise the error that occurred - @publishedPartner - @released - */ - IMPORT_C TInt GetSupportedClasses(TInt aPersonalityId, RArray& aClassUids); - - /** - Queries the USB manager to determine if a given class is supported - - @param aPersonalityId a personality id - @param aClassUid a class uid - @param aSupported set upon return - @return KErrNone if successful, otherwise the error that occurred - @publishedPartner - @released - */ - IMPORT_C TInt ClassSupported(TInt aPersonalityId, TUid aClassUid, TBool& aSupported); - - /** - Gets all supported personality ids of the device's USB service. - - @param aPersonalityIds populated with all supported personality ids of the USB device - @return KErrNone if successful, otherwise the error that occurred - @publishedPartner - @released - */ - IMPORT_C TInt GetPersonalityIds(RArray& aPersonalityIds); - - /** - Marks the start of heap cell checking for the USB Manager. This function is only defined - in debug builds. - - @return KErrNone if successful, otherwise the error that occurred - - @publishedPartner - @released - */ - IMPORT_C TInt __DbgMarkHeap(); - - /** - Checks that the number of allocated cells on the USB Manager's heap is correct. The USB - Manager will be panicked if it is not. This function is only defined in debug builds. - - @param aCount The expected number of heap cells allocated - @return KErrNone if successful, otherwise the error that occurred - - @publishedPartner - @released - */ - IMPORT_C TInt __DbgCheckHeap(TInt aCount); - - /** - Marks the end of heap cell checking for the USB Manager. Checks that the number of heap - cells allocated since the last __DbgMarkHeap() is aCount; the most common value to pass - here is zero. This function is only defined in debug builds. - - @param aCount The expected number of heap cells allocated - @return KErrNone if successful, otherwise the error that occurred - - @publishedPartner - @released - */ - IMPORT_C TInt __DbgMarkEnd(TInt aCount); - - /** - Simulates memory allocation failure in the USB Manager. This function is only defined in - debug builds. - - @param aCount The number of allocations after which memory allocation should fail - @return KErrNone if successful, otherwise the error that occurred - - @publishedPartner - @released - */ - IMPORT_C TInt __DbgFailNext(TInt aCount); - - /** - Functions below this point are deprecated and should not be used. - */ - - /** - Get the current state of the device's USB service. This function is deprecated and has been - replaced by the GetServiceState function from version 7.0s onwards. - - - @since 7.0 - @param aState Set by the method to the current state of the USB service - - @return KErrNone if successful, otherwise the error that occurred - - @publishedPartner - @deprecated - */ - IMPORT_C TInt GetCurrentState(TUsbServiceState& aState); - - /** - Request to be notified of a change in state of the USB device. This function is deprecated - and has been replaced by the DeviceStateNotification function from version 7.0s onwards. - - - @since 7.0 - @param aStateMask State mask of the states the client is interested in - @param aState State variable to be written to upon completion of the request - @param aStatus Status to complete when required state change occurs - - @publishedPartner - @deprecated - */ - IMPORT_C void StateNotification( - TUint aStateMask, - TUsbDeviceState& aState, - TRequestStatus& aStatus - ); - - /** - Cancel the outstanding device state notification request. This function is deprecated and - has been replaced by the DeviceStateNotificationCancel function from version 7.0s onwards. - - - @since 7.0 - - @publishedPartner - @deprecated - */ - IMPORT_C void StateNotificationCancel(); - - /** - * Set or reset the mode in which current RUsb session operates. - * Recent implementation assumes that there is the one and only application - * which controls USBMAN, all other clients act as listeners to notification - * requests. Only application which was previously granted 'control' mode is - * allowed to reset it at later stage. Any calls from other applications will - * generate an error. - * - * @param aValue True to inform USBMAN that Application wants to 'control' - * USBMAN - * False otherwise - * - * @capability NetworkControl - * @return KErrNone if successful - * KErrAccessDenied otherwise - */ - IMPORT_C TInt SetCtlSessionMode(TBool aValue); - - /** - * Cable watcher wants to assert Bus_request. - * If ID-Pin is present this is an A-Device and this will result in an attempt - * to raise VBus. Second attempt to raise VBus causes KErrUsbOtgVbusAlreadyRaised - * error. - * If ID-Pin is absent this is a B-Device and this will result in an attempt to - * use SRP. Recently does nothing - * - * When BusRequest() returns an error, VBus remains low until the errors are cleared by - * BusDrop() or BusClearErr() calls - * - * @capability NetworkControl - * @return KErrNone if successful, otherwise an error code returned by OTGDI - */ - IMPORT_C TInt BusRequest(); - - /** - * Cable watcher wants to assert Bus_request after SRP. - * If ID-Pin is present this is an A-Device and this will result in an attempt - * to raise VBus - * - * @capability NetworkControl - * @return KErrNone if successful, otherwise an error code returned by OTGDI - */ - IMPORT_C TInt BusRespondSrp(); - - /** - * Cable watcher wants to clear the Bus Error after A_VBUS_ERR - * Only works if ID-Pin is present (this is an A-Device) and there - * has already been a bus erorr. - * This will not result in any attempt to raise or drop VBus - * - * @capability NetworkControl - * @return KErrNone if successful, otherwise an error code returned by OTGDI - */ - IMPORT_C TInt BusClearError(); - - /** - * Cable watcher wants to drop VBus. - * If ID-Pin is present this is an A-Device and this will result in stopping VBus - * power-up - * - * @capability NetworkControl - * @return KErrNone if successful, otherwise an error code returned by OTGDI - */ - IMPORT_C TInt BusDrop(); - - /** - * Register for Messages notifications - * The request only completes when the new message arrives. - * Calling this function the first time initializes Messages queue - * - * - * @param aMessage UI Message variable to be written to upon completion - * of the request - * @param aStatus Status to complete when required state change occurs - * KErrNone - if successful - * KErrInUse - if there is another outstanding nofitication request - * for the same session - * otherwise an error code returned by OTGDI or Host - */ - IMPORT_C void MessageNotification(TRequestStatus& aStatus, TInt& aMessage); - - /** - * Cancel the outstanding Messages notification request. - */ - IMPORT_C void MessageNotificationCancel(); - - /** - * Register for Host Device Event notifications. - * The request only completes when the host event occurs. - * Calling this function the first time initializes Host Events queue - * - * @param aStatus Status to complete when required event occurs - * - * KErrNone - if successful - * KErrInUse - if there is another outstanding nofitication - * request for the same session - * otherwise an error code returned by FDF - * @param aDeviceInformation device info to be written to upon completion - * of the request - */ - IMPORT_C void HostEventNotification(TRequestStatus& aStatus, - TDeviceEventInformation& aDeviceInformation); - /** - * Cancel the outstanding FDF Device Event notification request. - */ - IMPORT_C void HostEventNotificationCancel(); - - /** - * Enable Function Driver Loading. - * - * @capability NetworkControl - * @return KErrNone - if successful - * KErrNotSupported - if FDF is not included in current configuration - * otherwise an error code returned by FDF - */ - IMPORT_C TInt EnableFunctionDriverLoading(); - - /** - * Disable Function Driver Loading. - * - * @capability NetworkControl - */ - IMPORT_C void DisableFunctionDriverLoading(); - - /** - * Get Supported Languages from USB Device - * - * @param aDeviceId DeviceID of given device - * @param aLangIds an array of language IDs supported by given device. - * These language IDs are supplied by USB-IF and are - * different from standard Symbian TLanguage enumeration - * - * @return KErrNone - if successful - * otherwise an error code returned by FDF - */ - IMPORT_C TInt GetSupportedLanguages(TUint aDeviceId, RArray& aLangIds); - - /** - * Get Manufacturer Descriptor - * - * @param aDeviceId DeviceID of given device - * @param aLangId required language ID which is supplied by USB-IF and is - * different from standard Symbian TLanguage enumeration - * @param aString manufacturer descriptor value at output - * - * @return KErrNone - if successful - * otherwise an error code returned by FDF - */ - IMPORT_C TInt GetManufacturerStringDescriptor(TUint aDeviceId, TUint aLangId, TName& aString); - - /** - * Get Product Descriptor - * - * @param aDeviceId DeviceID of given device - * @param aLangId required language ID which is supplied by USB-IF and is - * different from standard Symbian TLanguage enumeration - * @param aString product descriptor value at output - * - * @return KErrNone - if successful - * otherwise an error code returned by FDF - */ - IMPORT_C TInt GetProductStringDescriptor(TUint aDeviceId, TUint aLangId, TName& aString); - - /** - * Retrieve Otg Descriptor for device which has given device Id. - * Currently TOtgDescriptor has following fields: - * - HNP supported - * - SRP supported - * An OTG device should support them both. - * - * @param aDeviceId DeviceID of given device - * @param aDescriptor OTG descriptor value at output - * - * @return KErrNone - if successful - * otherwise an error code returned by FDF - */ - IMPORT_C TInt GetOtgDescriptor(TUint aDeviceId, TOtgDescriptor& aDescriptor); - - /** - Simulates memory allocation in the USB Manager. This function is only defined in - debug builds. - - @return KErrNone if successful, otherwise the error that occurred - - @publishedPartner - @released - */ - IMPORT_C TInt __DbgAlloc(); - - /** - Informs USB Manager that the client would like to initialte USB session. - On A-Device, it results in sending a notification to 'controller' application - On B-Device, it may trigger either SRP or HNP sequence depending on the state of VBus - - @return KErrNone if successful, otherwise the error that occurred - - @publishedPartner - @released - */ - IMPORT_C TInt RequestSession(); - - - /** - Gets the property of the personality identified by the aPersonalityId. - - @param aPersonalityId a personality id - @return the personality property - @publishedPartner - @released - */ - IMPORT_C TInt GetPersonalityProperty(TInt aPersonalityId, TUint32& aProperty); - - /** - Gets the detailed textual description of the personality identified by the aPersonalityId. - Caller is repsonsible for freeing up memories allocated to - aLocalizedPersonalityDescriptor. - - @param aPersonalityId a personality id - @param aLocalizedPersonalityDescriptor a localize text string - @return KErrNone if successful, otherwise the error that occurred - @publishedPartner - @released - */ - IMPORT_C TInt GetDetailedDescription(TInt aPersonalityId, HBufC*& aLocalizedPersonalityDescriptor); - -private: - /** - Used to register device state notifications. - */ - TPckg iDeviceStatePkg; - - /** - Used to register service state notifications. - */ - TPckg iServiceStatePkg; - - /** - Used to register OTG/Host message notifications. - */ - TPckg iMessagePkg; - - /** - Used to register Host state notifications. - */ - TPckg iHostPkg; - }; - -#endif //__USBMAN_H__ diff -r 703a2b94c06c -r dde4619868dc tsrc/testtools/usbman_stub/usbman/client/public/usbstates.h --- a/tsrc/testtools/usbman_stub/usbman/client/public/usbstates.h Wed Sep 15 13:20:24 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,96 +0,0 @@ -/* -* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -/** - @file -*/ - -#ifndef __USBSTATES_H__ -#define __USBSTATES_H__ - -#include - -/** TUsbServiceState - - Enumeration of all the USB service states. - - @publishedPartner - @released -*/ -enum TUsbServiceState - { - /** EUsbServiceIdle - The service is not started. - */ - EUsbServiceIdle = 0x01, - - /** EUsbServiceStarting */ - EUsbServiceStarting = 0x02, - - /** EUsbServiceStarted */ - EUsbServiceStarted = 0x04, - - /** EUsbServiceStopping */ - EUsbServiceStopping = 0x08, - - /** EUsbServiceFatalError */ - EUsbServiceFatalError = 0x10 - }; - -/** TUsbDeviceState - - Enumeration of all of the states of the USB device. - The states reported are dependent on the hardware. - - *** If this changes update KUsbDeviceStates below *** - - @publishedPartner - @released -*/ -enum TUsbDeviceState - { - /** EUsbDeviceStateUndefined */ - EUsbDeviceStateUndefined = 0x00, - - /** EUsbDeviceStateDefault */ - EUsbDeviceStateDefault = 0x01, - - /** EUsbDeviceStateAttached */ - EUsbDeviceStateAttached = 0x02, - - /** EUsbDeviceStatePowered */ - EUsbDeviceStatePowered = 0x04, - - /** EUsbDeviceStateConfigured */ - EUsbDeviceStateConfigured = 0x08, - - /** EUsbDeviceStateAddress */ - EUsbDeviceStateAddress = 0x10, - - /** EUsbDeviceStateSuspended */ - EUsbDeviceStateSuspended = 0x20 - }; - -/** -Number of different USB Device States - -@publishedPartner -*/ -const TInt KUsbDeviceStates = 7; - - -#endif //__USBSTATES_H__ diff -r 703a2b94c06c -r dde4619868dc tsrc/testtools/usbman_stub/usbman/client/rom/usbManStubSIS.iby --- a/tsrc/testtools/usbman_stub/usbman/client/rom/usbManStubSIS.iby Wed Sep 15 13:20:24 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,23 +0,0 @@ -/* -* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifndef USBMANSISECLIPSING_IBY -#define USBMANSISECLIPSING_IBY - -data=DATAZ_\system\install\UsbMan_stub.sis System\Install\usbman_stub.sis - -#endif diff -r 703a2b94c06c -r dde4619868dc tsrc/testtools/usbman_stub/usbman/client/src/RUsb.cpp --- a/tsrc/testtools/usbman_stub/usbman/client/src/RUsb.cpp Wed Sep 15 13:20:24 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1031 +0,0 @@ -/* -* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#include -#include -#include -#include -#include -#include "rusb.h" -#include -#include -#include "usbmandll_stub.h" -#include - -#ifdef __FLOG_ACTIVE -_LIT8(KLogComponent, "USBMAN"); -#endif - -#ifdef __USBMAN_NO_PROCESSES__ -#include -#endif - -// CONSTANTS -//const TUint KUsbAllStates = 0xFFFFFFFF; - -_LIT8(KLogStub, "[USBMAN] [Stub]"); - -static TInt StartServer() -// -// Start the server process or thread -// - { - const TUidType serverUid(KNullUid, KNullUid, KUsbmanSvrUid); - -#ifdef __USBMAN_NO_PROCESSES__ - // - // In EKA1 WINS the server is a DLL, the exported entrypoint returns a TInt - // which represents the real entry-point for the server thread - // - RLibrary lib; - TInt err = lib.Load(KUsbmanImg, serverUid); - - if (err != KErrNone) - { - return err; - } - - TLibraryFunction ordinal1 = lib.Lookup(1); - TThreadFunction serverFunc = reinterpret_cast(ordinal1()); - - // - // To deal with the unique thread (+semaphore!) naming in EPOC, and that we may - // be trying to restart a server that has just exited we attempt to create a - // unique thread name for the server. - // This uses Math::Random() to generate a 32-bit random number for the name - // - TName name(KUsbServerName); - name.AppendNum(Math::Random(),EHex); - - RThread server; - err = server.Create ( - name, - serverFunc, - KUsbmanStackSize, - NULL, - &lib, - NULL, - KUsbmanMinHeapSize, - KUsbmanMaxHeapSize, - EOwnerProcess - ); - - lib.Close(); // if successful, server thread has handle to library now -#else - // - // EPOC and EKA2 is easy, we just create a new server process. Simultaneous - // launching of two such processes should be detected when the second one - // attempts to create the server object, failing with KErrAlreadyExists. - // - RProcess server; - TInt err = server.Create(KUsbmanImg, KNullDesC, serverUid); -#endif //__USBMAN_NO_PROCESSES__ - - if (err != KErrNone) - { - return err; - } - - TRequestStatus stat; - server.Rendezvous(stat); - - if (stat!=KRequestPending) - server.Kill(0); // abort startup - else - server.Resume(); // logon OK - start the server - - User::WaitForRequest(stat); // wait for start or death - - // we can't use the 'exit reason' if the server panicked as this - // is the panic 'reason' and may be '0' which cannot be distinguished - // from KErrNone - err = (server.ExitType() == EExitPanic) ? KErrServerTerminated : stat.Int(); - - server.Close(); - - LOGTEXT2(_L8("USB server started successfully: err = %d\n"),err); - - return err; - } - - - - -EXPORT_C RUsb::RUsb() - : iDeviceStatePkg(0), iServiceStatePkg(0), iMessagePkg(0), - iHostPkg(TDeviceEventInformation()) - { - LOG_LINE - LOG_FUNC - } - -EXPORT_C RUsb::~RUsb() - { - LOG_LINE - LOG_FUNC - } - -EXPORT_C TVersion RUsb::Version() const - { - return(TVersion(KUsbSrvMajorVersionNumber,KUsbSrvMinorVersionNumber,KUsbSrvBuildVersionNumber)); - } - -EXPORT_C TInt RUsb::Connect() - { - LOG_LINE - LOG_FUNC - - TInt retry = 2; - - FOREVER - { - // Create the session to UsbSrv with 10 asynchronous message slots - TInt err = CreateSession(KUsbServerName, Version(), 10); - - if ((err != KErrNotFound) && (err != KErrServerTerminated)) - { - return err; - } - - if (--retry == 0) - { - return err; - } - - err = StartServer(); - - if ((err != KErrNone) && (err != KErrAlreadyExists)) - { - return err; - } - } - } - -EXPORT_C void RUsb::Start(TRequestStatus& aStatus) - { - LOG_LINE - LOG_FUNC - - SendReceive(EUsbStart, aStatus); - } - -EXPORT_C void RUsb::StartCancel() - { - LOG_LINE - LOG_FUNC - - SendReceive(EUsbStartCancel); - } - -EXPORT_C void RUsb::Stop() - { - LOG_LINE - LOG_FUNC - - SendReceive(EUsbStop); - } - -EXPORT_C void RUsb::Stop(TRequestStatus& aStatus) - { - LOG_LINE - LOG_FUNC - - SendReceive(EUsbStop, aStatus); - } - -EXPORT_C void RUsb::StopCancel() - { - LOG_LINE - LOG_FUNC - - SendReceive(EUsbStopCancel); - } - -EXPORT_C TInt RUsb::GetServiceState(TUsbServiceState& aState) - { - LOG_LINE - LOG_FUNC - - CStubber* stubber = CStubber::NewL(); - TApiBehavior beh( KUsbManStubAgentDll, EServiceState, 0, 0, KNullDesC8 ); - stubber -> InvokeApi( beh ); - - delete stubber; - stubber = NULL; - - if ( beh.iOutput != KNullDesC8 ) - { - if ( !beh.iOutput.Compare( _L8( "EUsbServiceIdle" ) ) ) - aState = EUsbServiceIdle; - else if ( !beh.iOutput.Compare( _L8( "EUsbServiceStarting" ) ) ) - aState = EUsbServiceStarting; - else if ( !beh.iOutput.Compare( _L8( "EUsbServiceStarted" ) ) ) - aState = EUsbServiceStarted; - else if ( !beh.iOutput.Compare( _L8( "EUsbServiceStopping" ) ) ) - aState = EUsbServiceStopping; - else if ( !beh.iOutput.Compare( _L8( "EUsbServiceFatalError" ) ) ) - aState = EUsbServiceFatalError; - else - {} - } - else - { - TPckg pkg(aState); - TInt ret=SendReceive(EUsbGetCurrentState, TIpcArgs(&pkg)); - aState=(TUsbServiceState)pkg(); - return ret; - } - return beh.iCompleteCode; - } - -EXPORT_C TInt RUsb::GetCurrentState(TUsbServiceState& aState) - { - LOG_LINE - LOG_FUNC - - return GetServiceState(aState); - } - -EXPORT_C void RUsb::ServiceStateNotification(TUsbServiceState& aState, - TRequestStatus& aStatus) - { - LOG_LINE - LOG_FUNC - - iServiceStatePkg.Set((TUint8*)&aState, sizeof(TUint32), sizeof(TUint32)); - - SendReceive(EUsbRegisterServiceObserver, TIpcArgs(&iServiceStatePkg), aStatus); - } - -EXPORT_C void RUsb::ServiceStateNotificationCancel() - { - LOG_LINE - LOG_FUNC - - SendReceive(EUsbCancelServiceObserver); - } - -EXPORT_C TInt RUsb::GetDeviceState(TUsbDeviceState& aState) - { - LOG_LINE - LOG_FUNC - - _LIT8( KLogStubConfigured, "[USBMAN] [StubConfigured]"); - CUsbLog::Write(KLogStub, KNullDesC8()); - - CStubber* stubber = CStubber::NewL(); - TApiBehavior beh( KUsbManStubAgentDll, EGetDeviceState, 0, 0, KNullDesC8 ); - stubber -> InvokeApi( beh ); - - delete stubber; - stubber = NULL; - - if ( beh.iOutput != KNullDesC8 ) - { - CUsbLog::Write(KLogStub, KNullDesC8()); - if ( !beh.iOutput.Compare( _L8( "EUsbDeviceStateUndefined" ) ) ) - aState = EUsbDeviceStateUndefined; - else if ( !beh.iOutput.Compare( _L8( "EUsbDeviceStateDefault" ) ) ) - aState = EUsbDeviceStateDefault; - else if ( !beh.iOutput.Compare( _L8( "EUsbDeviceStateAttached" ) ) ) - aState = EUsbDeviceStateAttached; - else if ( !beh.iOutput.Compare( _L8( "EUsbDeviceStatePowered" ) ) ) - aState = EUsbDeviceStatePowered; - else if ( !beh.iOutput.Compare( _L8( "EUsbDeviceStateConfigured" ) ) ) - { - aState = EUsbDeviceStateConfigured; - CUsbLog::Write(KLogStubConfigured, KNullDesC8()); - } - else if ( !beh.iOutput.Compare( _L8( "EUsbDeviceStateAddress" ) ) ) - aState = EUsbDeviceStateAddress; - else if ( !beh.iOutput.Compare( _L8( "EUsbDeviceStateSuspended" ) ) ) - aState = EUsbDeviceStateSuspended; - else - {} - } - else - { - _LIT8(KLogNoStub, "[USBMAN] [NoStub]"); - CUsbLog::Write(KLogNoStub, KNullDesC8()); - TPckg pkg(aState); - TInt ret=SendReceive(EUsbGetCurrentDeviceState, TIpcArgs(&pkg)); - aState=(TUsbDeviceState)pkg(); - return ret; - } - - return beh.iCompleteCode; - } - -EXPORT_C void RUsb::DeviceStateNotification(TUint aEventMask, TUsbDeviceState& aState, - TRequestStatus& aStatus) - { - LOG_LINE - LOG_FUNC - - CUsbLog::Write(KLogStub, KNullDesC8()); - CStubber* stubber = CStubber::NewL(); - TApiBehavior beh( KUsbManStubAgentDll, EDeviceStateNotification, 0, 0, KNullDesC8 ); - stubber -> InvokeApi( beh ); - - delete stubber; - stubber = NULL; - - TRequestStatus* stat = &aStatus; - - if ( beh.iOutput != KNullDesC8 ) - { - if ( !beh.iOutput.Compare( _L8( "EUsbDeviceStateUndefined" ) ) ) - aState = EUsbDeviceStateUndefined; - else if ( !beh.iOutput.Compare( _L8( "EUsbDeviceStateDefault" ) ) ) - aState = EUsbDeviceStateDefault; - else if ( !beh.iOutput.Compare( _L8( "EUsbDeviceStateAttached" ) ) ) - aState = EUsbDeviceStateAttached; - else if ( !beh.iOutput.Compare( _L8( "EUsbDeviceStatePowered" ) ) ) - aState = EUsbDeviceStatePowered; - else if ( !beh.iOutput.Compare( _L8( "EUsbDeviceStateConfigured" ) ) ) - aState = EUsbDeviceStateConfigured; - else if ( !beh.iOutput.Compare( _L8( "EUsbDeviceStateAddress" ) ) ) - aState = EUsbDeviceStateAddress; - else if ( !beh.iOutput.Compare( _L8( "EUsbDeviceStateSuspended" ) ) ) - aState = EUsbDeviceStateSuspended; - else - {} - User::RequestComplete( stat, beh.iAsyncCompleteCode ); - } - else - { - iDeviceStatePkg.Set((TUint8*)&aState, sizeof(TUint32), sizeof(TUint32)); - SendReceive(EUsbRegisterObserver, TIpcArgs(aEventMask, &iDeviceStatePkg), aStatus); - } - - } - -EXPORT_C void RUsb::DeviceStateNotificationCancel() - { - LOG_LINE - LOG_FUNC - - CStubber* stubber = CStubber::NewL(); - TApiBehavior beh( KUsbManStubAgentDll, EDeviceStateNotificationCancel, 0, 0, KNullDesC8 ); - stubber -> InvokeApi( beh ); - - delete stubber; - stubber = NULL; - - if ( beh.iOutput != KNullDesC8 ) - { - - } - else - { - SendReceive(EUsbCancelObserver); - } - } - -EXPORT_C void RUsb::StateNotification(TUint aEventMask, TUsbDeviceState& aState, TRequestStatus& aStatus) - { - LOG_LINE - LOG_FUNC - - DeviceStateNotification(aEventMask, aState, aStatus); - } - -EXPORT_C void RUsb::StateNotificationCancel() - { - LOG_LINE - LOG_FUNC - - DeviceStateNotificationCancel(); - } - -EXPORT_C void RUsb::TryStart(TInt aPersonalityId, TRequestStatus& aStatus) - { - LOG_LINE - LOG_FUNC - - CStubber* stubber = CStubber::NewL(); - TApiBehavior beh( KUsbManStubAgentDll, ETryStartAsync, 0, 0, KNullDesC8 ); - stubber -> InvokeApi( beh ); - - delete stubber; - stubber = NULL; - - if ( beh.iOutput != KNullDesC8 ) - { - TRequestStatus* stat = &aStatus; - User::RequestComplete( stat, beh.iAsyncCompleteCode ); - } - else - { - TIpcArgs ipcArgs(aPersonalityId); - SendReceive(EUsbTryStart, ipcArgs, aStatus); - } - } - -EXPORT_C void RUsb::TryStop(TRequestStatus& aStatus) - { - LOG_LINE - LOG_FUNC - - CStubber* stubber = CStubber::NewL(); - TApiBehavior beh( KUsbManStubAgentDll, ETryStopAsync, 0, 0, KNullDesC8 ); - stubber -> InvokeApi( beh ); - - delete stubber; - stubber = NULL; - - if ( beh.iOutput != KNullDesC8 ) - { - TRequestStatus* stat = &aStatus; - User::RequestComplete( stat, beh.iAsyncCompleteCode ); - } - else - SendReceive(EUsbTryStop, aStatus); - } - -EXPORT_C TInt RUsb::CancelInterest(TUsbReqType aMessageId) - { - LOG_LINE - LOG_FUNC - - CStubber* stubber = CStubber::NewL(); - TApiBehavior beh( KUsbManStubAgentDll, ECancelInterest, 0, 0, KNullDesC8 ); - stubber -> InvokeApi( beh ); - - delete stubber; - stubber = NULL; - - if ( beh.iOutput != KNullDesC8 ) - { - - } - else - { - TInt messageId; - switch (aMessageId) - { - case EStart: - messageId = EUsbStart; - break; - case EStop: - messageId = EUsbStop; - break; - case ETryStart: - messageId = EUsbTryStart; - break; - case ETryStop: - messageId = EUsbTryStop; - break; - default: - return KErrNotSupported; - } - - TIpcArgs ipcArgs(messageId); - return SendReceive(EUsbCancelInterest, ipcArgs); - } - - return beh.iCompleteCode; - } - -EXPORT_C TInt RUsb::GetDescription(TInt aPersonalityId, HBufC*& aLocalizedPersonalityDescriptor) - { - LOG_LINE - LOG_FUNC - - TInt ret = KErrNone; - // caller is responsible for freeing up memory allocatd for aLocalizedPersonalityDescriptor - TRAP(ret, aLocalizedPersonalityDescriptor = HBufC::NewL(KUsbStringDescStringMaxSize)); - if (ret == KErrNone) - { - TPtr ptr = aLocalizedPersonalityDescriptor->Des(); - TIpcArgs ipcArgs(0, &ptr); - ipcArgs.Set(0, aPersonalityId); - ret = SendReceive(EUsbGetDescription, ipcArgs); - } - else - { - // just in case caller tries to free the memory before checking the return code - aLocalizedPersonalityDescriptor = NULL; - } - - return ret; - } - -EXPORT_C TInt RUsb::GetCurrentPersonalityId(TInt& aPersonalityId) - { - LOG_LINE - LOG_FUNC - - CUsbLog::Write(KLogStub, KNullDesC8()); - CStubber* stubber = CStubber::NewL(); - TApiBehavior beh( KUsbManStubAgentDll, EGetCurrentPersonalityId, 0, 0, KNullDesC8 ); - stubber -> InvokeApi( beh ); - - delete stubber; - stubber = NULL; - - if ( beh.iOutput != KNullDesC8 ) - { - if ( !beh.iOutput.Compare( _L8( "KUsbPersonalityIdPCSuite" ) ) ) - aPersonalityId = KUsbPersonalityIdPCSuite; - else if ( !beh.iOutput.Compare( _L8( "KUsbPersonalityIdMS" ) ) ) - aPersonalityId = KUsbPersonalityIdMS; - else if ( !beh.iOutput.Compare( _L8( "KUsbPersonalityIdPTP" ) ) ) - aPersonalityId = KUsbPersonalityIdPTP; - else if ( !beh.iOutput.Compare( _L8( "KUsbPersonalityIdMTP" ) ) ) - aPersonalityId = KUsbPersonalityIdMTP; - else if ( !beh.iOutput.Compare( _L8( "KUsbPersonalityIdPCSuite" ) ) ) - aPersonalityId = KUsbPersonalityIdPCSuite; - else - {} - } - else - { - TPckg pkg0(aPersonalityId); - TInt ret = SendReceive(EUsbGetCurrentPersonalityId, TIpcArgs(&pkg0)); - aPersonalityId = static_cast(pkg0()); - return ret; - } - - return beh.iCompleteCode; - } - -EXPORT_C TInt RUsb::GetSupportedClasses(TInt aPersonalityId, RArray& aClassUids) - { - LOG_LINE - LOG_FUNC - - TInt ret = KErrNone; - HBufC8* buf = NULL; - // +1 for the actual count of personality ids - TRAP(ret, buf = HBufC8::NewL((KUsbMaxSupportedClasses + 1)*sizeof (TInt32))); - if (ret != KErrNone) - { - return ret; - } - - TPtr8 ptr8 = buf->Des(); - ret = SendReceive(EUsbGetSupportedClasses, TIpcArgs(aPersonalityId, &ptr8)); - - if (ret == KErrNone) - { - const TInt32* recvedIds = reinterpret_cast(buf->Ptr()); - if (!recvedIds) - { - delete buf; - return KErrCorrupt; - } - - TInt arraySize = *recvedIds++; - // Copy received supported class ids to aClassUids - for (TInt i = 0; i < arraySize; i++) - { - if (recvedIds) - { - ret = aClassUids.Append(TUid::Uid(*recvedIds++)); - if(ret!=KErrNone) - { - //Remove all the ids appended so far (assume the last append failed, because - //the only reason to fail is if the array couldn't grow to accommodate another - //element). - //It would be easier to just reset the array, but we never specified that - //aClassUids should be an empty array, nor did we specify that this method - //might empty the array. To maintain exisiting behaviour we should return - //aClassUids to the state it was in when this method was called. - TInt last = aClassUids.Count() - 1; - while(i>0) - { - aClassUids.Remove(last); - i--; - last--; - } - break; - } - } - else - { - ret = KErrCorrupt; - break; - } - } - } - - delete buf; - return ret; - } - -EXPORT_C TInt RUsb::ClassSupported(TInt aPersonalityId, TUid aClassUid, TBool& aSupported) - { - LOG_LINE - LOG_FUNC - - TPckg pkg2(aSupported); - TIpcArgs ipcArgs(aPersonalityId, aClassUid.iUid, &pkg2); - - TInt ret = SendReceive(EUsbClassSupported, ipcArgs); - - if (ret == KErrNone) - { - aSupported = static_cast(pkg2()); - } - - return ret; - } - -EXPORT_C TInt RUsb::GetPersonalityIds(RArray& aPersonalityIds) - { - LOG_LINE - LOG_FUNC - - TInt ret = KErrNone; - HBufC8* buf = NULL; - // +1 for the actual count of personality ids - TRAP(ret, buf = HBufC8::NewL((KUsbMaxSupportedPersonalities + 1)*sizeof (TInt))); - if (ret != KErrNone) - { - return ret; - } - - TPtr8 ptr8 = buf->Des(); - ret = SendReceive(EUsbGetPersonalityIds, TIpcArgs(&ptr8)); - - if (ret == KErrNone) - { - const TInt* recvedIds = reinterpret_cast(buf->Ptr()); - if (!recvedIds) - { - delete buf; - return KErrCorrupt; - } - - TInt arraySize = *recvedIds++; - // Copy received personality ids to aPersonalityIds - for (TInt i = 0; i < arraySize; i++) - { - if (recvedIds) - { - ret = aPersonalityIds.Append(*recvedIds++); - - if(ret!=KErrNone) - { - //Remove all the ids appended so far (assume the last append failed, because - //the only reason to fail is if the array couldn't grow to accommodate another - //element). - //It would be easier to just reset the array, but we never specified that - //aPersonalityIds should be an empty array, nor did we specify that this method - //might empty the array. To maintain exisiting behaviour we should return - //aPersonalityIds to the state it was in when this method was called. - TInt last = aPersonalityIds.Count() - 1; - while(i>0) - { - aPersonalityIds.Remove(last); - i--; - last--; - } - break; - } - } - else - { - ret = KErrCorrupt; - break; - } - } - } - - delete buf; - return ret; - } - -EXPORT_C TInt RUsb::__DbgMarkHeap() - { -#ifdef _DEBUG - return SendReceive(EUsbDbgMarkHeap); -#else - return KErrNone; -#endif - } - -EXPORT_C TInt RUsb::__DbgCheckHeap(TInt aCount) - { -#ifdef _DEBUG - return SendReceive(EUsbDbgCheckHeap, TIpcArgs(aCount)); -#else - (void)aCount; // not used for Release builds - return KErrNone; -#endif - } - -EXPORT_C TInt RUsb::__DbgMarkEnd(TInt aCount) - { -#ifdef _DEBUG - return SendReceive(EUsbDbgMarkEnd, TIpcArgs(aCount)); -#else - (void)aCount; // not used for Release builds - return KErrNone; -#endif - } - -EXPORT_C TInt RUsb::__DbgFailNext(TInt aCount) - { -#ifdef _DEBUG - return SendReceive(EUsbDbgFailNext, TIpcArgs(aCount)); -#else - (void)aCount; // not used for Release builds - return KErrNone; -#endif - } - -EXPORT_C TInt RUsb::__DbgAlloc() - { -#ifdef _DEBUG - return SendReceive(EUsbDbgAlloc); -#else - return KErrNone; -#endif - } - -EXPORT_C void panic() - { - _USB_PANIC(KUsbCliPncCat, EUsbPanicRemovedExport); - } - -EXPORT_C TInt RUsb::SetCtlSessionMode(TBool aValue) - { - LOG_LINE - LOG_FUNC - -// CUsbLog::Write(KLogStub, KNullDesC8()); -// CStubber* stubber = CStubber::NewL(); -// TApiBehavior beh( KUsbManStubAgentDll, ESetCtlSessionMode, 0, 0, KNullDesC8 ); -// stubber -> InvokeApi( beh ); -// -// delete stubber; -// stubber = NULL; -// -// if ( beh.iOutput != KNullDesC8 ) -// { -// return KErrNone; -// } -// else -// { - TPckg pkg(aValue); - return SendReceive(EUsbSetCtlSessionMode, TIpcArgs(&pkg)); -// } - - } - -EXPORT_C TInt RUsb::BusRequest() - { - LOG_LINE - LOG_FUNC - - return SendReceive(EUsbBusRequest); - } - -EXPORT_C TInt RUsb::BusRespondSrp() - { - LOG_LINE - LOG_FUNC - - return SendReceive(EUsbBusRespondSrp); - } - -EXPORT_C TInt RUsb::BusClearError() - { - LOG_LINE - LOG_FUNC - - return SendReceive(EUsbBusClearError); - } - - -EXPORT_C TInt RUsb::BusDrop() - { - LOG_LINE - LOG_FUNC - - return SendReceive(EUsbBusDrop); - } - -EXPORT_C void RUsb::MessageNotification(TRequestStatus& aStatus, TInt& aMessage) - { - LOG_LINE - LOG_FUNC - - iMessagePkg.Set((TUint8*)&aMessage, sizeof(TInt), sizeof(TInt)); - - SendReceive(EUsbRegisterMessageObserver, TIpcArgs(&iMessagePkg), aStatus); - } - -EXPORT_C void RUsb::MessageNotificationCancel() - { - LOG_LINE - LOG_FUNC - - SendReceive(EUsbCancelMessageObserver); - } - -EXPORT_C void RUsb::HostEventNotification(TRequestStatus& aStatus, - TDeviceEventInformation& aDeviceInformation) - { - LOG_LINE - LOG_FUNC - - iHostPkg.Set((TUint8*)&aDeviceInformation, sizeof(TDeviceEventInformation), sizeof(TDeviceEventInformation)); - - SendReceive(EUsbRegisterHostObserver, TIpcArgs(&iHostPkg), aStatus); - } - -EXPORT_C void RUsb::HostEventNotificationCancel() - { - LOG_LINE - LOG_FUNC - - SendReceive(EUsbCancelHostObserver); - } - -EXPORT_C TInt RUsb::EnableFunctionDriverLoading() - { - LOG_LINE - LOG_FUNC - - return SendReceive(EUsbEnableFunctionDriverLoading); - } - -EXPORT_C void RUsb::DisableFunctionDriverLoading() - { - LOG_LINE - LOG_FUNC - - SendReceive(EUsbDisableFunctionDriverLoading); - } - -EXPORT_C TInt RUsb::GetSupportedLanguages(TUint aDeviceId, RArray& aLangIds) - { - LOG_LINE - LOG_FUNC - - aLangIds.Reset(); - - TInt ret = KErrNone; - HBufC8* buf = NULL; - // +1 for the actual count of language ids - TRAP(ret, buf = HBufC8::NewL((KUsbMaxSupportedLanguageIds + 1)*sizeof (TUint))); - if (ret != KErrNone) - { - return ret; - } - - TPtr8 ptr8 = buf->Des(); - ret = SendReceive(EUsbGetSupportedLanguages, TIpcArgs(aDeviceId, &ptr8)); - - if (ret == KErrNone) - { - const TUint* recvedIds = reinterpret_cast(buf->Ptr()); - if (!recvedIds) - { - delete buf; - return KErrCorrupt; - } - - TInt arraySize = *recvedIds++; - // Copy received language ids to aLangIds - for (TInt i = 0; i < arraySize; i++) - { - ret = aLangIds.Append(*recvedIds++); // increments by sizeof(TUint) - if ( ret ) - { - aLangIds.Reset(); - break; - } - } - } - - delete buf; - return ret; - } - -EXPORT_C TInt RUsb::GetManufacturerStringDescriptor(TUint aDeviceId, TUint aLangId, TName& aString) - { - LOG_LINE - LOG_FUNC - - return SendReceive(EUsbGetManufacturerStringDescriptor, TIpcArgs(aDeviceId, aLangId, &aString)); - } - -EXPORT_C TInt RUsb::GetProductStringDescriptor(TUint aDeviceId, TUint aLangId, TName& aString) - { - LOG_LINE - LOG_FUNC - - return SendReceive(EUsbGetProductStringDescriptor, TIpcArgs(aDeviceId, aLangId, &aString)); - } - -EXPORT_C TInt RUsb::GetOtgDescriptor(TUint aDeviceId, TOtgDescriptor& aDescriptor) - { - LOG_LINE - LOG_FUNC - - TPckg otgDescPkg(aDescriptor); - - TIpcArgs args; - args.Set(0, aDeviceId); - args.Set(1, &otgDescPkg); - - return SendReceive(EUsbGetOtgDescriptor, args); - } - - -EXPORT_C TInt RUsb::RequestSession() - { - LOG_LINE - LOG_FUNC - - return SendReceive(EUsbRequestSession); - } - -EXPORT_C TInt RUsb::GetDetailedDescription(TInt aPersonalityId, HBufC*& aLocalizedPersonalityDescriptor) - { - LOG_LINE - LOG_FUNC - - TInt ret = KErrNone; - // caller is responsible for freeing up memory allocated for aLocalizedPersonalityDescriptor - TRAP(ret, aLocalizedPersonalityDescriptor = HBufC::NewL(KUsbStringDescStringMaxSize)); - if (ret == KErrNone) - { - TPtr ptr = aLocalizedPersonalityDescriptor->Des(); - TIpcArgs ipcArgs(0, &ptr); - ipcArgs.Set(0, aPersonalityId); - ret = SendReceive(EUsbGetDetailedDescription, ipcArgs); - } - else - { - // just in case caller tries to free the memory before checking the return code - aLocalizedPersonalityDescriptor = NULL; - } - - return ret; - } - -EXPORT_C TInt RUsb::GetPersonalityProperty(TInt aPersonalityId, TUint32& aProperty) - { - LOG_LINE - LOG_FUNC - - CUsbLog::Write(KLogStub, KNullDesC8()); - TPckg pkg(aProperty); - TInt ret = SendReceive(EUsbGetPersonalityProperty, TIpcArgs(aPersonalityId, &pkg)); - if (ret == KErrNone) - { - aProperty = static_cast(pkg()); - } - -// CUsbLog::Write(KLogStub, KNullDesC8()); -// CStubber* stubber = CStubber::NewL(); -// TApiBehavior beh( KUsbManStubAgentDll, EGetPersonalityProperty, 0, 0, KNullDesC8 ); -// stubber -> InvokeApi( beh ); -// -// delete stubber; -// stubber = NULL; -// -// if ( beh.iOutput != KNullDesC8 ) -// { -// if ( !beh.iOutput.Compare( _L8( "stub" ) ) ) -// { -// CUsbLog::Write(KLogStub, KNullDesC8()); -// TRequestStatus stat; -// TInt message; -// MessageNotification(stat,message); -// DeviceStateNotificationCancel(); -// TUsbDeviceState aState; -// GetDeviceState(aState); -// DeviceStateNotification( KUsbAllStates, aState, stat ); -// TryStop(stat); -// User::WaitForRequest(stat); -// TInt personalityId; -// GetCurrentPersonalityId(personalityId); -// TryStart(personalityId,stat); -// User::WaitForRequest(stat); -// } -// else -// {} -// } - - return ret; - } diff -r 703a2b94c06c -r dde4619868dc tsrc/testtools/usbman_stub/usbman/server/public/rusb.h --- a/tsrc/testtools/usbman_stub/usbman/server/public/rusb.h Wed Sep 15 13:20:24 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,116 +0,0 @@ -/* -* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -/** - @file - @internalComponent -*/ - -#ifndef __RUSB_H__ -#define __RUSB_H__ - -#include -#include - -const TInt KUsbSrvMajorVersionNumber = 1; -const TInt KUsbSrvMinorVersionNumber = 1; -const TInt KUsbSrvBuildVersionNumber = 0; - -const TInt KUsbMaxSupportedClasses = 64; // Max number of supported USB classes by a personality - -const TInt KUsbMaxSupportedPersonalities = 64; // Max number of supported personalities - -_LIT(KUsbServerName, "!usbman"); - -enum TUsbMessages - { - EUsbStart, - EUsbStop, - EUsbRegisterObserver, - EUsbGetCurrentState, - EUsbStartCancel, - EUsbCancelObserver, - EUsbStopCancel, - EUsbGetCurrentDeviceState, - EUsbRegisterServiceObserver, - EUsbCancelServiceObserver, - EUsbDbgMarkHeap, - EUsbDbgCheckHeap, - EUsbDbgMarkEnd, - EUsbDbgFailNext, - EUsbTryStart, - EUsbTryStop, - EUsbCancelInterest, - EUsbGetCurrentPersonalityId, - EUsbGetSupportedClasses, - EUsbGetPersonalityIds, - EUsbGetDescription, - EUsbClassSupported, - - - EUsbSetCtlSessionMode, - EUsbBusRequest, - EUsbBusRespondSrp, - EUsbBusClearError, - - EUsbBusDrop, - EUsbRegisterMessageObserver, - EUsbCancelMessageObserver, - EUsbRegisterHostObserver, - EUsbCancelHostObserver, - EUsbEnableFunctionDriverLoading, - EUsbDisableFunctionDriverLoading, - EUsbGetSupportedLanguages, - EUsbGetManufacturerStringDescriptor, - EUsbGetProductStringDescriptor, - EUsbGetOtgDescriptor, - EUsbDbgAlloc, - EUsbRequestSession, - EUsbGetDetailedDescription, - EUsbGetPersonalityProperty - }; - -_LIT(KUsbCliPncCat, "UsbMan-Client"); - -enum TUsbPanicClient - { - EUsbCreateFailure, - EUsbPanicIllegalIPC, - EUsbPanicRemovedExport - }; - -const TUid KUsbmanSvrUid = {0x101fe1db}; - -#ifdef __USBMAN_NO_PROCESSES__ - -const TUint KUsbmanStackSize = 0x3000; // 12KB -const TUint KUsbmanMinHeapSize = 0x1000; // 4KB -const TUint KUsbmanMaxHeapSize = 0x40000; // 256KB - -_LIT(KUsbmanImg, "usbsvr"); - -#else - -#ifndef __OVER_DUMMYUSBDI__ -_LIT(KUsbmanImg, "z:\\system\\programs\\usbsvr.exe"); -#else -_LIT(KUsbmanImg, "z:\\system\\programs\\usbsvr_over_dummyusbdi.exe"); -#endif - -#endif //__USBMAN_NO_PROCESSES__ - -#endif //__RUSB_H__ diff -r 703a2b94c06c -r dde4619868dc tsrc/testtools/usbman_stub/usbman/server/public/usbman.rh --- a/tsrc/testtools/usbman_stub/usbman/server/public/usbman.rh Wed Sep 15 13:20:24 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,133 +0,0 @@ -/* -* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* Resource header for usbman configuration. -* -*/ - -/** - @file - @publishedPartner - @released -*/ - -STRUCT usb_configuration - { - /** - vendorId is the 16-bit number that is assigned by USB-ORG. - */ - WORD vendorId = 0x0e22; - - /** - productId is a 16-bit number that is assigned by the licensee to - uniquely identify this particular type of device. - */ - WORD productId = 0x000b; - - /** - bcdDevice may be optionally used during enumeration, this depends on - the licensee's policy regarding device upgrades (new versions of a - device may require to use new host driver files) - */ - WORD bcdDevice = 0x0000; - - /** - manufacturerString is displayed on the Windows screen during first - enumeration of the device, and should identify the same company that - owns the USB vendorId given above - */ - LTEXT manufacturer = "Symbian Ltd."; - - /** - productString is displayed on the Windows screen during first - enumeration of the device, and should identify the same device that is - implied by the productId given above - */ - LTEXT product = "Symbian OS"; - } - -STRUCT PERSONALITY - { - /** Class code (assigned by the USB-IF). If this field is set to zero, each interface within - a configuration specifies its own class information and the various interfaces operate independently. - - If this field is set to a value between 1 and FEH, the device supports different class - specifications on different interfaces and the interfaces may not operate independently. - This value identifies the class definition used for the aggregate interfaces. - - If this field is set to FFH, the device class is vendor-specific. */ - BYTE bDeviceClass; - - /** Subclass code (assigned by the USB-IF). These codes are qualified by the value of the bDeviceClass field. - If the bDeviceClass field is set to zero, this field must also be set to zero. - If the bDeviceClass field is not set to FFH, all values are reserved for assignment by the USB-IF. */ - BYTE bDeviceSubClass; - - /** Protocol code (assigned by the USB-IF). These codes are qualified by the value of the bDeviceClass and the - bDeviceSubClass fields. If a device supports class-specific protocols on a device basis as opposed to an - interface basis, this code identifies the protocols that the device uses as defined by the specification of the device class. - If this field is set to zero, the device does not use class-specific protocols on a device basis. However, it may use - classspecific protocols on an interface basis. - If this field is set to FFH, the device uses a vendor-specific protocol on a device basis. */ - BYTE protocol; - - /** Number of possible configurations */ - BYTE numConfigurations; - - /** vendorId is the 16-bit number that is assigned by USB-ORG. */ - WORD vendorId; - - /** productId is a 16-bit number that is assigned by the licensee to - uniquely identify this particular personality as type of device . */ - WORD productId; - - /** bcdDevice may be optionally used during enumeration, this depends on - the licensee's policy regarding device upgrades */ - WORD bcdDevice; - - /** manufacturerString is displayed on the Windows screen during first - enumeration of the device, and should identify the same company that - owns the USB vendorId given above */ - LTEXT manufacturer; - - /** productString is displayed on the Windows screen during first - enumeration of the device, and should identify the same device that is - implied by the productId given above */ - LTEXT product; - - /** personality id - UID which identified this personality */ - WORD id; - - /** list of Class Controllers UIDs associated with this personality. - UIDs shoud be provided as list of hexadecimal numbers separated by space or comma. - Note Do not provide leading 0x or any trailing characters! - Example "1Abc3422, 12345678 FE43bc33" - Incorrect example "1abc3422, 0x12345678," */ - LTEXT class_uids; - - /** free text description of this personality. */ - LTEXT description; - - /** free text detailed description of this personality. */ - LTEXT detailedDescription; - - /** personality property - the property of this personality */ - LONG property; - - } - -STRUCT PERSONALITY_ARRAY - { - STRUCT personalities[]; // STRUCT PERSONALITY - } diff -r 703a2b94c06c -r dde4619868dc usbclasses/usbbasicpersonality/tsrc/UsbBasicPersonalityTest/Bmarm/UsbBasicPersonalityTestu.def --- a/usbclasses/usbbasicpersonality/tsrc/UsbBasicPersonalityTest/Bmarm/UsbBasicPersonalityTestu.def Wed Sep 15 13:20:24 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,3 +0,0 @@ -EXPORTS - LibEntryL__FR13CTestModuleIf @ 1 NONAME R3UNUSED ; LibEntryL(CTestModuleIf &) - diff -r 703a2b94c06c -r dde4619868dc usbclasses/usbbasicpersonality/tsrc/UsbBasicPersonalityTest/Bwins/UsbBasicPersonalityTestu.def --- a/usbclasses/usbbasicpersonality/tsrc/UsbBasicPersonalityTest/Bwins/UsbBasicPersonalityTestu.def Wed Sep 15 13:20:24 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,3 +0,0 @@ -EXPORTS - ?LibEntryL@@YAPAVCScriptBase@@AAVCTestModuleIf@@@Z @ 1 NONAME ; class CScriptBase * __cdecl LibEntryL(class CTestModuleIf &) - diff -r 703a2b94c06c -r dde4619868dc usbclasses/usbbasicpersonality/tsrc/UsbBasicPersonalityTest/conf/UsbBasicPersonalityTest.cfg --- a/usbclasses/usbbasicpersonality/tsrc/UsbBasicPersonalityTest/conf/UsbBasicPersonalityTest.cfg Wed Sep 15 13:20:24 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,126 +0,0 @@ -/* -* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -[StifSettings] -CapsModifier= UsbBasicPersonalityTest.exe -[EndStifSettings] - -// UsbBasicPersonalityTest Module - total 12 tc - -// UsbBasicPersonalityTest Api Tests (12 tc) - -[Test] -title Create And Delete Test -create UsbBasicPersonalityTest tester -tester ExecuteApiTest CreateAndDeleteTest -delete tester -[Endtest] - -[Test] -title Is Active Test -create UsbBasicPersonalityTest tester -tester ExecuteApiTest IsActiveTest -delete tester -[Endtest] - -[Test] -title Is Added Test -create UsbBasicPersonalityTest tester -tester ExecuteApiTest IsAddedTest -delete tester -[Endtest] - -[Test] -title Priority Test -create UsbBasicPersonalityTest tester -tester ExecuteApiTest PriorityTest -delete tester -[Endtest] - -[Test] -title Prepare Personality Start Test -create UsbBasicPersonalityTest tester -tester ExecuteApiTest PreparePersonalityStartTest -delete tester -[Endtest] - -[Test] -title Confirm Personality Unload Test -create UsbBasicPersonalityTest tester -tester ExecuteApiTest ConfirmPersonalityUnloadTest -delete tester -[Endtest] - -[Test] -title State Change Notify Test -create UsbBasicPersonalityTest tester -tester ExecuteApiTest StateChangeNotifyTest -delete tester -[Endtest] - -[Test] -title Finish Personality Start Test -create UsbBasicPersonalityTest tester -tester ExecuteApiTest FinishPersonalityStartTest -delete tester -[Endtest] - -[Test] -title Finish Personality Stop Test -create UsbBasicPersonalityTest tester -tester ExecuteApiTest FinishPersonalityStopTest -delete tester -[Endtest] - -[Test] -title Prepare Personality Stop Test -create UsbBasicPersonalityTest tester -tester ExecuteApiTest PreparePersonalityStopTest -delete tester -[Endtest] - -[Test] -title Set Priority Test -create UsbBasicPersonalityTest tester -tester ExecuteApiTest SetPriorityTest -delete tester -[Endtest] - -[Test] -title Show Usb Connection Note Test -create UsbBasicPersonalityTest tester -tester ExecuteApiTest ShowUsbConnectionNoteTest -delete tester -[Endtest] - - -// Add new api tests here -// ... - - -// UsbBasicPersonalityTest Module Tests (... tc) - - -// Add new module tests here -// ... - - -// UsbBasicPersonalityTest Branch Tests (... tc) - - -// Add new branch tests here -// ... diff -r 703a2b94c06c -r dde4619868dc usbclasses/usbbasicpersonality/tsrc/UsbBasicPersonalityTest/eabi/UsbBasicPersonalityTestu.def --- a/usbclasses/usbbasicpersonality/tsrc/UsbBasicPersonalityTest/eabi/UsbBasicPersonalityTestu.def Wed Sep 15 13:20:24 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,3 +0,0 @@ -EXPORTS - _Z9LibEntryLR13CTestModuleIf @ 1 NONAME - diff -r 703a2b94c06c -r dde4619868dc usbclasses/usbbasicpersonality/tsrc/UsbBasicPersonalityTest/group/UsbBasicPersonalityTest.mmp --- a/usbclasses/usbbasicpersonality/tsrc/UsbBasicPersonalityTest/group/UsbBasicPersonalityTest.mmp Wed Sep 15 13:20:24 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,54 +0,0 @@ -/* -* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - - -#if defined(__S60_) - // To get the OSEXT_LAYER_SYSTEMINCLUDE-definition - #include -#endif - -TARGET UsbBasicPersonalityTest.dll -TARGETTYPE dll -UID 0x1000008D 0x101FB3E3 - -CAPABILITY LocalServices ReadDeviceData NetworkControl WriteDeviceData DiskAdmin ReadUserData WriteUserData ProtServ - -DEFFILE UsbBasicPersonalityTest.def - - -USERINCLUDE ../inc - -MW_LAYER_SYSTEMINCLUDE - -USERINCLUDE ../../../inc - - -SOURCEPATH ../src -SOURCE UsbBasicPersonalityTest.cpp -SOURCE UsbBasicPersonalityTestBlocks.cpp UsbBasicPersonalityTest_exe.cpp - -LIBRARY euser.lib -LIBRARY stiftestinterface.lib -LIBRARY stiftestengine.lib -LIBRARY ecom.lib -LIBRARY usbman.lib -LIBRARY usbpersonality.lib - - -LANG SC - -// End of File diff -r 703a2b94c06c -r dde4619868dc usbclasses/usbbasicpersonality/tsrc/UsbBasicPersonalityTest/group/UsbBasicPersonalityTest_ats.pkg --- a/usbclasses/usbbasicpersonality/tsrc/UsbBasicPersonalityTest/group/UsbBasicPersonalityTest_ats.pkg Wed Sep 15 13:20:24 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,63 +0,0 @@ -; -; Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -; All rights reserved. -; This component and the accompanying materials are made available -; under the terms of "Eclipse Public License v1.0" -; which accompanies this distribution, and is available -; at the URL "http://www.eclipse.org/legal/epl-v10.html". -; -; Initial Contributors: -; Nokia Corporation - initial contribution. -; -; Contributors: -; -; Description: -; -; - -; Languages -&EN - -; Provide value for uid -#{"STIF"},(0x00000000),1,1,0,TYPE=SA - -; Series60 product id for S60 3.0 -[0x101F7961], 0, 0, 0, {"Series60ProductID"} - -; Localised Vendor name -%{"Nokia"} - -; Unique Vendor name -:"Nokia" - -; Logo -; None - -; Package signature - Optional -; None - -; Start of Package body - -; Condition blocks -; None - -; Options list -; None - -; Install files -"\epoc32\release\armv5\udeb\UsbBasicPersonalityTest.dll"-"c:\Sys\Bin\UsbBasicPersonalityTest.dll" -"\epoc32\release\armv5\udeb\UsbBasicPersonalityTest.exe"-"c:\Sys\Bin\UsbBasicPersonalityTest.exe" - -"..\init\UsbBasicPersonalityTest_ats.ini"-"e:\testing\init\UsbBasicPersonalityTest.ini" -"..\conf\UsbBasicPersonalityTest.cfg"-"e:\testing\conf\UsbBasicPersonalityTest.cfg" - -; Embedded SIS -; None - -; End of Package body - -; PKG dependencies -; None - -; PKG capabilities -; None diff -r 703a2b94c06c -r dde4619868dc usbclasses/usbbasicpersonality/tsrc/UsbBasicPersonalityTest/group/UsbBasicPersonalityTest_exe.mmp --- a/usbclasses/usbbasicpersonality/tsrc/UsbBasicPersonalityTest/group/UsbBasicPersonalityTest_exe.mmp Wed Sep 15 13:20:24 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,41 +0,0 @@ -/* -* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - - -#if defined(__S60_) - #include -#endif - -TARGET UsbBasicPersonalityTest.exe -TARGETTYPE exe - -CAPABILITY LocalServices ReadDeviceData NetworkControl WriteDeviceData DiskAdmin ReadUserData WriteUserData ProtServ - -UID 0 0xEF4892C6 - -MW_LAYER_SYSTEMINCLUDE - -SOURCEPATH ../src - -SOURCE UsbBasicPersonalityTest_exe.cpp - -LIBRARY euser.lib -LIBRARY stiftestinterface.lib - -EPOCSTACKSIZE 40960 - -// End of File diff -r 703a2b94c06c -r dde4619868dc usbclasses/usbbasicpersonality/tsrc/UsbBasicPersonalityTest/group/UsbBasicPersonalityTest_phone.pkg --- a/usbclasses/usbbasicpersonality/tsrc/UsbBasicPersonalityTest/group/UsbBasicPersonalityTest_phone.pkg Wed Sep 15 13:20:24 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,63 +0,0 @@ -; -; Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -; All rights reserved. -; This component and the accompanying materials are made available -; under the terms of "Eclipse Public License v1.0" -; which accompanies this distribution, and is available -; at the URL "http://www.eclipse.org/legal/epl-v10.html". -; -; Initial Contributors: -; Nokia Corporation - initial contribution. -; -; Contributors: -; -; Description: -; - - -; Languages -&EN - -; Provide value for uid -#{"STIF"},(0x00000000),1,1,0,TYPE=SA - -; Series60 product id for S60 3.0 -[0x1028315F], 0, 0, 0, {"Series60ProductID"} - -; Localised Vendor name -%{"Nokia"} - -; Unique Vendor name -:"Nokia" - -; Logo -; None - -; Package signature - Optional -; None - -; Start of Package body - -; Condition blocks -; None - -; Options list -; None - -; Install files -"\epoc32\release\armv5\urel\UsbBasicPersonalityTest.dll"-"c:\Sys\Bin\UsbBasicPersonalityTest.dll" -"\epoc32\release\armv5\urel\UsbBasicPersonalityTest.exe"-"c:\Sys\Bin\UsbBasicPersonalityTest.exe" - -"..\init\UsbBasicPersonalityTest_phone.ini"-"c:\testframework\testframework.ini" -"..\conf\UsbBasicPersonalityTest.cfg"-"c:\testframework\UsbBasicPersonalityTest.cfg" - -; Embedded SIS -; None - -; End of Package body - -; PKG dependencies -; None - -; PKG capabilities -; None diff -r 703a2b94c06c -r dde4619868dc usbclasses/usbbasicpersonality/tsrc/UsbBasicPersonalityTest/group/bld.inf --- a/usbclasses/usbbasicpersonality/tsrc/UsbBasicPersonalityTest/group/bld.inf Wed Sep 15 13:20:24 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,32 +0,0 @@ -/* -* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - - -PRJ_PLATFORMS -DEFAULT - -PRJ_TESTEXPORTS - -PRJ_EXPORTS - -PRJ_TESTMMPFILES -UsbBasicPersonalityTest.mmp -UsbBasicPersonalityTest_exe.mmp - -PRJ_MMPFILES - -// End of File diff -r 703a2b94c06c -r dde4619868dc usbclasses/usbbasicpersonality/tsrc/UsbBasicPersonalityTest/group/build_sis_ats.bat --- a/usbclasses/usbbasicpersonality/tsrc/UsbBasicPersonalityTest/group/build_sis_ats.bat Wed Sep 15 13:20:24 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,22 +0,0 @@ -@rem -@rem Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -@rem All rights reserved. -@rem This component and the accompanying materials are made available -@rem under the terms of "Eclipse Public License v1.0" -@rem which accompanies this distribution, and is available -@rem at the URL "http://www.eclipse.org/legal/epl-v10.html". -@rem -@rem Initial Contributors: -@rem Nokia Corporation - initial contribution. -@rem -@rem Contributors: -@rem -@rem Description: -@rem - -call sbs -c armv5.test -call sbs freeze -call sbs -c armv5.test - -call makesis UsbBasicPersonalityTest_ats.pkg -call signsis UsbBasicPersonalityTest_ats.sis UsbBasicPersonalityTest_ats.sisx x:\rd.cer x:\rd-key.pem diff -r 703a2b94c06c -r dde4619868dc usbclasses/usbbasicpersonality/tsrc/UsbBasicPersonalityTest/group/build_sis_phone.bat --- a/usbclasses/usbbasicpersonality/tsrc/UsbBasicPersonalityTest/group/build_sis_phone.bat Wed Sep 15 13:20:24 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,22 +0,0 @@ -@rem -@rem Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -@rem All rights reserved. -@rem This component and the accompanying materials are made available -@rem under the terms of "Eclipse Public License v1.0" -@rem which accompanies this distribution, and is available -@rem at the URL "http://www.eclipse.org/legal/epl-v10.html". -@rem -@rem Initial Contributors: -@rem Nokia Corporation - initial contribution. -@rem -@rem Contributors: -@rem -@rem Description: -@rem - -call sbs -c armv5.test -call sbs freeze -call sbs -c armv5.test - -call makesis UsbBasicPersonalityTest_phone.pkg -call signsis UsbBasicPersonalityTest_phone.sis UsbBasicPersonalityTest_phone.sisx x:\rd.cer x:\rd-key.pem diff -r 703a2b94c06c -r dde4619868dc usbclasses/usbbasicpersonality/tsrc/UsbBasicPersonalityTest/inc/UsbBasicPersonalityTest.h --- a/usbclasses/usbbasicpersonality/tsrc/UsbBasicPersonalityTest/inc/UsbBasicPersonalityTest.h Wed Sep 15 13:20:24 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,231 +0,0 @@ -/* -* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - - - - -#ifndef USBBASICPERSONALITYTEST_H -#define USBBASICPERSONALITYTEST_H - -// INCLUDES -#include -#include -#include -#include -#include -#include "TUsbPersonalityParams.h" - -class RUsb; -class CUsbPersonalityNotifier; - - -// CONSTANTS -//const ?type ?constant_var = ?constant; - -// MACROS -//#define ?macro ?macro_def -#define TEST_CLASS_VERSION_MAJOR 0 -#define TEST_CLASS_VERSION_MINOR 0 -#define TEST_CLASS_VERSION_BUILD 0 - -// Logging path -//_LIT( KUsbBasicPersonalityTestLogPath, "\\logs\\testframework\\UsbBasicPersonalityTest\\" ); - -// Logging path for ATS - for phone builds comment this line -_LIT( KUsbBasicPersonalityTestLogPath, "e:\\testing\\stiflogs\\" ); - -// Log file -_LIT( KUsbBasicPersonalityTestLogFile, "UsbBasicPersonalityTest.txt" ); -_LIT( KUsbBasicPersonalityTestLogFileWithTitle, "UsbBasicPersonalityTest_[%S].txt" ); - -// FUNCTION PROTOTYPES -//?type ?function_name(?arg_list); - -// FORWARD DECLARATIONS -//class ?FORWARD_CLASSNAME; -class CUsbBasicPersonalityTest; - -// DATA TYPES -//enum ?declaration - -enum TUsbBasicPersonalityTestResult - { - ETestCasePassed, - ETestCaseFailed - }; - -//typedef ?declaration -//extern ?data_type; - -// CLASS DECLARATION - -/** -* CUsbBasicPersonalityTest test class for STIF Test Framework TestScripter. -* ?other_description_lines -* -* @lib ?library -* @since ?Series60_version -*/ -NONSHARABLE_CLASS(CUsbBasicPersonalityTest) : public CScriptBase - { - public: // Constructors and destructor - - /** - * Two-phased constructor. - */ - static CUsbBasicPersonalityTest* NewL( CTestModuleIf& aTestModuleIf ); - - /** - * Destructor. - */ - virtual ~CUsbBasicPersonalityTest(); - - public: // New functions - - /** - * ?member_description. - * @since ?Series60_version - * @param ?arg1 ?description - * @return ?description - */ - //?type ?member_function( ?type ?arg1 ); - - public: // Functions from base classes - - /** - * From CScriptBase Runs a script line. - * @since ?Series60_version - * @param aItem Script line containing method name and parameters - * @return Symbian OS error code - */ - virtual TInt RunMethodL( CStifItemParser& aItem ); - - protected: // New functions - - /** - * ?member_description. - * @since ?Series60_version - * @param ?arg1 ?description - * @return ?description - */ - //?type ?member_function( ?type ?arg1 ); - - protected: // Functions from base classes - - /** - * From ?base_class ?member_description - */ - //?type ?member_function(); - - private: - - /** - * C++ default constructor. - */ - CUsbBasicPersonalityTest( CTestModuleIf& aTestModuleIf ); - - /** - * By default Symbian 2nd phase constructor is private. - */ - void ConstructL(); - - // Prohibit copy constructor if not deriving from CBase. - // ?classname( const ?classname& ); - // Prohibit assigment operator if not deriving from CBase. - // ?classname& operator=( const ?classname& ); - - /** - * Frees all resources allocated from test methods. - * @since ?Series60_version - */ - void Delete(); - - /** - * Test methods are listed below. - */ - - virtual TInt ExecuteApiTest( CStifItemParser& aItem ); - virtual TInt ExecuteModuleTest( CStifItemParser& aItem ); - virtual TInt ExecuteBranchTest( CStifItemParser& aItem ); - - /** - * Method used to log version of test class - */ - void SendTestClassVersion(); - - //ADD NEW METHOD DEC HERE - //[TestMethods] - Do not remove - - void DoExecuteApiTestL( TPtrC aApiTestName, TUsbBasicPersonalityTestResult& aTestResult ); - void ExampleApiTestL( TUsbBasicPersonalityTestResult& aTestResult ); - - void DoExecuteModuleTestL( TPtrC aModuleTestName, TUsbBasicPersonalityTestResult& aTestResult ); - void ExampleModuleTestL( TUsbBasicPersonalityTestResult& aTestResult ); - - void DoExecuteBranchTestL( TPtrC aBranchTestName, TUsbBasicPersonalityTestResult& aTestResult ); - void ExampleBranchTestL( TUsbBasicPersonalityTestResult& aTestResult ); - - TInt CreateAndDeleteTest( TUsbBasicPersonalityTestResult& aTestResult ); - TInt StateChangeNotifyTest( TUsbBasicPersonalityTestResult& aTestResult ); - TInt IsActiveTest( TUsbBasicPersonalityTestResult& aTestResult ); - TInt IsAddedTest( TUsbBasicPersonalityTestResult& aTestResult ); - TInt PriorityTest( TUsbBasicPersonalityTestResult& aTestResult ); - TInt ConfirmPersonalityUnloadTest( TUsbBasicPersonalityTestResult& aTestResult ); - TInt PreparePersonalityStartTest( TUsbBasicPersonalityTestResult& aTestResult ); - TInt ShowUsbConnectionNoteTest( TUsbBasicPersonalityTestResult& aTestResult ); //TODO Check - TInt FinishPersonalityStartTest( TUsbBasicPersonalityTestResult& aTestResult ); - TInt FinishPersonalityStopTest( TUsbBasicPersonalityTestResult& aTestResult ); - TInt PreparePersonalityStopTest( TUsbBasicPersonalityTestResult& aTestResult ); - TInt SetPriorityTest( TUsbBasicPersonalityTestResult& aTestResult ); - - - public: // Data - // ?one_line_short_description_of_data - //?data_declaration; - - protected: // Data - // ?one_line_short_description_of_data - //?data_declaration; - - private: // Data - - // ?one_line_short_description_of_data - //?data_declaration; - - CActiveScheduler* iScheduler; - TRequestStatus iStatus; - - RUsb iUsb; - CUsbPersonalityNotifier *iNotifier; - TUsbPersonalityParams *iParams; - CUsbPersonalityPlugin *iPlugin; - - // Reserved pointer for future extension - //TAny* iReserved; - - public: // Friend classes - //?friend_class_declaration; - protected: // Friend classes - //?friend_class_declaration; - private: // Friend classes - //?friend_class_declaration; - - }; - -#endif // USBBASICPERSONALITYTEST_H - -// End of File diff -r 703a2b94c06c -r dde4619868dc usbclasses/usbbasicpersonality/tsrc/UsbBasicPersonalityTest/init/UsbBasicPersonalityTest_ats.ini --- a/usbclasses/usbbasicpersonality/tsrc/UsbBasicPersonalityTest/init/UsbBasicPersonalityTest_ats.ini Wed Sep 15 13:20:24 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,235 +0,0 @@ -# -# Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -# All rights reserved. -# This component and the accompanying materials are made available -# under the terms of "Eclipse Public License v1.0" -# which accompanies this distribution, and is available -# at the URL "http://www.eclipse.org/legal/epl-v10.html". -# -# Initial Contributors: -# Nokia Corporation - initial contribution. -# -# Contributors: -# -# Description: -# -# - -# -# This is STIF initialization file -# Comment lines start with '#'-character. -# See STIF TestFramework users guide.doc for instructions - -# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -# Set following test engine settings: -# - Set Test Reporting mode. TestReportMode's possible values are: -# + 'Summary': Summary of the tested test cases. -# + 'Environment': Hardware and software info. -# + 'TestCases': Test case report. -# + 'FullReport': Set of all above ones. -# + Example 'TestReportMode= Summary TestCases' -# -# - CreateTestReport setting controls report creation mode -# + YES, Test report will created. -# + NO, No Test report. -# -# - File path indicates the base path of the test report. -# - File name indicates the name of the test report. -# -# - File format indicates the type of the test report. -# + TXT, Test report file will be txt type, for example 'TestReport.txt'. -# + HTML, Test report will be html type, for example 'TestReport.html'. -# + XML, Test report will be xml type, for example 'TestReport.xml'. -# Note, that xml format is available only when output is set to FILE. -# -# - File output indicates output source of the test report. -# + FILE, Test report logging to file. -# + RDEBUG, Test report logging to using rdebug. -# -# - File Creation Mode indicates test report overwriting if file exist. -# + OVERWRITE, Overwrites if the Test report file exist. -# + APPEND, Continue logging after the old Test report information if -# report exist. -# - Sets a device reset module's dll name(Reboot). -# + If Nokia specific reset module is not available or it is not correct one -# StifHWResetStub module may use as a template for user specific reset -# module. -# - Sets STIF test measurement disable options. e.g. pluging1 and pluging2 disablation -# DisableMeasurement= stifmeasurementplugin01 stifmeasurementplugin02 -# - -[Engine_Defaults] - -TestReportMode= FullReport # Possible values are: 'Empty', 'Summary', 'Environment', - 'TestCases' or 'FullReport' - -CreateTestReport= YES # Possible values: YES or NO - -TestReportFilePath= e:\testing\logs\ -TestReportFileName= UsbBasicPersonalityTest_TestReport - -TestReportFormat= TXT # Possible values: TXT, HTML or XML -TestReportOutput= FILE # Possible values: FILE or RDEBUG -TestReportFileCreationMode= OVERWRITE # Possible values: OVERWRITE or APPEND - -DeviceResetDllName= StifResetForNokia.dll # e.g. 'StifHWResetStub.dll' for user specific reseting - -DisableMeasurement= stifmeasurementdisablenone # Possible values are: - # 'stifmeasurementdisablenone', 'stifmeasurementdisableall' - # 'stifmeasurementplugin01', 'stifmeasurementplugin02', - # 'stifmeasurementplugin03', 'stifmeasurementplugin04', - # 'stifmeasurementplugin05' or 'stifbappeaprofiler' - -Timeout= 0 # Default timeout value for each test case. In milliseconds -UITestingSupport= YES # Possible values: YES or NO -#SeparateProcesses= YES # Possible values: YES or NO (default: NO) -[End_Defaults] -# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - - - -# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -# Module configurations start -# Modules are added between module tags -# tags. Module name is specified after ModuleName= tag, like -# ModuleName= UsbBasicPersonalityTestUsbBasicPersonalityTestUsbBasicPersonalityTest -# Modules might have initialisation file, specified as -# IniFile= c:\testframework\YYYYYY -# Modules might have several configuration files, like -# TestCaseFile= c:\testframework\NormalCases.txt -# TestCaseFile= c:\testframework\SmokeCases.txt -# TestCaseFile= c:\testframework\ManualCases.txt - -# (TestCaseFile is synonym for old term ConfigFile) - -# Following case specifies demo module settings. Demo module -# does not read any settings from file, so tags -# IniFile and TestCaseFile are not used. -# In the simplest case it is enough to specify only the -# name of the test module when adding new test module - -[New_Module] -ModuleName= testscripter -TestCaseFile= e:\testing\conf\UsbBasicPersonalityTest.cfg -[End_Module] - - -# Load testmoduleUsbBasicPersonalityTest, optionally with initialization file and/or test case files -#[New_Module] -#ModuleName= testmodulexxx - -#TestModuleUsbBasicPersonalityTest used initialization file -#IniFile= c:\testframework\init.txt - -#TestModuleUsbBasicPersonalityTest used configuration file(s) -#TestCaseFile= c:\testframework\testcases1.cfg -#TestCaseFile= c:\testframework\testcases2.cfg -#TestCaseFile= c:\testframework\manualtestcases.cfg - -#[End_Module] -# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - - - -# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -# Set STIF logging overwrite parameters for Logger. -# Hardware and emulator environment logging path and styles can -# be configured from here to overwrite the Logger's implemented values. -# -# Settings description: -# - Indicates option for creation log directory/directories. If log directory/directories -# is/are not created by user they will make by software. -# + YES, Create log directory/directories if not allready exist. -# + NO, Log directory/directories not created. Only created one is used. -# -# - Overwrite emulator path setting. -# + Example: If 'EmulatorBasePath= C:\LOGS\TestFramework\' and in code is defined -# Logger's path 'D:\\LOGS\\Module\\' with those definition the path -# will be 'C:\LOGS\TestFramework\LOGS\Module\' -# -# - Overwrite emulator's logging format. -# + TXT, Log file(s) will be txt type(s), for example 'Module.txt'. -# + HTML, Log file(s) will be html type(s), for example 'Module.html'. -# -# - Overwrited emulator logging output source. -# + FILE, Logging to file(s). -# + RDEBUG, Logging to using rdebug(s). -# -# - Overwrite hardware path setting (Same description as above in emulator path). -# - Overwrite hardware's logging format(Same description as above in emulator format). -# - Overwrite hardware's logging output source(Same description as above in emulator output). -# -# - File Creation Mode indicates file overwriting if file exist. -# + OVERWRITE, Overwrites if file(s) exist. -# + APPEND, Continue logging after the old logging information if file(s) exist. -# -# - Will thread id include to the log filename. -# + YES, Thread id to log file(s) name, Example filename 'Module_b9.txt'. -# + NO, No thread id to log file(s), Example filename 'Module.txt'. -# -# - Will time stamps include the to log file. -# + YES, Time stamp added to each line in log file(s). Time stamp is -# for example'12.Nov.2003 115958 LOGGING INFO' -# + NO, No time stamp(s). -# -# - Will line breaks include to the log file. -# + YES, Each logging event includes line break and next log event is in own line. -# + NO, No line break(s). -# -# - Will event ranking include to the log file. -# + YES, Event ranking number added to each line in log file(s). Ranking number -# depends on environment's tics, for example(includes time stamp also) -# '012 12.Nov.2003 115958 LOGGING INFO' -# + NO, No event ranking. -# -# - Will write log file in unicode format. -# + YES, Log file will be written in unicode format -# + NO, Log will be written as normal, not unicode, file. -# - -[Logger_Defaults] - -#NOTE: If you want to set Logger using next setting(s) remove comment(s)'#' -#NOTE: TestEngine and TestServer logging settings cannot change here - -#CreateLogDirectories= YES # Possible values: YES or NO - -#EmulatorBasePath= C:\LOGS\TestFramework\ -#EmulatorFormat= HTML # Possible values: TXT or HTML -#EmulatorOutput= FILE # Possible values: FILE or RDEBUG - -#HardwareBasePath= D:\LOGS\TestFramework\ -#HardwareFormat= HTML # Possible values: TXT or HTML -#HardwareOutput= FILE # Possible values: FILE or RDEBUG - -#FileCreationMode= OVERWRITE # Possible values: OVERWRITE or APPEND - -#ThreadIdToLogFile= YES # Possible values: YES or NO -#WithTimeStamp= YES # Possible values: YES or NO -#WithLineBreak= YES # Possible values: YES or NO -#WithEventRanking= YES # Possible values: YES or NO - -#FileUnicode= YES # Possible values: YES or NO -#AddTestCaseTitle= YES # Possible values: YES or NO -[End_Logger_Defaults] -# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - - - -# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -# Set filters to be used by ConsoleUI. -# If you want to use filter with ConsoleUI, simply remove comments -# from section below and provide valid filter entries. -# Each filter line has to start with "filter= " keyword. -# Filter can contain special wildcard characters: -# * which stands for none or any literal; -# ? which stands for single character. -# Filters are not case-sensitive. - -#[Filters] -#filter= *math* -#filter= *radio* -#[End_Filters] -# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - -# End of file diff -r 703a2b94c06c -r dde4619868dc usbclasses/usbbasicpersonality/tsrc/UsbBasicPersonalityTest/init/UsbBasicPersonalityTest_phone.ini --- a/usbclasses/usbbasicpersonality/tsrc/UsbBasicPersonalityTest/init/UsbBasicPersonalityTest_phone.ini Wed Sep 15 13:20:24 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,235 +0,0 @@ -# -# Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -# All rights reserved. -# This component and the accompanying materials are made available -# under the terms of "Eclipse Public License v1.0" -# which accompanies this distribution, and is available -# at the URL "http://www.eclipse.org/legal/epl-v10.html". -# -# Initial Contributors: -# Nokia Corporation - initial contribution. -# -# Contributors: -# -# Description: -# -# - -# -# This is STIF initialization file -# Comment lines start with '#'-character. -# See STIF TestFramework users guide.doc for instructions - -# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -# Set following test engine settings: -# - Set Test Reporting mode. TestReportMode's possible values are: -# + 'Summary': Summary of the tested test cases. -# + 'Environment': Hardware and software info. -# + 'TestCases': Test case report. -# + 'FullReport': Set of all above ones. -# + Example 'TestReportMode= Summary TestCases' -# -# - CreateTestReport setting controls report creation mode -# + YES, Test report will created. -# + NO, No Test report. -# -# - File path indicates the base path of the test report. -# - File name indicates the name of the test report. -# -# - File format indicates the type of the test report. -# + TXT, Test report file will be txt type, for example 'TestReport.txt'. -# + HTML, Test report will be html type, for example 'TestReport.html'. -# + XML, Test report will be xml type, for example 'TestReport.xml'. -# Note, that xml format is available only when output is set to FILE. -# -# - File output indicates output source of the test report. -# + FILE, Test report logging to file. -# + RDEBUG, Test report logging to using rdebug. -# -# - File Creation Mode indicates test report overwriting if file exist. -# + OVERWRITE, Overwrites if the Test report file exist. -# + APPEND, Continue logging after the old Test report information if -# report exist. -# - Sets a device reset module's dll name(Reboot). -# + If Nokia specific reset module is not available or it is not correct one -# StifHWResetStub module may use as a template for user specific reset -# module. -# - Sets STIF test measurement disable options. e.g. pluging1 and pluging2 disablation -# DisableMeasurement= stifmeasurementplugin01 stifmeasurementplugin02 -# - -[Engine_Defaults] - -TestReportMode= FullReport # Possible values are: 'Empty', 'Summary', 'Environment', - 'TestCases' or 'FullReport' - -CreateTestReport= YES # Possible values: YES or NO - -TestReportFilePath= c:\logs\testframework\UsbBasicPersonalityTest\ -TestReportFileName= testreport - -TestReportFormat= TXT # Possible values: TXT, HTML or XML -TestReportOutput= FILE # Possible values: FILE or RDEBUG -TestReportFileCreationMode= OVERWRITE # Possible values: OVERWRITE or APPEND - -DeviceResetDllName= StifResetForNokia.dll # e.g. 'StifHWResetStub.dll' for user specific reseting - -DisableMeasurement= stifmeasurementdisablenone # Possible values are: - # 'stifmeasurementdisablenone', 'stifmeasurementdisableall' - # 'stifmeasurementplugin01', 'stifmeasurementplugin02', - # 'stifmeasurementplugin03', 'stifmeasurementplugin04', - # 'stifmeasurementplugin05' or 'stifbappeaprofiler' - -Timeout= 0 # Default timeout value for each test case. In milliseconds -UITestingSupport= YES # Possible values: YES or NO -#SeparateProcesses= YES # Possible values: YES or NO (default: NO) -[End_Defaults] -# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - - - -# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -# Module configurations start -# Modules are added between module tags -# tags. Module name is specified after ModuleName= tag, like -# ModuleName= UsbBasicPersonalityTestUsbBasicPersonalityTestUsbBasicPersonalityTest -# Modules might have initialisation file, specified as -# IniFile= c:\testframework\YYYYYY -# Modules might have several configuration files, like -# TestCaseFile= c:\testframework\NormalCases.txt -# TestCaseFile= c:\testframework\SmokeCases.txt -# TestCaseFile= c:\testframework\ManualCases.txt - -# (TestCaseFile is synonym for old term ConfigFile) - -# Following case specifies demo module settings. Demo module -# does not read any settings from file, so tags -# IniFile and TestCaseFile are not used. -# In the simplest case it is enough to specify only the -# name of the test module when adding new test module - -[New_Module] -ModuleName= testscripter -TestCaseFile= c:\testframework\UsbBasicPersonalityTest.cfg -[End_Module] - - -# Load testmoduleUsbBasicPersonalityTest, optionally with initialization file and/or test case files -#[New_Module] -#ModuleName= testmodulexxx - -#TestModuleUsbBasicPersonalityTest used initialization file -#IniFile= c:\testframework\init.txt - -#TestModuleUsbBasicPersonalityTest used configuration file(s) -#TestCaseFile= c:\testframework\testcases1.cfg -#TestCaseFile= c:\testframework\testcases2.cfg -#TestCaseFile= c:\testframework\manualtestcases.cfg - -#[End_Module] -# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - - - -# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -# Set STIF logging overwrite parameters for Logger. -# Hardware and emulator environment logging path and styles can -# be configured from here to overwrite the Logger's implemented values. -# -# Settings description: -# - Indicates option for creation log directory/directories. If log directory/directories -# is/are not created by user they will make by software. -# + YES, Create log directory/directories if not allready exist. -# + NO, Log directory/directories not created. Only created one is used. -# -# - Overwrite emulator path setting. -# + Example: If 'EmulatorBasePath= C:\LOGS\TestFramework\' and in code is defined -# Logger's path 'D:\\LOGS\\Module\\' with those definition the path -# will be 'C:\LOGS\TestFramework\LOGS\Module\' -# -# - Overwrite emulator's logging format. -# + TXT, Log file(s) will be txt type(s), for example 'Module.txt'. -# + HTML, Log file(s) will be html type(s), for example 'Module.html'. -# -# - Overwrited emulator logging output source. -# + FILE, Logging to file(s). -# + RDEBUG, Logging to using rdebug(s). -# -# - Overwrite hardware path setting (Same description as above in emulator path). -# - Overwrite hardware's logging format(Same description as above in emulator format). -# - Overwrite hardware's logging output source(Same description as above in emulator output). -# -# - File Creation Mode indicates file overwriting if file exist. -# + OVERWRITE, Overwrites if file(s) exist. -# + APPEND, Continue logging after the old logging information if file(s) exist. -# -# - Will thread id include to the log filename. -# + YES, Thread id to log file(s) name, Example filename 'Module_b9.txt'. -# + NO, No thread id to log file(s), Example filename 'Module.txt'. -# -# - Will time stamps include the to log file. -# + YES, Time stamp added to each line in log file(s). Time stamp is -# for example'12.Nov.2003 115958 LOGGING INFO' -# + NO, No time stamp(s). -# -# - Will line breaks include to the log file. -# + YES, Each logging event includes line break and next log event is in own line. -# + NO, No line break(s). -# -# - Will event ranking include to the log file. -# + YES, Event ranking number added to each line in log file(s). Ranking number -# depends on environment's tics, for example(includes time stamp also) -# '012 12.Nov.2003 115958 LOGGING INFO' -# + NO, No event ranking. -# -# - Will write log file in unicode format. -# + YES, Log file will be written in unicode format -# + NO, Log will be written as normal, not unicode, file. -# - -[Logger_Defaults] - -#NOTE: If you want to set Logger using next setting(s) remove comment(s)'#' -#NOTE: TestEngine and TestServer logging settings cannot change here - -#CreateLogDirectories= YES # Possible values: YES or NO - -#EmulatorBasePath= C:\LOGS\TestFramework\ -#EmulatorFormat= HTML # Possible values: TXT or HTML -#EmulatorOutput= FILE # Possible values: FILE or RDEBUG - -#HardwareBasePath= D:\LOGS\TestFramework\ -#HardwareFormat= HTML # Possible values: TXT or HTML -#HardwareOutput= FILE # Possible values: FILE or RDEBUG - -#FileCreationMode= OVERWRITE # Possible values: OVERWRITE or APPEND - -#ThreadIdToLogFile= YES # Possible values: YES or NO -#WithTimeStamp= YES # Possible values: YES or NO -#WithLineBreak= YES # Possible values: YES or NO -#WithEventRanking= YES # Possible values: YES or NO - -#FileUnicode= YES # Possible values: YES or NO -#AddTestCaseTitle= YES # Possible values: YES or NO -[End_Logger_Defaults] -# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - - - -# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -# Set filters to be used by ConsoleUI. -# If you want to use filter with ConsoleUI, simply remove comments -# from section below and provide valid filter entries. -# Each filter line has to start with "filter= " keyword. -# Filter can contain special wildcard characters: -# * which stands for none or any literal; -# ? which stands for single character. -# Filters are not case-sensitive. - -#[Filters] -#filter= *math* -#filter= *radio* -#[End_Filters] -# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - -# End of file diff -r 703a2b94c06c -r dde4619868dc usbclasses/usbbasicpersonality/tsrc/UsbBasicPersonalityTest/src/UsbBasicPersonalityTest.cpp --- a/usbclasses/usbbasicpersonality/tsrc/UsbBasicPersonalityTest/src/UsbBasicPersonalityTest.cpp Wed Sep 15 13:20:24 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,213 +0,0 @@ -/* -* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - - - - -// INCLUDE FILES -#include -#include "UsbBasicPersonalityTest.h" -#include -#include - -// EXTERNAL DATA STRUCTURES -//extern ?external_data; - -// EXTERNAL FUNCTION PROTOTYPES -//extern ?external_function( ?arg_type,?arg_type ); - -// CONSTANTS -//const ?type ?constant_var = ?constant; - -// MACROS -//#define ?macro ?macro_def - -// LOCAL CONSTANTS AND MACROS -//const ?type ?constant_var = ?constant; -//#define ?macro_name ?macro_def - -// MODULE DATA STRUCTURES -//enum ?declaration -//typedef ?declaration - -// LOCAL FUNCTION PROTOTYPES -//?type ?function_name( ?arg_type, ?arg_type ); - -// FORWARD DECLARATIONS -//class ?FORWARD_CLASSNAME; - -// ============================= LOCAL FUNCTIONS =============================== - -// ----------------------------------------------------------------------------- -// ?function_name ?description. -// ?description -// Returns: ?value_1: ?description -// ?value_n: ?description_line1 -// ?description_line2 -// ----------------------------------------------------------------------------- -// -/* -?type ?function_name( - ?arg_type arg, // ?description - ?arg_type arg) // ?description - { - - ?code // ?comment - - // ?comment - ?code - } -*/ - -// ============================ MEMBER FUNCTIONS =============================== - -// ----------------------------------------------------------------------------- -// CUsbBasicPersonalityTest::CUsbBasicPersonalityTest -// C++ default constructor can NOT contain any code, that -// might leave. -// ----------------------------------------------------------------------------- -// -CUsbBasicPersonalityTest::CUsbBasicPersonalityTest( - CTestModuleIf& aTestModuleIf ): - CScriptBase( aTestModuleIf ) - { - } - -// ----------------------------------------------------------------------------- -// CUsbBasicPersonalityTest::ConstructL -// Symbian 2nd phase constructor can leave. -// ----------------------------------------------------------------------------- -// -void CUsbBasicPersonalityTest::ConstructL() - { - //Read logger settings to check whether test case name is to be - //appended to log file name. - RSettingServer settingServer; - TInt ret = settingServer.Connect(); - if(ret != KErrNone) - { - User::Leave(ret); - } - // Struct to StifLogger settigs. - TLoggerSettings loggerSettings; - // Parse StifLogger defaults from STIF initialization file. - ret = settingServer.GetLoggerSettings(loggerSettings); - if(ret != KErrNone) - { - User::Leave(ret); - } - // Close Setting server session - settingServer.Close(); - - TFileName logFileName; - - if(loggerSettings.iAddTestCaseTitle) - { - TName title; - TestModuleIf().GetTestCaseTitleL(title); - logFileName.Format(KUsbBasicPersonalityTestLogFileWithTitle, &title); - } - else - { - logFileName.Copy(KUsbBasicPersonalityTestLogFile); - } - - iLog = CStifLogger::NewL( KUsbBasicPersonalityTestLogPath, - logFileName, - CStifLogger::ETxt, - CStifLogger::EFile, - EFalse ); - - SendTestClassVersion(); - - if (!CActiveScheduler::Current()) - { - iScheduler = new ( ELeave ) CActiveScheduler(); - CActiveScheduler::Install( iScheduler ); - } - - iNotifier = CUsbPersonalityNotifier::NewL(); - iParams = new ( ELeave )TUsbPersonalityParams( iUsb, *iNotifier ); - iPlugin = CUsbPersonalityPlugin::NewL( *iParams, TUid::Uid(0x102068DF) ); - - } - -// ----------------------------------------------------------------------------- -// CUsbBasicPersonalityTest::NewL -// Two-phased constructor. -// ----------------------------------------------------------------------------- -// -CUsbBasicPersonalityTest* CUsbBasicPersonalityTest::NewL( - CTestModuleIf& aTestModuleIf ) - { - CUsbBasicPersonalityTest* self = new (ELeave) CUsbBasicPersonalityTest( aTestModuleIf ); - - CleanupStack::PushL( self ); - self->ConstructL(); - CleanupStack::Pop(); - - return self; - - } - -// Destructor -CUsbBasicPersonalityTest::~CUsbBasicPersonalityTest() - { - // Delete resources allocated from test methods - Delete(); - - // Delete logger - delete iLog; - iLog = NULL; - } - -//----------------------------------------------------------------------------- -// CUsbBasicPersonalityTest::SendTestClassVersion -// Method used to send version of test class -//----------------------------------------------------------------------------- -// -void CUsbBasicPersonalityTest::SendTestClassVersion() - { - TVersion moduleVersion; - moduleVersion.iMajor = TEST_CLASS_VERSION_MAJOR; - moduleVersion.iMinor = TEST_CLASS_VERSION_MINOR; - moduleVersion.iBuild = TEST_CLASS_VERSION_BUILD; - - TFileName moduleName; - moduleName = _L("UsbBasicPersonalityTest.dll"); - - TBool newVersionOfMethod = ETrue; - TestModuleIf().SendTestModuleVersion(moduleVersion, moduleName, newVersionOfMethod); - } - -// ========================== OTHER EXPORTED FUNCTIONS ========================= - -// ----------------------------------------------------------------------------- -// LibEntryL is a polymorphic Dll entry point. -// Returns: CScriptBase: New CScriptBase derived object -// ----------------------------------------------------------------------------- -// -EXPORT_C CScriptBase* LibEntryL( - CTestModuleIf& aTestModuleIf ) // Backpointer to STIF Test Framework - { - - return ( CScriptBase* ) CUsbBasicPersonalityTest::NewL( aTestModuleIf ); - - } - - -// End of File diff -r 703a2b94c06c -r dde4619868dc usbclasses/usbbasicpersonality/tsrc/UsbBasicPersonalityTest/src/UsbBasicPersonalityTestBlocks.cpp --- a/usbclasses/usbbasicpersonality/tsrc/UsbBasicPersonalityTest/src/UsbBasicPersonalityTestBlocks.cpp Wed Sep 15 13:20:24 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,646 +0,0 @@ -/* -* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - - - -// [INCLUDE FILES] - do not remove -#include -#include -#include -#include "UsbBasicPersonalityTest.h" -#include - -#include - - -// EXTERNAL DATA STRUCTURES -//extern ?external_data; - -// EXTERNAL FUNCTION PROTOTYPES -//extern ?external_function( ?arg_type,?arg_type ); - -// CONSTANTS -//const ?type ?constant_var = ?constant; - -// MACROS -//#define ?macro ?macro_def - -// LOCAL CONSTANTS AND MACROS -//const ?type ?constant_var = ?constant; -//#define ?macro_name ?macro_def - -// MODULE DATA STRUCTURES -//enum ?declaration -//typedef ?declaration - -// LOCAL FUNCTION PROTOTYPES -//?type ?function_name( ?arg_type, ?arg_type ); - -// FORWARD DECLARATIONS -//class ?FORWARD_CLASSNAME; - -// ============================= LOCAL FUNCTIONS =============================== - -// ----------------------------------------------------------------------------- -// ?function_name ?description. -// ?description -// Returns: ?value_1: ?description -// ?value_n: ?description_line1 -// ?description_line2 -// ----------------------------------------------------------------------------- -// -/* -?type ?function_name( - ?arg_type arg, // ?description - ?arg_type arg) // ?description - { - - ?code // ?comment - - // ?comment - ?code - } -*/ - -// ============================ MEMBER FUNCTIONS =============================== - -// ----------------------------------------------------------------------------- -// CUsbBasicPersonalityTest::Delete -// Delete here all resources allocated and opened from test methods. -// Called from destructor. -// ----------------------------------------------------------------------------- -// -void CUsbBasicPersonalityTest::Delete() - { - iUsb.Close(); - - delete iScheduler; - iScheduler = NULL; - - delete iPlugin; - iPlugin = NULL; - REComSession::FinalClose(); - - delete iNotifier; - iNotifier = NULL; - - delete iParams; - iParams = NULL; - } - -// ----------------------------------------------------------------------------- -// CUsbBasicPersonalityTest::RunMethodL -// Run specified method. Contains also table of test mothods and their names. -// ----------------------------------------------------------------------------- -// -TInt CUsbBasicPersonalityTest::RunMethodL( - CStifItemParser& aItem ) - { - - static TStifFunctionInfo const KFunctions[] = - { - //ADD NEW ENTRY HERE - // [test cases entries] - Do not remove - ENTRY( "ExecuteApiTest", CUsbBasicPersonalityTest::ExecuteApiTest ), - ENTRY( "ExecuteModuleTest", CUsbBasicPersonalityTest::ExecuteModuleTest ), - ENTRY( "ExecuteBranchTest", CUsbBasicPersonalityTest::ExecuteBranchTest ), - }; - - const TInt count = sizeof( KFunctions ) / - sizeof( TStifFunctionInfo ); - - return RunInternalL( KFunctions, count, aItem ); - - } - -// ----------------------------------------------------------------------------- -// CUsbBasicPersonalityTest::ExecuteApiTest -// ----------------------------------------------------------------------------- -// -TInt CUsbBasicPersonalityTest::ExecuteApiTest( CStifItemParser& aItem ) - { - STIF_LOG( "[STIF_LOG] >>>ExecuteApiTest" ); - - TInt res; - TUsbBasicPersonalityTestResult testResult; - TPtrC apiTestName( KNullDesC ); - - res = aItem.GetString( _L( "ExecuteApiTest" ), apiTestName ); - if ( res != KErrNone ) - { - iLog -> Log( _L( "GetString failed with value: %d" ), res ); - return res; - } - - TRAP( res, DoExecuteApiTestL( apiTestName, testResult ) ); - if ( res != KErrNone ) - { - iLog -> Log( _L( "DoExecuteApiTestL error: %d"), res ); - return res; - } - - STIF_ASSERT_EQUALS( ETestCasePassed, testResult ); - STIF_LOG( "[STIF_LOG] Test case passed" ); - STIF_LOG( "[STIF_LOG] <<>>DoExecuteApiTestL" ); - if ( !aApiTestName.Compare( _L( "ExampleApiTest" ) ) ) - { - STIF_LOG( "[STIF_LOG] Api test type: ExampleApiTest" ); - ExampleApiTestL( aTestResult ); - } - else if ( !aApiTestName.Compare( _L( "CreateAndDeleteTest" ) ) ) - { - STIF_LOG( "[STIF_LOG] Api test type: CreateAndDeleteTest" ); - CreateAndDeleteTest ( aTestResult ); - } - else if ( !aApiTestName.Compare( _L( "IsActiveTest" ) ) ) - { - STIF_LOG( "[STIF_LOG] Api test type: IsActiveTest" ); - IsActiveTest ( aTestResult ); - } - else if ( !aApiTestName.Compare( _L( "IsAddedTest" ) ) ) - { - STIF_LOG( "[STIF_LOG] Api test type: IsAddedTest" ); - IsAddedTest ( aTestResult ); - } - else if ( !aApiTestName.Compare( _L( "PriorityTest" ) ) ) - { - STIF_LOG( "[STIF_LOG] Api test type: PriorityTest" ); - PriorityTest ( aTestResult ); - } - else if ( !aApiTestName.Compare( _L( "PreparePersonalityStartTest" ) ) ) - { - STIF_LOG( "[STIF_LOG] Api test type: PreparePersonalityStartTest" ); - PreparePersonalityStartTest ( aTestResult ); - } - else if ( !aApiTestName.Compare( _L( "ConfirmPersonalityUnloadTest" ) ) ) - { - STIF_LOG( "[STIF_LOG] Api test type: ConfirmPersonalityUnloadTest" ); - ConfirmPersonalityUnloadTest ( aTestResult ); - } - else if ( !aApiTestName.Compare( _L( "StateChangeNotifyTest" ) ) ) - { - STIF_LOG( "[STIF_LOG] Api test type: StateChangeNotifyTest" ); - StateChangeNotifyTest ( aTestResult ); - } - else if ( !aApiTestName.Compare( _L( "FinishPersonalityStartTest" ) ) ) - { - STIF_LOG( "[STIF_LOG] Api test type: FinishPersonalityStartTest" ); - FinishPersonalityStartTest ( aTestResult ); - } - else if ( !aApiTestName.Compare( _L( "FinishPersonalityStopTest" ) ) ) - { - STIF_LOG( "[STIF_LOG] Api test type: FinishPersonalityStopTest" ); - FinishPersonalityStopTest ( aTestResult ); - } - else if ( !aApiTestName.Compare( _L( "PreparePersonalityStopTest" ) ) ) - { - STIF_LOG( "[STIF_LOG] Api test type: PreparePersonalityStopTest" ); - PreparePersonalityStopTest ( aTestResult ); - } - else if ( !aApiTestName.Compare( _L( "SetPriorityTest" ) ) ) - { - STIF_LOG( "[STIF_LOG] Api test type: SetPriorityTest" ); - SetPriorityTest ( aTestResult ); - } - else if ( !aApiTestName.Compare( _L( "ShowUsbConnectionNoteTest" ) ) ) - { - STIF_LOG( "[STIF_LOG] Api test type: ShowUsbConnectionNoteTest" ); - ShowUsbConnectionNoteTest ( aTestResult ); - } - else - { - STIF_LOG( "[STIF_LOG] Api test type: not found" ); - User::Leave( KErrNotFound ); - } - STIF_LOG( "[STIF_LOG] <<>>ExampleApiTestL" ); - - aTestResult = ETestCasePassed; - - STIF_LOG( "[STIF_LOG] <<>>ExecuteModuleTest" ); - - TInt res; - TUsbBasicPersonalityTestResult testResult; - TPtrC moduleTestName( KNullDesC ); - - res = aItem.GetString( _L( "ExecuteModuleTest" ), moduleTestName ); - if ( res != KErrNone ) - { - iLog -> Log( _L( "GetString failed with value: %d" ), res ); - return res; - } - - TRAP( res, DoExecuteModuleTestL( moduleTestName, testResult ) ); - if ( res != KErrNone ) - { - iLog -> Log( _L( "DoExecuteModuleTestL error: %d"), res ); - return res; - } - - STIF_ASSERT_EQUALS( ETestCasePassed, testResult ); - STIF_LOG( "[STIF_LOG] Test case passed" ); - STIF_LOG( "[STIF_LOG] <<>>DoExecuteModuleTestL" ); - if ( !aModuleTestName.Compare( _L( "ExampleModuleTest" ) ) ) - { - STIF_LOG( "[STIF_LOG] Module test type: ExampleModuleTest" ); - ExampleModuleTestL( aTestResult ); - } - else - { - STIF_LOG( "[STIF_LOG] Module test type: not found" ); - User::Leave( KErrNotFound ); - } - STIF_LOG( "[STIF_LOG] <<>>ExampleModuleTestL" ); - - aTestResult = ETestCasePassed; - - STIF_LOG( "[STIF_LOG] <<>>ExecuteBranchTest" ); - - TInt res; - TUsbBasicPersonalityTestResult testResult; - TPtrC branchTestName( KNullDesC ); - - res = aItem.GetString( _L( "ExecuteBranchTest" ), branchTestName ); - if ( res != KErrNone ) - { - iLog -> Log( _L( "GetString failed with value: %d" ), res ); - return res; - } - - TRAP( res, DoExecuteBranchTestL( branchTestName, testResult ) ); - if ( res != KErrNone ) - { - iLog -> Log( _L( "DoExecuteBranchTestL error: %d"), res ); - return res; - } - - STIF_ASSERT_EQUALS( ETestCasePassed, testResult ); - STIF_LOG( "[STIF_LOG] Test case passed" ); - STIF_LOG( "[STIF_LOG] <<>>DoExecuteBranchTestL" ); - if ( !aBranchTestName.Compare( _L( "ExampleBranchTest" ) ) ) - { - STIF_LOG( "[STIF_LOG] Branch test type: ExampleBranchTest" ); - ExampleBranchTestL( aTestResult ); - } - else - { - STIF_LOG( "[STIF_LOG] Branch test type: not found" ); - User::Leave( KErrNotFound ); - } - STIF_LOG( "[STIF_LOG] <<>>ExampleBranchTestL" ); - - aTestResult = ETestCasePassed; - - STIF_LOG( "[STIF_LOG] <<ShowUsbConnectionNote(); - - aTestResult = ETestCasePassed; - - STIF_LOG("ShowUsbConnectionNoteTest: End "); - - return KErrNone; - } - -// ----------------------------------------------------------------------------- -// CUsbBasicPersonalityTest::SetPriorityTest -// ----------------------------------------------------------------------------- -// -TInt CUsbBasicPersonalityTest::SetPriorityTest( TUsbBasicPersonalityTestResult& aTestResult ) - { - STIF_LOG("SetPriorityTest:> Started"); - - TRequestStatus status; - - iPlugin->SetPriority( CActive::EPriorityStandard ); - - aTestResult = ETestCasePassed; - - STIF_LOG("SetPriorityTest:> End "); - - return KErrNone; - } - - -// ----------------------------------------------------------------------------- -// CUsbBasicPersonalityTest::PreparePersonalityStopTest -// ----------------------------------------------------------------------------- -// -TInt CUsbBasicPersonalityTest::PreparePersonalityStopTest( TUsbBasicPersonalityTestResult& aTestResult ) - { - STIF_LOG("PreparePersonalityStopTest:> Started"); - - TRequestStatus status; - - iPlugin->PreparePersonalityStop( status ); - User::WaitForRequest( iStatus ); - - REComSession::FinalClose(); - - aTestResult = ETestCasePassed; - - STIF_LOG("PreparePersonalityStopTest:> End "); - - return KErrNone; - } - -// ----------------------------------------------------------------------------- -// CUsbBasicPersonalityTest::FinishPersonalityStopTest -// ----------------------------------------------------------------------------- -// -TInt CUsbBasicPersonalityTest::FinishPersonalityStopTest( TUsbBasicPersonalityTestResult& aTestResult ) - { - STIF_LOG("FinishPersonalityStopTest:> Started"); - - TRequestStatus status; - - iPlugin->FinishPersonalityStop( status ); - User::WaitForRequest( iStatus ); - - REComSession::FinalClose(); - - aTestResult = ETestCasePassed; - - STIF_LOG("FinishPersonalityStopTets:> End "); - - return KErrNone; - } - -// ----------------------------------------------------------------------------- -// CUsbBasicPersonalityTest::FinishPersonalityStartTest -// ----------------------------------------------------------------------------- -// -TInt CUsbBasicPersonalityTest::FinishPersonalityStartTest( TUsbBasicPersonalityTestResult& aTestResult ) - { - STIF_LOG("FinishPersonalityStartTest:> Started"); - - TRequestStatus status; - - iPlugin->FinishPersonalityStart( status ); - User::WaitForRequest( iStatus ); - - REComSession::FinalClose(); - - aTestResult = ETestCasePassed; - - STIF_LOG("FinishPersonalityStartTest:> End "); - - return KErrNone; - - } - -// ----------------------------------------------------------------------------- -// CUsbBasicPersonalityTest::ConfirmPersonalityUnloadTest -// ----------------------------------------------------------------------------- -// -TInt CUsbBasicPersonalityTest::ConfirmPersonalityUnloadTest( TUsbBasicPersonalityTestResult& aTestResult ) - { - STIF_LOG("ConfirmPersonalityUnloadTest: Started"); - - iPlugin->ConfirmPersonalityUnload( iStatus ); - User::WaitForRequest( iStatus ); - - REComSession::FinalClose(); - - aTestResult = ETestCasePassed; - - STIF_LOG("ConfirmPersonalityUnloadTest: End "); - return KErrNone; - } - -// ----------------------------------------------------------------------------- -// CUsbBasicPersonalityTest::PreparePersonalityStartTest -// ----------------------------------------------------------------------------- -// -TInt CUsbBasicPersonalityTest::PreparePersonalityStartTest( TUsbBasicPersonalityTestResult& aTestResult ) - { - STIF_LOG("PreparePersonalityStartTest: Started"); - - iPlugin->PreparePersonalityStart( iStatus ); - User::WaitForRequest( iStatus ); - - REComSession::FinalClose(); - - aTestResult = ETestCasePassed; - - STIF_LOG("PreparePersonalityStartTest: End "); - - return KErrNone; - } - - -// ----------------------------------------------------------------------------- -// CUsbBasicPersonalityTest::StateChangeNotifyTest -// ----------------------------------------------------------------------------- -// -TInt CUsbBasicPersonalityTest::StateChangeNotifyTest( TUsbBasicPersonalityTestResult& aTestResult ) - { - STIF_LOG("StateChangeNotifyTest:> Started"); - - TUsbDeviceState state = EUsbDeviceStateDefault; - iPlugin->StateChangeNotify( state ); - - aTestResult = ETestCasePassed; - - STIF_LOG("StateChangeNotifyTest:> End "); - return KErrNone; - - } - - -// ----------------------------------------------------------------------------- -// CUsbBasicPersonalityTest::IsActiveTest -// ----------------------------------------------------------------------------- -// -TInt CUsbBasicPersonalityTest::IsActiveTest( TUsbBasicPersonalityTestResult& aTestResult ) - { - STIF_LOG("IsActiveTest:> Started"); - - _LIT(KIsActive,"IsActiveTest:> Is Active? %d"); - iLog->Log(KIsActive, iPlugin->IsActive() ); - - aTestResult = ETestCasePassed; - - STIF_LOG("IsActiveTest:> End "); - - return KErrNone; - - } - -// ----------------------------------------------------------------------------- -// CUsbBasicPersonalityTest::IsAddedTest -// ----------------------------------------------------------------------------- -// -TInt CUsbBasicPersonalityTest::IsAddedTest( TUsbBasicPersonalityTestResult& aTestResult ) - { - STIF_LOG("IsAddedTest:> Started"); - - _LIT(KIsActive,"IsAddedTest:> Is Added? %d"); - iLog->Log(KIsActive, iPlugin->IsAdded() ); - - aTestResult = ETestCasePassed; - - STIF_LOG("IsAddedTest:> End "); - - return KErrNone; - - } - -// ----------------------------------------------------------------------------- -// CUsbBasicPersonalityTest::PriorityTest -// ----------------------------------------------------------------------------- -// -TInt CUsbBasicPersonalityTest::PriorityTest( TUsbBasicPersonalityTestResult& aTestResult ) - { - STIF_LOG("PriorityTest:> Started"); - - iPlugin->SetPriority( CActive::EPriorityLow ); - TInt priority; - priority = iPlugin->Priority(); - - priority == CActive::EPriorityLow ? - aTestResult = ETestCasePassed : - aTestResult = ETestCaseFailed; - - STIF_LOG("PriorityTest:> End "); - - return KErrNone; - - } - -// ========================== OTHER EXPORTED FUNCTIONS ========================= -// None - -// [End of File] - Do not remove diff -r 703a2b94c06c -r dde4619868dc usbclasses/usbbasicpersonality/tsrc/UsbBasicPersonalityTest/src/UsbBasicPersonalityTest_exe.cpp --- a/usbclasses/usbbasicpersonality/tsrc/UsbBasicPersonalityTest/src/UsbBasicPersonalityTest_exe.cpp Wed Sep 15 13:20:24 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,65 +0,0 @@ -/* -* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - - -// INCLUDE FILES -#include -#include -#include -// EXTERNAL DATA STRUCTURES - -// EXTERNAL FUNCTION PROTOTYPES - -// ================= OTHER EXPORTED FUNCTIONS ================================= - -/* -------------------------------------------------------------------------------- - - Class: - - - Method: E32Main - - Description: - - Parameters: None - - Return Values: TInt: Symbian error code - - Errors/Exceptions: None - - Status: Draft - -------------------------------------------------------------------------------- -*/ -GLDEF_C TInt E32Main() - { - _LIT( KProcessMsgStart, "New process starting" ); - RDebug::Print( KProcessMsgStart ); - - - // This starts a new session that get capabilites that is used in - // UsbBasicPersonalityTest_exe.mmp file. - TInt r = StartSession(); - - _LIT( KProcessMsgEnd, "New process ends" ); - RDebug::Print( KProcessMsgEnd ); - - return r; - - } - -// End of File diff -r 703a2b94c06c -r dde4619868dc usbclasses/usbmscpersonality/tsrc/UsbMscPersonalityTest/Bmarm/UsbMscPersonalityTestu.def --- a/usbclasses/usbmscpersonality/tsrc/UsbMscPersonalityTest/Bmarm/UsbMscPersonalityTestu.def Wed Sep 15 13:20:24 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,3 +0,0 @@ -EXPORTS - LibEntryL__FR13CTestModuleIf @ 1 NONAME R3UNUSED ; LibEntryL(CTestModuleIf &) - diff -r 703a2b94c06c -r dde4619868dc usbclasses/usbmscpersonality/tsrc/UsbMscPersonalityTest/Bwins/UsbMscPersonalityTestu.def --- a/usbclasses/usbmscpersonality/tsrc/UsbMscPersonalityTest/Bwins/UsbMscPersonalityTestu.def Wed Sep 15 13:20:24 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,3 +0,0 @@ -EXPORTS - ?LibEntryL@@YAPAVCScriptBase@@AAVCTestModuleIf@@@Z @ 1 NONAME ; class CScriptBase * __cdecl LibEntryL(class CTestModuleIf &) - diff -r 703a2b94c06c -r dde4619868dc usbclasses/usbmscpersonality/tsrc/UsbMscPersonalityTest/conf/UsbMscPersonalityTest.cfg --- a/usbclasses/usbmscpersonality/tsrc/UsbMscPersonalityTest/conf/UsbMscPersonalityTest.cfg Wed Sep 15 13:20:24 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,124 +0,0 @@ -/* -* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -[StifSettings] -CapsModifier = UsbMscPersonalityTest.exe -[EndStifSettings] - -// UsbMscPersonalityTest Module - total 13 tc - - -// UsbHidClassDriverTest Api Tests (8 tc) - -[Test] -title Initialization Test -create UsbMscPersonalityTest tester -tester InitializationTestL API -delete tester -[Endtest] - -[Test] -title Prepare Personality Start -create UsbMscPersonalityTest tester -tester PreparePersonalityStartTestL API -delete tester -[Endtest] - -[Test] -title Finish Personality Start -create UsbMscPersonalityTest tester -tester FinishPersonalityStartTestL API -delete tester -[Endtest] - -[Test] -title Prepare Personality Stop -create UsbMscPersonalityTest tester -tester PreparePersonalityStopTestL API -delete tester -[Endtest] - -[Test] -title Finish Personality Stop -create UsbMscPersonalityTest tester -tester FinishPersonalityStopTestL API -delete tester -[Endtest] - -[Test] -title State Change Notify -create UsbMscPersonalityTest tester -tester StateChangeNotifyTestL API -delete tester -[Endtest] - -[Test] -title State Change Notify Undefined -create UsbMscPersonalityTest tester -tester StateChangeNotifyUndefinedTestL API -delete tester -[Endtest] - -[Test] -title State Change Notify State Address -create UsbMscPersonalityTest tester -tester StateChangeNotifyStateAddressTestL API -delete tester -[Endtest] - -// UsbHidClassDriverTest Module Tests (5 tc) -// Add new module tests here -// ... - -[Test] -title Confirm Personality Unload -create UsbMscPersonalityTest tester -tester ConfirmPersonalityUnloadTestL MODULE -delete tester -[Endtest] - -[Test] -title Allow Dismount 2 sec -create UsbMscPersonalityTest tester -tester AllowDismountAfter2SecTestL MODULE -delete tester -[Endtest] - -[Test] -title Allow Dismount -create UsbMscPersonalityTest tester -tester AllowDismountTestL MODULE -delete tester -[Endtest] - -[Test] -title Not Allow Dismount -create UsbMscPersonalityTest tester -tester NotAllowDismountTestL MODULE -delete tester -[Endtest] - -[Test] -title Allow Dismount Late -create UsbMscPersonalityTest tester -tester AllowDismountTooLateTestL MODULE -delete tester -[Endtest] -// Add new module tests here -// ... - - diff -r 703a2b94c06c -r dde4619868dc usbclasses/usbmscpersonality/tsrc/UsbMscPersonalityTest/eabi/UsbMscPersonalityTestu.def --- a/usbclasses/usbmscpersonality/tsrc/UsbMscPersonalityTest/eabi/UsbMscPersonalityTestu.def Wed Sep 15 13:20:24 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,7 +0,0 @@ -EXPORTS - _Z9LibEntryLR13CTestModuleIf @ 1 NONAME - _ZTI15CDismountClient @ 2 NONAME - _ZTI34CUsbMscPersonalityTestActiveObject @ 3 NONAME - _ZTV15CDismountClient @ 4 NONAME - _ZTV34CUsbMscPersonalityTestActiveObject @ 5 NONAME - diff -r 703a2b94c06c -r dde4619868dc usbclasses/usbmscpersonality/tsrc/UsbMscPersonalityTest/group/UsbMscPersonalityTest.mmp --- a/usbclasses/usbmscpersonality/tsrc/UsbMscPersonalityTest/group/UsbMscPersonalityTest.mmp Wed Sep 15 13:20:24 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,51 +0,0 @@ -/* -* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - - -#if defined(__S60_) - // To get the OSEXT_LAYER_SYSTEMINCLUDE-definition - #include -#endif - -TARGET UsbMscPersonalityTest.dll -TARGETTYPE dll -UID 0x1000008D 0x101FB3E3 - -CAPABILITY LocalServices ReadDeviceData NetworkControl WriteDeviceData DiskAdmin ReadUserData WriteUserData ProtServ - -DEFFILE UsbMscPersonalityTest.def - -MW_LAYER_SYSTEMINCLUDE - -USERINCLUDE ../inc - -SOURCEPATH ../src -SOURCE UsbMscPersonalityTest.cpp -SOURCE UsbMscPersonalityTestBlocks.cpp DismountClient.cpp UsbMscPersonalityTestActiveObject.cpp - -LIBRARY euser.lib -LIBRARY stiftestinterface.lib -LIBRARY stiftestengine.lib -LIBRARY ecom.lib -LIBRARY usbman.lib -LIBRARY usbpersonality.lib -LIBRARY platformver.lib -LIBRARY efsrv.lib - -LANG SC - -// End of File diff -r 703a2b94c06c -r dde4619868dc usbclasses/usbmscpersonality/tsrc/UsbMscPersonalityTest/group/UsbMscPersonalityTest_ats.pkg --- a/usbclasses/usbmscpersonality/tsrc/UsbMscPersonalityTest/group/UsbMscPersonalityTest_ats.pkg Wed Sep 15 13:20:24 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,62 +0,0 @@ -; -; Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -; All rights reserved. -; This component and the accompanying materials are made available -; under the terms of "Eclipse Public License v1.0" -; which accompanies this distribution, and is available -; at the URL "http://www.eclipse.org/legal/epl-v10.html". -; -; Initial Contributors: -; Nokia Corporation - initial contribution. -; -; Contributors: -; -; Description: -; - -; Languages -&EN - -; Provide value for uid -#{"STIF"},(0x00000000),1,1,0,TYPE=SA - -; Series60 product id for S60 5.2 -[0x20022E6D], 0, 0, 0, {"Series60ProductID"} - -; Localised Vendor name -%{"Nokia"} - -; Unique Vendor name -:"Nokia" - -; Logo -; None - -; Package signature - Optional -; None - -; Start of Package body - -; Condition blocks -; None - -; Options list -; None - -; Install files -"/epoc32/release/armv5/udeb/UsbMscPersonalityTest.dll"-"c:/Sys/Bin/UsbMscPersonalityTest.dll" -"/epoc32/release/armv5/udeb/UsbMscPersonalityTest.exe"-"c:/Sys/Bin/UsbMscPersonalityTest.exe" - -"../init/UsbMscPersonalityTest_ats.ini"-"e:/testing/init/UsbMscPersonalityTest.ini" -"../conf/UsbMscPersonalityTest.cfg"-"e:/testing/conf/UsbMscPersonalityTest.cfg" - -; Embedded SIS -; None - -; End of Package body - -; PKG dependencies -; None - -; PKG capabilities -; None diff -r 703a2b94c06c -r dde4619868dc usbclasses/usbmscpersonality/tsrc/UsbMscPersonalityTest/group/UsbMscPersonalityTest_exe.mmp --- a/usbclasses/usbmscpersonality/tsrc/UsbMscPersonalityTest/group/UsbMscPersonalityTest_exe.mmp Wed Sep 15 13:20:24 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,46 +0,0 @@ -/* -* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#if defined(__S60_) - // To get the OS_LAYER_SYSTEMINCLUDE-definition - #include -#endif - -TARGET UsbMscPersonalityTest.exe -TARGETTYPE exe -UID 0 0xEF4892C6 - -/* Specify the capabilities according to your test environment */ -CAPABILITY LocalServices ReadDeviceData NetworkControl WriteDeviceData DiskAdmin ReadUserData WriteUserData ProtServ -/* Remove comments and replace 0x00000000 with correct vendor id */ -// VENDORID 0x00000000 -/* Remove comments and replace 0x00000000 with correct secure id */ -// SECUREID 0x00000000 - -MW_LAYER_SYSTEMINCLUDE -SOURCEPATH ../src - - -SOURCE UsbMscPersonalityTest_exe.cpp - -/* Used libraries */ -LIBRARY euser.lib -LIBRARY stiftestinterface.lib - -EPOCSTACKSIZE 40960 - -// End of File diff -r 703a2b94c06c -r dde4619868dc usbclasses/usbmscpersonality/tsrc/UsbMscPersonalityTest/group/UsbMscPersonalityTest_phone.pkg --- a/usbclasses/usbmscpersonality/tsrc/UsbMscPersonalityTest/group/UsbMscPersonalityTest_phone.pkg Wed Sep 15 13:20:24 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,63 +0,0 @@ -; -; Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -; All rights reserved. -; This component and the accompanying materials are made available -; under the terms of "Eclipse Public License v1.0" -; which accompanies this distribution, and is available -; at the URL "http://www.eclipse.org/legal/epl-v10.html". -; -; Initial Contributors: -; Nokia Corporation - initial contribution. -; -; Contributors: -; -; Description: -; - -; Languages -&EN - -; Provide value for uid -#{"STIF"},(0x00000000),1,1,0,TYPE=SA - -; Series60 product id for S60 5.2 -[0x20022E6D], 0, 0, 0, {"Series60ProductID"} - -; Localised Vendor name -%{"Nokia"} - -; Unique Vendor name -:"Nokia" - -; Logo -; None - -; Package signature - Optional -; None - -; Start of Package body - -; Condition blocks -; None - -; Options list -; None - -; Install files -"/epoc32/release/armv5/udeb/UsbMscPersonalityTest.dll"-"c:/Sys/Bin/UsbMscPersonalityTest.dll" -"/epoc32/release/armv5/udeb/UsbMscPersonalityTest.exe"-"c:/Sys/Bin/UsbMscPersonalityTest.exe" - -"../init/UsbMscPersonalityTest_phone.ini"-"c:/testframework/testframework.ini" -"../conf/UsbMscPersonalityTest.cfg"-"c:/testframework/UsbMscPersonalityTest.cfg" - - -; Embedded SIS -; None - -; End of Package body - -; PKG dependencies -; None - -; PKG capabilities -; None diff -r 703a2b94c06c -r dde4619868dc usbclasses/usbmscpersonality/tsrc/UsbMscPersonalityTest/group/bld.inf --- a/usbclasses/usbmscpersonality/tsrc/UsbMscPersonalityTest/group/bld.inf Wed Sep 15 13:20:24 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,32 +0,0 @@ -/* -* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - - -PRJ_PLATFORMS -DEFAULT - -PRJ_TESTEXPORTS - -PRJ_EXPORTS - -PRJ_TESTMMPFILES -UsbMscPersonalityTest.mmp -UsbMscPersonalityTest_exe.mmp - -PRJ_MMPFILES - -// End of File diff -r 703a2b94c06c -r dde4619868dc usbclasses/usbmscpersonality/tsrc/UsbMscPersonalityTest/group/build_sis_ats.bat --- a/usbclasses/usbmscpersonality/tsrc/UsbMscPersonalityTest/group/build_sis_ats.bat Wed Sep 15 13:20:24 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,20 +0,0 @@ -@rem -@rem Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -@rem All rights reserved. -@rem This component and the accompanying materials are made available -@rem under the terms of "Eclipse Public License v1.0" -@rem which accompanies this distribution, and is available -@rem at the URL "http://www.eclipse.org/legal/epl-v10.html". -@rem -@rem Initial Contributors: -@rem Nokia Corporation - initial contribution. -@rem -@rem Contributors: -@rem -@rem Description: -@rem - - -call sbs -c armv5.test -call makesis UsbMscPersonalityTest_ats.pkg -call signsis UsbMscPersonalityTest_ats.sis UsbMscPersonalityTest_ats.sisx x:\rd.cer x:\rd-key.pem diff -r 703a2b94c06c -r dde4619868dc usbclasses/usbmscpersonality/tsrc/UsbMscPersonalityTest/group/build_sis_phone.bat --- a/usbclasses/usbmscpersonality/tsrc/UsbMscPersonalityTest/group/build_sis_phone.bat Wed Sep 15 13:20:24 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,21 +0,0 @@ -@rem -@rem Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -@rem All rights reserved. -@rem This component and the accompanying materials are made available -@rem under the terms of "Eclipse Public License v1.0" -@rem which accompanies this distribution, and is available -@rem at the URL "http://www.eclipse.org/legal/epl-v10.html". -@rem -@rem Initial Contributors: -@rem Nokia Corporation - initial contribution. -@rem -@rem Contributors: -@rem -@rem Description: -@rem - -call sbs -c armv5.test -call sbs freeze -call sbs -c armv5.test -call makesis UsbMscPersonalityTest_phone.pkg -call signsis UsbMscPersonalityTest_phone.sis UsbMscPersonalityTest_phone.sisx x:\rd.cer x:\rd-key.pem diff -r 703a2b94c06c -r dde4619868dc usbclasses/usbmscpersonality/tsrc/UsbMscPersonalityTest/inc/DismountClient.h --- a/usbclasses/usbmscpersonality/tsrc/UsbMscPersonalityTest/inc/DismountClient.h Wed Sep 15 13:20:24 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,89 +0,0 @@ -/* -* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifndef DISMOUNTCLIENT_H -#define DISMOUNTCLIENT_H - -#include // For CActive, link against: euser.lib -#include // For RTimer, link against: euser.lib -#include -#include - -enum TAllowDismountOption -{ - EAllowDismount, - EAllowDismountAfter2Sec, - EAllowDismountTooLate, - ENotAllowDismount -}; - -class CDismountClient : public CActive - { -public: - // Cancel and destroy - ~CDismountClient(); - - // Two-phased constructor. - static CDismountClient* NewL(CStifLogger *aLog); - - // Two-phased constructor. - static CDismountClient* NewLC(CStifLogger *aLog); - -public: - // New functions - // Function for making the initial request - void StartL(TAllowDismountOption aAllowDismountOption); - -private: - // C++ constructor - CDismountClient(); - - // Second-phase constructor - void ConstructL(CStifLogger *aLog); - -private: - // From CActive - // Handle completion - void RunL(); - - // How to cancel me - void DoCancel(); - - // Override to handle leaves from RunL(). Default implementation causes - // the active scheduler to panic. - TInt RunError(TInt aError); - -private: - enum TDismountClientState - { - EWaitForDelay, - EDelay, - EUninitialized, // Uninitialized - EInitialized, // Initalized - EError // Error condition - }; - -private: - TInt iState; // State of the active object - RFs iFs; - CStifLogger *iLog; - RTimer iTimer; - TAllowDismountOption iAllowDismountOption; - - }; - -#endif // DISMOUNTCLIENT_H diff -r 703a2b94c06c -r dde4619868dc usbclasses/usbmscpersonality/tsrc/UsbMscPersonalityTest/inc/UsbMscPersonalityTest.h --- a/usbclasses/usbmscpersonality/tsrc/UsbMscPersonalityTest/inc/UsbMscPersonalityTest.h Wed Sep 15 13:20:24 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,269 +0,0 @@ -/* -* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - - -#ifndef USBMSCPERSONALITYTEST_H -#define USBMSCPERSONALITYTEST_H - -// INCLUDES -#include -#include -#include -#include - -#include -#include - -#include "UsbMscPersonalityTestActiveObject.h" -#include -#include "DismountClient.h" - -// CONSTANTS -// Logging path -_LIT( KUsbMscPersonalityTestLogPath, "\\logs\\testframework\\UsbMscPersonalityTest\\" ); - -// Logging path for ATS - for phone builds comment this line -//_LIT( KUsbMscPersonalityTestLogPath, "e:\\testing\\stiflogs\\" ); - -// Log file -_LIT( KUsbMscPersonalityTestLogFile, "UsbMscPersonalityTest.txt" ); -_LIT( KUsbMscPersonalityTestLogFileWithTitle, "UsbMscPersonalityTest_[%S].txt" ); - -// MACROS -#define TEST_CLASS_VERSION_MAJOR 0 -#define TEST_CLASS_VERSION_MINOR 0 -#define TEST_CLASS_VERSION_BUILD 0 - -// Macros used to extract test block parameters -#define TESTENTRY( A, B )\ - if ( !iTestBlockParams.iTestBlockName.Compare( TPtrC( ( TText* ) L ##A ) ) )\ - { iTestBlockFunction = &B; iTestBlockFound = ETrue; }\ - if ( !iTestBlockParams.iTestBlockName.Compare( TPtrC( ( TText* ) L ##A ) ) ) - -#define TESTPARAM( A, B )\ - GetTestBlockParamL( ( TGetTestBlockParamOperation ) A, ( TTestBlockParamName ) B ); - -// FUNCTION PROTOTYPES - -// FORWARD DECLARATIONS - -// DATA TYPES - -// Enum type used to determine test block execution result -enum TUsbMscPersonalityTestResult - { - ETestCasePassed, - ETestCaseFailed - }; - -// Enum type indicating test block parameter which should be used to store -// data extracted from test script -enum TTestBlockParamName - { - eTestOption1, - eTestOption2, - eTestOption3, - eTestIntOption1, - eTestIntOption2, - eTestIntOption3, - eTestCharOption1, - eTestCharOption2, - eTestCharOption3 - }; - -// Enum type used to indicate which get parameter function should be used -enum TGetTestBlockParamOperation - { - eGetString, - eGetInt, - eGetChar - }; - -// CLASS DECLARATION -/** -* TUsbMscPersonalityTestBlockParams test class for storing test block parameters. -*/ -NONSHARABLE_CLASS( TUsbMscPersonalityTestBlockParams ) - { - public: - TPtrC iTestBlockName; - - TPtrC iTestOption1; - TPtrC iTestOption2; - TPtrC iTestOption3; - - TInt iTestIntOption1; - TInt iTestIntOption2; - TInt iTestIntOption3; - - TChar iTestCharOption1; - TChar iTestCharOption2; - TChar iTestCharOption3; - }; - -/** -* CUsbMscPersonalityTest test class for STIF Test Framework TestScripter. -*/ -NONSHARABLE_CLASS( CUsbMscPersonalityTest ) : public CScriptBase - { - public: // Constructors and destructor - - /** - * Two-phased constructor. - */ - static CUsbMscPersonalityTest* NewL( CTestModuleIf& aTestModuleIf ); - - /** - * Destructor. - */ - virtual ~CUsbMscPersonalityTest(); - - public: // New functions - public: // Functions from base classes - - /** - * From CScriptBase Runs a script line. - * @since ?Series60_version - * @param aItem Script line containing method name and parameters - * @return Symbian OS error code - */ - virtual TInt RunMethodL( CStifItemParser& aItem ); - - protected: // New functions - protected: // Functions from base classes - private: - - /** - * C++ default constructor. - */ - CUsbMscPersonalityTest( CTestModuleIf& aTestModuleIf ); - - /** - * By default Symbian 2nd phase constructor is private. - */ - void ConstructL(); - - /** - * Frees all resources allocated from test methods. - * @since ?Series60_version - */ - void TestDelete(); - - /** - * Constructs all test resources for test methods. - */ - void TestConstructL(); - - /** - * Extracts test block parameters from script file - */ - void TestBlocksInfoL(); - - /** - * Executes test block - */ - TInt ExecuteTestBlock( CStifItemParser& aItem ); - - /** - * Executes proper get parameter function indicated by its arguments - */ - void GetTestBlockParamL( TGetTestBlockParamOperation aOperation, - TTestBlockParamName aParamName ); - - /** - * Method used to log version of test class - */ - void SendTestClassVersion(); - - // ADD NEW METHOD DEC HERE - // [TestMethods] - Do not remove - void ExampleTestL( TUsbMscPersonalityTestBlockParams& aParams, - TUsbMscPersonalityTestResult& aTestResult ); - - void ExecuteDismounting(); - - void PreparePersonalityStartTestL( TUsbMscPersonalityTestBlockParams& aParams, - TUsbMscPersonalityTestResult& aTestResult ); - void FinishPersonalityStartTestL( TUsbMscPersonalityTestBlockParams& aParams, - TUsbMscPersonalityTestResult& aTestResult ); - void PreparePersonalityStopTestL( TUsbMscPersonalityTestBlockParams& aParams, - TUsbMscPersonalityTestResult& aTestResult ); - void FinishPersonalityStopTestL( TUsbMscPersonalityTestBlockParams& aParams, - TUsbMscPersonalityTestResult& aTestResult ); - void InitializationTestL( TUsbMscPersonalityTestBlockParams& aParams, - TUsbMscPersonalityTestResult& aTestResult ); - void StateChangeNotifyTestL( TUsbMscPersonalityTestBlockParams& aParams, - TUsbMscPersonalityTestResult& aTestResult ); - void StateChangeNotifyUndefinedTestL( TUsbMscPersonalityTestBlockParams& aParams, - TUsbMscPersonalityTestResult& aTestResult ); - void StateChangeNotifyStateAddressTestL( TUsbMscPersonalityTestBlockParams& aParams, - TUsbMscPersonalityTestResult& aTestResult ); - void ConfirmPersonalityUnloadTestL( TUsbMscPersonalityTestBlockParams& aParams, - TUsbMscPersonalityTestResult& aTestResult ); - void AllowDismountAfter2SecTestL( TUsbMscPersonalityTestBlockParams& aParams, - TUsbMscPersonalityTestResult& aTestResult ); - void AllowDismountTestL( TUsbMscPersonalityTestBlockParams& aParams, - TUsbMscPersonalityTestResult& aTestResult ); - void NotAllowDismountTestL( TUsbMscPersonalityTestBlockParams& aParams, - TUsbMscPersonalityTestResult& aTestResult ); - void AllowDismountTooLateTestL( TUsbMscPersonalityTestBlockParams& aParams, - TUsbMscPersonalityTestResult& aTestResult ); - - - void InitializeTestObjectsL(); - void DeleteTestObjects(); - - - public: // Data - protected: // Data - private: // Data - - // Member object used to store test block parameters - TUsbMscPersonalityTestBlockParams iTestBlockParams; - - // Used to indicate if test block with specified parameters exist - TBool iTestBlockFound; - - // Function pointer used to call proper test block methods - void ( CUsbMscPersonalityTest::*iTestBlockFunction ) - ( TUsbMscPersonalityTestBlockParams&, TUsbMscPersonalityTestResult& ); - - // Not own - CStifItemParser* iItem; - - // Reserved pointer for future extension - //TAny* iReserved; - - // ADD NEW DATA DEC HERE - - RUsb* iUsb; - CUsbPersonalityNotifier* iNotifier; - TRequestStatus iRequestStatus; - CActiveScheduler* iScheduler; - CUsbMscPersonalityTestActiveObject* iActive; - CUsbPersonalityPlugin* iPlugin; - TUsbPersonalityParams* iParams; - CDismountClient* iDismountClient; - - public: // Friend classes - protected: // Friend classes - private: // Friend classes - - }; -#endif // USBMSCPERSONALITYTEST_H - -// End of File diff -r 703a2b94c06c -r dde4619868dc usbclasses/usbmscpersonality/tsrc/UsbMscPersonalityTest/inc/UsbMscPersonalityTestActiveObject.h --- a/usbclasses/usbmscpersonality/tsrc/UsbMscPersonalityTest/inc/UsbMscPersonalityTestActiveObject.h Wed Sep 15 13:20:24 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,80 +0,0 @@ -/* -* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifndef USBMSCPERSONALITYTESTACTIVEOBJECT_H -#define USBMSCPERSONALITYTESTACTIVEOBJECT_H - -#include // For CActive, link against: euser.lib -#include // For RTimer, link against: euser.lib -#include -#include - -#include -#include -#include - -class CUsbMscPersonalityTestActiveObject : public CActive - { -public: - // Cancel and destroy - ~CUsbMscPersonalityTestActiveObject(); - - // Two-phased constructor. - static CUsbMscPersonalityTestActiveObject* NewL( CUsbPersonalityPlugin*, CStifLogger*, TUsbPersonalityParams* ); - - // Two-phased constructor. - static CUsbMscPersonalityTestActiveObject* NewLC( CUsbPersonalityPlugin*, CStifLogger*, TUsbPersonalityParams* ); - -public: - - void PreparePersonalityStart( TRequestStatus& aStatus); - void FinishPersonalityStart( TRequestStatus& aStatus); - void PreparePersonalityStop( TRequestStatus& aStatus); - void FinishPersonalityStop( TRequestStatus& aStatus); - void ConfirmPersonalityUnload( TRequestStatus& aStatus); - -private: - // C++ constructor - CUsbMscPersonalityTestActiveObject( CUsbPersonalityPlugin*, CStifLogger*, TUsbPersonalityParams* ); - - // Second-phase constructor - void ConstructL(); - -private: - // From CActive - // Handle completion - void RunL(); - - // How to cancel me - void DoCancel(); - - // Override to handle leaves from RunL(). Default implementation causes - // the active scheduler to panic. - TInt RunError(TInt aError); - -private: - - -private: - - CUsbPersonalityPlugin* iPlugin; - CStifLogger* iLog; - TUsbPersonalityParams* iParams; - - }; - -#endif // USBMSCPERSONALITYTESTACTIVEOBJECT_H diff -r 703a2b94c06c -r dde4619868dc usbclasses/usbmscpersonality/tsrc/UsbMscPersonalityTest/inc/testdebug.h --- a/usbclasses/usbmscpersonality/tsrc/UsbMscPersonalityTest/inc/testdebug.h Wed Sep 15 13:20:24 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,66 +0,0 @@ -/* -* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifndef TESTDEBUG_H_ -#define TESTDEBUG_H_ - -// INCLUDES -#include -#include - -// CONSTANTS -_LIT8(KStifTestPrefix8, "[STIF_LOG] "); -_LIT( KStifTestPrefix, "[STIF_LOG] "); -_LIT8( KStifEntryPrefix8, ">>> %S" ); -_LIT8( KStifExitPrefix8, "<<< %S" ); - -const TInt KMaxLogLineLength = 512; -typedef TBuf8< KMaxLogLineLength > TLogBuf8; -typedef TBuf16< KMaxLogLineLength > TLogBuf16; - -// CLASS DECLARATION -NONSHARABLE_CLASS( TTestLogger ) - { -public: - static inline TLogBuf16 CreateLogBuf( TRefByValue aFmt, ... ); - static inline TLogBuf16 CreateLogBuf( TRefByValue aFmt, ... ); - static inline void Trace( CStifLogger& aLog, TLogBuf16 aLogBuf ); - }; - -// MACROS -#define TRACE( p ) {\ - TLogBuf16 buf = TTestLogger::CreateLogBuf( _L( p ) );\ - TTestLogger::Trace( *iLog, buf );\ - } -#define TRACE_INFO( p, args... ) {\ - TLogBuf16 buf = TTestLogger::CreateLogBuf( _L( p ), args );\ - TTestLogger::Trace( *iLog, buf );\ - } -#define TRACE_FUNC_ENTRY {\ - TPtrC8 ptr8( ( TUint8* ) __FUNCTION__ );\ - TLogBuf16 buf = TTestLogger::CreateLogBuf( KStifEntryPrefix8, &ptr8 );\ - TTestLogger::Trace( *iLog, buf );\ - } -#define TRACE_FUNC_EXIT {\ - TPtrC8 ptr8( ( TUint8* ) __FUNCTION__ );\ - TLogBuf16 buf = TTestLogger::CreateLogBuf( KStifExitPrefix8, &ptr8 );\ - TTestLogger::Trace( *iLog, buf );\ - } - -#include "testdebug.inl" - -#endif /* TESTDEBUG_H_ */ diff -r 703a2b94c06c -r dde4619868dc usbclasses/usbmscpersonality/tsrc/UsbMscPersonalityTest/inc/testdebug.inl --- a/usbclasses/usbmscpersonality/tsrc/UsbMscPersonalityTest/inc/testdebug.inl Wed Sep 15 13:20:24 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,69 +0,0 @@ -/* -* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#include - -NONSHARABLE_CLASS( TOverflowTruncate8 ) : public TDes8Overflow - { -public: - void Overflow( TDes8& /*aDes*/ ) {} - }; - -NONSHARABLE_CLASS( TOverflowTruncate16 ) : public TDes16Overflow - { -public: - void Overflow( TDes16& /*aDes*/ ) {} - }; - -TLogBuf16 TTestLogger::CreateLogBuf( TRefByValue aFmt, ... ) - { - VA_LIST list; - VA_START( list, aFmt ); - TOverflowTruncate8 overflow; - TLogBuf8 buf8; - TLogBuf16 buf16; - buf8.AppendFormatList( aFmt, list, &overflow ); - buf16.Copy( buf8 ); - return buf16; - }; - -TLogBuf16 TTestLogger::CreateLogBuf( TRefByValue aFmt, ... ) - { - VA_LIST list; - VA_START( list, aFmt ); - TOverflowTruncate16 overflow; - TLogBuf16 buf16; - buf16.AppendFormatList( aFmt, list, &overflow ); - return buf16; - }; - -void TTestLogger::Trace( CStifLogger& aLog, TLogBuf16 aLogBuf ) - { - RBuf16 buf; - RBuf16 bufStifLog; - - buf.Create( KMaxLogLineLength ); - buf.Append( KStifTestPrefix ); - buf.Append( aLogBuf ); - bufStifLog.Create( KMaxLogLineLength ); - bufStifLog.Append( aLogBuf ); - - RDebug::Print( buf ); - aLog.Log( bufStifLog ); - buf.Close(); - bufStifLog.Close(); - }; diff -r 703a2b94c06c -r dde4619868dc usbclasses/usbmscpersonality/tsrc/UsbMscPersonalityTest/init/UsbMscPersonalityTest_ats.ini --- a/usbclasses/usbmscpersonality/tsrc/UsbMscPersonalityTest/init/UsbMscPersonalityTest_ats.ini Wed Sep 15 13:20:24 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,233 +0,0 @@ -# Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -# All rights reserved. -# This component and the accompanying materials are made available -# under the terms of "Eclipse Public License v1.0" -# which accompanies this distribution, and is available -# at the URL "http://www.eclipse.org/legal/epl-v10.html". -# -# Initial Contributors: -# Nokia Corporation - initial contribution. -# -# Contributors: -# -# Description: -# - -# -# This is STIF initialization file -# Comment lines start with '#'-character. -# See STIF TestFramework users guide.doc for instructions - -# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -# Set following test engine settings: -# - Set Test Reporting mode. TestReportMode's possible values are: -# + 'Summary': Summary of the tested test cases. -# + 'Environment': Hardware and software info. -# + 'TestCases': Test case report. -# + 'FullReport': Set of all above ones. -# + Example 'TestReportMode= Summary TestCases' -# -# - CreateTestReport setting controls report creation mode -# + YES, Test report will created. -# + NO, No Test report. -# -# - File path indicates the base path of the test report. -# - File name indicates the name of the test report. -# -# - File format indicates the type of the test report. -# + TXT, Test report file will be txt type, for example 'TestReport.txt'. -# + HTML, Test report will be html type, for example 'TestReport.html'. -# + XML, Test report will be xml type, for example 'TestReport.xml'. -# Note, that xml format is available only when output is set to FILE. -# -# - File output indicates output source of the test report. -# + FILE, Test report logging to file. -# + RDEBUG, Test report logging to using rdebug. -# -# - File Creation Mode indicates test report overwriting if file exist. -# + OVERWRITE, Overwrites if the Test report file exist. -# + APPEND, Continue logging after the old Test report information if -# report exist. -# - Sets a device reset module's dll name(Reboot). -# + If Nokia specific reset module is not available or it is not correct one -# StifHWResetStub module may use as a template for user specific reset -# module. -# - Sets STIF test measurement disable options. e.g. pluging1 and pluging2 disablation -# DisableMeasurement= stifmeasurementplugin01 stifmeasurementplugin02 -# - -[Engine_Defaults] - -TestReportMode= FullReport # Possible values are: 'Empty', 'Summary', 'Environment', - 'TestCases' or 'FullReport' - -CreateTestReport= YES # Possible values: YES or NO - -TestReportFilePath= e:\testing\logs\ -TestReportFileName= UsbMscPersonalityTest_TestReport - -TestReportFormat= TXT # Possible values: TXT, HTML or XML -TestReportOutput= FILE # Possible values: FILE or RDEBUG -TestReportFileCreationMode= OVERWRITE # Possible values: OVERWRITE or APPEND - -DeviceResetDllName= StifResetForNokia.dll # e.g. 'StifHWResetStub.dll' for user specific reseting - -DisableMeasurement= stifmeasurementdisablenone # Possible values are: - # 'stifmeasurementdisablenone', 'stifmeasurementdisableall' - # 'stifmeasurementplugin01', 'stifmeasurementplugin02', - # 'stifmeasurementplugin03', 'stifmeasurementplugin04', - # 'stifmeasurementplugin05' or 'stifbappeaprofiler' - -Timeout= 0 # Default timeout value for each test case. In milliseconds -UITestingSupport= YES # Possible values: YES or NO -#SeparateProcesses= YES # Possible values: YES or NO (default: NO) -[End_Defaults] -# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - - - -# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -# Module configurations start -# Modules are added between module tags -# tags. Module name is specified after ModuleName= tag, like -# ModuleName= UsbMscPersonalityTestUsbMscPersonalityTestUsbMscPersonalityTest -# Modules might have initialisation file, specified as -# IniFile= c:\testframework\YYYYYY -# Modules might have several configuration files, like -# TestCaseFile= c:\testframework\NormalCases.txt -# TestCaseFile= c:\testframework\SmokeCases.txt -# TestCaseFile= c:\testframework\ManualCases.txt - -# (TestCaseFile is synonym for old term ConfigFile) - -# Following case specifies demo module settings. Demo module -# does not read any settings from file, so tags -# IniFile and TestCaseFile are not used. -# In the simplest case it is enough to specify only the -# name of the test module when adding new test module - -[New_Module] -ModuleName= testscripter -TestCaseFile= e:\testing\conf\UsbMscPersonalityTest.cfg -[End_Module] - - -# Load testmoduleUsbMscPersonalityTest, optionally with initialization file and/or test case files -#[New_Module] -#ModuleName= testmodulexxx - -#TestModuleUsbMscPersonalityTest used initialization file -#IniFile= c:\testframework\init.txt - -#TestModuleUsbMscPersonalityTest used configuration file(s) -#TestCaseFile= c:\testframework\testcases1.cfg -#TestCaseFile= c:\testframework\testcases2.cfg -#TestCaseFile= c:\testframework\manualtestcases.cfg - -#[End_Module] -# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - - - -# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -# Set STIF logging overwrite parameters for Logger. -# Hardware and emulator environment logging path and styles can -# be configured from here to overwrite the Logger's implemented values. -# -# Settings description: -# - Indicates option for creation log directory/directories. If log directory/directories -# is/are not created by user they will make by software. -# + YES, Create log directory/directories if not allready exist. -# + NO, Log directory/directories not created. Only created one is used. -# -# - Overwrite emulator path setting. -# + Example: If 'EmulatorBasePath= C:\LOGS\TestFramework\' and in code is defined -# Logger's path 'D:\\LOGS\\Module\\' with those definition the path -# will be 'C:\LOGS\TestFramework\LOGS\Module\' -# -# - Overwrite emulator's logging format. -# + TXT, Log file(s) will be txt type(s), for example 'Module.txt'. -# + HTML, Log file(s) will be html type(s), for example 'Module.html'. -# -# - Overwrited emulator logging output source. -# + FILE, Logging to file(s). -# + RDEBUG, Logging to using rdebug(s). -# -# - Overwrite hardware path setting (Same description as above in emulator path). -# - Overwrite hardware's logging format(Same description as above in emulator format). -# - Overwrite hardware's logging output source(Same description as above in emulator output). -# -# - File Creation Mode indicates file overwriting if file exist. -# + OVERWRITE, Overwrites if file(s) exist. -# + APPEND, Continue logging after the old logging information if file(s) exist. -# -# - Will thread id include to the log filename. -# + YES, Thread id to log file(s) name, Example filename 'Module_b9.txt'. -# + NO, No thread id to log file(s), Example filename 'Module.txt'. -# -# - Will time stamps include the to log file. -# + YES, Time stamp added to each line in log file(s). Time stamp is -# for example'12.Nov.2003 115958 LOGGING INFO' -# + NO, No time stamp(s). -# -# - Will line breaks include to the log file. -# + YES, Each logging event includes line break and next log event is in own line. -# + NO, No line break(s). -# -# - Will event ranking include to the log file. -# + YES, Event ranking number added to each line in log file(s). Ranking number -# depends on environment's tics, for example(includes time stamp also) -# '012 12.Nov.2003 115958 LOGGING INFO' -# + NO, No event ranking. -# -# - Will write log file in unicode format. -# + YES, Log file will be written in unicode format -# + NO, Log will be written as normal, not unicode, file. -# - -[Logger_Defaults] - -#NOTE: If you want to set Logger using next setting(s) remove comment(s)'#' -#NOTE: TestEngine and TestServer logging settings cannot change here - -#CreateLogDirectories= YES # Possible values: YES or NO - -#EmulatorBasePath= C:\LOGS\TestFramework\ -#EmulatorFormat= HTML # Possible values: TXT or HTML -#EmulatorOutput= FILE # Possible values: FILE or RDEBUG - -#HardwareBasePath= D:\LOGS\TestFramework\ -#HardwareFormat= HTML # Possible values: TXT or HTML -#HardwareOutput= FILE # Possible values: FILE or RDEBUG - -#FileCreationMode= OVERWRITE # Possible values: OVERWRITE or APPEND - -#ThreadIdToLogFile= YES # Possible values: YES or NO -#WithTimeStamp= YES # Possible values: YES or NO -#WithLineBreak= YES # Possible values: YES or NO -#WithEventRanking= YES # Possible values: YES or NO - -#FileUnicode= YES # Possible values: YES or NO -#AddTestCaseTitle= YES # Possible values: YES or NO -[End_Logger_Defaults] -# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - - - -# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -# Set filters to be used by ConsoleUI. -# If you want to use filter with ConsoleUI, simply remove comments -# from section below and provide valid filter entries. -# Each filter line has to start with "filter= " keyword. -# Filter can contain special wildcard characters: -# * which stands for none or any literal; -# ? which stands for single character. -# Filters are not case-sensitive. - -#[Filters] -#filter= *math* -#filter= *radio* -#[End_Filters] -# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - -# End of file diff -r 703a2b94c06c -r dde4619868dc usbclasses/usbmscpersonality/tsrc/UsbMscPersonalityTest/init/UsbMscPersonalityTest_phone.ini --- a/usbclasses/usbmscpersonality/tsrc/UsbMscPersonalityTest/init/UsbMscPersonalityTest_phone.ini Wed Sep 15 13:20:24 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,234 +0,0 @@ -# Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -# All rights reserved. -# This component and the accompanying materials are made available -# under the terms of "Eclipse Public License v1.0" -# which accompanies this distribution, and is available -# at the URL "http://www.eclipse.org/legal/epl-v10.html". -# -# Initial Contributors: -# Nokia Corporation - initial contribution. -# -# Contributors: -# -# Description: -# - - -# -# This is STIF initialization file -# Comment lines start with '#'-character. -# See STIF TestFramework users guide.doc for instructions - -# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -# Set following test engine settings: -# - Set Test Reporting mode. TestReportMode's possible values are: -# + 'Summary': Summary of the tested test cases. -# + 'Environment': Hardware and software info. -# + 'TestCases': Test case report. -# + 'FullReport': Set of all above ones. -# + Example 'TestReportMode= Summary TestCases' -# -# - CreateTestReport setting controls report creation mode -# + YES, Test report will created. -# + NO, No Test report. -# -# - File path indicates the base path of the test report. -# - File name indicates the name of the test report. -# -# - File format indicates the type of the test report. -# + TXT, Test report file will be txt type, for example 'TestReport.txt'. -# + HTML, Test report will be html type, for example 'TestReport.html'. -# + XML, Test report will be xml type, for example 'TestReport.xml'. -# Note, that xml format is available only when output is set to FILE. -# -# - File output indicates output source of the test report. -# + FILE, Test report logging to file. -# + RDEBUG, Test report logging to using rdebug. -# -# - File Creation Mode indicates test report overwriting if file exist. -# + OVERWRITE, Overwrites if the Test report file exist. -# + APPEND, Continue logging after the old Test report information if -# report exist. -# - Sets a device reset module's dll name(Reboot). -# + If Nokia specific reset module is not available or it is not correct one -# StifHWResetStub module may use as a template for user specific reset -# module. -# - Sets STIF test measurement disable options. e.g. pluging1 and pluging2 disablation -# DisableMeasurement= stifmeasurementplugin01 stifmeasurementplugin02 -# - -[Engine_Defaults] - -TestReportMode= FullReport # Possible values are: 'Empty', 'Summary', 'Environment', - 'TestCases' or 'FullReport' - -CreateTestReport= YES # Possible values: YES or NO - -TestReportFilePath= c:\logs\testframework\UsbMscPersonalityTest\ -TestReportFileName= testreport - -TestReportFormat= TXT # Possible values: TXT, HTML or XML -TestReportOutput= FILE # Possible values: FILE or RDEBUG -TestReportFileCreationMode= OVERWRITE # Possible values: OVERWRITE or APPEND - -DeviceResetDllName= StifResetForNokia.dll # e.g. 'StifHWResetStub.dll' for user specific reseting - -DisableMeasurement= stifmeasurementdisablenone # Possible values are: - # 'stifmeasurementdisablenone', 'stifmeasurementdisableall' - # 'stifmeasurementplugin01', 'stifmeasurementplugin02', - # 'stifmeasurementplugin03', 'stifmeasurementplugin04', - # 'stifmeasurementplugin05' or 'stifbappeaprofiler' - -Timeout= 0 # Default timeout value for each test case. In milliseconds -UITestingSupport= YES # Possible values: YES or NO -#SeparateProcesses= YES # Possible values: YES or NO (default: NO) -[End_Defaults] -# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - - - -# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -# Module configurations start -# Modules are added between module tags -# tags. Module name is specified after ModuleName= tag, like -# ModuleName= UsbMscPersonalityTestUsbMscPersonalityTestUsbMscPersonalityTest -# Modules might have initialisation file, specified as -# IniFile= c:\testframework\YYYYYY -# Modules might have several configuration files, like -# TestCaseFile= c:\testframework\NormalCases.txt -# TestCaseFile= c:\testframework\SmokeCases.txt -# TestCaseFile= c:\testframework\ManualCases.txt - -# (TestCaseFile is synonym for old term ConfigFile) - -# Following case specifies demo module settings. Demo module -# does not read any settings from file, so tags -# IniFile and TestCaseFile are not used. -# In the simplest case it is enough to specify only the -# name of the test module when adding new test module - -[New_Module] -ModuleName= testscripter -TestCaseFile= c:\testframework\UsbMscPersonalityTest.cfg -[End_Module] - - -# Load testmoduleUsbMscPersonalityTest, optionally with initialization file and/or test case files -#[New_Module] -#ModuleName= testmodulexxx - -#TestModuleUsbMscPersonalityTest used initialization file -#IniFile= c:\testframework\init.txt - -#TestModuleUsbMscPersonalityTest used configuration file(s) -#TestCaseFile= c:\testframework\testcases1.cfg -#TestCaseFile= c:\testframework\testcases2.cfg -#TestCaseFile= c:\testframework\manualtestcases.cfg - -#[End_Module] -# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - - - -# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -# Set STIF logging overwrite parameters for Logger. -# Hardware and emulator environment logging path and styles can -# be configured from here to overwrite the Logger's implemented values. -# -# Settings description: -# - Indicates option for creation log directory/directories. If log directory/directories -# is/are not created by user they will make by software. -# + YES, Create log directory/directories if not allready exist. -# + NO, Log directory/directories not created. Only created one is used. -# -# - Overwrite emulator path setting. -# + Example: If 'EmulatorBasePath= C:\LOGS\TestFramework\' and in code is defined -# Logger's path 'D:\\LOGS\\Module\\' with those definition the path -# will be 'C:\LOGS\TestFramework\LOGS\Module\' -# -# - Overwrite emulator's logging format. -# + TXT, Log file(s) will be txt type(s), for example 'Module.txt'. -# + HTML, Log file(s) will be html type(s), for example 'Module.html'. -# -# - Overwrited emulator logging output source. -# + FILE, Logging to file(s). -# + RDEBUG, Logging to using rdebug(s). -# -# - Overwrite hardware path setting (Same description as above in emulator path). -# - Overwrite hardware's logging format(Same description as above in emulator format). -# - Overwrite hardware's logging output source(Same description as above in emulator output). -# -# - File Creation Mode indicates file overwriting if file exist. -# + OVERWRITE, Overwrites if file(s) exist. -# + APPEND, Continue logging after the old logging information if file(s) exist. -# -# - Will thread id include to the log filename. -# + YES, Thread id to log file(s) name, Example filename 'Module_b9.txt'. -# + NO, No thread id to log file(s), Example filename 'Module.txt'. -# -# - Will time stamps include the to log file. -# + YES, Time stamp added to each line in log file(s). Time stamp is -# for example'12.Nov.2003 115958 LOGGING INFO' -# + NO, No time stamp(s). -# -# - Will line breaks include to the log file. -# + YES, Each logging event includes line break and next log event is in own line. -# + NO, No line break(s). -# -# - Will event ranking include to the log file. -# + YES, Event ranking number added to each line in log file(s). Ranking number -# depends on environment's tics, for example(includes time stamp also) -# '012 12.Nov.2003 115958 LOGGING INFO' -# + NO, No event ranking. -# -# - Will write log file in unicode format. -# + YES, Log file will be written in unicode format -# + NO, Log will be written as normal, not unicode, file. -# - -[Logger_Defaults] - -#NOTE: If you want to set Logger using next setting(s) remove comment(s)'#' -#NOTE: TestEngine and TestServer logging settings cannot change here - -#CreateLogDirectories= YES # Possible values: YES or NO - -#EmulatorBasePath= C:\LOGS\TestFramework\ -#EmulatorFormat= HTML # Possible values: TXT or HTML -#EmulatorOutput= FILE # Possible values: FILE or RDEBUG - -#HardwareBasePath= D:\LOGS\TestFramework\ -#HardwareFormat= HTML # Possible values: TXT or HTML -#HardwareOutput= FILE # Possible values: FILE or RDEBUG - -#FileCreationMode= OVERWRITE # Possible values: OVERWRITE or APPEND - -#ThreadIdToLogFile= YES # Possible values: YES or NO -#WithTimeStamp= YES # Possible values: YES or NO -#WithLineBreak= YES # Possible values: YES or NO -#WithEventRanking= YES # Possible values: YES or NO - -#FileUnicode= YES # Possible values: YES or NO -#AddTestCaseTitle= YES # Possible values: YES or NO -[End_Logger_Defaults] -# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - - - -# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -# Set filters to be used by ConsoleUI. -# If you want to use filter with ConsoleUI, simply remove comments -# from section below and provide valid filter entries. -# Each filter line has to start with "filter= " keyword. -# Filter can contain special wildcard characters: -# * which stands for none or any literal; -# ? which stands for single character. -# Filters are not case-sensitive. - -#[Filters] -#filter= *math* -#filter= *radio* -#[End_Filters] -# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - -# End of file diff -r 703a2b94c06c -r dde4619868dc usbclasses/usbmscpersonality/tsrc/UsbMscPersonalityTest/src/DismountClient.cpp --- a/usbclasses/usbmscpersonality/tsrc/UsbMscPersonalityTest/src/DismountClient.cpp Wed Sep 15 13:20:24 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,129 +0,0 @@ -/* -* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#include "DismountClient.h" - -CDismountClient::CDismountClient() : - CActive(EPriorityStandard) // Standard priority - { - } - -CDismountClient* CDismountClient::NewLC(CStifLogger *aLog) - { - CDismountClient* self = new (ELeave) CDismountClient(); - CleanupStack::PushL(self); - self->ConstructL(aLog); - return self; - } - -CDismountClient* CDismountClient::NewL(CStifLogger *aLog) - { - CDismountClient* self = CDismountClient::NewLC(aLog); - CleanupStack::Pop(); // self; - return self; - } - -void CDismountClient::ConstructL(CStifLogger *aLog) - { - User::LeaveIfError(iTimer.CreateLocal()); - iLog = aLog; - User::LeaveIfError( iFs.Connect() ); - - CActiveScheduler::Add(this); // Add to scheduler - } - -CDismountClient::~CDismountClient() - { - Cancel(); // Cancel any request, if outstanding - // Delete instance variables if any - iTimer.Close(); - iFs.NotifyDismountCancel(); - iFs.Close(); - } - -void CDismountClient::DoCancel() - { - iTimer.Cancel(); - iFs.NotifyDismountCancel(); - } - -void CDismountClient::StartL(TAllowDismountOption aAllowDismountOption) - { - Cancel(); - - iAllowDismountOption = aAllowDismountOption; - if (iAllowDismountOption == EAllowDismountTooLate || - iAllowDismountOption == EAllowDismountAfter2Sec) - { - iState = EDelay; - } - - iFs.NotifyDismount(EDriveE,iStatus,EFsDismountRegisterClient); - RDebug::Printf( " DiscmountClient StartL "); - iFs.NotifyDismountCancel(); - SetActive(); - } - -void CDismountClient::RunL() - { - - switch (iAllowDismountOption) - { - case EAllowDismount: - iFs.AllowDismount(EDriveE); - break; - - case EAllowDismountAfter2Sec: - if (iState ==EDelay) - { - iTimer.After(iStatus,(TTimeIntervalMicroSeconds32)2000000); - iState=EWaitForDelay; - SetActive(); - } - else - if(iState==EWaitForDelay) - { - iFs.AllowDismount(EDriveE); - iState=EDelay; - } - break; - - case EAllowDismountTooLate: - if (iState == EDelay) - { - iTimer.After(iStatus,(TTimeIntervalMicroSeconds32)8000000); - iState=EWaitForDelay; - SetActive(); - } - else - if(iState==EWaitForDelay) - { - iFs.AllowDismount(EDriveE); - iState=EDelay; - } - break; - - case ENotAllowDismount: - default: - break; - } - } - -TInt CDismountClient::RunError(TInt aError) - { - return aError; - } diff -r 703a2b94c06c -r dde4619868dc usbclasses/usbmscpersonality/tsrc/UsbMscPersonalityTest/src/UsbMscPersonalityTest.cpp --- a/usbclasses/usbmscpersonality/tsrc/UsbMscPersonalityTest/src/UsbMscPersonalityTest.cpp Wed Sep 15 13:20:24 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,326 +0,0 @@ -/* -* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -// INCLUDE FILES -#include -#include "UsbMscPersonalityTest.h" -#include -#include "testdebug.h" - -// EXTERNAL DATA STRUCTURES - -// EXTERNAL FUNCTION PROTOTYPES - -// CONSTANTS - -// MACROS - -// LOCAL CONSTANTS AND MACROS - -// MODULE DATA STRUCTURES - -// LOCAL FUNCTION PROTOTYPES - -// FORWARD DECLARATIONS - -// ============================= LOCAL FUNCTIONS =============================== - -// ----------------------------------------------------------------------------- -// ----------------------------------------------------------------------------- - -// ============================ MEMBER FUNCTIONS =============================== - -// ----------------------------------------------------------------------------- -// CUsbMscPersonalityTest::CUsbMscPersonalityTest -// C++ default constructor can NOT contain any code, that -// might leave. -// ----------------------------------------------------------------------------- -// -CUsbMscPersonalityTest::CUsbMscPersonalityTest( - CTestModuleIf& aTestModuleIf ): - CScriptBase( aTestModuleIf ) - { - } - -// ----------------------------------------------------------------------------- -// CUsbMscPersonalityTest::ConstructL -// Symbian 2nd phase constructor can leave. -// ----------------------------------------------------------------------------- -// -void CUsbMscPersonalityTest::ConstructL() - { - //Read logger settings to check whether test case name is to be - //appended to log file name. - RSettingServer settingServer; - TInt ret = settingServer.Connect(); - if(ret != KErrNone) - { - User::Leave(ret); - } - // Struct to StifLogger settigs. - TLoggerSettings loggerSettings; - // Parse StifLogger defaults from STIF initialization file. - ret = settingServer.GetLoggerSettings( loggerSettings ); - if( ret != KErrNone ) - { - User::Leave( ret ); - } - // Close Setting server session - settingServer.Close(); - - TFileName logFileName; - - if( loggerSettings.iAddTestCaseTitle ) - { - TName title; - TestModuleIf().GetTestCaseTitleL( title ); - logFileName.Format( KUsbMscPersonalityTestLogFileWithTitle, &title ); - } - else - { - logFileName.Copy( KUsbMscPersonalityTestLogFile ); - } - - iLog = CStifLogger::NewL( KUsbMscPersonalityTestLogPath, - logFileName, - CStifLogger::ETxt, - CStifLogger::EFile, - EFalse ); - - SendTestClassVersion(); - TestConstructL(); - } - -// ----------------------------------------------------------------------------- -// CUsbMscPersonalityTest::NewL -// Two-phased constructor. -// ----------------------------------------------------------------------------- -// -CUsbMscPersonalityTest* CUsbMscPersonalityTest::NewL( - CTestModuleIf& aTestModuleIf ) - { - CUsbMscPersonalityTest* self = new (ELeave) CUsbMscPersonalityTest( aTestModuleIf ); - CleanupStack::PushL( self ); - self->ConstructL(); - CleanupStack::Pop(); - return self; - } - -// Destructor -CUsbMscPersonalityTest::~CUsbMscPersonalityTest() - { - - // Delete resources allocated from test methods - TestDelete(); - - // Delete logger - delete iLog; - - } - -// ----------------------------------------------------------------------------- -// CUsbMscPersonalityTest::RunMethodL -// Run specified method. Contains also table of test mothods and their names. -// ----------------------------------------------------------------------------- - -TInt CUsbMscPersonalityTest::RunMethodL( - CStifItemParser& aItem ) - { - return ExecuteTestBlock( aItem ); - } - -// ----------------------------------------------------------------------------- -// CUsbMscPersonalityTest::ExecuteTestBlock -// ----------------------------------------------------------------------------- - -TInt CUsbMscPersonalityTest::ExecuteTestBlock( CStifItemParser& aItem ) - { - TRACE_FUNC_ENTRY - iItem = &aItem; - TInt res; - TUsbMscPersonalityTestResult testResult = ETestCaseFailed; - - res = iItem -> GetString( _L( "tester" ), iTestBlockParams.iTestBlockName ); - if ( res != KErrNone ) - { - TRACE_INFO( "Getting test block name failed with: %d", res ) - TRACE_FUNC_EXIT - return res; - } - TRACE_INFO( "Test block name: %S", &iTestBlockParams.iTestBlockName ) - - TRACE( "Extracting test block parameters..." ) - TRAP( res, TestBlocksInfoL() ); - if ( res != KErrNone ) - { - TRACE_INFO( "Extracting parameters failed: %d", res ) - TRACE_FUNC_EXIT - return res; - } - if ( !iTestBlockFound ) - { - TRACE( "Test block not found!" ) - TRACE_FUNC_EXIT - return KErrNotFound; - } - TRACE( "Extracting parameters successful" ) - - TRAP( res, ( this ->*iTestBlockFunction )( iTestBlockParams, testResult ) ); - if ( res != KErrNone ) - { - TRACE_INFO( "ExecuteTestBlockL error: %d", res ) - TRACE_FUNC_EXIT - return res; - } - - STIF_ASSERT_EQUALS( ETestCasePassed, testResult ); - TRACE( "Test block passed!" ); - TRACE_FUNC_EXIT - return KErrNone; - } - -// ----------------------------------------------------------------------------- -// CUsbMscPersonalityTest::GetTestBlockParamL -// ----------------------------------------------------------------------------- - -void CUsbMscPersonalityTest::GetTestBlockParamL( TGetTestBlockParamOperation aOperation, TTestBlockParamName aParamName ) - { - switch( aOperation ) - { - case eGetString: - { - switch ( aParamName ) - { - case eTestOption1: - { - User::LeaveIfError( iItem -> GetNextString( iTestBlockParams.iTestOption1 ) ); - break; - } - case eTestOption2: - { - User::LeaveIfError( iItem -> GetNextString( iTestBlockParams.iTestOption2 ) ); - break; - } - case eTestOption3: - { - User::LeaveIfError( iItem -> GetNextString( iTestBlockParams.iTestOption3 ) ); - break; - } - default: - { - User::Leave( KErrArgument ); - break; - } - } - break; - } - case eGetInt: - { - switch ( aParamName ) - { - case eTestIntOption1: - { - User::LeaveIfError( iItem -> GetNextInt( iTestBlockParams.iTestIntOption1 ) ); - break; - } - case eTestIntOption2: - { - User::LeaveIfError( iItem -> GetNextInt( iTestBlockParams.iTestIntOption2 ) ); - break; - } - case eTestIntOption3: - { - User::LeaveIfError( iItem -> GetNextInt( iTestBlockParams.iTestIntOption3 ) ); - break; - } - default: - { - User::Leave( KErrArgument ); - break; - } - } - break; - } - case eGetChar: - { - switch ( aParamName ) - { - case eTestCharOption1: - { - User::LeaveIfError( iItem -> GetNextChar( iTestBlockParams.iTestCharOption1 ) ); - break; - } - case eTestCharOption2: - { - User::LeaveIfError( iItem -> GetNextChar( iTestBlockParams.iTestCharOption2 ) ); - break; - } - case eTestCharOption3: - { - User::LeaveIfError( iItem -> GetNextChar( iTestBlockParams.iTestCharOption3 ) ); - break; - } - default: - { - User::Leave( KErrArgument ); - } - } - break; - } - default: - { - User::Leave( KErrArgument ); - } - } - } - -//----------------------------------------------------------------------------- -// CUsbMscPersonalityTest::SendTestClassVersion -// Method used to send version of test class -//----------------------------------------------------------------------------- -// -void CUsbMscPersonalityTest::SendTestClassVersion() - { - TVersion moduleVersion; - moduleVersion.iMajor = TEST_CLASS_VERSION_MAJOR; - moduleVersion.iMinor = TEST_CLASS_VERSION_MINOR; - moduleVersion.iBuild = TEST_CLASS_VERSION_BUILD; - - TFileName moduleName; - moduleName = _L("UsbMscPersonalityTest.dll"); - - TBool newVersionOfMethod = ETrue; - TestModuleIf().SendTestModuleVersion(moduleVersion, moduleName, newVersionOfMethod); - } - -// ========================== OTHER EXPORTED FUNCTIONS ========================= - -// ----------------------------------------------------------------------------- -// LibEntryL is a polymorphic Dll entry point. -// Returns: CScriptBase: New CScriptBase derived object -// ----------------------------------------------------------------------------- -// -EXPORT_C CScriptBase* LibEntryL( - CTestModuleIf& aTestModuleIf ) // Backpointer to STIF Test Framework - { - - return ( CScriptBase* ) CUsbMscPersonalityTest::NewL( aTestModuleIf ); - - } - - -// End of File diff -r 703a2b94c06c -r dde4619868dc usbclasses/usbmscpersonality/tsrc/UsbMscPersonalityTest/src/UsbMscPersonalityTestActiveObject.cpp --- a/usbclasses/usbmscpersonality/tsrc/UsbMscPersonalityTest/src/UsbMscPersonalityTestActiveObject.cpp Wed Sep 15 13:20:24 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,115 +0,0 @@ -/* -* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ -#include "UsbMscPersonalityTestActiveObject.h" -#include - -CUsbMscPersonalityTestActiveObject::CUsbMscPersonalityTestActiveObject( CUsbPersonalityPlugin* aPlugin, CStifLogger* aLog, TUsbPersonalityParams* aParams ) : - CActive(EPriorityStandard) // Standard priority - { - iPlugin = aPlugin; - iLog = aLog; - iParams = aParams; - } - -CUsbMscPersonalityTestActiveObject* CUsbMscPersonalityTestActiveObject::NewLC( CUsbPersonalityPlugin* aPlugin, CStifLogger* aLog, TUsbPersonalityParams* aParams ) - { - CUsbMscPersonalityTestActiveObject* self = - new (ELeave) CUsbMscPersonalityTestActiveObject( aPlugin, aLog, aParams ); - CleanupStack::PushL(self); - self->ConstructL(); - return self; - } - -CUsbMscPersonalityTestActiveObject* CUsbMscPersonalityTestActiveObject::NewL( CUsbPersonalityPlugin* aPlugin, CStifLogger* aLog, TUsbPersonalityParams* aParams ) - { - CUsbMscPersonalityTestActiveObject* self = - CUsbMscPersonalityTestActiveObject::NewLC( aPlugin, aLog, aParams ); - CleanupStack::Pop(); // self; - return self; - } - -void CUsbMscPersonalityTestActiveObject::ConstructL() - { - CActiveScheduler::Add(this); // Add to scheduler - } - -CUsbMscPersonalityTestActiveObject::~CUsbMscPersonalityTestActiveObject() - { - Cancel(); // Cancel any request, if outstanding - - // Delete instance variables if any - } - -void CUsbMscPersonalityTestActiveObject::DoCancel() - { - } - -void CUsbMscPersonalityTestActiveObject::RunL() - { - CActiveScheduler::Stop(); - } - -TInt CUsbMscPersonalityTestActiveObject::RunError(TInt aError) - { - return aError; - } - -void CUsbMscPersonalityTestActiveObject::PreparePersonalityStart( TRequestStatus& aStatus) - { - iPlugin->PreparePersonalityStart(aStatus); - RDebug::Printf( "prepare personality start, status: %d", aStatus.Int()); - - SetActive(); - CActiveScheduler::Start(); - } - -void CUsbMscPersonalityTestActiveObject::FinishPersonalityStart( TRequestStatus& aStatus) - { - iPlugin->FinishPersonalityStart(aStatus); - RDebug::Printf( "finish personality start, status: %d", aStatus.Int()); - - SetActive(); - CActiveScheduler::Start(); - } - -void CUsbMscPersonalityTestActiveObject::PreparePersonalityStop( TRequestStatus& aStatus) - { - iPlugin->PreparePersonalityStop(aStatus); - RDebug::Printf( "prepare personality start, status: %d", aStatus.Int()); - - SetActive(); - CActiveScheduler::Start(); - } - -void CUsbMscPersonalityTestActiveObject::FinishPersonalityStop( TRequestStatus& aStatus) - { - iPlugin->FinishPersonalityStop(aStatus); - RDebug::Printf( "finish personality start, status: %d", aStatus.Int()); - - SetActive(); - CActiveScheduler::Start(); - } - -void CUsbMscPersonalityTestActiveObject::ConfirmPersonalityUnload( TRequestStatus& aStatus) - { - iPlugin->ConfirmPersonalityUnload(aStatus); - RDebug::Printf( "confirm personality unload, status: %d", aStatus.Int()); - - iParams->PersonalityNotifier().CancelQuery(KQueriesNotifier); - SetActive(); - CActiveScheduler::Start(); - } diff -r 703a2b94c06c -r dde4619868dc usbclasses/usbmscpersonality/tsrc/UsbMscPersonalityTest/src/UsbMscPersonalityTestBlocks.cpp --- a/usbclasses/usbmscpersonality/tsrc/UsbMscPersonalityTest/src/UsbMscPersonalityTestBlocks.cpp Wed Sep 15 13:20:24 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,497 +0,0 @@ -/* - * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). - * All rights reserved. - * This component and the accompanying materials are made available - * under the terms of "Eclipse Public License v1.0" - * which accompanies this distribution, and is available - * at the URL "http://www.eclipse.org/legal/epl-v10.html". - * - * Initial Contributors: - * Nokia Corporation - initial contribution. - * - * Contributors: - * - * Description: - * - */ - -// [INCLUDE FILES] - do not remove -#include -#include -#include -#include "UsbMscPersonalityTest.h" -#include "testdebug.h" -#include -// EXTERNAL DATA STRUCTURES - -// EXTERNAL FUNCTION PROTOTYPES - -// CONSTANTS - -// MACROS - -// LOCAL CONSTANTS AND MACROS - -// MODULE DATA STRUCTURES - -// LOCAL FUNCTION PROTOTYPES - -// FORWARD DECLARATIONS - -// ============================= LOCAL FUNCTIONS =============================== - -// ----------------------------------------------------------------------------- -// ----------------------------------------------------------------------------- - -// ============================ MEMBER FUNCTIONS =============================== - -// ----------------------------------------------------------------------------- -// CUsbMscPersonalityTest::TestConstructL -// Construct here all test resources for test methods. -// Called from ConstructL. -// ----------------------------------------------------------------------------- - -void CUsbMscPersonalityTest::TestConstructL() - { - TRACE_FUNC_ENTRY - - if (!CActiveScheduler::Current()) - { - iScheduler = new (ELeave) CActiveScheduler; - CActiveScheduler::Install(iScheduler); - } - - iUsb = new (ELeave) RUsb; - iNotifier = CUsbPersonalityNotifier::NewL(); - iParams = new (ELeave) TUsbPersonalityParams(*iUsb, *iNotifier); - // iParams->SetPersonalityId(2); - iPlugin = CUsbPersonalityPlugin::NewL(*iParams, TUid::Uid(0x1020DF7B)); - - TRACE_FUNC_EXIT - } - -// ----------------------------------------------------------------------------- -// CUsbMscPersonalityTest::TestDelete -// Delete here all resources allocated and opened from test methods. -// Called from destructor. -// ----------------------------------------------------------------------------- - -void CUsbMscPersonalityTest::TestDelete() - { - TRACE_FUNC_ENTRY - - if (iScheduler) - { - iScheduler->Stop(); - delete iScheduler; - iScheduler = NULL; - } - - if (iUsb) - { - delete iUsb; - iUsb = NULL; - } - - if (iNotifier) - { - delete iNotifier; - } - - if (iParams) - { - delete iParams; - iParams = NULL; - } - - if (iPlugin) - { - iPlugin->Cancel(); - delete iPlugin; - iPlugin = NULL; - } - - if (iActive) - { - delete iActive; - iActive = NULL; - } - - if (iDismountClient) - { - delete iDismountClient; - iDismountClient = NULL; - } - - REComSession::FinalClose(); - - TRACE_FUNC_EXIT - } - -// ----------------------------------------------------------------------------- -// CUsbMscPersonalityTest::TestBlocksInfoL -// Add new test block parameter entries below -// ----------------------------------------------------------------------------- - -void CUsbMscPersonalityTest::TestBlocksInfoL() - { - - TESTENTRY( "ExampleTestL", CUsbMscPersonalityTest::ExampleTestL ) - { - TESTPARAM( eGetString, eTestOption1 ) - TESTPARAM( eGetString, eTestOption2 ) - TESTPARAM( eGetInt, eTestIntOption1 ) - TESTPARAM( eGetChar, eTestCharOption1 ) - } - TESTENTRY( "PreparePersonalityStartTestL", CUsbMscPersonalityTest::PreparePersonalityStartTestL ) - { - TESTPARAM( eGetString, eTestOption1 ) - } - TESTENTRY( "FinishPersonalityStartTestL", CUsbMscPersonalityTest::FinishPersonalityStartTestL ) - { - TESTPARAM( eGetString, eTestOption1 ) - } - TESTENTRY( "PreparePersonalityStopTestL", CUsbMscPersonalityTest::PreparePersonalityStopTestL ) - { - TESTPARAM( eGetString, eTestOption1 ) - } - TESTENTRY( "FinishPersonalityStopTestL", CUsbMscPersonalityTest::FinishPersonalityStopTestL ) - { - TESTPARAM( eGetString, eTestOption1 ) - } - TESTENTRY( "InitializationTestL", CUsbMscPersonalityTest::InitializationTestL ) - { - TESTPARAM( eGetString, eTestOption1 ) - } - TESTENTRY( "StateChangeNotifyTestL", CUsbMscPersonalityTest::StateChangeNotifyTestL ) - { - TESTPARAM( eGetString, eTestOption1 ) - } - TESTENTRY( "StateChangeNotifyUndefinedTestL", CUsbMscPersonalityTest::StateChangeNotifyUndefinedTestL ) - { - TESTPARAM( eGetString, eTestOption1 ) - } - TESTENTRY( "StateChangeNotifyStateAddressTestL", CUsbMscPersonalityTest::StateChangeNotifyStateAddressTestL ) - { - TESTPARAM( eGetString, eTestOption1 ) - } - TESTENTRY( "ConfirmPersonalityUnloadTestL", CUsbMscPersonalityTest::ConfirmPersonalityUnloadTestL ) - { - TESTPARAM( eGetString, eTestOption1 ) - } - TESTENTRY( "AllowDismountAfter2SecTestL", CUsbMscPersonalityTest::AllowDismountAfter2SecTestL ) - { - TESTPARAM( eGetString, eTestOption1 ) - } - TESTENTRY( "AllowDismountTestL", CUsbMscPersonalityTest::AllowDismountTestL ) - { - TESTPARAM( eGetString, eTestOption1 ) - } - TESTENTRY( "NotAllowDismountTestL", CUsbMscPersonalityTest::NotAllowDismountTestL ) - { - TESTPARAM( eGetString, eTestOption1 ) - } - TESTENTRY( "AllowDismountTooLateTestL", CUsbMscPersonalityTest::AllowDismountTooLateTestL ) - { - TESTPARAM( eGetString, eTestOption1 ) - } - - } - -// Add test block methods implementation here -// ----------------------------------------------------------------------------- -// CUsbMscPersonalityTest::ExampleTestL -// ----------------------------------------------------------------------------- - -void CUsbMscPersonalityTest::ExampleTestL( - TUsbMscPersonalityTestBlockParams& aParams, - TUsbMscPersonalityTestResult& aTestResult) - { - TRACE_FUNC_ENTRY - - if (!aParams.iTestOption1.Compare(_L( "API" ))) - { - TRACE_INFO( "Api test option: %S", &aParams.iTestOption1 ) - TRACE_INFO( "Api test sub-option: %S", &aParams.iTestOption2 ) - TRACE_INFO( "Api test int option: %d", aParams.iTestIntOption1 ) - TRACE_INFO( "Api test char option: %c", TText( aParams.iTestCharOption1 ) ) - } - else if (!aParams.iTestOption1.Compare(_L( "MODULE" ))) - { - TRACE_INFO( "Module test option: %S", &aParams.iTestOption1 ) - TRACE_INFO( "Module test sub-option: %S", &aParams.iTestOption2 ) - TRACE_INFO( "Module test int option: %d", aParams.iTestIntOption1 ) - TRACE_INFO( "Module test char option: %c", TText( aParams.iTestCharOption1 ) ) - } - else if (!aParams.iTestOption1.Compare(_L( "BRANCH" ))) - { - TRACE_INFO( "Branch test option: %S", &aParams.iTestOption1 ) - TRACE_INFO( "Branch test sub-option: %S", &aParams.iTestOption2 ) - TRACE_INFO( "Branch test int option: %d", aParams.iTestIntOption1 ) - TRACE_INFO( "Branch test char option: %c", TText( aParams.iTestCharOption1 ) ) - } - else - { - TRACE( "Invalid test parameter" ) - TRACE_FUNC_EXIT - User::Leave(KErrNotFound); - } - - aTestResult = ETestCasePassed; - TRACE_FUNC_EXIT - } - -void CUsbMscPersonalityTest::InitializeTestObjectsL() - { - iActive - = CUsbMscPersonalityTestActiveObject::NewL(iPlugin, iLog, iParams); - iDismountClient = CDismountClient::NewL(iLog); - TRACE ( " test objects initialized " ); - } - -void CUsbMscPersonalityTest::DeleteTestObjects() - { - delete iActive; - iActive = NULL; - delete iDismountClient; - iDismountClient = NULL; - TRACE ( " test objects deleted " ); - } - -void CUsbMscPersonalityTest::InitializationTestL( - TUsbMscPersonalityTestBlockParams& aParams, - TUsbMscPersonalityTestResult& aTestResult) - { - InitializeTestObjectsL(); - TRACE( "checking iPlugin") - if (iPlugin) - { - aTestResult = ETestCasePassed; - } - else - { - TRACE( "no iplugin instance") - } - - DeleteTestObjects(); - } - -void CUsbMscPersonalityTest::ExecuteDismounting() - { - iActive->PreparePersonalityStart(iRequestStatus); - iActive->FinishPersonalityStart(iRequestStatus); - iActive->PreparePersonalityStop(iRequestStatus); - iActive->FinishPersonalityStop(iRequestStatus); - } - -void CUsbMscPersonalityTest::PreparePersonalityStartTestL( - TUsbMscPersonalityTestBlockParams& aParams, - TUsbMscPersonalityTestResult& aTestResult) - { - InitializeTestObjectsL(); - - iActive->PreparePersonalityStart(iRequestStatus); - - TRACE_INFO( "prepare personality start status: %d, expected: %d", iRequestStatus.Int(), KErrNone ); - User::LeaveIfError(iRequestStatus.Int()); - - aTestResult = ETestCasePassed; - DeleteTestObjects(); - } - -void CUsbMscPersonalityTest::FinishPersonalityStartTestL( - TUsbMscPersonalityTestBlockParams& aParams, - TUsbMscPersonalityTestResult& aTestResult) - { - InitializeTestObjectsL(); - - iActive->PreparePersonalityStart(iRequestStatus); - TRACE_INFO( "prepare personality start status: %d, expected: %d", iRequestStatus.Int(), KErrNone ); - User::LeaveIfError(iRequestStatus.Int()); - - iActive->FinishPersonalityStart(iRequestStatus); - TRACE_INFO( "finish personality start status: %d, expected: %d", iRequestStatus.Int(), KErrNone ); - - iActive->PreparePersonalityStop(iRequestStatus); - iActive->FinishPersonalityStart(iRequestStatus); - User::LeaveIfError(iRequestStatus.Int()); - - aTestResult = ETestCasePassed; - - DeleteTestObjects(); - } - -void CUsbMscPersonalityTest::PreparePersonalityStopTestL( - TUsbMscPersonalityTestBlockParams& aParams, - TUsbMscPersonalityTestResult& aTestResult) - { - InitializeTestObjectsL(); - - iActive->PreparePersonalityStart(iRequestStatus); - TRACE_INFO( "prepare personality start status: %d, expected: %d", iRequestStatus.Int(), KErrNone ); - User::LeaveIfError( iRequestStatus.Int() ); - - iActive->FinishPersonalityStart(iRequestStatus); - TRACE_INFO( "finish personality start status: %d, expected: %d", iRequestStatus.Int(), KErrNone ); - User::LeaveIfError( iRequestStatus.Int() ); - - iActive->PreparePersonalityStop(iRequestStatus); - TRACE_INFO( "prepare personality stop status: %d, expected: %d", iRequestStatus.Int(), KErrNone ); - User::LeaveIfError( iRequestStatus.Int() ); - - aTestResult = ETestCasePassed; - - DeleteTestObjects(); - } - -void CUsbMscPersonalityTest::FinishPersonalityStopTestL( - TUsbMscPersonalityTestBlockParams& aParams, - TUsbMscPersonalityTestResult& aTestResult) - { - InitializeTestObjectsL(); - - iActive->PreparePersonalityStart(iRequestStatus); - TRACE_INFO( "prepare personality start status: %d, expected: %d", iRequestStatus.Int(), KErrNone ); - User::LeaveIfError( iRequestStatus.Int() ); - - iActive->FinishPersonalityStart(iRequestStatus); - TRACE_INFO( "finish personality start status: %d, expected: %d", iRequestStatus.Int(), KErrNone ); - User::LeaveIfError( iRequestStatus.Int() ); - - iActive->PreparePersonalityStop(iRequestStatus); - TRACE_INFO( "prepare personality stop status: %d, expected: %d", iRequestStatus.Int(), KErrNone ); - User::LeaveIfError( iRequestStatus.Int() ); - - iActive->FinishPersonalityStop(iRequestStatus); - TRACE_INFO( "finish personality stop status: %d, expected: %d", iRequestStatus.Int(), KErrNone ); - User::LeaveIfError( iRequestStatus.Int() ); - - aTestResult = ETestCasePassed; - - DeleteTestObjects(); - } - -void CUsbMscPersonalityTest::ConfirmPersonalityUnloadTestL( - TUsbMscPersonalityTestBlockParams& aParams, - TUsbMscPersonalityTestResult& aTestResult) - { - InitializeTestObjectsL(); - - TRACE_INFO( "prepare personality start status: %d, expected: %d", iRequestStatus.Int(), KErrNone ); - User::LeaveIfError( iRequestStatus.Int() ); - - iActive->FinishPersonalityStart(iRequestStatus); - TRACE_INFO( "finish personality start status: %d, expected: %d", iRequestStatus.Int(), KErrNone ); - User::LeaveIfError( iRequestStatus.Int() ); - - iActive->ConfirmPersonalityUnload(iRequestStatus); - User::After(5000); - TRACE_INFO( "confirm personality unload status: %d, expected: %d", iRequestStatus.Int(), KErrNone ); - User::LeaveIfError( iRequestStatus.Int() ); - - aTestResult = ETestCasePassed; - - DeleteTestObjects(); - } - -void CUsbMscPersonalityTest::StateChangeNotifyTestL( - TUsbMscPersonalityTestBlockParams& aParams, - TUsbMscPersonalityTestResult& aTestResult) - { - InitializeTestObjectsL(); - - TUsbDeviceState state = EUsbDeviceStateDefault; - iPlugin->StateChangeNotify(state); - - aTestResult = ETestCasePassed; - - DeleteTestObjects(); - } - -void CUsbMscPersonalityTest::StateChangeNotifyUndefinedTestL( TUsbMscPersonalityTestBlockParams& aParams, - TUsbMscPersonalityTestResult& aTestResult ) - { - InitializeTestObjectsL(); - - TUsbDeviceState state = EUsbDeviceStateUndefined; - iPlugin->StateChangeNotify(state); - - aTestResult = ETestCasePassed; - - DeleteTestObjects(); - } - -void CUsbMscPersonalityTest::StateChangeNotifyStateAddressTestL( TUsbMscPersonalityTestBlockParams& aParams, - TUsbMscPersonalityTestResult& aTestResult ) - { - InitializeTestObjectsL(); - - TUsbDeviceState state = EUsbDeviceStateAddress; - iPlugin->StateChangeNotify(state); - - User::After( 2000000 ); - iPlugin->Cancel(); - - aTestResult = ETestCasePassed; - - DeleteTestObjects(); - } - -void CUsbMscPersonalityTest::AllowDismountAfter2SecTestL( - TUsbMscPersonalityTestBlockParams& aParams, - TUsbMscPersonalityTestResult& aTestResult) - { - InitializeTestObjectsL(); - iDismountClient->StartL(EAllowDismountAfter2Sec); - iActive->PreparePersonalityStart(iRequestStatus); - ExecuteDismounting(); - - aTestResult = ETestCasePassed; - DeleteTestObjects(); - } - -void CUsbMscPersonalityTest::AllowDismountTestL( - TUsbMscPersonalityTestBlockParams& aParams, - TUsbMscPersonalityTestResult& aTestResult) - { - InitializeTestObjectsL(); - iDismountClient->StartL(EAllowDismount); - iActive->PreparePersonalityStart(iRequestStatus); - ExecuteDismounting(); - - aTestResult = ETestCasePassed; - DeleteTestObjects(); - } - -void CUsbMscPersonalityTest::NotAllowDismountTestL( - TUsbMscPersonalityTestBlockParams& aParams, - TUsbMscPersonalityTestResult& aTestResult) - { - InitializeTestObjectsL(); - iDismountClient->StartL(ENotAllowDismount); - iActive->PreparePersonalityStart(iRequestStatus); - ExecuteDismounting(); - - aTestResult = ETestCasePassed; - DeleteTestObjects(); - } - -void CUsbMscPersonalityTest::AllowDismountTooLateTestL( - TUsbMscPersonalityTestBlockParams& aParams, - TUsbMscPersonalityTestResult& aTestResult) - { - InitializeTestObjectsL(); - iDismountClient->StartL(EAllowDismountTooLate); - iActive->PreparePersonalityStart(iRequestStatus); - ExecuteDismounting(); - - aTestResult = ETestCasePassed; - DeleteTestObjects(); - } -// Add other member functions implementation here - - -// ========================== OTHER EXPORTED FUNCTIONS ========================= -// None - -// [End of File] - Do not remove diff -r 703a2b94c06c -r dde4619868dc usbclasses/usbmscpersonality/tsrc/UsbMscPersonalityTest/src/UsbMscPersonalityTest_exe.cpp --- a/usbclasses/usbmscpersonality/tsrc/UsbMscPersonalityTest/src/UsbMscPersonalityTest_exe.cpp Wed Sep 15 13:20:24 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,64 +0,0 @@ -/* -* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -// INCLUDE FILES -#include -#include -#include -// EXTERNAL DATA STRUCTURES - -// EXTERNAL FUNCTION PROTOTYPES - -// ================= OTHER EXPORTED FUNCTIONS ================================= - -/* -------------------------------------------------------------------------------- - - Class: - - - Method: E32Main - - Description: - - Parameters: None - - Return Values: TInt: Symbian error code - - Errors/Exceptions: None - - Status: Draft - -------------------------------------------------------------------------------- -*/ -GLDEF_C TInt E32Main() - { - _LIT( KProcessMsgStart, "New process starting" ); - RDebug::Print( KProcessMsgStart ); - - - // This starts a new session that get capabilites that is used in - // usbmscpersonalitytest_exe.mmp file. - TInt r = StartSession(); - - _LIT( KProcessMsgEnd, "New process ends" ); - RDebug::Print( KProcessMsgEnd ); - - return r; - - } - -// End of File diff -r 703a2b94c06c -r dde4619868dc usbclasses/usbobexclasscontroller/tsrc/UsbObexClassControllerTest/bmarm/UsbObexClassControllerTestu.def --- a/usbclasses/usbobexclasscontroller/tsrc/UsbObexClassControllerTest/bmarm/UsbObexClassControllerTestu.def Wed Sep 15 13:20:24 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,3 +0,0 @@ -EXPORTS - LibEntryL__FR13CTestModuleIf @ 1 NONAME R3UNUSED ; LibEntryL(CTestModuleIf &) - diff -r 703a2b94c06c -r dde4619868dc usbclasses/usbobexclasscontroller/tsrc/UsbObexClassControllerTest/bwins/UsbObexClassControllerTestu.def --- a/usbclasses/usbobexclasscontroller/tsrc/UsbObexClassControllerTest/bwins/UsbObexClassControllerTestu.def Wed Sep 15 13:20:24 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,3 +0,0 @@ -EXPORTS - ?LibEntryL@@YAPAVCScriptBase@@AAVCTestModuleIf@@@Z @ 1 NONAME ; class CScriptBase * __cdecl LibEntryL(class CTestModuleIf &) - diff -r 703a2b94c06c -r dde4619868dc usbclasses/usbobexclasscontroller/tsrc/UsbObexClassControllerTest/conf/UsbObexClassControllerTest.cfg --- a/usbclasses/usbobexclasscontroller/tsrc/UsbObexClassControllerTest/conf/UsbObexClassControllerTest.cfg Wed Sep 15 13:20:24 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,105 +0,0 @@ -/* -* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - - -[StifSettings] -CapsModifier= UsbObexClassControllerTest.exe -[EndStifSettings] - -// UsbObexClassControllerTest Module - total 9 tc - -// UsbObexClassControllerTest Api Tests (9 tc) - -[Test] -title Initialization Test -create UsbObexClassControllerTest tester -tester ExecuteApiTest InitializationTest -delete tester -[Endtest] - -[Test] -title Start Test -create UsbObexClassControllerTest tester -tester ExecuteApiTest StartTest -delete tester -[Endtest] - -[Test] -title Stop Test -create UsbObexClassControllerTest tester -tester ExecuteApiTest StopTest -delete tester -[Endtest] - -[Test] -title InterfaceInfo Test -create UsbObexClassControllerTest tester -tester ExecuteApiTest InterfaceInfoTest -delete tester -[Endtest] - -[Test] -title InterfaceLengthInfo Test -create UsbObexClassControllerTest tester -tester ExecuteApiTest InterfaceLengthInfoTest -delete tester -[Endtest] - -[Test] -title NumberOfInterfacesInfo Test -create UsbObexClassControllerTest tester -tester ExecuteApiTest NumberOfInterfacesInfoTest -delete tester -[Endtest] - -[Test] -title StartupPriorityInfo Test -create UsbObexClassControllerTest tester -tester ExecuteApiTest StartupPriorityInfoTest -delete tester -[Endtest] - -[Test] -title StateInfo Test -create UsbObexClassControllerTest tester -tester ExecuteApiTest StateInfoTest -delete tester -[Endtest] - -[Test] -title Owner Test -create UsbObexClassControllerTest tester -tester ExecuteApiTest OwnerTest -delete tester -[Endtest] - -// Add new api tests here -// ... - - -// UsbObexClassControllerTest Module Tests (... tc) - - -// Add new module tests here -// ... - - -// UsbObexClassControllerTest Branch Tests (... tc) - - -// Add new branch tests here -// ... diff -r 703a2b94c06c -r dde4619868dc usbclasses/usbobexclasscontroller/tsrc/UsbObexClassControllerTest/eabi/UsbObexClassControllerTestu.def --- a/usbclasses/usbobexclasscontroller/tsrc/UsbObexClassControllerTest/eabi/UsbObexClassControllerTestu.def Wed Sep 15 13:20:24 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,5 +0,0 @@ -EXPORTS - _Z9LibEntryLR13CTestModuleIf @ 1 NONAME - _ZTI27CUSBObexApiTestActiveObject @ 2 NONAME - _ZTV27CUSBObexApiTestActiveObject @ 3 NONAME - diff -r 703a2b94c06c -r dde4619868dc usbclasses/usbobexclasscontroller/tsrc/UsbObexClassControllerTest/group/UsbObexClassControllerTest.mmp --- a/usbclasses/usbobexclasscontroller/tsrc/UsbObexClassControllerTest/group/UsbObexClassControllerTest.mmp Wed Sep 15 13:20:24 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,49 +0,0 @@ -/* -* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: TYPE TESTCLASS -* -*/ - - -#if defined(__S60_) - // To get the OSEXT_LAYER_SYSTEMINCLUDE-definition - #include -#endif - -TARGET UsbObexClassControllerTest.dll -TARGETTYPE dll -UID 0x1000008D 0x101FB3E3 - -CAPABILITY NetworkControl LocalServices NetworkServices CommDD ProtServ - -DEFFILE UsbObexClassControllerTest.def - -MW_LAYER_SYSTEMINCLUDE - -USERINCLUDE ../inc - -SOURCEPATH ../src -SOURCE UsbObexClassControllerTest.cpp -SOURCE UsbObexClassControllerTestBlocks.cpp USBObexApiTestActiveObject.cpp UsbObexClassControllerTest_exe.cpp - -LIBRARY euser.lib -LIBRARY stiftestinterface.lib -LIBRARY stiftestengine.lib -LIBRARY usbclasscontroller.lib -LIBRARY ecom.lib - - -LANG SC - -// End of File diff -r 703a2b94c06c -r dde4619868dc usbclasses/usbobexclasscontroller/tsrc/UsbObexClassControllerTest/group/UsbObexClassControllerTest_ats.pkg --- a/usbclasses/usbobexclasscontroller/tsrc/UsbObexClassControllerTest/group/UsbObexClassControllerTest_ats.pkg Wed Sep 15 13:20:24 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,62 +0,0 @@ -; -; Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -; All rights reserved. -; This component and the accompanying materials are made available -; under the terms of "Eclipse Public License v1.0" -; which accompanies this distribution, and is available -; at the URL "http://www.eclipse.org/legal/epl-v10.html". -; -; Initial Contributors: -; Nokia Corporation - initial contribution. -; -; Contributors: -; -; Description: -; - -; Languages -&EN - -; Provide value for uid -#{"STIF"},(0x00000000),1,1,0,TYPE=SA - -; Series60 product id for S60 3.0 -[0x101F7961], 0, 0, 0, {"Series60ProductID"} - -; Localised Vendor name -%{"Nokia"} - -; Unique Vendor name -:"Nokia" - -; Logo -; None - -; Package signature - Optional -; None - -; Start of Package body - -; Condition blocks -; None - -; Options list -; None - -; Install files -"\epoc32\release\armv5\udeb\UsbObexClassControllerTest.dll"-"c:\Sys\Bin\UsbObexClassControllerTest.dll" -"\epoc32\release\armv5\udeb\UsbObexClassControllerTest.exe"-"c:\Sys\Bin\UsbObexClassControllerTest.exe" - -"..\init\UsbObexClassControllerTest_ats.ini"-"e:\testing\init\UsbObexClassControllerTest.ini" -"..\conf\UsbObexClassControllerTest.cfg"-"e:\testing\conf\UsbObexClassControllerTest.cfg" - -; Embedded SIS -; None - -; End of Package body - -; PKG dependencies -; None - -; PKG capabilities -; None diff -r 703a2b94c06c -r dde4619868dc usbclasses/usbobexclasscontroller/tsrc/UsbObexClassControllerTest/group/UsbObexClassControllerTest_exe.mmp --- a/usbclasses/usbobexclasscontroller/tsrc/UsbObexClassControllerTest/group/UsbObexClassControllerTest_exe.mmp Wed Sep 15 13:20:24 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,41 +0,0 @@ -/* -* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: TYPE TESTCLASS -* -*/ - - -#if defined(__S60_) - #include -#endif - -TARGET UsbObexClassControllerTest.exe -TARGETTYPE exe - -CAPABILITY NetworkControl LocalServices NetworkServices CommDD ProtServ - -UID 0 0xEF4892C6 - -MW_LAYER_SYSTEMINCLUDE - -SOURCEPATH ../src - -SOURCE UsbObexClassControllerTest_exe.cpp - -LIBRARY euser.lib -LIBRARY stiftestinterface.lib - -EPOCSTACKSIZE 40960 - -// End of File diff -r 703a2b94c06c -r dde4619868dc usbclasses/usbobexclasscontroller/tsrc/UsbObexClassControllerTest/group/UsbObexClassControllerTest_phone.pkg --- a/usbclasses/usbobexclasscontroller/tsrc/UsbObexClassControllerTest/group/UsbObexClassControllerTest_phone.pkg Wed Sep 15 13:20:24 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,62 +0,0 @@ -; -; Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -; All rights reserved. -; This component and the accompanying materials are made available -; under the terms of "Eclipse Public License v1.0" -; which accompanies this distribution, and is available -; at the URL "http://www.eclipse.org/legal/epl-v10.html". -; -; Initial Contributors: -; Nokia Corporation - initial contribution. -; -; Contributors: -; -; Description: -; - -; Languages -&EN - -; Provide value for uid -#{"STIF"},(0x00000000),1,1,0,TYPE=SA - -; Series60 product id for S60 3.0 -[0x1028315F], 0, 0, 0, {"Series60ProductID"} - -; Localised Vendor name -%{"Nokia"} - -; Unique Vendor name -:"Nokia" - -; Logo -; None - -; Package signature - Optional -; None - -; Start of Package body - -; Condition blocks -; None - -; Options list -; None - -; Install files -"\epoc32\release\armv5\udeb\UsbObexClassControllerTest.dll"-"c:\Sys\Bin\UsbObexClassControllerTest.dll" -"\epoc32\release\armv5\udeb\UsbObexClassControllerTest.exe"-"c:\Sys\Bin\UsbObexClassControllerTest.exe" - -"..\init\UsbObexClassControllerTest_phone.ini"-"c:\testframework\testframework.ini" -"..\conf\UsbObexClassControllerTest.cfg"-"c:\testframework\UsbObexClassControllerTest.cfg" - -; Embedded SIS -; None - -; End of Package body - -; PKG dependencies -; None - -; PKG capabilities -; None diff -r 703a2b94c06c -r dde4619868dc usbclasses/usbobexclasscontroller/tsrc/UsbObexClassControllerTest/group/bld.inf --- a/usbclasses/usbobexclasscontroller/tsrc/UsbObexClassControllerTest/group/bld.inf Wed Sep 15 13:20:24 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,32 +0,0 @@ -/* -* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: ?Description -* -*/ - - -PRJ_PLATFORMS -DEFAULT - -PRJ_TESTEXPORTS - -PRJ_EXPORTS - -PRJ_TESTMMPFILES -UsbObexClassControllerTest.mmp -UsbObexClassControllerTest_exe.mmp - -PRJ_MMPFILES - -// End of File diff -r 703a2b94c06c -r dde4619868dc usbclasses/usbobexclasscontroller/tsrc/UsbObexClassControllerTest/group/build_sis_ats.bat --- a/usbclasses/usbobexclasscontroller/tsrc/UsbObexClassControllerTest/group/build_sis_ats.bat Wed Sep 15 13:20:24 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,23 +0,0 @@ -@rem -@rem Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -@rem All rights reserved. -@rem This component and the accompanying materials are made available -@rem under the terms of "Eclipse Public License v1.0" -@rem which accompanies this distribution, and is available -@rem at the URL "http://www.eclipse.org/legal/epl-v10.html". -@rem -@rem Initial Contributors: -@rem Nokia Corporation - initial contribution. -@rem -@rem Contributors: -@rem -@rem Description: -@rem - -call sbs -c armv5_udeb clean -call sbs -c armv5_udeb.test -call sbs -c armv5_udeb.test freeze -call sbs -c armv5_udeb.test - -call makesis UsbObexClassControllerTest_ats.pkg -call signsis UsbObexClassControllerTest_ats.sis UsbObexClassControllerTest_ats.sisx x:\rd.cer x:\rd-key.pem diff -r 703a2b94c06c -r dde4619868dc usbclasses/usbobexclasscontroller/tsrc/UsbObexClassControllerTest/group/build_sis_phone.bat --- a/usbclasses/usbobexclasscontroller/tsrc/UsbObexClassControllerTest/group/build_sis_phone.bat Wed Sep 15 13:20:24 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,25 +0,0 @@ -@rem -@rem Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -@rem All rights reserved. -@rem This component and the accompanying materials are made available -@rem under the terms of "Eclipse Public License v1.0" -@rem which accompanies this distribution, and is available -@rem at the URL "http://www.eclipse.org/legal/epl-v10.html". -@rem -@rem Initial Contributors: -@rem Nokia Corporation - initial contribution. -@rem -@rem Contributors: -@rem -@rem Description: -@rem - - -call sbs -c armv5_udeb clean -call sbs -c armv5_udeb.test -call sbs -c armv5_udeb.test freeze -call sbs -c armv5_udeb.test - - -call makesis UsbObexClassControllerTest_phone.pkg -call signsis UsbObexClassControllerTest_phone.sis UsbObexClassControllerTest_phone.sisx x:\rd.cer x:\rd-key.pem \ No newline at end of file diff -r 703a2b94c06c -r dde4619868dc usbclasses/usbobexclasscontroller/tsrc/UsbObexClassControllerTest/inc/USBObexApiTestActiveObject.h --- a/usbclasses/usbobexclasscontroller/tsrc/UsbObexClassControllerTest/inc/USBObexApiTestActiveObject.h Wed Sep 15 13:20:24 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,54 +0,0 @@ -/* -* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifndef USBOBEXAPITESTACTIVEOBJECT_H_ -#define USBOBEXAPITESTACTIVEOBJECT_H_ - -#include -#include -#include - -class CStifLogger; -class CUsbClassControllerPlugIn; - -class CUSBObexApiTestActiveObject : public CActive -{ -public: - static CUSBObexApiTestActiveObject* NewL - (CStifLogger* aLog, - CUsbClassControllerPlugIn* aUsbClassControllerPlugIn); - virtual ~CUSBObexApiTestActiveObject(); - - void Start(); - void Stop(); - -private: - CUSBObexApiTestActiveObject - (CStifLogger* aLog, - CUsbClassControllerPlugIn* aUsbClassControllerPlugIn); - void RunL(); - void DoCancel(); - void ConstructL(); - - -private: - CStifLogger* iLog; - CUsbClassControllerPlugIn* iUsbClassControllerPlugIn; - TUsbServiceState iUsbServiceState; -}; - -#endif /*USBOBEXAPITESTACTIVEOBJECT_H_*/ diff -r 703a2b94c06c -r dde4619868dc usbclasses/usbobexclasscontroller/tsrc/UsbObexClassControllerTest/inc/UsbObexClassControllerTest.h --- a/usbclasses/usbobexclasscontroller/tsrc/UsbObexClassControllerTest/inc/UsbObexClassControllerTest.h Wed Sep 15 13:20:24 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,240 +0,0 @@ -/* -* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: ?Description -* -*/ - - - - -#ifndef USBOBEXCLASSCONTROLLERTEST_H -#define USBOBEXCLASSCONTROLLERTEST_H - -// INCLUDES -#include -#include -#include -#include - -#include "USBObexApiTestActiveObject.h" -#include -#include -#include -#include -#include - -// CONSTANTS -//const ?type ?constant_var = ?constant; - -// MACROS -//#define ?macro ?macro_def -#define TEST_CLASS_VERSION_MAJOR 0 -#define TEST_CLASS_VERSION_MINOR 0 -#define TEST_CLASS_VERSION_BUILD 0 - -// Logging path -_LIT( KUsbObexClassControllerTestLogPath, "\\logs\\testframework\\UsbObexClassControllerTest\\" ); - -// Logging path for ATS - for phone builds comment this line -//_LIT( KUsbObexClassControllerTestLogPath, "e:\\testing\\stiflogs\\" ); - -// Log file -_LIT( KUsbObexClassControllerTestLogFile, "UsbObexClassControllerTest.txt" ); -_LIT( KUsbObexClassControllerTestLogFileWithTitle, "UsbObexClassControllerTest_[%S].txt" ); - -// FUNCTION PROTOTYPES -//?type ?function_name(?arg_list); - -// FORWARD DECLARATIONS -//class ?FORWARD_CLASSNAME; -class CUsbObexClassControllerTest; -class CUsbClassControllerIterator; - -// DATA TYPES -//enum ?declaration - -enum TUsbObexClassControllerTestResult - { - ETestCasePassed, - ETestCaseFailed - }; - -//typedef ?declaration -//extern ?data_type; - -// CLASS DECLARATION - -/** -* CUsbObexClassControllerTest test class for STIF Test Framework TestScripter. -* ?other_description_lines -* -* @lib ?library -* @since ?Series60_version -*/ -NONSHARABLE_CLASS(CUsbObexClassControllerTest) : - public CScriptBase, - public MUsbClassControllerNotify - { - public: // Constructors and destructor - - /** - * Two-phased constructor. - */ - static CUsbObexClassControllerTest* NewL( CTestModuleIf& aTestModuleIf ); - - /** - * Destructor. - */ - virtual ~CUsbObexClassControllerTest(); - - public: // New functions - - /** - * ?member_description. - * @since ?Series60_version - * @param ?arg1 ?description - * @return ?description - */ - //?type ?member_function( ?type ?arg1 ); - - public: // Functions from base classes - - /** - * From CScriptBase Runs a script line. - * @since ?Series60_version - * @param aItem Script line containing method name and parameters - * @return Symbian OS error code - */ - virtual TInt RunMethodL( CStifItemParser& aItem ); - - /** - * overrider of pure virtual functions from MUsbClassControllerNotify class - */ - CUsbClassControllerIterator* UccnGetClassControllerIteratorL(); - void UccnError(TInt aError); - - protected: // New functions - - /** - * ?member_description. - * @since ?Series60_version - * @param ?arg1 ?description - * @return ?description - */ - //?type ?member_function( ?type ?arg1 ); - - protected: // Functions from base classes - - /** - * From ?base_class ?member_description - */ - //?type ?member_function(); - - private: - - /** - * C++ default constructor. - */ - CUsbObexClassControllerTest( CTestModuleIf& aTestModuleIf ); - - /** - * By default Symbian 2nd phase constructor is private. - */ - void ConstructL(); - - // Prohibit copy constructor if not deriving from CBase. - // ?classname( const ?classname& ); - // Prohibit assigment operator if not deriving from CBase. - // ?classname& operator=( const ?classname& ); - - /** - * Frees all resources allocated from test methods. - * @since ?Series60_version - */ - void Delete(); - - /** - * Test methods are listed below. - */ - - virtual TInt ExecuteApiTest( CStifItemParser& aItem ); - virtual TInt ExecuteModuleTest( CStifItemParser& aItem ); - virtual TInt ExecuteBranchTest( CStifItemParser& aItem ); - - /** - * Method used to log version of test class - */ - void SendTestClassVersion(); - - //ADD NEW METHOD DEC HERE - //[TestMethods] - Do not remove - - void DoExecuteApiTestL( TPtrC aApiTestName, TUsbObexClassControllerTestResult& aTestResult ); - - void ExampleApiTestL( TUsbObexClassControllerTestResult& aTestResult ); - - void DoExecuteModuleTestL( TPtrC aModuleTestName, TUsbObexClassControllerTestResult& aTestResult ); - - void ExampleModuleTestL( TUsbObexClassControllerTestResult& aTestResult ); - - void DoExecuteBranchTestL( TPtrC aBranchTestName, TUsbObexClassControllerTestResult& aTestResult ); - - void ExampleBranchTestL( TUsbObexClassControllerTestResult& aTestResult ); - - void InitializeTestObjectL(); - void DeleteTestObject(); - TInt InitializationTestL( TUsbObexClassControllerTestResult& aTestResult ); - TInt StartTestL( TUsbObexClassControllerTestResult& aTestResult ); - TInt StopTestL( TUsbObexClassControllerTestResult& aTestResult ); - TInt InterfaceInfoTestL( TUsbObexClassControllerTestResult& aTestResult ); - TInt InterfaceLengthInfoTestL( TUsbObexClassControllerTestResult& aTestResult ); - TInt NumberOfInterfacesInfoTestL( TUsbObexClassControllerTestResult& aTestResult ); - TInt StartupPriorityInfoTestL( TUsbObexClassControllerTestResult& aTestResult ); - TInt StateInfoTestL( TUsbObexClassControllerTestResult& aTestResult ); - TInt OwnerTestL( TUsbObexClassControllerTestResult& aTestResult ); - TInt CompareTestL( TUsbObexClassControllerTestResult& aTestResult ); - - public: // Data - // ?one_line_short_description_of_data - //?data_declaration; - - protected: // Data - // ?one_line_short_description_of_data - //?data_declaration; - - private: // Data - - // ?one_line_short_description_of_data - //?data_declaration; - - CUsbClassControllerPlugIn* iUsbClassControllerPlugIn; - CActiveScheduler* iScheduler; - TRequestStatus iRequestStatus; - TUsbServiceState iUsbServiceState; - - // Reserved pointer for future extension - //TAny* iReserved; - - public: // Friend classes - //?friend_class_declaration; - protected: // Friend classes - //?friend_class_declaration; - private: // Friend classes - //?friend_class_declaration; - - }; - -#endif // USBOBEXCLASSCONTROLLERTEST_H - -// End of File diff -r 703a2b94c06c -r dde4619868dc usbclasses/usbobexclasscontroller/tsrc/UsbObexClassControllerTest/init/UsbObexClassControllerTest_ats.ini --- a/usbclasses/usbobexclasscontroller/tsrc/UsbObexClassControllerTest/init/UsbObexClassControllerTest_ats.ini Wed Sep 15 13:20:24 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,235 +0,0 @@ -# -# Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -# All rights reserved. -# This component and the accompanying materials are made available -# under the terms of "Eclipse Public License v1.0" -# which accompanies this distribution, and is available -# at the URL "http://www.eclipse.org/legal/epl-v10.html". -# -# Initial Contributors: -# Nokia Corporation - initial contribution. -# -# Contributors: -# -# Description: -# - - -# -# This is STIF initialization file -# Comment lines start with '#'-character. -# See STIF TestFramework users guide.doc for instructions - -# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -# Set following test engine settings: -# - Set Test Reporting mode. TestReportMode's possible values are: -# + 'Summary': Summary of the tested test cases. -# + 'Environment': Hardware and software info. -# + 'TestCases': Test case report. -# + 'FullReport': Set of all above ones. -# + Example 'TestReportMode= Summary TestCases' -# -# - CreateTestReport setting controls report creation mode -# + YES, Test report will created. -# + NO, No Test report. -# -# - File path indicates the base path of the test report. -# - File name indicates the name of the test report. -# -# - File format indicates the type of the test report. -# + TXT, Test report file will be txt type, for example 'TestReport.txt'. -# + HTML, Test report will be html type, for example 'TestReport.html'. -# + XML, Test report will be xml type, for example 'TestReport.xml'. -# Note, that xml format is available only when output is set to FILE. -# -# - File output indicates output source of the test report. -# + FILE, Test report logging to file. -# + RDEBUG, Test report logging to using rdebug. -# -# - File Creation Mode indicates test report overwriting if file exist. -# + OVERWRITE, Overwrites if the Test report file exist. -# + APPEND, Continue logging after the old Test report information if -# report exist. -# - Sets a device reset module's dll name(Reboot). -# + If Nokia specific reset module is not available or it is not correct one -# StifHWResetStub module may use as a template for user specific reset -# module. -# - Sets STIF test measurement disable options. e.g. pluging1 and pluging2 disablation -# DisableMeasurement= stifmeasurementplugin01 stifmeasurementplugin02 -# - -[Engine_Defaults] - -TestReportMode= FullReport # Possible values are: 'Empty', 'Summary', 'Environment', - 'TestCases' or 'FullReport' - -CreateTestReport= YES # Possible values: YES or NO - -TestReportFilePath= e:\testing\logs\ -TestReportFileName= UsbObexClassControllerTest_TestReport - -TestReportFormat= TXT # Possible values: TXT, HTML or XML -TestReportOutput= FILE # Possible values: FILE or RDEBUG -TestReportFileCreationMode= OVERWRITE # Possible values: OVERWRITE or APPEND - -DeviceResetDllName= StifResetForNokia.dll # e.g. 'StifHWResetStub.dll' for user specific reseting - -DisableMeasurement= stifmeasurementdisablenone # Possible values are: - # 'stifmeasurementdisablenone', 'stifmeasurementdisableall' - # 'stifmeasurementplugin01', 'stifmeasurementplugin02', - # 'stifmeasurementplugin03', 'stifmeasurementplugin04', - # 'stifmeasurementplugin05' or 'stifbappeaprofiler' - -Timeout= 0 # Default timeout value for each test case. In milliseconds -UITestingSupport= YES # Possible values: YES or NO -#SeparateProcesses= YES # Possible values: YES or NO (default: NO) -[End_Defaults] -# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - - - -# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -# Module configurations start -# Modules are added between module tags -# tags. Module name is specified after ModuleName= tag, like -# ModuleName= UsbObexClassControllerTestUsbObexClassControllerTestUsbObexClassControllerTest -# Modules might have initialisation file, specified as -# IniFile= c:\testframework\YYYYYY -# Modules might have several configuration files, like -# TestCaseFile= c:\testframework\NormalCases.txt -# TestCaseFile= c:\testframework\SmokeCases.txt -# TestCaseFile= c:\testframework\ManualCases.txt - -# (TestCaseFile is synonym for old term ConfigFile) - -# Following case specifies demo module settings. Demo module -# does not read any settings from file, so tags -# IniFile and TestCaseFile are not used. -# In the simplest case it is enough to specify only the -# name of the test module when adding new test module - -[New_Module] -ModuleName= testscripter -TestCaseFile= e:\testing\conf\UsbObexClassControllerTest.cfg -[End_Module] - - -# Load testmoduleUsbObexClassControllerTest, optionally with initialization file and/or test case files -#[New_Module] -#ModuleName= testmodulexxx - -#TestModuleUsbObexClassControllerTest used initialization file -#IniFile= c:\testframework\init.txt - -#TestModuleUsbObexClassControllerTest used configuration file(s) -#TestCaseFile= c:\testframework\testcases1.cfg -#TestCaseFile= c:\testframework\testcases2.cfg -#TestCaseFile= c:\testframework\manualtestcases.cfg - -#[End_Module] -# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - - - -# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -# Set STIF logging overwrite parameters for Logger. -# Hardware and emulator environment logging path and styles can -# be configured from here to overwrite the Logger's implemented values. -# -# Settings description: -# - Indicates option for creation log directory/directories. If log directory/directories -# is/are not created by user they will make by software. -# + YES, Create log directory/directories if not allready exist. -# + NO, Log directory/directories not created. Only created one is used. -# -# - Overwrite emulator path setting. -# + Example: If 'EmulatorBasePath= C:\LOGS\TestFramework\' and in code is defined -# Logger's path 'D:\\LOGS\\Module\\' with those definition the path -# will be 'C:\LOGS\TestFramework\LOGS\Module\' -# -# - Overwrite emulator's logging format. -# + TXT, Log file(s) will be txt type(s), for example 'Module.txt'. -# + HTML, Log file(s) will be html type(s), for example 'Module.html'. -# -# - Overwrited emulator logging output source. -# + FILE, Logging to file(s). -# + RDEBUG, Logging to using rdebug(s). -# -# - Overwrite hardware path setting (Same description as above in emulator path). -# - Overwrite hardware's logging format(Same description as above in emulator format). -# - Overwrite hardware's logging output source(Same description as above in emulator output). -# -# - File Creation Mode indicates file overwriting if file exist. -# + OVERWRITE, Overwrites if file(s) exist. -# + APPEND, Continue logging after the old logging information if file(s) exist. -# -# - Will thread id include to the log filename. -# + YES, Thread id to log file(s) name, Example filename 'Module_b9.txt'. -# + NO, No thread id to log file(s), Example filename 'Module.txt'. -# -# - Will time stamps include the to log file. -# + YES, Time stamp added to each line in log file(s). Time stamp is -# for example'12.Nov.2003 115958 LOGGING INFO' -# + NO, No time stamp(s). -# -# - Will line breaks include to the log file. -# + YES, Each logging event includes line break and next log event is in own line. -# + NO, No line break(s). -# -# - Will event ranking include to the log file. -# + YES, Event ranking number added to each line in log file(s). Ranking number -# depends on environment's tics, for example(includes time stamp also) -# '012 12.Nov.2003 115958 LOGGING INFO' -# + NO, No event ranking. -# -# - Will write log file in unicode format. -# + YES, Log file will be written in unicode format -# + NO, Log will be written as normal, not unicode, file. -# - -[Logger_Defaults] - -#NOTE: If you want to set Logger using next setting(s) remove comment(s)'#' -#NOTE: TestEngine and TestServer logging settings cannot change here - -#CreateLogDirectories= YES # Possible values: YES or NO - -#EmulatorBasePath= C:\LOGS\TestFramework\ -#EmulatorFormat= HTML # Possible values: TXT or HTML -#EmulatorOutput= FILE # Possible values: FILE or RDEBUG - -#HardwareBasePath= D:\LOGS\TestFramework\ -#HardwareFormat= HTML # Possible values: TXT or HTML -#HardwareOutput= FILE # Possible values: FILE or RDEBUG - -#FileCreationMode= OVERWRITE # Possible values: OVERWRITE or APPEND - -#ThreadIdToLogFile= YES # Possible values: YES or NO -#WithTimeStamp= YES # Possible values: YES or NO -#WithLineBreak= YES # Possible values: YES or NO -#WithEventRanking= YES # Possible values: YES or NO - -#FileUnicode= YES # Possible values: YES or NO -#AddTestCaseTitle= YES # Possible values: YES or NO -[End_Logger_Defaults] -# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - - - -# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -# Set filters to be used by ConsoleUI. -# If you want to use filter with ConsoleUI, simply remove comments -# from section below and provide valid filter entries. -# Each filter line has to start with "filter= " keyword. -# Filter can contain special wildcard characters: -# * which stands for none or any literal; -# ? which stands for single character. -# Filters are not case-sensitive. - -#[Filters] -#filter= *math* -#filter= *radio* -#[End_Filters] -# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - -# End of file diff -r 703a2b94c06c -r dde4619868dc usbclasses/usbobexclasscontroller/tsrc/UsbObexClassControllerTest/init/UsbObexClassControllerTest_phone.ini --- a/usbclasses/usbobexclasscontroller/tsrc/UsbObexClassControllerTest/init/UsbObexClassControllerTest_phone.ini Wed Sep 15 13:20:24 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,235 +0,0 @@ -# -# Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -# All rights reserved. -# This component and the accompanying materials are made available -# under the terms of "Eclipse Public License v1.0" -# which accompanies this distribution, and is available -# at the URL "http://www.eclipse.org/legal/epl-v10.html". -# -# Initial Contributors: -# Nokia Corporation - initial contribution. -# -# Contributors: -# -# Description: -# - - -# -# This is STIF initialization file -# Comment lines start with '#'-character. -# See STIF TestFramework users guide.doc for instructions - -# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -# Set following test engine settings: -# - Set Test Reporting mode. TestReportMode's possible values are: -# + 'Summary': Summary of the tested test cases. -# + 'Environment': Hardware and software info. -# + 'TestCases': Test case report. -# + 'FullReport': Set of all above ones. -# + Example 'TestReportMode= Summary TestCases' -# -# - CreateTestReport setting controls report creation mode -# + YES, Test report will created. -# + NO, No Test report. -# -# - File path indicates the base path of the test report. -# - File name indicates the name of the test report. -# -# - File format indicates the type of the test report. -# + TXT, Test report file will be txt type, for example 'TestReport.txt'. -# + HTML, Test report will be html type, for example 'TestReport.html'. -# + XML, Test report will be xml type, for example 'TestReport.xml'. -# Note, that xml format is available only when output is set to FILE. -# -# - File output indicates output source of the test report. -# + FILE, Test report logging to file. -# + RDEBUG, Test report logging to using rdebug. -# -# - File Creation Mode indicates test report overwriting if file exist. -# + OVERWRITE, Overwrites if the Test report file exist. -# + APPEND, Continue logging after the old Test report information if -# report exist. -# - Sets a device reset module's dll name(Reboot). -# + If Nokia specific reset module is not available or it is not correct one -# StifHWResetStub module may use as a template for user specific reset -# module. -# - Sets STIF test measurement disable options. e.g. pluging1 and pluging2 disablation -# DisableMeasurement= stifmeasurementplugin01 stifmeasurementplugin02 -# - -[Engine_Defaults] - -TestReportMode= FullReport # Possible values are: 'Empty', 'Summary', 'Environment', - 'TestCases' or 'FullReport' - -CreateTestReport= YES # Possible values: YES or NO - -TestReportFilePath= c:\logs\testframework\UsbObexClassControllerTest\ -TestReportFileName= testreport - -TestReportFormat= TXT # Possible values: TXT, HTML or XML -TestReportOutput= FILE # Possible values: FILE or RDEBUG -TestReportFileCreationMode= OVERWRITE # Possible values: OVERWRITE or APPEND - -DeviceResetDllName= StifResetForNokia.dll # e.g. 'StifHWResetStub.dll' for user specific reseting - -DisableMeasurement= stifmeasurementdisablenone # Possible values are: - # 'stifmeasurementdisablenone', 'stifmeasurementdisableall' - # 'stifmeasurementplugin01', 'stifmeasurementplugin02', - # 'stifmeasurementplugin03', 'stifmeasurementplugin04', - # 'stifmeasurementplugin05' or 'stifbappeaprofiler' - -Timeout= 0 # Default timeout value for each test case. In milliseconds -UITestingSupport= YES # Possible values: YES or NO -#SeparateProcesses= YES # Possible values: YES or NO (default: NO) -[End_Defaults] -# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - - - -# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -# Module configurations start -# Modules are added between module tags -# tags. Module name is specified after ModuleName= tag, like -# ModuleName= UsbObexClassControllerTestUsbObexClassControllerTestUsbObexClassControllerTest -# Modules might have initialisation file, specified as -# IniFile= c:\testframework\YYYYYY -# Modules might have several configuration files, like -# TestCaseFile= c:\testframework\NormalCases.txt -# TestCaseFile= c:\testframework\SmokeCases.txt -# TestCaseFile= c:\testframework\ManualCases.txt - -# (TestCaseFile is synonym for old term ConfigFile) - -# Following case specifies demo module settings. Demo module -# does not read any settings from file, so tags -# IniFile and TestCaseFile are not used. -# In the simplest case it is enough to specify only the -# name of the test module when adding new test module - -[New_Module] -ModuleName= testscripter -TestCaseFile= c:\testframework\UsbObexClassControllerTest.cfg -[End_Module] - - -# Load testmoduleUsbObexClassControllerTest, optionally with initialization file and/or test case files -#[New_Module] -#ModuleName= testmodulexxx - -#TestModuleUsbObexClassControllerTest used initialization file -#IniFile= c:\testframework\init.txt - -#TestModuleUsbObexClassControllerTest used configuration file(s) -#TestCaseFile= c:\testframework\testcases1.cfg -#TestCaseFile= c:\testframework\testcases2.cfg -#TestCaseFile= c:\testframework\manualtestcases.cfg - -#[End_Module] -# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - - - -# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -# Set STIF logging overwrite parameters for Logger. -# Hardware and emulator environment logging path and styles can -# be configured from here to overwrite the Logger's implemented values. -# -# Settings description: -# - Indicates option for creation log directory/directories. If log directory/directories -# is/are not created by user they will make by software. -# + YES, Create log directory/directories if not allready exist. -# + NO, Log directory/directories not created. Only created one is used. -# -# - Overwrite emulator path setting. -# + Example: If 'EmulatorBasePath= C:\LOGS\TestFramework\' and in code is defined -# Logger's path 'D:\\LOGS\\Module\\' with those definition the path -# will be 'C:\LOGS\TestFramework\LOGS\Module\' -# -# - Overwrite emulator's logging format. -# + TXT, Log file(s) will be txt type(s), for example 'Module.txt'. -# + HTML, Log file(s) will be html type(s), for example 'Module.html'. -# -# - Overwrited emulator logging output source. -# + FILE, Logging to file(s). -# + RDEBUG, Logging to using rdebug(s). -# -# - Overwrite hardware path setting (Same description as above in emulator path). -# - Overwrite hardware's logging format(Same description as above in emulator format). -# - Overwrite hardware's logging output source(Same description as above in emulator output). -# -# - File Creation Mode indicates file overwriting if file exist. -# + OVERWRITE, Overwrites if file(s) exist. -# + APPEND, Continue logging after the old logging information if file(s) exist. -# -# - Will thread id include to the log filename. -# + YES, Thread id to log file(s) name, Example filename 'Module_b9.txt'. -# + NO, No thread id to log file(s), Example filename 'Module.txt'. -# -# - Will time stamps include the to log file. -# + YES, Time stamp added to each line in log file(s). Time stamp is -# for example'12.Nov.2003 115958 LOGGING INFO' -# + NO, No time stamp(s). -# -# - Will line breaks include to the log file. -# + YES, Each logging event includes line break and next log event is in own line. -# + NO, No line break(s). -# -# - Will event ranking include to the log file. -# + YES, Event ranking number added to each line in log file(s). Ranking number -# depends on environment's tics, for example(includes time stamp also) -# '012 12.Nov.2003 115958 LOGGING INFO' -# + NO, No event ranking. -# -# - Will write log file in unicode format. -# + YES, Log file will be written in unicode format -# + NO, Log will be written as normal, not unicode, file. -# - -[Logger_Defaults] - -#NOTE: If you want to set Logger using next setting(s) remove comment(s)'#' -#NOTE: TestEngine and TestServer logging settings cannot change here - -#CreateLogDirectories= YES # Possible values: YES or NO - -#EmulatorBasePath= C:\LOGS\TestFramework\ -#EmulatorFormat= HTML # Possible values: TXT or HTML -#EmulatorOutput= FILE # Possible values: FILE or RDEBUG - -#HardwareBasePath= D:\LOGS\TestFramework\ -#HardwareFormat= HTML # Possible values: TXT or HTML -#HardwareOutput= FILE # Possible values: FILE or RDEBUG - -#FileCreationMode= OVERWRITE # Possible values: OVERWRITE or APPEND - -#ThreadIdToLogFile= YES # Possible values: YES or NO -#WithTimeStamp= YES # Possible values: YES or NO -#WithLineBreak= YES # Possible values: YES or NO -#WithEventRanking= YES # Possible values: YES or NO - -#FileUnicode= YES # Possible values: YES or NO -#AddTestCaseTitle= YES # Possible values: YES or NO -[End_Logger_Defaults] -# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - - - -# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -# Set filters to be used by ConsoleUI. -# If you want to use filter with ConsoleUI, simply remove comments -# from section below and provide valid filter entries. -# Each filter line has to start with "filter= " keyword. -# Filter can contain special wildcard characters: -# * which stands for none or any literal; -# ? which stands for single character. -# Filters are not case-sensitive. - -#[Filters] -#filter= *math* -#filter= *radio* -#[End_Filters] -# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - -# End of file diff -r 703a2b94c06c -r dde4619868dc usbclasses/usbobexclasscontroller/tsrc/UsbObexClassControllerTest/src/USBObexApiTestActiveObject.cpp --- a/usbclasses/usbobexclasscontroller/tsrc/UsbObexClassControllerTest/src/USBObexApiTestActiveObject.cpp Wed Sep 15 13:20:24 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,107 +0,0 @@ -/* -* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#include "USBObexApiTestActiveObject.h" - -// ----------------------------------------------------------------------------- -// CUSBObexApiTestActiveObject::CUSBObexApiTestActiveObject -// C++ default constructor can NOT contain any code, that -// might leave. -// ----------------------------------------------------------------------------- -// -CUSBObexApiTestActiveObject::CUSBObexApiTestActiveObject( CStifLogger* aLog, - CUsbClassControllerPlugIn* aUsbClassControllerPlugIn ) : - CActive( EPriorityStandard ) - { - iUsbClassControllerPlugIn = aUsbClassControllerPlugIn; - iLog = aLog; - } - -// Destructor -CUSBObexApiTestActiveObject::~CUSBObexApiTestActiveObject() - { - Cancel(); - } - -// --------------------------------------------------------------------------- -// CUSBObexApiTestActiveObject::RunL -// --------------------------------------------------------------------------- -// -void CUSBObexApiTestActiveObject::RunL() - { - iLog->Log( _L("ActiveTestObject::RunL")); - CActiveScheduler::Stop(); - iLog->Log( _L("ActiveScheduler Stopped")); - iUsbServiceState = iUsbClassControllerPlugIn -> State(); - } - -// ----------------------------------------------------------------------------- -// CUSBObexApiTestActiveObject::NewL -// Two-phased constructor. -// ----------------------------------------------------------------------------- -// -CUSBObexApiTestActiveObject* CUSBObexApiTestActiveObject::NewL( - CStifLogger* aLog, CUsbClassControllerPlugIn* aUsbClassControllerPlugIn ) - { - CUSBObexApiTestActiveObject* self = new ( ELeave )CUSBObexApiTestActiveObject( aLog, aUsbClassControllerPlugIn ); - CleanupStack::PushL( self ); - self->ConstructL(); - CleanupStack::Pop( self ); - return self; - } - -// ----------------------------------------------------------------------------- -// CUSBObexApiTestActiveObject::ConstructL -// Symbian 2nd phase constructor can leave. -// ----------------------------------------------------------------------------- -// -void CUSBObexApiTestActiveObject::ConstructL() - { - CActiveScheduler::Add( this ); - } - -// --------------------------------------------------------------------------- -// CUSBObexApiTestActiveObject::DoCancel -// --------------------------------------------------------------------------- -// -void CUSBObexApiTestActiveObject::DoCancel() - { - iLog->Log( _L("ActiveTestObject::DoCancel")); - } - -// --------------------------------------------------------------------------- -// CUSBObexApiTestActiveObject::Start -// --------------------------------------------------------------------------- -// -void CUSBObexApiTestActiveObject::Start() - { - iUsbClassControllerPlugIn -> Start( iStatus ); - SetActive(); - iLog->Log( _L("Obex Controller Started")); - } - -// --------------------------------------------------------------------------- -// CUSBObexApiTestActiveObject::Stop -// --------------------------------------------------------------------------- -// -void CUSBObexApiTestActiveObject::Stop() - { - iUsbClassControllerPlugIn -> Stop( iStatus ); - SetActive(); - iLog->Log( _L("Obex Controller Stopped")); - } - diff -r 703a2b94c06c -r dde4619868dc usbclasses/usbobexclasscontroller/tsrc/UsbObexClassControllerTest/src/UsbObexClassControllerTest.cpp --- a/usbclasses/usbobexclasscontroller/tsrc/UsbObexClassControllerTest/src/UsbObexClassControllerTest.cpp Wed Sep 15 13:20:24 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,202 +0,0 @@ -/* -* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: ?Description -* -*/ - - - - -// INCLUDE FILES -#include -#include "UsbObexClassControllerTest.h" -#include - -// EXTERNAL DATA STRUCTURES -//extern ?external_data; - -// EXTERNAL FUNCTION PROTOTYPES -//extern ?external_function( ?arg_type,?arg_type ); - -// CONSTANTS -//const ?type ?constant_var = ?constant; - -// MACROS -//#define ?macro ?macro_def - -// LOCAL CONSTANTS AND MACROS -//const ?type ?constant_var = ?constant; -//#define ?macro_name ?macro_def - -// MODULE DATA STRUCTURES -//enum ?declaration -//typedef ?declaration - -// LOCAL FUNCTION PROTOTYPES -//?type ?function_name( ?arg_type, ?arg_type ); - -// FORWARD DECLARATIONS -//class ?FORWARD_CLASSNAME; - -// ============================= LOCAL FUNCTIONS =============================== - -// ----------------------------------------------------------------------------- -// ?function_name ?description. -// ?description -// Returns: ?value_1: ?description -// ?value_n: ?description_line1 -// ?description_line2 -// ----------------------------------------------------------------------------- -// -/* -?type ?function_name( - ?arg_type arg, // ?description - ?arg_type arg) // ?description - { - - ?code // ?comment - - // ?comment - ?code - } -*/ - -// ============================ MEMBER FUNCTIONS =============================== - -// ----------------------------------------------------------------------------- -// CUsbObexClassControllerTest::CUsbObexClassControllerTest -// C++ default constructor can NOT contain any code, that -// might leave. -// ----------------------------------------------------------------------------- -// -CUsbObexClassControllerTest::CUsbObexClassControllerTest( - CTestModuleIf& aTestModuleIf ): - CScriptBase( aTestModuleIf ) - { - } - -// ----------------------------------------------------------------------------- -// CUsbObexClassControllerTest::ConstructL -// Symbian 2nd phase constructor can leave. -// ----------------------------------------------------------------------------- -// -void CUsbObexClassControllerTest::ConstructL() - { - //Read logger settings to check whether test case name is to be - //appended to log file name. - RSettingServer settingServer; - TInt ret = settingServer.Connect(); - if(ret != KErrNone) - { - User::Leave(ret); - } - // Struct to StifLogger settigs. - TLoggerSettings loggerSettings; - // Parse StifLogger defaults from STIF initialization file. - ret = settingServer.GetLoggerSettings(loggerSettings); - if(ret != KErrNone) - { - User::Leave(ret); - } - // Close Setting server session - settingServer.Close(); - - TFileName logFileName; - - if(loggerSettings.iAddTestCaseTitle) - { - TName title; - TestModuleIf().GetTestCaseTitleL(title); - logFileName.Format(KUsbObexClassControllerTestLogFileWithTitle, &title); - } - else - { - logFileName.Copy(KUsbObexClassControllerTestLogFile); - } - - iLog = CStifLogger::NewL( KUsbObexClassControllerTestLogPath, - logFileName, - CStifLogger::ETxt, - CStifLogger::EFile, - EFalse ); - - SendTestClassVersion(); - } - -// ----------------------------------------------------------------------------- -// CUsbObexClassControllerTest::NewL -// Two-phased constructor. -// ----------------------------------------------------------------------------- -// -CUsbObexClassControllerTest* CUsbObexClassControllerTest::NewL( - CTestModuleIf& aTestModuleIf ) - { - CUsbObexClassControllerTest* self = new (ELeave) CUsbObexClassControllerTest( aTestModuleIf ); - - CleanupStack::PushL( self ); - self->ConstructL(); - CleanupStack::Pop(); - - return self; - - } - -// Destructor -CUsbObexClassControllerTest::~CUsbObexClassControllerTest() - { - - // Delete resources allocated from test methods - Delete(); - - // Delete logger - delete iLog; - - } - -//----------------------------------------------------------------------------- -// CUsbObexClassControllerTest::SendTestClassVersion -// Method used to send version of test class -//----------------------------------------------------------------------------- -// -void CUsbObexClassControllerTest::SendTestClassVersion() - { - TVersion moduleVersion; - moduleVersion.iMajor = TEST_CLASS_VERSION_MAJOR; - moduleVersion.iMinor = TEST_CLASS_VERSION_MINOR; - moduleVersion.iBuild = TEST_CLASS_VERSION_BUILD; - - TFileName moduleName; - moduleName = _L("UsbObexClassControllerTest.dll"); - - TBool newVersionOfMethod = ETrue; - TestModuleIf().SendTestModuleVersion(moduleVersion, moduleName, newVersionOfMethod); - } - -// ========================== OTHER EXPORTED FUNCTIONS ========================= - -// ----------------------------------------------------------------------------- -// LibEntryL is a polymorphic Dll entry point. -// Returns: CScriptBase: New CScriptBase derived object -// ----------------------------------------------------------------------------- -// -EXPORT_C CScriptBase* LibEntryL( - CTestModuleIf& aTestModuleIf ) // Backpointer to STIF Test Framework - { - - return ( CScriptBase* ) CUsbObexClassControllerTest::NewL( aTestModuleIf ); - - } - - -// End of File diff -r 703a2b94c06c -r dde4619868dc usbclasses/usbobexclasscontroller/tsrc/UsbObexClassControllerTest/src/UsbObexClassControllerTestBlocks.cpp --- a/usbclasses/usbobexclasscontroller/tsrc/UsbObexClassControllerTest/src/UsbObexClassControllerTestBlocks.cpp Wed Sep 15 13:20:24 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,681 +0,0 @@ -/* -* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: ?Description -* -*/ - - - - -// [INCLUDE FILES] - do not remove -#include -#include -#include -#include "UsbObexClassControllerTest.h" - -// EXTERNAL DATA STRUCTURES -//extern ?external_data; - -// EXTERNAL FUNCTION PROTOTYPES -//extern ?external_function( ?arg_type,?arg_type ); - -// CONSTANTS -//const ?type ?constant_var = ?constant; -const TUid KCSrcsInterfaceUid = {0x101F7C8C}; -const TInt KObexNumInterfaces = 2; - -// MACROS -//#define ?macro ?macro_def - -// LOCAL CONSTANTS AND MACROS -//const ?type ?constant_var = ?constant; -//#define ?macro_name ?macro_def - -// MODULE DATA STRUCTURES -//enum ?declaration -//typedef ?declaration - -// LOCAL FUNCTION PROTOTYPES -//?type ?function_name( ?arg_type, ?arg_type ); - -// FORWARD DECLARATIONS -//class ?FORWARD_CLASSNAME; - -// ============================= LOCAL FUNCTIONS =============================== - -// ----------------------------------------------------------------------------- -// ?function_name ?description. -// ?description -// Returns: ?value_1: ?description -// ?value_n: ?description_line1 -// ?description_line2 -// ----------------------------------------------------------------------------- -// -/* -?type ?function_name( - ?arg_type arg, // ?description - ?arg_type arg) // ?description - { - - ?code // ?comment - - // ?comment - ?code - } -*/ - -// ============================ MEMBER FUNCTIONS =============================== - -// ----------------------------------------------------------------------------- -// CUsbObexClassControllerTest::Delete -// Delete here all resources allocated and opened from test methods. -// Called from destructor. -// ----------------------------------------------------------------------------- -// -void CUsbObexClassControllerTest::Delete() - { - - } - -// ----------------------------------------------------------------------------- -// CUsbObexClassControllerTest::RunMethodL -// Run specified method. Contains also table of test mothods and their names. -// ----------------------------------------------------------------------------- -// -TInt CUsbObexClassControllerTest::RunMethodL( - CStifItemParser& aItem ) - { - - static TStifFunctionInfo const KFunctions[] = - { - //ADD NEW ENTRY HERE - // [test cases entries] - Do not remove - ENTRY( "ExecuteApiTest", CUsbObexClassControllerTest::ExecuteApiTest ), - ENTRY( "ExecuteModuleTest", CUsbObexClassControllerTest::ExecuteModuleTest ), - ENTRY( "ExecuteBranchTest", CUsbObexClassControllerTest::ExecuteBranchTest ), - }; - - const TInt count = sizeof( KFunctions ) / - sizeof( TStifFunctionInfo ); - - return RunInternalL( KFunctions, count, aItem ); - - } - -// ----------------------------------------------------------------------------- -// CUsbObexClassControllerTest::ExecuteApiTest -// ----------------------------------------------------------------------------- -// -TInt CUsbObexClassControllerTest::ExecuteApiTest( CStifItemParser& aItem ) - { - STIF_LOG( "[STIF_LOG] >>>ExecuteApiTest" ); - - TInt res; - TUsbObexClassControllerTestResult testResult = ETestCaseFailed; - TPtrC apiTestName( KNullDesC ); - - res = aItem.GetString( _L( "ExecuteApiTest" ), apiTestName ); - if ( res != KErrNone ) - { - iLog -> Log( _L( "GetString failed with value: %d" ), res ); - return res; - } - - TRAP( res, DoExecuteApiTestL( apiTestName, testResult ) ); - if ( res != KErrNone ) - { - iLog -> Log( _L( "DoExecuteApiTestL error: %d"), res ); - return res; - } - - STIF_ASSERT_EQUALS( ETestCasePassed, testResult ); - STIF_LOG( "[STIF_LOG] Test case passed" ); - STIF_LOG( "[STIF_LOG] <<>>DoExecuteApiTestL" ); - if ( !aApiTestName.Compare( _L( "ExampleApiTest" ) ) ) - { - STIF_LOG( "[STIF_LOG] Api test type: ExampleApiTest" ); - ExampleApiTestL( aTestResult ); - } - else if ( !aApiTestName.Compare( _L( "InitializationTest" ) ) ) - { - STIF_LOG( "[STIF_LOG] Api test type: ExampleApiTest" ); - InitializationTestL( aTestResult ); - } - else if ( !aApiTestName.Compare( _L( "StartTest" ) ) ) - { - STIF_LOG( "[STIF_LOG] Api test type: ExampleApiTest" ); - StartTestL( aTestResult ); - } - else if ( !aApiTestName.Compare( _L( "StopTest" ) ) ) - { - STIF_LOG( "[STIF_LOG] Api test type: ExampleApiTest" ); - StopTestL( aTestResult ); - } - else if ( !aApiTestName.Compare( _L( "InterfaceInfoTest" ) ) ) - { - STIF_LOG( "[STIF_LOG] Api test type: ExampleApiTest" ); - InterfaceInfoTestL( aTestResult ); - } - else if ( !aApiTestName.Compare( _L( "InterfaceLengthInfoTest" ) ) ) - { - STIF_LOG( "[STIF_LOG] Api test type: ExampleApiTest" ); - InterfaceLengthInfoTestL( aTestResult ); - } - else if ( !aApiTestName.Compare( _L( "NumberOfInterfacesInfoTest" ) ) ) - { - STIF_LOG( "[STIF_LOG] Api test type: ExampleApiTest" ); - NumberOfInterfacesInfoTestL( aTestResult ); - } - else if ( !aApiTestName.Compare( _L( "StartupPriorityInfoTest" ) ) ) - { - STIF_LOG( "[STIF_LOG] Api test type: ExampleApiTest" ); - StartupPriorityInfoTestL( aTestResult ); - } - else if ( !aApiTestName.Compare( _L( "StateInfoTest" ) ) ) - { - STIF_LOG( "[STIF_LOG] Api test type: ExampleApiTest" ); - StateInfoTestL( aTestResult ); - } - else if ( !aApiTestName.Compare( _L( "OwnerTest" ) ) ) - { - STIF_LOG( "[STIF_LOG] Api test type: ExampleApiTest" ); - OwnerTestL( aTestResult ); - } - else - { - STIF_LOG( "[STIF_LOG] Api test type: not found" ); - User::Leave( KErrNotFound ); - } - STIF_LOG( "[STIF_LOG] <<>>ExampleApiTestL" ); - - aTestResult = ETestCasePassed; - - STIF_LOG( "[STIF_LOG] <<>>ExecuteModuleTest" ); - - TInt res; - TUsbObexClassControllerTestResult testResult; - TPtrC moduleTestName( KNullDesC ); - - res = aItem.GetString( _L( "ExecuteModuleTest" ), moduleTestName ); - if ( res != KErrNone ) - { - iLog -> Log( _L( "GetString failed with value: %d" ), res ); - return res; - } - - TRAP( res, DoExecuteModuleTestL( moduleTestName, testResult ) ); - if ( res != KErrNone ) - { - iLog -> Log( _L( "DoExecuteModuleTestL error: %d"), res ); - return res; - } - - STIF_ASSERT_EQUALS( ETestCasePassed, testResult ); - STIF_LOG( "[STIF_LOG] Test case passed" ); - STIF_LOG( "[STIF_LOG] <<>>DoExecuteModuleTestL" ); - if ( !aModuleTestName.Compare( _L( "ExampleModuleTest" ) ) ) - { - STIF_LOG( "[STIF_LOG] Module test type: ExampleModuleTest" ); - ExampleModuleTestL( aTestResult ); - } - else - { - STIF_LOG( "[STIF_LOG] Module test type: not found" ); - User::Leave( KErrNotFound ); - } - STIF_LOG( "[STIF_LOG] <<>>ExampleModuleTestL" ); - - aTestResult = ETestCasePassed; - - STIF_LOG( "[STIF_LOG] <<>>ExecuteBranchTest" ); - - TInt res; - TUsbObexClassControllerTestResult testResult; - TPtrC branchTestName( KNullDesC ); - - res = aItem.GetString( _L( "ExecuteBranchTest" ), branchTestName ); - if ( res != KErrNone ) - { - iLog -> Log( _L( "GetString failed with value: %d" ), res ); - return res; - } - - TRAP( res, DoExecuteBranchTestL( branchTestName, testResult ) ); - if ( res != KErrNone ) - { - iLog -> Log( _L( "DoExecuteBranchTestL error: %d"), res ); - return res; - } - - STIF_ASSERT_EQUALS( ETestCasePassed, testResult ); - STIF_LOG( "[STIF_LOG] Test case passed" ); - STIF_LOG( "[STIF_LOG] <<>>DoExecuteBranchTestL" ); - if ( !aBranchTestName.Compare( _L( "ExampleBranchTest" ) ) ) - { - STIF_LOG( "[STIF_LOG] Branch test type: ExampleBranchTest" ); - ExampleBranchTestL( aTestResult ); - } - else - { - STIF_LOG( "[STIF_LOG] Branch test type: not found" ); - User::Leave( KErrNotFound ); - } - STIF_LOG( "[STIF_LOG] <<>>ExampleBranchTestL" ); - - aTestResult = ETestCasePassed; - - STIF_LOG( "[STIF_LOG] <<Log( _L("Test Case Passed")); - aTestResult = ETestCasePassed; - return KErrNone; - } - - -// ----------------------------------------------------------------------------- -// CUsbObexClassControllerTest::StartTestL -// ----------------------------------------------------------------------------- -// -TInt CUsbObexClassControllerTest::StartTestL( TUsbObexClassControllerTestResult& aTestResult ) - { - iUsbServiceState = EUsbServiceStarted; - InitializeTestObjectL(); - CUSBObexApiTestActiveObject* activeTestObject = - CUSBObexApiTestActiveObject::NewL( iLog, iUsbClassControllerPlugIn ); - activeTestObject -> Start(); - CActiveScheduler::Start(); - iLog->Log( _L("UsbServiceState = %d, expected %d"), - iUsbServiceState, iUsbClassControllerPlugIn -> State()); - STIF_ASSERT_EQUALS( iUsbServiceState, iUsbClassControllerPlugIn -> State() ); - DeleteTestObject(); - activeTestObject -> Cancel(); - - // Case was executed - iLog->Log( _L("Test Case Passed")); - aTestResult = ETestCasePassed; - return KErrNone; - } - -// ----------------------------------------------------------------------------- -// CUsbObexClassControllerTest::StopTestL -// ----------------------------------------------------------------------------- -// -TInt CUsbObexClassControllerTest::StopTestL( TUsbObexClassControllerTestResult& aTestResult ) - { - iUsbServiceState = EUsbServiceIdle; - InitializeTestObjectL(); - CUSBObexApiTestActiveObject* activeTestObject = - CUSBObexApiTestActiveObject::NewL( iLog, iUsbClassControllerPlugIn ); - activeTestObject -> Start(); - CActiveScheduler::Start(); - activeTestObject -> Stop(); - CActiveScheduler::Start(); - iLog->Log( _L("UsbServiceState = %d, expected %d"), - iUsbServiceState, iUsbClassControllerPlugIn -> State()); - STIF_ASSERT_EQUALS( iUsbServiceState, iUsbClassControllerPlugIn -> State() ); - DeleteTestObject(); - activeTestObject -> Cancel(); - - // Case was executed - iLog->Log( _L("Test Case Passed")); - aTestResult = ETestCasePassed; - return KErrNone; - } - - -// ----------------------------------------------------------------------------- -// CUsbObexClassControllerTest::InterfaceInfoTestL -// ----------------------------------------------------------------------------- -// -TInt CUsbObexClassControllerTest::InterfaceInfoTestL( TUsbObexClassControllerTestResult& aTestResult ) - { - TUsbDescriptor aDescriptorInfo; - RImplInfoPtrArray implInfoArray; - CleanupClosePushL(implInfoArray); - TEComResolverParams resolverParams; - TInt numberOfInterfaces; - - InitializeTestObjectL(); - CUSBObexApiTestActiveObject* activeTestObject = - CUSBObexApiTestActiveObject::NewL( iLog, iUsbClassControllerPlugIn ); - activeTestObject -> Start(); - CActiveScheduler::Start(); - iUsbClassControllerPlugIn -> GetDescriptorInfo( aDescriptorInfo ); - resolverParams.SetDataType( KSrcsTransportUSB ); - resolverParams.SetWildcardMatch( EFalse ); - REComSession::ListImplementationsL( KCSrcsInterfaceUid, resolverParams, implInfoArray ); - numberOfInterfaces = implInfoArray.Count() * KObexNumInterfaces; - - iLog->Log( _L("Number of interfaces = %d, expected %d"), - numberOfInterfaces, aDescriptorInfo.iNumInterfaces); - STIF_ASSERT_EQUALS( numberOfInterfaces, aDescriptorInfo.iNumInterfaces ); - - DeleteTestObject(); - activeTestObject -> Cancel(); - CleanupStack::PopAndDestroy(&implInfoArray); - - // Case was executed - iLog->Log( _L("Test Case Passed")); - aTestResult = ETestCasePassed; - return KErrNone; - } - - -// ----------------------------------------------------------------------------- -// CUsbObexClassControllerTest::InterfaceLengthInfoTestL -// ----------------------------------------------------------------------------- -// -TInt CUsbObexClassControllerTest::InterfaceLengthInfoTestL( TUsbObexClassControllerTestResult& aTestResult ) - { - TUsbDescriptor aDescriptorInfo; - RImplInfoPtrArray implInfoArray; - CleanupClosePushL(implInfoArray); - TEComResolverParams resolverParams; - TInt interfaceLength = 0; - - InitializeTestObjectL(); - CUSBObexApiTestActiveObject* activeTestObject = - CUSBObexApiTestActiveObject::NewL( iLog, iUsbClassControllerPlugIn ); - activeTestObject -> Start(); - CActiveScheduler::Start(); - iUsbClassControllerPlugIn -> GetDescriptorInfo( aDescriptorInfo ); - resolverParams.SetDataType( KSrcsTransportUSB ); - resolverParams.SetWildcardMatch( EFalse ); - REComSession::ListImplementationsL( KCSrcsInterfaceUid, resolverParams, implInfoArray ); - - iLog->Log( _L("Interface Length = %d, expected %d"), - interfaceLength, aDescriptorInfo.iLength); - STIF_ASSERT_EQUALS( interfaceLength, aDescriptorInfo.iLength ); - - DeleteTestObject(); - activeTestObject -> Cancel(); - CleanupStack::PopAndDestroy(&implInfoArray); - - // Case was executed - iLog->Log( _L("Test Case Passed")); - aTestResult = ETestCasePassed; - return KErrNone; - } - - -// ----------------------------------------------------------------------------- -// CUsbObexClassControllerTest::NumberOfInterfacesInfoTestL -// ----------------------------------------------------------------------------- -// -TInt CUsbObexClassControllerTest::NumberOfInterfacesInfoTestL( TUsbObexClassControllerTestResult& aTestResult ) - { - TUsbDescriptor aDescriptorInfo; - RImplInfoPtrArray implInfoArray; - CleanupClosePushL(implInfoArray); - TEComResolverParams resolverParams; - TInt interfaceLength = 0; - - InitializeTestObjectL(); - CUSBObexApiTestActiveObject* activeTestObject = - CUSBObexApiTestActiveObject::NewL( iLog, iUsbClassControllerPlugIn ); - activeTestObject -> Start(); - CActiveScheduler::Start(); - iUsbClassControllerPlugIn -> GetDescriptorInfo( aDescriptorInfo ); - resolverParams.SetDataType( KSrcsTransportUSB ); - resolverParams.SetWildcardMatch( EFalse ); - REComSession::ListImplementationsL( KCSrcsInterfaceUid, resolverParams, implInfoArray ); - - iLog->Log( _L("Number of Interfaces this class controller is responsible for = %d, expected %d"), - interfaceLength, aDescriptorInfo.iNumInterfaces); - STIF_ASSERT_EQUALS( interfaceLength, aDescriptorInfo.iLength ); - - DeleteTestObject(); - activeTestObject -> Cancel(); - CleanupStack::PopAndDestroy(&implInfoArray); - - // Case was executed - iLog->Log( _L("Test Case Passed")); - aTestResult = ETestCasePassed; - return KErrNone; - } - -// ----------------------------------------------------------------------------- -// CUsbObexClassControllerTest::StartupPriorityInfoTestL -// ----------------------------------------------------------------------------- -// -TInt CUsbObexClassControllerTest::StartupPriorityInfoTestL( TUsbObexClassControllerTestResult& aTestResult ) - { - TInt priority = 0; - - InitializeTestObjectL(); - CUSBObexApiTestActiveObject* activeTestObject = - CUSBObexApiTestActiveObject::NewL( iLog, iUsbClassControllerPlugIn ); - activeTestObject -> Start(); - CActiveScheduler::Start(); - priority = iUsbClassControllerPlugIn -> StartupPriority(); - - iLog->Log( _L("StartupPriorityInfoTestL:> Priority = %d "),priority ); - - DeleteTestObject(); - activeTestObject -> Cancel(); - - // Case was executed - iLog->Log( _L("StartupPriorityInfoTestL:> Test Case Passed")); - aTestResult = ETestCasePassed; - return KErrNone; - } - -// ----------------------------------------------------------------------------- -// CUsbObexClassControllerTest::StateInfoTestL -// ----------------------------------------------------------------------------- -// -TInt CUsbObexClassControllerTest::StateInfoTestL( TUsbObexClassControllerTestResult& aTestResult ) - { - TUsbServiceState state; - - InitializeTestObjectL(); - CUSBObexApiTestActiveObject* activeTestObject = - CUSBObexApiTestActiveObject::NewL( iLog, iUsbClassControllerPlugIn ); - activeTestObject -> Start(); - CActiveScheduler::Start(); - state = iUsbClassControllerPlugIn -> State(); - - iLog->Log( _L("StateTestL:> State = 0x%x "), state ); - - DeleteTestObject(); - activeTestObject -> Cancel(); - - // Case was executed - iLog->Log( _L("StateInfoTestL:> Test Case Passed")); - aTestResult = ETestCasePassed; - return KErrNone; - } - -// ----------------------------------------------------------------------------- -// CUsbObexClassControllerTest::OwnerTestL -// ----------------------------------------------------------------------------- -// -TInt CUsbObexClassControllerTest::OwnerTestL( TUsbObexClassControllerTestResult& aTestResult ) - { - InitializeTestObjectL(); - CUSBObexApiTestActiveObject* activeTestObject = - CUSBObexApiTestActiveObject::NewL( iLog, iUsbClassControllerPlugIn ); - activeTestObject -> Start(); - CActiveScheduler::Start(); - (iUsbClassControllerPlugIn -> Owner()).UccnGetClassControllerIteratorL(); - - (iUsbClassControllerPlugIn -> Owner()).UccnError( KErrNone ); - - DeleteTestObject(); - activeTestObject -> Cancel(); - - // Case was executed - iLog->Log( _L("OwnerTestL:> Test Case Passed")); - aTestResult = ETestCasePassed; - return KErrNone; - } - -// ----------------------------------------------------------------------------- -// CUsbObexClassControllerTest::CompareTestL -// ----------------------------------------------------------------------------- -// -TInt CUsbObexClassControllerTest::CompareTestL( TUsbObexClassControllerTestResult& aTestResult ) - { - InitializeTestObjectL(); - - CUSBObexApiTestActiveObject* activeTestObject = - CUSBObexApiTestActiveObject::NewL( iLog, iUsbClassControllerPlugIn ); - activeTestObject -> Start(); - CActiveScheduler::Start(); - - //result = iUsbClassControllerPlugIn -> Compare( this, iUsbClassControllerPlugIn ); - //iLog->Log( _L("CompareTestL:> Comparition Result = %d "),result ); - - DeleteTestObject(); - activeTestObject -> Cancel(); - - // Case was executed - iLog->Log( _L("CompareTestL:> Test Case Passed")); - aTestResult = ETestCasePassed; - return KErrNone; - } - -// ----------------------------------------------------------------------------- -// CUsbObexClassControllerTest::InitializeTestObjectL -// ----------------------------------------------------------------------------- -// -void CUsbObexClassControllerTest::InitializeTestObjectL() - { - iUsbClassControllerPlugIn = CUsbClassControllerPlugIn::NewL( TUid::Uid( 0x10281F2A ), *this); - } - -// ----------------------------------------------------------------------------- -// CUsbObexClassControllerTest::DeleteTestObject -// ----------------------------------------------------------------------------- -// -void CUsbObexClassControllerTest::DeleteTestObject() - { - delete iUsbClassControllerPlugIn; - iUsbClassControllerPlugIn = NULL; - REComSession::FinalClose(); - } - -// ----------------------------------------------------------------------------- -// CUsbObexClassControllerTest::UccnGetClassControllerIteratorL -// ----------------------------------------------------------------------------- -// -CUsbClassControllerIterator* CUsbObexClassControllerTest::UccnGetClassControllerIteratorL() - { - iLog->Log( _L("get class controller iterator")); - return (CUsbClassControllerIterator *)NULL; - } - -// ----------------------------------------------------------------------------- -// CUsbObexClassControllerTest::UccnError -// ----------------------------------------------------------------------------- -// -void CUsbObexClassControllerTest::UccnError( TInt aError ) - { - iLog->Log( _L("class controller iterator error: %d"), aError ); - } -// ========================== OTHER EXPORTED FUNCTIONS ========================= -// None - -// [End of File] - Do not remove diff -r 703a2b94c06c -r dde4619868dc usbclasses/usbobexclasscontroller/tsrc/UsbObexClassControllerTest/src/UsbObexClassControllerTest_exe.cpp --- a/usbclasses/usbobexclasscontroller/tsrc/UsbObexClassControllerTest/src/UsbObexClassControllerTest_exe.cpp Wed Sep 15 13:20:24 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,66 +0,0 @@ -/* -* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: ?Description -* -*/ - - - -// INCLUDE FILES -#include -#include -#include -// EXTERNAL DATA STRUCTURES - -// EXTERNAL FUNCTION PROTOTYPES - -// ================= OTHER EXPORTED FUNCTIONS ================================= - -/* -------------------------------------------------------------------------------- - - Class: - - - Method: E32Main - - Description: - - Parameters: None - - Return Values: TInt: Symbian error code - - Errors/Exceptions: None - - Status: Draft - -------------------------------------------------------------------------------- -*/ -GLDEF_C TInt E32Main() - { - _LIT( KProcessMsgStart, "New process starting" ); - RDebug::Print( KProcessMsgStart ); - - - // This starts a new session that get capabilites that is used in - // UsbObexClassControllerTest_exe.mmp file. - TInt r = StartSession(); - - _LIT( KProcessMsgEnd, "New process ends" ); - RDebug::Print( KProcessMsgEnd ); - - return r; - - } - -// End of File diff -r 703a2b94c06c -r dde4619868dc usbclasses/usbphoneasmodem/classimplementation/atplugin/src/pamengine.cpp --- a/usbclasses/usbphoneasmodem/classimplementation/atplugin/src/pamengine.cpp Wed Sep 15 13:20:24 2010 +0300 +++ b/usbclasses/usbphoneasmodem/classimplementation/atplugin/src/pamengine.cpp Wed Oct 13 15:41:46 2010 +0300 @@ -306,9 +306,9 @@ CleanupStack::PopAndDestroy(); // connectionMethod } tmpName = NULL; - CleanupStack::PopAndDestroy(2); // destination + CleanupStack::PopAndDestroy(2); // destination, tmpName } - CleanupStack::PopAndDestroy(3); // cmManager + CleanupStack::PopAndDestroy(3); // cmManager, destinations, buf TRACE_FUNC_EXIT return; } diff -r 703a2b94c06c -r dde4619868dc usbclasses/usbphoneasmodem/classimplementation/atplugin/src/pamplugin.cpp --- a/usbclasses/usbphoneasmodem/classimplementation/atplugin/src/pamplugin.cpp Wed Sep 15 13:20:24 2010 +0300 +++ b/usbclasses/usbphoneasmodem/classimplementation/atplugin/src/pamplugin.cpp Wed Oct 13 15:41:46 2010 +0300 @@ -1,4 +1,4 @@ -// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +// Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). // All rights reserved. // This component and the accompanying materials are made available // under the terms of "Eclipse Public License v1.0" @@ -185,8 +185,9 @@ buf.Append( KCrlfString ); buf.Append( KOkString ); + delete supportedAp; aReply.Zero(); - aReply.Create( buf ); + aReply.CreateL( buf ); TRACE_FUNC_EXIT return; @@ -209,7 +210,7 @@ TInt apArrayLength = apArray->Count(); if ( apArrayLength > 0) { - HBufC8* buf = HBufC8::NewL( KreplyBufferLength ); + HBufC8* buf = HBufC8::NewLC( KreplyBufferLength ); buf->Des().Zero(); buf->Des().Append( KCrlfString ); for (TInt i=0; i < apArrayLength; i++ ) @@ -221,7 +222,8 @@ } buf->Des().Append( KOkString ); aReply.Zero(); - aReply.Create( *buf ); + aReply.CreateL( *buf ); + CleanupStack::PopAndDestroy(buf); // buf; } else { diff -r 703a2b94c06c -r dde4619868dc usbclasses/usbphoneasmodem/classimplementation/mscfileserver/inc/mscfileserversecuritypolicy.h --- a/usbclasses/usbphoneasmodem/classimplementation/mscfileserver/inc/mscfileserversecuritypolicy.h Wed Sep 15 13:20:24 2010 +0300 +++ b/usbclasses/usbphoneasmodem/classimplementation/mscfileserver/inc/mscfileserversecuritypolicy.h Wed Oct 13 15:41:46 2010 +0300 @@ -1,4 +1,4 @@ -// Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). +// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). // All rights reserved. // This component and the accompanying materials are made available // under the terms of "Eclipse Public License v1.0" @@ -21,21 +21,24 @@ // USB masss storage Server Security Policy Definition -const TUint KUsbMsServerRangeCount = 2; +const TUint KUsbMsServerRangeCount = 3; const TInt KUsbMsServerRanges[KUsbMsServerRangeCount] = { - EMscFileSetupLu, // NetworkControl [SetupLogicalUnitL/StartL/Stop/Shutdown] + EMscFileStart, // NetworkControl [StartL/Stop] + EMscFileShutdown, // DiskAdmin [Shutdown] EMscFileShutdown + 1, // fail (to KMaxInt) }; // Index numbers into KUsbMsServerElements[] const TInt KPolicyNetworkControl = 0; +const TInt KPolicyDiskAdmin = 1; // Mapping IPCs to poicy element const TUint8 KUsbMsServerElementsIndex[KUsbMsServerRangeCount] = { - KPolicyNetworkControl, // EMscFileSetupLu, EMscFileStart, EMscFileStop, EMscFileShutdown + KPolicyNetworkControl, // EMscFileStart & EMscFileStop + KPolicyDiskAdmin, // EMscFileShutdown CPolicyServer::ENotSupported, // EMscFileShutdown + 1 to KMaxTInt }; @@ -43,6 +46,7 @@ const CPolicyServer::TPolicyElement KUsbMsServerElements[] = { { _INIT_SECURITY_POLICY_C1(ECapabilityNetworkControl), CPolicyServer::EFailClient }, + { _INIT_SECURITY_POLICY_C1(ECapabilityDiskAdmin), CPolicyServer::EFailClient}, // the EFailClient means that if the check fails // the CheckFailed method with return KErrPermissionDenied }; diff -r 703a2b94c06c -r dde4619868dc usbengines/usblocodplugin/tsrc/USBLocodPluginTest/group/USBLocodPluginTest_phone.pkg --- a/usbengines/usblocodplugin/tsrc/USBLocodPluginTest/group/USBLocodPluginTest_phone.pkg Wed Sep 15 13:20:24 2010 +0300 +++ b/usbengines/usblocodplugin/tsrc/USBLocodPluginTest/group/USBLocodPluginTest_phone.pkg Wed Oct 13 15:41:46 2010 +0300 @@ -44,7 +44,7 @@ ; None ; Install files -"\epoc32\release\armv5\udeb\USBLocodPluginTest.dll"-"c:\Sys\Bin\USBLocodPluginTest.dll" +"\epoc32\release\armv5\urel\USBLocodPluginTest.dll"-"c:\Sys\Bin\USBLocodPluginTest.dll" "..\init\USBLocodPluginTest_phone.ini"-"c:\testframework\testframework.ini" "..\conf\USBLocodPluginTest.cfg"-"c:\testframework\USBLocodPluginTest.cfg" diff -r 703a2b94c06c -r dde4619868dc usbengines/usblocodplugin/tsrc/USBLocodPluginTest/group/build_sis_ats.bat --- a/usbengines/usblocodplugin/tsrc/USBLocodPluginTest/group/build_sis_ats.bat Wed Sep 15 13:20:24 2010 +0300 +++ b/usbengines/usblocodplugin/tsrc/USBLocodPluginTest/group/build_sis_ats.bat Wed Oct 13 15:41:46 2010 +0300 @@ -14,10 +14,7 @@ @rem Description: @rem -call sbs -c armv5_udeb clean -call sbs -c armv5_udeb.test -call sbs -c armv5_udeb.test freeze -call sbs -c armv5_udeb.test - +call bldmake bldfiles +call abld test build armv5 call makesis USBLocodPluginTest_ats.pkg -call signsis USBLocodPluginTest_ats.sis USBLocodPluginTest_ats.sisx x:\rd.cer x:\rd-key.pem +call signsis USBLocodPluginTest_ats.sis USBLocodPluginTest_ats.sisx rd.cer rd-key.pem diff -r 703a2b94c06c -r dde4619868dc usbengines/usblocodplugin/tsrc/USBLocodPluginTest/group/build_sis_phone.bat --- a/usbengines/usblocodplugin/tsrc/USBLocodPluginTest/group/build_sis_phone.bat Wed Sep 15 13:20:24 2010 +0300 +++ b/usbengines/usblocodplugin/tsrc/USBLocodPluginTest/group/build_sis_phone.bat Wed Oct 13 15:41:46 2010 +0300 @@ -14,10 +14,7 @@ @rem Description: @rem -call sbs -c armv5_udeb clean -call sbs -c armv5_udeb.test -call sbs -c armv5_udeb.test freeze -call sbs -c armv5_udeb.test - +call bldmake bldfiles +call abld test build armv5 call makesis USBLocodPluginTest_phone.pkg -call signsis USBLocodPluginTest_phone.sis USBLocodPluginTest_phone.sisx x:\rd.cer x:\rd-key.pem +call signsis USBLocodPluginTest_phone.sis USBLocodPluginTest_phone.sisx rd.cer rd-key.pem diff -r 703a2b94c06c -r dde4619868dc usbengines/usbotgwatcher/src/cusbotgwatcher.cpp --- a/usbengines/usbotgwatcher/src/cusbotgwatcher.cpp Wed Sep 15 13:20:24 2010 +0300 +++ b/usbengines/usbotgwatcher/src/cusbotgwatcher.cpp Wed Oct 13 15:41:46 2010 +0300 @@ -37,10 +37,8 @@ #include "errors.h" #include "debug.h" #include "panic.h" -#ifndef STIF _LIT_SECURITY_POLICY_PASS( KAlwaysPassPolicy ); _LIT_SECURITY_POLICY_C1( KLocalServicesPolicy, ECapabilityLocalServices ); -#endif // --------------------------------------------------------------------------- // diff -r 703a2b94c06c -r dde4619868dc usbengines/usbotgwatcher/tsrc/UsbOtgWatcherTest/Bmarm/UsbOtgWatcherTestu.def --- a/usbengines/usbotgwatcher/tsrc/UsbOtgWatcherTest/Bmarm/UsbOtgWatcherTestu.def Wed Sep 15 13:20:24 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,3 +0,0 @@ -EXPORTS - LibEntryL__FR13CTestModuleIf @ 1 NONAME R3UNUSED ; LibEntryL(CTestModuleIf &) - diff -r 703a2b94c06c -r dde4619868dc usbengines/usbotgwatcher/tsrc/UsbOtgWatcherTest/Bwins/UsbOtgWatcherTestu.def --- a/usbengines/usbotgwatcher/tsrc/UsbOtgWatcherTest/Bwins/UsbOtgWatcherTestu.def Wed Sep 15 13:20:24 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,3 +0,0 @@ -EXPORTS - ?LibEntryL@@YAPAVCScriptBase@@AAVCTestModuleIf@@@Z @ 1 NONAME ; class CScriptBase * __cdecl LibEntryL(class CTestModuleIf &) - diff -r 703a2b94c06c -r dde4619868dc usbengines/usbotgwatcher/tsrc/UsbOtgWatcherTest/conf/UsbOtgWatcherTest.cfg --- a/usbengines/usbotgwatcher/tsrc/UsbOtgWatcherTest/conf/UsbOtgWatcherTest.cfg Wed Sep 15 13:20:24 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,112 +0,0 @@ -/* -* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -[StifSettings] -CapsModifier= UsbOtgWatcherTest.exe -[EndStifSettings] - -// UsbOtgWatcherTest Module - total 10 tc - -// UsbOtgWatcherTest Api Tests (1 tc) - -[Test] -title SetupTearDown -create UsbOtgWatcherTest tester -tester SetupTearDown API -delete tester -[Endtest] - - -// Add new api tests here -// ... - - -// UsbOtgWatcherTest Module Tests (9 tc) - -// Add new module tests here -// ... - -[Test] -title PinOnTest_Success -create UsbOtgWatcherTest tester -tester PinOnTest_Success MODULE -delete tester -[Endtest] - - -[Test] -title PinOffTest_Success -create UsbOtgWatcherTest tester -tester PinOffTest_Success MODULE -delete tester -[Endtest] - -[Test] -title PinOnTest_EmptyCable -create UsbOtgWatcherTest tester -tester PinOnTest_EmptyCable MODULE -delete tester -[Endtest] - -[Test] -title PinOnTest_TryStartError -create UsbOtgWatcherTest tester -tester PinOnTest_TryStartError MODULE -delete tester -[Endtest] - -[Test] -title PinOnTest_BusRequestError -create UsbOtgWatcherTest tester -tester PinOnTest_BusRequestError MODULE -delete tester -[Endtest] - -[Test] -title DeviceAttached_BadHubPostion -create UsbOtgWatcherTest tester -tester DeviceAttached_BadHubPostion MODULE -delete tester -[Endtest] - -[Test] -title DeviceAttached_TooMuchRequired -create UsbOtgWatcherTest tester -tester DeviceAttached_TooMuchRequired MODULE -delete tester -[Endtest] - -[Test] -title DeviceAttached_SupportedDevice -create UsbOtgWatcherTest tester -tester DeviceAttached_SupportedDevice MODULE -delete tester -[Endtest] - -[Test] -title DeviceDetached_SupportedDevice -create UsbOtgWatcherTest tester -tester DeviceDetached_SupportedDevice MODULE -delete tester -[Endtest] - - - -// UsbOtgWatcherTest Branch Tests (... tc) - -// Add new branch tests here -// ... diff -r 703a2b94c06c -r dde4619868dc usbengines/usbotgwatcher/tsrc/UsbOtgWatcherTest/eabi/UsbOtgWatcherTestu.def --- a/usbengines/usbotgwatcher/tsrc/UsbOtgWatcherTest/eabi/UsbOtgWatcherTestu.def Wed Sep 15 13:20:24 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,23 +0,0 @@ -EXPORTS - _Z9LibEntryLR13CTestModuleIf @ 1 NONAME - _ZN14CUsbOtgWatcher4NewLER4RUsb @ 2 NONAME - _ZN14CUsbOtgWatcher9IsDeviceAEv @ 3 NONAME - _ZTI14CUsbOtgWatcher @ 4 NONAME - _ZTI16CUsbNotifManager @ 5 NONAME - _ZTIN16CUsbNoteNotifier15CNotifierActiveE @ 6 NONAME - _ZTV14CUsbOtgWatcher @ 7 NONAME - _ZTV16CUsbNotifManager @ 8 NONAME - _ZTVN16CUsbNoteNotifier15CNotifierActiveE @ 9 NONAME - _ZTI16CUsbVBusObserver @ 10 NONAME - _ZTI17CUsbIdPinObserver @ 11 NONAME - _ZTI20CUsbOtgStateObserver @ 12 NONAME - _ZTI23CUsbBusActivityObserver @ 13 NONAME - _ZTI31CUsbMessageNotificationObserver @ 14 NONAME - _ZTI33CUsbHostEventNotificationObserver @ 15 NONAME - _ZTV16CUsbVBusObserver @ 16 NONAME - _ZTV17CUsbIdPinObserver @ 17 NONAME - _ZTV20CUsbOtgStateObserver @ 18 NONAME - _ZTV23CUsbBusActivityObserver @ 19 NONAME - _ZTV31CUsbMessageNotificationObserver @ 20 NONAME - _ZTV33CUsbHostEventNotificationObserver @ 21 NONAME - diff -r 703a2b94c06c -r dde4619868dc usbengines/usbotgwatcher/tsrc/UsbOtgWatcherTest/group/UsbOtgWatcherTest.mmp --- a/usbengines/usbotgwatcher/tsrc/UsbOtgWatcherTest/group/UsbOtgWatcherTest.mmp Wed Sep 15 13:20:24 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,100 +0,0 @@ -/* -* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - - -#if defined(__S60_) - // To get the MW_LAYER_SYSTEMINCLUDE-definition - #include -#endif - -TARGET UsbOtgWatcherTest.dll -TARGETTYPE dll -UID 0x1000008D 0x101FB3E3 - -CAPABILITY CommDD NetworkControl WriteDeviceData NetworkServices LocalServices ProtServ -VENDORID VID_DEFAULT - -DEFFILE UsbOtgWatcherTest.def - -MW_LAYER_SYSTEMINCLUDE -MACRO STIF_STUB -MACRO STIF - -//includes for stubbing -SYSTEMINCLUDE /epoc32/include/mw/stubsrv/ -SYSTEMINCLUDE /epoc32/include/mw/taf/ - -USERINCLUDE ../inc -SOURCEPATH ../src - -SOURCE UsbOtgWatcherTest.cpp -SOURCE UsbOtgWatcherTestBlocks.cpp - -// Mock classes (used for emulation of real ones) -SOURCE mockcusbidpinobserver.cpp -SOURCE mockcusbvbusobserver.cpp -SOURCE mockcusbotgstateobserver.cpp -SOURCE mockcusbhosteventnotificationobserver.cpp -SOURCE mockcusbmessagenotificationobserver.cpp -SOURCE mockcusbbusactivityobserver.cpp -SOURCE mockrusb.cpp -SOURCE mockcusbtimer.cpp -SOURCE mockcusbnotifmanager.cpp - -// real classes to be tested -SOURCEPATH ../../../src -USERINCLUDE ../../../inc - -SOURCE cusbotgwatcher.cpp -SOURCE cusbstate.cpp -SOURCE cusbstatehostabase.cpp -SOURCE cusbstatehostainitiate.cpp -SOURCE cusbstatehostahost.cpp -SOURCE cusbstatehostaperipheral.cpp -SOURCE cusbstatehosthandle.cpp -SOURCE cusbservicecontrol.cpp -SOURCE cusbnotifier.cpp -SOURCE cusbwarningnotifier.cpp -SOURCE CUsbNoteNotifier.cpp -SOURCE CUsbStateHostHandleDropping.cpp -SOURCE CUsbStateHostDelayNotAttachedHandle.cpp -SOURCE CUsbStateHostDelayAttachedHandle.cpp -SOURCE CUsbStateHostUndefined.cpp -SOURCE cusbstatehostdelayhandle.cpp - - - - -//standart lib for stif testing -LIBRARY euser.lib -LIBRARY stiftestinterface.lib -LIBRARY stiftestengine.lib - -//lib for stubbing -LIBRARY apibehavior.lib -LIBRARY stubber.lib - -//lib for component testing -LIBRARY usbdescriptors.lib -LIBRARY usbdi_utils.lib -LIBRARY aknnotify.lib - -LANG SC - - - -// End of File diff -r 703a2b94c06c -r dde4619868dc usbengines/usbotgwatcher/tsrc/UsbOtgWatcherTest/group/UsbOtgWatcherTest_ats.pkg --- a/usbengines/usbotgwatcher/tsrc/UsbOtgWatcherTest/group/UsbOtgWatcherTest_ats.pkg Wed Sep 15 13:20:24 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,69 +0,0 @@ -; -; Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -; All rights reserved. -; This component and the accompanying materials are made available -; under the terms of "Eclipse Public License v1.0" -; which accompanies this distribution, and is available -; at the URL "http://www.eclipse.org/legal/epl-v10.html". -; -; Initial Contributors: -; Nokia Corporation - initial contribution. -; -; Contributors: -; -; Description: Installation file for STIF -; - - -; -; Installation file for STIF -; - -; Languages -&EN - -; Provide value for uid -#{"UsbOtgWatcherTest"},(0x00000000),1,1,0,TYPE=SA - -; Series60 product id for S60 5.2 -[0x20022E6D], 0, 0, 0, {"Series60ProductID"} - -; Localised Vendor name -%{"Nokia"} - -; Unique Vendor name; -:"Nokia" - - -; Logo -; None - -; Package signature - Optional -; None - -; Start of Package body - -; Condition blocks -; None - -; Options list -; None - -; Install files -"/epoc32/release/armv5/udeb/UsbOtgWatcherTest.dll"-"C:/Sys/Bin/UsbOtgWatcherTest.dll" -"/epoc32/release/armv5/udeb/UsbOtgWatcherTest.exe"-"C:/Sys/Bin/UsbOtgWatcherTest.exe" - -"../conf/UsbOtgWatcherTest.cfg"-"E:/testing/conf/UsbOtgWatcherTest.cfg" -"../init/UsbOtgWatcherTest_ats.ini"-"E:/testing/init/UsbOtgWatcherTest.ini" - -; Embedded SIS -; None - -; End of Package body - -; PKG dependencies -; None - -; PKG capabilities -; None - diff -r 703a2b94c06c -r dde4619868dc usbengines/usbotgwatcher/tsrc/UsbOtgWatcherTest/group/UsbOtgWatcherTest_exe.mmp --- a/usbengines/usbotgwatcher/tsrc/UsbOtgWatcherTest/group/UsbOtgWatcherTest_exe.mmp Wed Sep 15 13:20:24 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,41 +0,0 @@ -/* -* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - - -#if defined(__S60_) - #include -#endif - -TARGET UsbOtgWatcherTest.exe -TARGETTYPE exe -UID 0 0xEF4892C6 - -CAPABILITY CommDD NetworkControl WriteDeviceData NetworkServices LocalServices ProtServ -VENDORID VID_DEFAULT - -MW_LAYER_SYSTEMINCLUDE - -SOURCEPATH ../src - -SOURCE UsbOtgWatcherTest_exe.cpp - -LIBRARY euser.lib -LIBRARY stiftestinterface.lib - -EPOCSTACKSIZE 40960 - -// End of File diff -r 703a2b94c06c -r dde4619868dc usbengines/usbotgwatcher/tsrc/UsbOtgWatcherTest/group/UsbOtgWatcherTest_phone.pkg --- a/usbengines/usbotgwatcher/tsrc/UsbOtgWatcherTest/group/UsbOtgWatcherTest_phone.pkg Wed Sep 15 13:20:24 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,64 +0,0 @@ - -; Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -; All rights reserved. -; This component and the accompanying materials are made available -; under the terms of "Eclipse Public License v1.0" -; which accompanies this distribution, and is available -; at the URL "http://www.eclipse.org/legal/epl-v10.html". -; -; Initial Contributors: -; Nokia Corporation - initial contribution. -; -; Contributors: -; -; Description: Installation file for STIF -; - -; Languages -&EN - -; Provide value for uid -#{"UsbOtgWatcherTest"},(0x00000000),1,1,0,TYPE=SA - -; Series60 product id for S60 5.2 -[0x20022E6D], 0, 0, 0, {"Series60ProductID"} - -; Localised Vendor name -%{"Nokia"} - -; Unique Vendor name; -:"Nokia" - - -; Logo -; None - -; Package signature - Optional -; None - -; Start of Package body - -; Condition blocks -; None - -; Options list -; None - -; Install files -"/epoc32/release/armv5/udeb/UsbOtgWatcherTest.dll"-"C:/Sys/Bin/UsbOtgWatcherTest.dll" -"/epoc32/release/armv5/udeb/UsbOtgWatcherTest.exe"-"C:/Sys/Bin/UsbOtgWatcherTest.exe" - -"../conf/UsbOtgWatcherTest.cfg"-"C:/testframework/UsbOtgWatcherTest.cfg" -"../init/UsbOtgWatcherTest_phone.ini"-"C:/testframework/testframework.ini" - -; Embedded SIS -; None - -; End of Package body - -; PKG dependencies -; None - -; PKG capabilities -; None - diff -r 703a2b94c06c -r dde4619868dc usbengines/usbotgwatcher/tsrc/UsbOtgWatcherTest/group/bld.inf --- a/usbengines/usbotgwatcher/tsrc/UsbOtgWatcherTest/group/bld.inf Wed Sep 15 13:20:24 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,34 +0,0 @@ -/* -* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - - - -PRJ_PLATFORMS -DEFAULT - -PRJ_TESTEXPORTS - -../inc/usbmandll_stub.h /epoc32/include/mw/taf/usbmandll_stub.h - - -PRJ_TESTMMPFILES -UsbOtgWatcherTest.mmp -UsbOtgWatcherTest_exe.mmp - -PRJ_MMPFILES - -// End of File diff -r 703a2b94c06c -r dde4619868dc usbengines/usbotgwatcher/tsrc/UsbOtgWatcherTest/group/build_sis_ats.bat --- a/usbengines/usbotgwatcher/tsrc/UsbOtgWatcherTest/group/build_sis_ats.bat Wed Sep 15 13:20:24 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,20 +0,0 @@ -@rem -@rem Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -@rem All rights reserved. -@rem This component and the accompanying materials are made available -@rem under the terms of "Eclipse Public License v1.0" -@rem which accompanies this distribution, and is available -@rem at the URL "http://www.eclipse.org/legal/epl-v10.html". -@rem -@rem Initial Contributors: -@rem Nokia Corporation - initial contribution. -@rem -@rem Contributors: -@rem -@rem Description: -@rem - - -call sbs -c armv5.test -call makesis UsbOtgWatcherTest_ats.pkg -call signsis UsbOtgWatcherTest_ats.sis UsbOtgWatcherTest_ats.sisx rd.cer rd-key.pem diff -r 703a2b94c06c -r dde4619868dc usbengines/usbotgwatcher/tsrc/UsbOtgWatcherTest/group/build_sis_phone.bat --- a/usbengines/usbotgwatcher/tsrc/UsbOtgWatcherTest/group/build_sis_phone.bat Wed Sep 15 13:20:24 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,20 +0,0 @@ -@rem -@rem Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -@rem All rights reserved. -@rem This component and the accompanying materials are made available -@rem under the terms of "Eclipse Public License v1.0" -@rem which accompanies this distribution, and is available -@rem at the URL "http://www.eclipse.org/legal/epl-v10.html". -@rem -@rem Initial Contributors: -@rem Nokia Corporation - initial contribution. -@rem -@rem Contributors: -@rem -@rem Description: -@rem - - -call sbs -c armv5.test -call makesis UsbOtgWatcherTest_phone.pkg -call signsis UsbOtgWatcherTest_phone.sis UsbOtgWatcherTest_phone.sisx rd.cer rd-key.pem diff -r 703a2b94c06c -r dde4619868dc usbengines/usbotgwatcher/tsrc/UsbOtgWatcherTest/inc/UsbOtgWatcherTest.h --- a/usbengines/usbotgwatcher/tsrc/UsbOtgWatcherTest/inc/UsbOtgWatcherTest.h Wed Sep 15 13:20:24 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,274 +0,0 @@ -/* -* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - - -#ifndef USBOTGWATCHERTEST_H -#define USBOTGWATCHERTEST_H - -// INCLUDES -#include -#include -#include -#include -#include "stifassertmacros.h" -// INCLUDES FOR STUBS -#include -#include -#include -// INCLUDES FOR TEST -#include -#include -#include "cusbotgwatcher.h" -#include "cusbnotifier.h" -#include "cusbstatehostainitiate.h" -#include "cusbstatehosthandle.h" -#include "cusbservicecontrol.h" - - -// CONSTANTS -// Logging path -_LIT( KUsbOtgWatcherTestLogPath, "\\logs\\testframework\\UsbOtgWatcherTest\\" ); - -// Logging path for ATS - for phone builds comment this line -//_LIT( KUsbOtgWatcherTestLogPath, "e:\\testing\\stiflogs\\" ); - -// Log file -_LIT( KUsbOtgWatcherTestLogFile, "UsbOtgWatcherTest.txt" ); -_LIT( KUsbOtgWatcherTestLogFileWithTitle, "UsbOtgWatcherTest_[%S].txt" ); - -// MACROS -#define TEST_CLASS_VERSION_MAJOR 0 -#define TEST_CLASS_VERSION_MINOR 0 -#define TEST_CLASS_VERSION_BUILD 0 - -// Macros used to extract test block parameters -#define TESTENTRY( A, B )\ - if ( !iTestBlockParams.iTestBlockName.Compare( TPtrC( ( TText* ) L ##A ) ) )\ - { iTestBlockFunction = &B; iTestBlockFound = ETrue; }\ - if ( !iTestBlockParams.iTestBlockName.Compare( TPtrC( ( TText* ) L ##A ) ) ) - -#define TESTPARAM( A, B )\ - GetTestBlockParamL( ( TGetTestBlockParamOperation ) A, ( TTestBlockParamName ) B ); - -// FUNCTION PROTOTYPES - -// FORWARD DECLARATIONS -class CUsbOtgWatcher; -class RUsb; - -// DATA TYPES - -// Enum type used to determine test block execution result -enum TUsbOtgWatcherTestResult - { - ETestCasePassed, - ETestCaseFailed - }; - -// Enum type indicating test block parameter which should be used to store -// data extracted from test script -enum TTestBlockParamName - { - eTestOption1, - eTestOption2, - eTestOption3, - eTestIntOption1, - eTestIntOption2, - eTestIntOption3, - eTestCharOption1, - eTestCharOption2, - eTestCharOption3 - }; - -// Enum type used to indicate which get parameter function should be used -enum TGetTestBlockParamOperation - { - eGetString, - eGetInt, - eGetChar - }; - -// CLASS DECLARATION -/** -* TUsbOtgWatcherTestBlockParams test class for storing test block parameters. -*/ -NONSHARABLE_CLASS( TUsbOtgWatcherTestBlockParams ) - { - public: - TPtrC iTestBlockName; - - TPtrC iTestOption1; - TPtrC iTestOption2; - TPtrC iTestOption3; - - TInt iTestIntOption1; - TInt iTestIntOption2; - TInt iTestIntOption3; - - TChar iTestCharOption1; - TChar iTestCharOption2; - TChar iTestCharOption3; - }; - -/** -* CUsbOtgWatcherTest test class for STIF Test Framework TestScripter. -*/ -NONSHARABLE_CLASS( CtUsbOtgWatcher ) : public CScriptBase - { - public: // Constructors and destructor - - /** - * Two-phased constructor. - */ - static CtUsbOtgWatcher* NewL( CTestModuleIf& aTestModuleIf ); - - /** - * Destructor. - */ - virtual ~CtUsbOtgWatcher(); - - public: // New functions - public: // Functions from base classes - - /** - * From CScriptBase Runs a script line. - * @since ?Series60_version - * @param aItem Script line containing method name and parameters - * @return Symbian OS error code - */ - virtual TInt RunMethodL( CStifItemParser& aItem ); - - protected: // New functions - protected: // Functions from base classes - private: - - /** - * C++ default constructor. - */ - CtUsbOtgWatcher( CTestModuleIf& aTestModuleIf ); - - /** - * By default Symbian 2nd phase constructor is private. - */ - void ConstructL(); - - /** - * Frees all resources allocated from test methods. - * @since ?Series60_version - */ - void TestDelete(); - - /** - * Constructs all test resources for test methods. - */ - void TestConstructL(); - - /** - * Extracts test block parameters from script file - */ - void TestBlocksInfoL(); - - /** - * Executes test block - */ - TInt ExecuteTestBlock( CStifItemParser& aItem ); - - /** - * Executes proper get parameter function indicated by its arguments - */ - void GetTestBlockParamL( TGetTestBlockParamOperation aOperation, - TTestBlockParamName aParamName ); - - /** - * Method used to log version of test class - */ - void SendTestClassVersion(); - - // ADD NEW METHOD DEC HERE - // [TestMethods] - Do not remove - void ExampleTestL( TUsbOtgWatcherTestBlockParams& aParams, - TUsbOtgWatcherTestResult& aTestResult ); - - void SetupTearDownL( TUsbOtgWatcherTestBlockParams& aParams, - TUsbOtgWatcherTestResult& aTestResult ); - - void PinOnTest_SuccessL( TUsbOtgWatcherTestBlockParams& aParams, - TUsbOtgWatcherTestResult& aTestResult ); - - void PinOffTest_SuccessL( TUsbOtgWatcherTestBlockParams& aParams, - TUsbOtgWatcherTestResult& aTestResult ); - - void PinOnTest_EmptyCableL( TUsbOtgWatcherTestBlockParams& aParams, - TUsbOtgWatcherTestResult& aTestResult ); - - void PinOnTest_TryStartErrorL( TUsbOtgWatcherTestBlockParams& aParams, - TUsbOtgWatcherTestResult& aTestResult ); - - void PinOnTest_BusRequestErrorL( TUsbOtgWatcherTestBlockParams& aParams, - TUsbOtgWatcherTestResult& aTestResult ); - - void DeviceAttached_BadHubPostionL( TUsbOtgWatcherTestBlockParams& aParams, - TUsbOtgWatcherTestResult& aTestResult ); - - void DeviceAttached_TooMuchRequiredL( TUsbOtgWatcherTestBlockParams& aParams, - TUsbOtgWatcherTestResult& aTestResult ); - - void DeviceAttached_SupportedDeviceL( TUsbOtgWatcherTestBlockParams& aParams, - TUsbOtgWatcherTestResult& aTestResult ); - - void DeviceDetached_SupportedDeviceL( TUsbOtgWatcherTestBlockParams& aParams, - TUsbOtgWatcherTestResult& aTestResult ); - - //others method - void SetupL(); - void TearDown(); - - public: // Data - protected: // Data - private: // Data - - // Member object used to store test block parameters - TUsbOtgWatcherTestBlockParams iTestBlockParams; - TTestResult iResult; - - // Used to indicate if test block with specified parameters exist - TBool iTestBlockFound; - - // Function pointer used to call proper test block methods - void ( CtUsbOtgWatcher::*iTestBlockFunction ) - ( TUsbOtgWatcherTestBlockParams&, TUsbOtgWatcherTestResult& ); - - // Not own - CStifItemParser* iItem; - CStubber * iStubber; - RUsb* iUsbMan; - CUsbOtgWatcher* iWatcher; - - // Reserved pointer for future extension - //TAny* iReserved; - - // ADD NEW DATA DEC HERE - - - public: // Friend classes - protected: // Friend classes - private: // Friend classes - - }; -#endif // USBOTGWATCHERTEST_H - -// End of File diff -r 703a2b94c06c -r dde4619868dc usbengines/usbotgwatcher/tsrc/UsbOtgWatcherTest/inc/mockcusbbusactivityobserver.h --- a/usbengines/usbotgwatcher/tsrc/UsbOtgWatcherTest/inc/mockcusbbusactivityobserver.h Wed Sep 15 13:20:24 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,108 +0,0 @@ -/* -* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifndef C_USBBUSACTIVITYOBSERVER_H -#define C_USBBUSACTIVITYOBSERVER_H - -#include - -#include "tassertbase.h" - -class MUsbBusActivityObserver - { -public: - - virtual void BusIdleL() = 0; - virtual void BusActiveL() = 0; - }; - -/** - * Class observes OTG State property, see usbotgdefs.h - * - * @lib ?library - * @since S60 ?S60_version *** for example, S60 v3.0 - */ -class CUsbBusActivityObserver : public TAssertBase - { - friend class CtUsbOtgWatcher; - friend class CUsbOtgWatcherTest; - -public: - - enum TBusActivity - { - EBusIdle = 0, - EBusActive = 1 - }; - - /** - * Two-phased constructor. - * @param ?arg1 ?description - * @param ?arg2 ?description - */ - // ?IMPORT_C - static CUsbBusActivityObserver* NewL(); - - /** - * Destructor. - */ - virtual ~CUsbBusActivityObserver(); - - /** - * ?description - * - * @since S60 ?S60_version - * @param ?arg1 ?description - * @param ?arg2 ?description - * @return ?description - */ - // ?IMPORT_C - TBusActivity BusActivity(); - - /** - * ?description - * - * @since S60 ?S60_version - * @param ?arg1 ?description - * @param ?arg2 ?description - * @return ?description - */ - void SubscribeL(MUsbBusActivityObserver&); - - void UnsubscribeL(MUsbBusActivityObserver&); - - void TriggerBusIdleL(); - - void TriggerBusActiveL(); - -private: - - CUsbBusActivityObserver(); - - void ConstructL(); - -private: - // data - - // The observer reports state changes to own observers - // Owns - MUsbBusActivityObserver* iObserver; - - TInt iBusActivity; - }; - -#endif // C_USBOTGSTATEOBSERVER_H diff -r 703a2b94c06c -r dde4619868dc usbengines/usbotgwatcher/tsrc/UsbOtgWatcherTest/inc/mockcusbhosteventnotificationobserver.h --- a/usbengines/usbotgwatcher/tsrc/UsbOtgWatcherTest/inc/mockcusbhosteventnotificationobserver.h Wed Sep 15 13:20:24 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,97 +0,0 @@ -/* -* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifndef C_USBHOSTEVENTNOTIFICATIONOBSERVER_H -#define C_USBHOSTEVENTNOTIFICATIONOBSERVER_H - -#include -#include - -#include -#include - -#include "tassertbase.h" - -class RUsb; - -class MUsbHostEventNotificationObserver - { -public: - - virtual void DeviceAttachedL(TDeviceEventInformation) = 0; - virtual void DeviceDetachedL(TDeviceEventInformation) = 0; - virtual void DriverLoadSuccessL(TDeviceEventInformation) = 0; - virtual void DriverLoadPartialSuccessL(TDeviceEventInformation) = 0; - virtual void DriverLoadFailureL(TDeviceEventInformation) = 0; - - }; - -/** - * Class observes USB Notifications - * - * @lib ?library - * @since S60 ?S60_version *** for example, S60 v3.0 - */ -class CUsbHostEventNotificationObserver : public TAssertBase - { - friend class CtUsbOtgWatcher; - friend class CUsbOtgWatcherTest; - -public: - - /** - * Two-phased constructor. - * @param ?arg1 ?description - * @param ?arg2 ?description - */ - // ?IMPORT_C - static CUsbHostEventNotificationObserver* NewL(RUsb* aUsb); - - /** - * Destructor. - */ - virtual ~CUsbHostEventNotificationObserver(); - - void SubscribeL(MUsbHostEventNotificationObserver&); - - void UnsubscribeL(MUsbHostEventNotificationObserver&); - - void TriggerDeviceAttachedL(TDeviceEventInformation eventInfo); - void TriggerDeviceDetachedL(TDeviceEventInformation eventInfo); - void TriggerDriverLoadSuccessL(TDeviceEventInformation eventInfo); - void TriggerDriverLoadPartialSuccessL(TDeviceEventInformation eventInfo); - void TriggerDriverLoadFailureL(TDeviceEventInformation eventInfo); - -private: - - CUsbHostEventNotificationObserver(RUsb* aUsb); - - void ConstructL(); - -private: - // data - - // The observer reports changes to own observers - // Owns - MUsbHostEventNotificationObserver* iObserver; - - // Notifications come from USB - // Not own - RUsb* iUsb; - }; - -#endif // C_USBHOSTEVENTNOTIFICATIONOBSERVER_H diff -r 703a2b94c06c -r dde4619868dc usbengines/usbotgwatcher/tsrc/UsbOtgWatcherTest/inc/mockcusbidpinobserver.h --- a/usbengines/usbotgwatcher/tsrc/UsbOtgWatcherTest/inc/mockcusbidpinobserver.h Wed Sep 15 13:20:24 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,113 +0,0 @@ -/* -* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifndef MOCK_C_USBIDPINOBSERVER_H -#define MOCK_C_USBIDPINOBSERVER_H - -#include - -#include -#include -#include - -#include "tassertbase.h" - -class CStifLogger; - -class MUsbIdPinObserver - { -public: - - virtual void IdPinOffL() = 0; - virtual void IdPinOnL() = 0; - - }; - -/** - * Class observes ID-PIN property - * - * @lib ?library - * @since S60 ?S60_version *** for example, S60 v3.0 - */ -class CUsbIdPinObserver : public TAssertBase - { - friend class CtUsbOtgWatcher; - friend class CUsbOtgWatcherTest; -public: - enum TState - { - EIdPinOff = 0, - EIdPinOn = 1 - }; - - /** - * Two-phased constructor. - * @param ?arg1 ?description - * @param ?arg2 ?description - */ - // ?IMPORT_C - static CUsbIdPinObserver* NewL(); - - /** - * Destructor. - */ - virtual ~CUsbIdPinObserver(); - - /** - * ?description - * - * @since S60 ?S60_version - * @param ?arg1 ?description - * @param ?arg2 ?description - * @return ?description - */ - // ?IMPORT_C - TState IdPin() /* const! read comment in impl*/; - - /** - * ?description - * - * @since S60 ?S60_version - * @param ?arg1 ?description - * @param ?arg2 ?description - * @return ?description - */ - - void SubscribeL(MUsbIdPinObserver&); - - void UnsubscribeL(MUsbIdPinObserver&); - - void TriggerPinOnL(); - - void TriggerPinOffL(); - -private: - - CUsbIdPinObserver(); - - void ConstructL(); - -private: - // data - // The observer reports state changes to its own observers - // Own - MUsbIdPinObserver* iObserver; - TInt iIdPinOn; - CActiveSchedulerWait * iWait; - }; - -#endif // MOCK_C_USBIDPINOBSERVER_H diff -r 703a2b94c06c -r dde4619868dc usbengines/usbotgwatcher/tsrc/UsbOtgWatcherTest/inc/mockcusbmessagenotificationobserver.h --- a/usbengines/usbotgwatcher/tsrc/UsbOtgWatcherTest/inc/mockcusbmessagenotificationobserver.h Wed Sep 15 13:20:24 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,96 +0,0 @@ -/* -* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifndef C_USBMESSAGENOTIFICATIONOBSERVER_H -#define C_USBMESSAGENOTIFICATIONOBSERVER_H - -#include - -#include "tassertbase.h" - -class RUsb; - -class MUsbMessageNotificationObserver - { -public: - - virtual void MessageNotificationReceivedL(TInt) = 0; - virtual void BadHubPositionL() = 0; - virtual void VBusErrorL() = 0; - virtual void SrpReceivedL() = 0; - virtual void SessionRequestedL() = 0; - }; - -/** - * Class observes USB Notifications - * - * @lib ?library - * @since S60 ?S60_version *** for example, S60 v3.0 - */ -class CUsbMessageNotificationObserver : public TAssertBase - { - friend class CtUsbOtgWatcher; - friend class CUsbOtgWatcherTest; - -public: - - /** - * Two-phased constructor. - * @param ?arg1 ?description - * @param ?arg2 ?description - */ - // ?IMPORT_C - static CUsbMessageNotificationObserver* NewL(RUsb* aUsb); - - /** - * Destructor. - */ - virtual ~CUsbMessageNotificationObserver(); - - void SubscribeL(MUsbMessageNotificationObserver&); - - void UnsubscribeL(MUsbMessageNotificationObserver&); - - void TriggerMessageNotificationReceivedL(TInt); - void TriggerBadHubPositionL(); - void TriggerVBusErrorL(); - void TriggerSrpReceivedL(); - void TriggerSessionRequestedL(); - -private: - - CUsbMessageNotificationObserver(RUsb* aUsb); - - void ConstructL(); - -private: - // data - - // The observer reports to own observers - // Owns - MUsbMessageNotificationObserver* iObserver; - - // Notifications come from USB - // Not own - RUsb* iUsb; - - // Info from notification comes to this member - TInt iMessage; - - }; - -#endif // C_USBMESSAGENOTIFICATIONOBSERVER_H diff -r 703a2b94c06c -r dde4619868dc usbengines/usbotgwatcher/tsrc/UsbOtgWatcherTest/inc/mockcusbnotifmanager.h --- a/usbengines/usbotgwatcher/tsrc/UsbOtgWatcherTest/inc/mockcusbnotifmanager.h Wed Sep 15 13:20:24 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,90 +0,0 @@ -/* -* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifndef C_USBNOTIFMANAGER_H -#define C_USBNOTIFMANAGER_H - -#include - -#include -#include - -#include "tassertbase.h" -#include "cusbnotifier.h" -#include "cusbwarningnotifier.h" -#include "cusbotgwatcher.h" - -#define INVALID_VALUE NULL - -// forward declaration -class CUsbWaitNotifier; -class CUsbNotifier; - -class MWaitNotifierObserver -{ -public: - - // feedback to observer - virtual void WaitNotifierCompletedL(TInt aFeedback) = 0; -}; - -/** - * Function of the class is own and share RNotifier, own list of CWaitNotifier(s), - * show notifiers, which are synchronous, and cancel it with a delay - * - * @lib ?library - * @since S60 ?S60_version *** for example, S60 v3.0 - */ -class CUsbNotifManager : public TAssertBase - { -friend class CtUsbOtgWatcher; - friend class CUsbOtgWatcherTest; - -public: - static CUsbNotifManager* NewL(CUsbOtgWatcher& aOtgWatcher); - - virtual ~CUsbNotifManager(); - - void ShowNotifierL(TUid aCat, TUint aNotifId, MWaitNotifierObserver* aObserver = NULL ); - - void BlinkIndicatorL(TBool aBlinking = ETrue); - - void ShowIndicatorL(TBool aVisible = ETrue); - - void CloseAllNotifiers(); - - TBool GetUsbIconBlinking() { return iUsbIconBlinking; }; - -private: - - CUsbNotifManager(); - - void ConstructL(); - - // call back. Notifier show is over - void NotifierShowCompletedL(CUsbNotifier& aWaitNotifier, TInt aResult, TInt aFeedback); - -private: // data - TUid iCat; - TUint iNotifId; - MWaitNotifierObserver* iObserver; - - TBool iUsbIconBlinking; - TBool iUsbIconShown; - }; - -#endif // C_USBNOTIFMANAGER_H diff -r 703a2b94c06c -r dde4619868dc usbengines/usbotgwatcher/tsrc/UsbOtgWatcherTest/inc/mockcusbotgstateobserver.h --- a/usbengines/usbotgwatcher/tsrc/UsbOtgWatcherTest/inc/mockcusbotgstateobserver.h Wed Sep 15 13:20:24 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,115 +0,0 @@ -/* -* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifndef C_USBOTGSTATEOBSERVER_H -#define C_USBOTGSTATEOBSERVER_H - -#include -#include - -#include -#include - -#include "tassertbase.h" - -class MUsbOtgStateObserver - { -public: - - virtual void AIdleL() = 0; - virtual void AHostL() = 0; - virtual void APeripheralL() = 0; - virtual void AVBusErrorL() = 0; - virtual void BIdleL() = 0; - virtual void BPeripheralL() = 0; - virtual void BHostL() = 0; - }; - -/** - * Class observes OTG State property, see usbotgdefs.h - * - * @lib ?library - * @since S60 ?S60_version *** for example, S60 v3.0 - */ -class CUsbOtgStateObserver : public TAssertBase - { - friend class CtUsbOtgWatcher; - friend class CUsbOtgWatcherTest; - -public: - - /** - * Two-phased constructor. - * @param ?arg1 ?description - * @param ?arg2 ?description - */ - // ?IMPORT_C - static CUsbOtgStateObserver* NewL(); - - /** - * Destructor. - */ - virtual ~CUsbOtgStateObserver(); - - /** - * ?description - * - * @since S60 ?S60_version - * @param ?arg1 ?description - * @param ?arg2 ?description - * @return ?description - */ - // ?IMPORT_C - TUsbOtgState OtgState(); - - /** - * ?description - * - * @since S60 ?S60_version - * @param ?arg1 ?description - * @param ?arg2 ?description - * @return ?description - */ - void SubscribeL(MUsbOtgStateObserver&); - - void UnsubscribeL(MUsbOtgStateObserver&); - - void TriggerAIdleL(); - void TriggerAHostL(); - void TriggerAPeripheralL(); - void TriggerAVBusErrorL(); - void TriggerBIdleL(); - void TriggerBPeripheralL(); - void TriggerBHostL(); - -private: - - CUsbOtgStateObserver(); - - void ConstructL(); - -private: - // data - - // The observer reports state changes to own observers - // Owns - MUsbOtgStateObserver* iObserver; - - TInt iOtgState; - }; - -#endif // C_USBOTGSTATEOBSERVER_H diff -r 703a2b94c06c -r dde4619868dc usbengines/usbotgwatcher/tsrc/UsbOtgWatcherTest/inc/mockcusbtimer.h --- a/usbengines/usbotgwatcher/tsrc/UsbOtgWatcherTest/inc/mockcusbtimer.h Wed Sep 15 13:20:24 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,103 +0,0 @@ -/* -* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifndef C_USBTIMER_H -#define C_USBTIMER_H - -#include - -#include -#include - -#include "tassertbase.h" - -class CUsbTimer; - -/** - * timer ids for usbotgwatcher - */ -enum TUsbTimerId - { - EDeviceAttachmentTimer, - EInactiveTimer, - EIconBlinkingTimer, - ETooMuchPowerRequiredTimer, - EDriversNotFoundTimer - }; - - -class MUsbTimerObserver - { - friend class CtUsbOtgWatcher; - friend class CUsbOtgWatcherTest; -public: - - virtual void TimerElapsedL(TUsbTimerId aTimerId) = 0; - }; - -// Wrapper class, will report to MUsbTimerObserver once time is over -// Name CUsbTimer is given due to CTimer name already used -NONSHARABLE_CLASS(CUsbTimer) : public TAssertBase - { -public: - - /** - * Two-phased constructor - * - * @param aTimeOver pointer to a call back function. Called when time is over. - */ - static CUsbTimer* NewL(MUsbTimerObserver& aObserver, TUsbTimerId aTimerId); - - /** - * Destructor. - */ - virtual ~CUsbTimer(); - - // calls RunL after aMilliseconds - void After(TInt aMilliseconds); - - //cancels timer - void Cancel(); - - TBool IsActive(); - - void TriggerTimerElapsedL(); - -public: - - // from base class CActive - - void RunL(); - - TInt RunError( TInt /*aError*/); - - void DoCancel(); - -private: - - CUsbTimer(MUsbTimerObserver& aObserver, TUsbTimerId aTimerId); - - void ConstructL(); - -private: // data - - MUsbTimerObserver* iObserver; - TBool iActive; - TUsbTimerId iTimerId; - }; - -#endif // C_USBTIMER_H diff -r 703a2b94c06c -r dde4619868dc usbengines/usbotgwatcher/tsrc/UsbOtgWatcherTest/inc/mockcusbvbusobserver.h --- a/usbengines/usbotgwatcher/tsrc/UsbOtgWatcherTest/inc/mockcusbvbusobserver.h Wed Sep 15 13:20:24 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,115 +0,0 @@ -/* -* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifndef C_USBVBUSOBSERVER_H -#define C_USBVBUSOBSERVER_H - -#include - -#include -#include - -#include "tassertbase.h" - -class RUsb; - -class MUsbVBusObserver - { -public: - - void virtual VBusDownL() = 0; - void virtual VBusUpL() = 0; - - }; - -/** - * Class observes VBUS property - * - * @lib ?library - * @since S60 ?S60_version *** for example, S60 v3.0 - */ -class CUsbVBusObserver : public TAssertBase - { - friend class CtUsbOtgWatcher; - friend class CUsbOtgWatcherTest; - -public: - enum TState - { - EVBusDown = 0, - EVBusUp = 1 - }; - - /** - * Two-phased constructor. - * @param ?arg1 ?description - * @param ?arg2 ?description - */ - // ?IMPORT_C - static CUsbVBusObserver* NewL(); - - /** - * Destructor. - */ - virtual ~CUsbVBusObserver(); - - /** - * ?description - * - * @since S60 ?S60_version - * @param ?arg1 ?description - * @param ?arg2 ?description - * @return ?description - */ - // ?IMPORT_C - TState VBus() /* const! read comment in impl*/; - - /** - * ?description - * - * @since S60 ?S60_version - * @param ?arg1 ?description - * @param ?arg2 ?description - * @return ?description - */ - - void SubscribeL(MUsbVBusObserver&); - - void UnsubscribeL(MUsbVBusObserver&); - - void SetRUsb(RUsb* aRUsb); - - void TriggerVBusUpL(); - - void TriggerVBusDownL(); -private: - - CUsbVBusObserver(); - - void ConstructL(); - -private: - // data - RUsb* iUsb; - - // The observer reports state changes to own observers - // Own - MUsbVBusObserver* iObserver; - - }; - -#endif // C_USBVBUSOBSERVER_H diff -r 703a2b94c06c -r dde4619868dc usbengines/usbotgwatcher/tsrc/UsbOtgWatcherTest/inc/mockusbman.h --- a/usbengines/usbotgwatcher/tsrc/UsbOtgWatcherTest/inc/mockusbman.h Wed Sep 15 13:20:24 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,152 +0,0 @@ -/* -* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifndef __USBMAN_H__ -#define __USBMAN_H__ - -//#ifndef R_USB_H -//#define R_USB_H - -#include - -#include -#include - -#include "tassertbase.h" -#include - -//enum TUsbMockServiceState -// { -// EUsbServiceStateIdle = 0x01, -// EUsbServiceStateStarting = 0x02, -// EUsbServiceStateStarted = 0x04, -// EUsbServiceStateStopping = 0x08, -// EUsbServiceStateFatalError = 0x10 -// }; - -class RUsb : public TAssertBase - { - - // Request types, the interest of which can be cancelled by clients - enum TUsbReqType - { - EStart, - EStop, - ETryStart, - ETryStop - }; - -public: - static RUsb* NewL(); - - ~RUsb(); - // from base class MUsb - /** - */ - void TryStart(TInt aPersonalityId, TRequestStatus& aStatus); - - /** - */ - void StartCancel(TRequestStatus& aStatus); - - /** - */ - void TryStop(TRequestStatus& aStatus); - - /** - */ - void MessageNotification(TRequestStatus& aStatus, TInt& aMessage); - - /** - */ - void MessageNotificationCancel(); - - /** - */ - void HostEventNotification(TRequestStatus& aStatus, - TDeviceEventInformation& aDeviceInformation); - - /** - */ - void HostEventNotificationCancel(); - - /** - */ - TInt EnableFunctionDriverLoading(); - - /** - */ - void DisableFunctionDriverLoading(); - - /** - */ - TInt BusRequest(); - - /** - */ - TInt BusRespondSrp(); - - /** - */ - TInt BusClearError(); - - /** - */ - TInt BusDrop(); - - void ServiceStateNotification(TUsbServiceState &aState, TRequestStatus &aStatus); - - TInt GetCurrentPersonalityId(TInt &aPersonalityId); - - TInt CancelInterest(TUsbReqType aMessageId); // to pending op. of usb service state - - void ServiceStateNotificationCancel(); - - TInt GetOtgDescriptor(TUint aDeviceId, TOtgDescriptor& aDescriptor); - - // from base class RSessionBase - /** - */ - void Close(); - - //Mock methods - void SetTryStartError(TInt aError); - void SetBusRequestError(TInt aError); - void SetUsbServiceState(TUsbServiceState aUsbServiceState); - void SetCurrentPersonality(TInt aPersonality); - - TBool GetVBusUp(); - - TInt GetServiceState(TUsbServiceState& aState); -private: - RUsb(); - - void ConstructL(); - -private: // data - TBool iBusCleared; - TBool iBusRequested; - TBool iServiceStateNotificationRequested; - - TInt iTryStartError; - TInt iBusRequestError; - TInt iCurrentPersonalityId; - - TUsbServiceState iUsbServiceState; - }; - -#endif // __USBMAN_H__ diff -r 703a2b94c06c -r dde4619868dc usbengines/usbotgwatcher/tsrc/UsbOtgWatcherTest/inc/stifassertmacros.h --- a/usbengines/usbotgwatcher/tsrc/UsbOtgWatcherTest/inc/stifassertmacros.h Wed Sep 15 13:20:24 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,62 +0,0 @@ -/* -* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - - -#ifndef STIFASSERT_MACRO_H -#define STIFASSERT_MACRO_H - -#ifdef __STIF_ASSERT_SHARED -#undef __STIF_ASSERT_SHARED -/********************************************************************************* - * Assert Macros - *********************************************************************************/ -#define __STIF_ASSERT_SHARED( aFunction, aMessage ) \ - if(!aFunction) \ - { \ - iLog->Log( aMessage, __STIF_DBG_FILE__, __LINE__ );\ - iResult.SetResult( KErrGeneral, _L("Testcase failed"));\ - return;\ - } -#endif - -#ifdef __STIF_ASSERT_SHARED_DESC -#undef __STIF_ASSERT_SHARED_DESC -#define __STIF_ASSERT_SHARED_DESC( aFunction, aMessage, aDesc ) \ - if(!aFunction) \ - { \ - iLog->Log( aMessage, __STIF_DBG_FILE__, __LINE__ );\ - iResult.SetResult( KErrGeneral, aDesc );\ - return;\ - } \ - else \ - { \ - iResult.SetResult( KErrNone, aDesc ); \ - } -#endif - -#ifdef STIF_ASSERT_PANIC_DESC -#undef STIF_ASSERT_PANIC_DESC - -#define STIF_ASSERT_PANIC_DESC( aPanicCode, aStatement, aDescription ) \ - { \ - TestModuleIf().SetExitReason( CTestModuleIf::EPanic, aPanicCode ); \ - iResult.SetResult(KErrNone, aDescription); \ - aStatement; \ - } -#endif - -#endif diff -r 703a2b94c06c -r dde4619868dc usbengines/usbotgwatcher/tsrc/UsbOtgWatcherTest/inc/tassertbase.h --- a/usbengines/usbotgwatcher/tsrc/UsbOtgWatcherTest/inc/tassertbase.h Wed Sep 15 13:20:24 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,46 +0,0 @@ -/* -* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - - -#ifndef TASSERTBASE_H -#define TASSERTBASE_H - -#include -#include - -class TAssertBase - { -public: - // Pointer to logger - // Not own - CStifLogger * iLog; - - // Test result - TTestResult iResult; - - void SetStifLogger(CStifLogger* aLog) - { - iLog = aLog; - } - - TBool IsTestResultNoneError() - { - return iResult.iResult == KErrNone; - } - }; - -#endif //ASSERTBASE_H diff -r 703a2b94c06c -r dde4619868dc usbengines/usbotgwatcher/tsrc/UsbOtgWatcherTest/inc/testdebug.h --- a/usbengines/usbotgwatcher/tsrc/UsbOtgWatcherTest/inc/testdebug.h Wed Sep 15 13:20:24 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,66 +0,0 @@ -/* -* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifndef TESTDEBUG_H_ -#define TESTDEBUG_H_ - -// INCLUDES -#include -#include - -// CONSTANTS -_LIT8(KStifTestPrefix8, "[STIF_LOG] "); -_LIT( KStifTestPrefix, "[STIF_LOG] "); -_LIT8( KStifEntryPrefix8, ">>> %S" ); -_LIT8( KStifExitPrefix8, "<<< %S" ); - -const TInt KMaxLogLineLength = 512; -typedef TBuf8< KMaxLogLineLength > TLogBuf8; -typedef TBuf16< KMaxLogLineLength > TLogBuf16; - -// CLASS DECLARATION -NONSHARABLE_CLASS( TTestLogger ) - { -public: - static inline TLogBuf16 CreateLogBuf( TRefByValue aFmt, ... ); - static inline TLogBuf16 CreateLogBuf( TRefByValue aFmt, ... ); - static inline void Trace( CStifLogger& aLog, TLogBuf16 aLogBuf ); - }; - -// MACROS -#define TRACE( p ) {\ - TLogBuf16 buf = TTestLogger::CreateLogBuf( _L( p ) );\ - TTestLogger::Trace( *iLog, buf );\ - } -#define TRACE_INFO( p, args... ) {\ - TLogBuf16 buf = TTestLogger::CreateLogBuf( _L( p ), args );\ - TTestLogger::Trace( *iLog, buf );\ - } -#define TRACE_FUNC_ENTRY {\ - TPtrC8 ptr8( ( TUint8* ) __FUNCTION__ );\ - TLogBuf16 buf = TTestLogger::CreateLogBuf( KStifEntryPrefix8, &ptr8 );\ - TTestLogger::Trace( *iLog, buf );\ - } -#define TRACE_FUNC_EXIT {\ - TPtrC8 ptr8( ( TUint8* ) __FUNCTION__ );\ - TLogBuf16 buf = TTestLogger::CreateLogBuf( KStifExitPrefix8, &ptr8 );\ - TTestLogger::Trace( *iLog, buf );\ - } - -#include "testdebug.inl" - -#endif /* TESTDEBUG_H_ */ diff -r 703a2b94c06c -r dde4619868dc usbengines/usbotgwatcher/tsrc/UsbOtgWatcherTest/inc/testdebug.inl --- a/usbengines/usbotgwatcher/tsrc/UsbOtgWatcherTest/inc/testdebug.inl Wed Sep 15 13:20:24 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,69 +0,0 @@ -/* -* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#include - -NONSHARABLE_CLASS( TOverflowTruncate8 ) : public TDes8Overflow - { -public: - void Overflow( TDes8& /*aDes*/ ) {} - }; - -NONSHARABLE_CLASS( TOverflowTruncate16 ) : public TDes16Overflow - { -public: - void Overflow( TDes16& /*aDes*/ ) {} - }; - -TLogBuf16 TTestLogger::CreateLogBuf( TRefByValue aFmt, ... ) - { - VA_LIST list; - VA_START( list, aFmt ); - TOverflowTruncate8 overflow; - TLogBuf8 buf8; - TLogBuf16 buf16; - buf8.AppendFormatList( aFmt, list, &overflow ); - buf16.Copy( buf8 ); - return buf16; - }; - -TLogBuf16 TTestLogger::CreateLogBuf( TRefByValue aFmt, ... ) - { - VA_LIST list; - VA_START( list, aFmt ); - TOverflowTruncate16 overflow; - TLogBuf16 buf16; - buf16.AppendFormatList( aFmt, list, &overflow ); - return buf16; - }; - -void TTestLogger::Trace( CStifLogger& aLog, TLogBuf16 aLogBuf ) - { - RBuf16 buf; - RBuf16 bufStifLog; - - buf.Create( KMaxLogLineLength ); - buf.Append( KStifTestPrefix ); - buf.Append( aLogBuf ); - bufStifLog.Create( KMaxLogLineLength ); - bufStifLog.Append( aLogBuf ); - - RDebug::Print( buf ); - aLog.Log( bufStifLog ); - buf.Close(); - bufStifLog.Close(); - }; diff -r 703a2b94c06c -r dde4619868dc usbengines/usbotgwatcher/tsrc/UsbOtgWatcherTest/inc/usbmandll_stub.h --- a/usbengines/usbotgwatcher/tsrc/UsbOtgWatcherTest/inc/usbmandll_stub.h Wed Sep 15 13:20:24 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,41 +0,0 @@ -/* -* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - - -#ifndef USBMANDLL_STUB_H_ -#define USBMANDLL_STUB_H_ - -static const TUint KUsbManStubAgentDll = 0x00000033; - -enum TUsbManStubAgentApi - { - EConnect, - EGetDeviceState, - EStart, - EStop, - ETryStartAsync, - ETryStopAsync, - EDeviceStateNotification, - EGetCurrentPersonalityId, - ECancelInterest, - EDeviceStateNotificationCancel, - EServiceState, - ESetCtlSessionMode, - EGetPersonalityProperty - }; - -#endif /*USBMANDLL_STUB_H_*/ diff -r 703a2b94c06c -r dde4619868dc usbengines/usbotgwatcher/tsrc/UsbOtgWatcherTest/init/UsbOtgWatcherTest_ats.ini --- a/usbengines/usbotgwatcher/tsrc/UsbOtgWatcherTest/init/UsbOtgWatcherTest_ats.ini Wed Sep 15 13:20:24 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,232 +0,0 @@ -# Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -# All rights reserved. -# This component and the accompanying materials are made available -# under the terms of "Eclipse Public License v1.0" -# which accompanies this distribution, and is available -# at the URL "http://www.eclipse.org/legal/epl-v10.html". -# -# Initial Contributors: -# Nokia Corporation - initial contribution. -# -# Contributors: -# -# Description: Installation file for STIF -# - - -# -# This is STIF initialization file -# Comment lines start with '#'-character. -# See STIF TestFramework users guide.doc for instructions - -# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -# Set following test engine settings: -# - Set Test Reporting mode. TestReportMode's possible values are: -# + 'Summary': Summary of the tested test cases. -# + 'Environment': Hardware and software info. -# + 'TestCases': Test case report. -# + 'FullReport': Set of all above ones. -# + Example 'TestReportMode= Summary TestCases' -# -# - CreateTestReport setting controls report creation mode -# + YES, Test report will created. -# + NO, No Test report. -# -# - File path indicates the base path of the test report. -# - File name indicates the name of the test report. -# -# - File format indicates the type of the test report. -# + TXT, Test report file will be txt type, for example 'TestReport.txt'. -# + HTML, Test report will be html type, for example 'TestReport.html'. -# -# - File output indicates output source of the test report. -# + FILE, Test report logging to file. -# + RDEBUG, Test report logging to using rdebug. -# -# - File Creation Mode indicates test report overwriting if file exist. -# + OVERWRITE, Overwrites if the Test report file exist. -# + APPEND, Continue logging after the old Test report information if -# report exist. -# - Sets a device reset module's dll name(Reboot). -# + If Nokia specific reset module is not available or it is not correct one -# StifHWResetStub module may use as a template for user specific reset -# module. -# - Sets STIF test measurement disable options. e.g. pluging1 and pluging2 disablation -# DisableMeasurement= stifmeasurementplugin01 stifmeasurementplugin02 -# - -[Engine_Defaults] - -TestReportMode= FullReport # Possible values are: 'Empty', 'Summary', 'Environment', - 'TestCases' or 'FullReport' - -CreateTestReport= YES # Possible values: YES or NO - -TestReportFilePath= E:/Testing/Logs/ -TestReportFileName= UsbOtgWatcherTest_TestReport.log - -TestReportFormat= TXT # Possible values: TXT or HTML -TestReportOutput= FILE # Possible values: FILE or RDEBUG -TestReportFileCreationMode= OVERWRITE # Possible values: OVERWRITE or APPEND - -DeviceResetDllName= StifResetForNokia.dll # e.g. 'StifHWResetStub.dll' for user specific reseting - -DisableMeasurement= stifmeasurementdisablenone # Possible values are: - # 'stifmeasurementdisablenone', 'stifmeasurementdisableall' - # 'stifmeasurementplugin01', 'stifmeasurementplugin02', - # 'stifmeasurementplugin03', 'stifmeasurementplugin04', - # 'stifmeasurementplugin05' or 'stifbappeaprofiler' - -Timeout= 0 # Default timeout value for each test case. In milliseconds -UITestingSupport= YES # Possible values: YES or NO -#SeparateProcesses= YES # Possible values: YES or NO (default: NO) -[End_Defaults] -# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - - - -# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -# Module configurations start -# Modules are added between module tags -# tags. Module name is specified after ModuleName= tag, like -# ModuleName= UsbOtgWatcherTestUsbOtgWatcherTestUsbOtgWatcherTest -# Modules might have initialisation file, specified as -# IniFile= c:/testframework/YYYYYY -# Modules might have several configuration files, like -# TestCaseFile= c:/testframework/NormalCases.txt -# TestCaseFile= c:/testframework/SmokeCases.txt -# TestCaseFile= c:/testframework/ManualCases.txt - -# (TestCaseFile is synonym for old term ConfigFile) - -# Following case specifies demo module settings. Demo module -# does not read any settings from file, so tags -# IniFile and TestCaseFile are not used. -# In the simplest case it is enough to specify only the -# name of the test module when adding new test module - -[New_Module] -ModuleName= TestScripter -TestCaseFile= E:/testing/conf/UsbOtgWatcherTest.cfg -[End_Module] - - -# Load testmoduleUsbOtgWatcherTest, optionally with initialization file and/or test case files -#[New_Module] -#ModuleName= testmodulexxx - -#TestModuleUsbOtgWatcherTest used initialization file -#IniFile= c:/testframework/init.txt - -#TestModuleUsbOtgWatcherTest used configuration file(s) -#TestCaseFile= c:/testframework/testcases1.cfg -#TestCaseFile= c:/testframework/testcases2.cfg -#TestCaseFile= c:/testframework/manualtestcases.cfg - -#[End_Module] -# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - - - -# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -# Set STIF logging overwrite parameters for Logger. -# Hardware and emulator environment logging path and styles can -# be configured from here to overwrite the Logger's implemented values. -# -# Settings description: -# - Indicates option for creation log directory/directories. If log directory/directories -# is/are not created by user they will make by software. -# + YES, Create log directory/directories if not allready exist. -# + NO, Log directory/directories not created. Only created one is used. -# -# - Overwrite emulator path setting. -# + Example: If 'EmulatorBasePath= C:/LOGS/TestFramework/' and in code is defined -# Logger's path 'D://LOGS//Module//' with those definition the path -# will be 'C:/LOGS/TestFramework/LOGS/Module/' -# -# - Overwrite emulator's logging format. -# + TXT, Log file(s) will be txt type(s), for example 'Module.txt'. -# + HTML, Log file(s) will be html type(s), for example 'Module.html'. -# -# - Overwrited emulator logging output source. -# + FILE, Logging to file(s). -# + RDEBUG, Logging to using rdebug(s). -# -# - Overwrite hardware path setting (Same description as above in emulator path). -# - Overwrite hardware's logging format(Same description as above in emulator format). -# - Overwrite hardware's logging output source(Same description as above in emulator output). -# -# - File Creation Mode indicates file overwriting if file exist. -# + OVERWRITE, Overwrites if file(s) exist. -# + APPEND, Continue logging after the old logging information if file(s) exist. -# -# - Will thread id include to the log filename. -# + YES, Thread id to log file(s) name, Example filename 'Module_b9.txt'. -# + NO, No thread id to log file(s), Example filename 'Module.txt'. -# -# - Will time stamps include the to log file. -# + YES, Time stamp added to each line in log file(s). Time stamp is -# for example'12.Nov.2003 115958 LOGGING INFO' -# + NO, No time stamp(s). -# -# - Will line breaks include to the log file. -# + YES, Each logging event includes line break and next log event is in own line. -# + NO, No line break(s). -# -# - Will event ranking include to the log file. -# + YES, Event ranking number added to each line in log file(s). Ranking number -# depends on environment's tics, for example(includes time stamp also) -# '012 12.Nov.2003 115958 LOGGING INFO' -# + NO, No event ranking. -# -# - Will write log file in unicode format. -# + YES, Log file will be written in unicode format -# + NO, Log will be written as normal, not unicode, file. -# - -[Logger_Defaults] - -#NOTE: If you want to set Logger using next setting(s) remove comment(s)'#' -#NOTE: TestEngine and TestServer logging settings cannot change here - -CreateLogDirectories= YES # Possible values: YES or NO - -#EmulatorBasePath= C:/LOGS/TestFramework/ -#EmulatorFormat= HTML # Possible values: TXT or HTML -#EmulatorOutput= FILE # Possible values: FILE or RDEBUG - -#HardwareBasePath= D:/LOGS/TestFramework/ -#HardwareFormat= HTML # Possible values: TXT or HTML -#HardwareOutput= FILE # Possible values: FILE or RDEBUG - -#FileCreationMode= OVERWRITE # Possible values: OVERWRITE or APPEND - -#ThreadIdToLogFile= YES # Possible values: YES or NO -#WithTimeStamp= YES # Possible values: YES or NO -#WithLineBreak= YES # Possible values: YES or NO -#WithEventRanking= YES # Possible values: YES or NO - -#FileUnicode= YES # Possible values: YES or NO -#AddTestCaseTitle= YES # Possible values: YES or NO -[End_Logger_Defaults] -# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - - - -# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -# Set filters to be used by ConsoleUI. -# If you want to use filter with ConsoleUI, simply remove comments -# from section below and provide valid filter entries. -# Each filter line has to start with "filter= " keyword. -# Filter can contain special wildcard characters: -# * which stands for none or any literal; -# ? which stands for single character. -# Filters are not case-sensitive. - -#[Filters] -#filter= *math* -#filter= *radio* -#[End_Filters] -# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - -# End of file \ No newline at end of file diff -r 703a2b94c06c -r dde4619868dc usbengines/usbotgwatcher/tsrc/UsbOtgWatcherTest/init/UsbOtgWatcherTest_phone.ini --- a/usbengines/usbotgwatcher/tsrc/UsbOtgWatcherTest/init/UsbOtgWatcherTest_phone.ini Wed Sep 15 13:20:24 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,233 +0,0 @@ -# Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -# All rights reserved. -# This component and the accompanying materials are made available -# under the terms of "Eclipse Public License v1.0" -# which accompanies this distribution, and is available -# at the URL "http://www.eclipse.org/legal/epl-v10.html". -# -# Initial Contributors: -# Nokia Corporation - initial contribution. -# -# Contributors: -# -# Description: Installation file for STIF -# - - - -# -# This is STIF initialization file -# Comment lines start with '#'-character. -# See STIF TestFramework users guide.doc for instructions - -# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -# Set following test engine settings: -# - Set Test Reporting mode. TestReportMode's possible values are: -# + 'Summary': Summary of the tested test cases. -# + 'Environment': Hardware and software info. -# + 'TestCases': Test case report. -# + 'FullReport': Set of all above ones. -# + Example 'TestReportMode= Summary TestCases' -# -# - CreateTestReport setting controls report creation mode -# + YES, Test report will created. -# + NO, No Test report. -# -# - File path indicates the base path of the test report. -# - File name indicates the name of the test report. -# -# - File format indicates the type of the test report. -# + TXT, Test report file will be txt type, for example 'TestReport.txt'. -# + HTML, Test report will be html type, for example 'TestReport.html'. -# -# - File output indicates output source of the test report. -# + FILE, Test report logging to file. -# + RDEBUG, Test report logging to using rdebug. -# -# - File Creation Mode indicates test report overwriting if file exist. -# + OVERWRITE, Overwrites if the Test report file exist. -# + APPEND, Continue logging after the old Test report information if -# report exist. -# - Sets a device reset module's dll name(Reboot). -# + If Nokia specific reset module is not available or it is not correct one -# StifHWResetStub module may use as a template for user specific reset -# module. -# - Sets STIF test measurement disable options. e.g. pluging1 and pluging2 disablation -# DisableMeasurement= stifmeasurementplugin01 stifmeasurementplugin02 -# - -[Engine_Defaults] - -TestReportMode= FullReport # Possible values are: 'Empty', 'Summary', 'Environment', - 'TestCases' or 'FullReport' - -CreateTestReport= YES # Possible values: YES or NO - -TestReportFilePath= c:\logs\testframework\TemplateScriptUsbOtgWatcherTest\ -TestReportFileName= UsbOtgWatcherTest_TestReport.log - -TestReportFormat= TXT # Possible values: TXT or HTML -TestReportOutput= FILE # Possible values: FILE or RDEBUG -TestReportFileCreationMode= OVERWRITE # Possible values: OVERWRITE or APPEND - -DeviceResetDllName= StifResetForNokia.dll # e.g. 'StifHWResetStub.dll' for user specific reseting - -DisableMeasurement= stifmeasurementdisablenone # Possible values are: - # 'stifmeasurementdisablenone', 'stifmeasurementdisableall' - # 'stifmeasurementplugin01', 'stifmeasurementplugin02', - # 'stifmeasurementplugin03', 'stifmeasurementplugin04', - # 'stifmeasurementplugin05' or 'stifbappeaprofiler' - -Timeout= 0 # Default timeout value for each test case. In milliseconds -UITestingSupport= YES # Possible values: YES or NO -#SeparateProcesses= YES # Possible values: YES or NO (default: NO) -[End_Defaults] -# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - - - -# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -# Module configurations start -# Modules are added between module tags -# tags. Module name is specified after ModuleName= tag, like -# ModuleName= UsbOtgWatcherTestUsbOtgWatcherTestUsbOtgWatcherTest -# Modules might have initialisation file, specified as -# IniFile= c:/testframework/YYYYYY -# Modules might have several configuration files, like -# TestCaseFile= c:/testframework/NormalCases.txt -# TestCaseFile= c:/testframework/SmokeCases.txt -# TestCaseFile= c:/testframework/ManualCases.txt - -# (TestCaseFile is synonym for old term ConfigFile) - -# Following case specifies demo module settings. Demo module -# does not read any settings from file, so tags -# IniFile and TestCaseFile are not used. -# In the simplest case it is enough to specify only the -# name of the test module when adding new test module - -[New_Module] -ModuleName= TestScripter -TestCaseFile= c:\testframework\UsbOtgWatcherTest.cfg -[End_Module] - - -# Load testmoduleUsbOtgWatcherTest, optionally with initialization file and/or test case files -#[New_Module] -#ModuleName= testmodulexxx - -#TestModuleUsbOtgWatcherTest used initialization file -#IniFile= c:/testframework/init.txt - -#TestModuleUsbOtgWatcherTest used configuration file(s) -#TestCaseFile= c:/testframework/testcases1.cfg -#TestCaseFile= c:/testframework/testcases2.cfg -#TestCaseFile= c:/testframework/manualtestcases.cfg - -#[End_Module] -# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - - - -# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -# Set STIF logging overwrite parameters for Logger. -# Hardware and emulator environment logging path and styles can -# be configured from here to overwrite the Logger's implemented values. -# -# Settings description: -# - Indicates option for creation log directory/directories. If log directory/directories -# is/are not created by user they will make by software. -# + YES, Create log directory/directories if not allready exist. -# + NO, Log directory/directories not created. Only created one is used. -# -# - Overwrite emulator path setting. -# + Example: If 'EmulatorBasePath= C:/LOGS/TestFramework/' and in code is defined -# Logger's path 'D://LOGS//Module//' with those definition the path -# will be 'C:/LOGS/TestFramework/LOGS/Module/' -# -# - Overwrite emulator's logging format. -# + TXT, Log file(s) will be txt type(s), for example 'Module.txt'. -# + HTML, Log file(s) will be html type(s), for example 'Module.html'. -# -# - Overwrited emulator logging output source. -# + FILE, Logging to file(s). -# + RDEBUG, Logging to using rdebug(s). -# -# - Overwrite hardware path setting (Same description as above in emulator path). -# - Overwrite hardware's logging format(Same description as above in emulator format). -# - Overwrite hardware's logging output source(Same description as above in emulator output). -# -# - File Creation Mode indicates file overwriting if file exist. -# + OVERWRITE, Overwrites if file(s) exist. -# + APPEND, Continue logging after the old logging information if file(s) exist. -# -# - Will thread id include to the log filename. -# + YES, Thread id to log file(s) name, Example filename 'Module_b9.txt'. -# + NO, No thread id to log file(s), Example filename 'Module.txt'. -# -# - Will time stamps include the to log file. -# + YES, Time stamp added to each line in log file(s). Time stamp is -# for example'12.Nov.2003 115958 LOGGING INFO' -# + NO, No time stamp(s). -# -# - Will line breaks include to the log file. -# + YES, Each logging event includes line break and next log event is in own line. -# + NO, No line break(s). -# -# - Will event ranking include to the log file. -# + YES, Event ranking number added to each line in log file(s). Ranking number -# depends on environment's tics, for example(includes time stamp also) -# '012 12.Nov.2003 115958 LOGGING INFO' -# + NO, No event ranking. -# -# - Will write log file in unicode format. -# + YES, Log file will be written in unicode format -# + NO, Log will be written as normal, not unicode, file. -# - -[Logger_Defaults] - -#NOTE: If you want to set Logger using next setting(s) remove comment(s)'#' -#NOTE: TestEngine and TestServer logging settings cannot change here - -CreateLogDirectories= YES # Possible values: YES or NO - -#EmulatorBasePath= C:/LOGS/TestFramework/ -#EmulatorFormat= HTML # Possible values: TXT or HTML -#EmulatorOutput= FILE # Possible values: FILE or RDEBUG - -#HardwareBasePath= D:/LOGS/TestFramework/ -#HardwareFormat= HTML # Possible values: TXT or HTML -#HardwareOutput= FILE # Possible values: FILE or RDEBUG - -#FileCreationMode= OVERWRITE # Possible values: OVERWRITE or APPEND - -#ThreadIdToLogFile= YES # Possible values: YES or NO -#WithTimeStamp= YES # Possible values: YES or NO -#WithLineBreak= YES # Possible values: YES or NO -#WithEventRanking= YES # Possible values: YES or NO - -#FileUnicode= YES # Possible values: YES or NO -#AddTestCaseTitle= YES # Possible values: YES or NO -[End_Logger_Defaults] -# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - - - -# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -# Set filters to be used by ConsoleUI. -# If you want to use filter with ConsoleUI, simply remove comments -# from section below and provide valid filter entries. -# Each filter line has to start with "filter= " keyword. -# Filter can contain special wildcard characters: -# * which stands for none or any literal; -# ? which stands for single character. -# Filters are not case-sensitive. - -#[Filters] -#filter= *math* -#filter= *radio* -#[End_Filters] -# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - -# End of file \ No newline at end of file diff -r 703a2b94c06c -r dde4619868dc usbengines/usbotgwatcher/tsrc/UsbOtgWatcherTest/src/UsbOtgWatcherTest.cpp --- a/usbengines/usbotgwatcher/tsrc/UsbOtgWatcherTest/src/UsbOtgWatcherTest.cpp Wed Sep 15 13:20:24 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,329 +0,0 @@ -/* -* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -// INCLUDE FILES -#include -#include -#include "UsbOtgWatcherTest.h" -#include "testdebug.h" - -// EXTERNAL DATA STRUCTURES - -// EXTERNAL FUNCTION PROTOTYPES - -// CONSTANTS - -// MACROS - -// LOCAL CONSTANTS AND MACROS - -// MODULE DATA STRUCTURES - -// LOCAL FUNCTION PROTOTYPES - -// FORWARD DECLARATIONS - -// ============================= LOCAL FUNCTIONS =============================== - -// ----------------------------------------------------------------------------- -// ----------------------------------------------------------------------------- - -// ============================ MEMBER FUNCTIONS =============================== - -// ----------------------------------------------------------------------------- -// CUsbOtgWatcherTest::CUsbOtgWatcherTest -// C++ default constructor can NOT contain any code, that -// might leave. -// ----------------------------------------------------------------------------- -// -CtUsbOtgWatcher::CtUsbOtgWatcher( - CTestModuleIf& aTestModuleIf ): - CScriptBase( aTestModuleIf ) - { - } - -// ----------------------------------------------------------------------------- -// CtUsbOtgWatcher::ConstructL -// Symbian 2nd phase constructor can leave. -// ----------------------------------------------------------------------------- -// -void CtUsbOtgWatcher::ConstructL() - { - //Read logger settings to check whether test case name is to be - //appended to log file name. - RSettingServer settingServer; - TInt ret = settingServer.Connect(); - if(ret != KErrNone) - { - User::Leave(ret); - } - // Struct to StifLogger settigs. - TLoggerSettings loggerSettings; - // Parse StifLogger defaults from STIF initialization file. - ret = settingServer.GetLoggerSettings( loggerSettings ); - if( ret != KErrNone ) - { - User::Leave( ret ); - } - // Close Setting server session - settingServer.Close(); - - TFileName logFileName; - - if( loggerSettings.iAddTestCaseTitle ) - { - TName title; - TestModuleIf().GetTestCaseTitleL( title ); - logFileName.Format( KUsbOtgWatcherTestLogFileWithTitle, &title ); - } - else - { - logFileName.Copy( KUsbOtgWatcherTestLogFile ); - } - - iLog = CStifLogger::NewL( KUsbOtgWatcherTestLogPath, - logFileName, - CStifLogger::ETxt, - CStifLogger::EFile, - EFalse ); - - SendTestClassVersion(); - TestConstructL(); - } - -// ----------------------------------------------------------------------------- -// CtUsbOtgWatcher::NewL -// Two-phased constructor. -// ----------------------------------------------------------------------------- -// -CtUsbOtgWatcher* CtUsbOtgWatcher::NewL( - CTestModuleIf& aTestModuleIf ) - { - CtUsbOtgWatcher* self = new (ELeave) CtUsbOtgWatcher( aTestModuleIf ); - CleanupStack::PushL( self ); - self->ConstructL(); - CleanupStack::Pop(); - return self; - } - -// Destructor -CtUsbOtgWatcher::~CtUsbOtgWatcher() - { - - // Delete resources allocated from test methods - TestDelete(); - - // Delete logger - delete iLog; - - } - -// ----------------------------------------------------------------------------- -// CtUsbOtgWatcher::RunMethodL -// Run specified method. Contains also table of test mothods and their names. -// ----------------------------------------------------------------------------- - -TInt CtUsbOtgWatcher::RunMethodL( - CStifItemParser& aItem ) - { - return ExecuteTestBlock( aItem ); - } - -// ----------------------------------------------------------------------------- -// CtUsbOtgWatcher::ExecuteTestBlock -// ----------------------------------------------------------------------------- - -TInt CtUsbOtgWatcher::ExecuteTestBlock( CStifItemParser& aItem ) - { - TRACE_FUNC_ENTRY - iItem = &aItem; - TInt res; - TUsbOtgWatcherTestResult testResult = ETestCaseFailed; - - res = iItem -> GetString( _L( "tester" ), iTestBlockParams.iTestBlockName ); - if ( res != KErrNone ) - { - TRACE_INFO( "Getting test block name failed with: %d", res ) - TRACE_FUNC_EXIT - return res; - } - TRACE_INFO( "Test block name: %S", &iTestBlockParams.iTestBlockName ) - - TRACE( "Extracting test block parameters..." ) - TRAP( res, TestBlocksInfoL() ); - if ( res != KErrNone ) - { - TRACE_INFO( "Extracting parameters failed: %d", res ) - TRACE_FUNC_EXIT - return res; - } - if ( !iTestBlockFound ) - { - TRACE( "Test block not found!" ) - TRACE_FUNC_EXIT - return KErrNotFound; - } - TRACE( "Extracting parameters successful" ) - - TRAP( res, ( this ->*iTestBlockFunction )( iTestBlockParams, testResult ) ); - if ( res != KErrNone ) - { - TRACE_INFO( "ExecuteTestBlockL error: %d", res ) - TRACE_FUNC_EXIT - return res; - } - - if (ETestCasePassed != testResult) - { - return KErrGeneral; - } - TRACE( "Test block passed!" ); - TRACE_FUNC_EXIT - return KErrNone; - } - -// ----------------------------------------------------------------------------- -// CtUsbOtgWatcher::GetTestBlockParamL -// ----------------------------------------------------------------------------- - -void CtUsbOtgWatcher::GetTestBlockParamL( TGetTestBlockParamOperation aOperation, TTestBlockParamName aParamName ) - { - switch( aOperation ) - { - case eGetString: - { - switch ( aParamName ) - { - case eTestOption1: - { - User::LeaveIfError( iItem -> GetNextString( iTestBlockParams.iTestOption1 ) ); - break; - } - case eTestOption2: - { - User::LeaveIfError( iItem -> GetNextString( iTestBlockParams.iTestOption2 ) ); - break; - } - case eTestOption3: - { - User::LeaveIfError( iItem -> GetNextString( iTestBlockParams.iTestOption3 ) ); - break; - } - default: - { - User::Leave( KErrArgument ); - break; - } - } - break; - } - case eGetInt: - { - switch ( aParamName ) - { - case eTestIntOption1: - { - User::LeaveIfError( iItem -> GetNextInt( iTestBlockParams.iTestIntOption1 ) ); - break; - } - case eTestIntOption2: - { - User::LeaveIfError( iItem -> GetNextInt( iTestBlockParams.iTestIntOption2 ) ); - break; - } - case eTestIntOption3: - { - User::LeaveIfError( iItem -> GetNextInt( iTestBlockParams.iTestIntOption3 ) ); - break; - } - default: - { - User::Leave( KErrArgument ); - break; - } - } - break; - } - case eGetChar: - { - switch ( aParamName ) - { - case eTestCharOption1: - { - User::LeaveIfError( iItem -> GetNextChar( iTestBlockParams.iTestCharOption1 ) ); - break; - } - case eTestCharOption2: - { - User::LeaveIfError( iItem -> GetNextChar( iTestBlockParams.iTestCharOption2 ) ); - break; - } - case eTestCharOption3: - { - User::LeaveIfError( iItem -> GetNextChar( iTestBlockParams.iTestCharOption3 ) ); - break; - } - default: - { - User::Leave( KErrArgument ); - } - } - break; - } - default: - { - User::Leave( KErrArgument ); - } - } - } - -//----------------------------------------------------------------------------- -// CtUsbOtgWatcher::SendTestClassVersion -// Method used to send version of test class -//----------------------------------------------------------------------------- -// -void CtUsbOtgWatcher::SendTestClassVersion() - { - TVersion moduleVersion; - moduleVersion.iMajor = TEST_CLASS_VERSION_MAJOR; - moduleVersion.iMinor = TEST_CLASS_VERSION_MINOR; - moduleVersion.iBuild = TEST_CLASS_VERSION_BUILD; - - TFileName moduleName; - moduleName = _L("UsbOtgWatcherTest.dll"); - - TBool newVersionOfMethod = ETrue; - TestModuleIf().SendTestModuleVersion(moduleVersion, moduleName, newVersionOfMethod); - } - -// ========================== OTHER EXPORTED FUNCTIONS ========================= - -// ----------------------------------------------------------------------------- -// LibEntryL is a polymorphic Dll entry point. -// Returns: CScriptBase: New CScriptBase derived object -// ----------------------------------------------------------------------------- -// -EXPORT_C CScriptBase* LibEntryL( - CTestModuleIf& aTestModuleIf ) // Backpointer to STIF Test Framework - { - - return ( CScriptBase* ) CtUsbOtgWatcher::NewL( aTestModuleIf ); - - } - - -// End of File diff -r 703a2b94c06c -r dde4619868dc usbengines/usbotgwatcher/tsrc/UsbOtgWatcherTest/src/UsbOtgWatcherTestBlocks.cpp --- a/usbengines/usbotgwatcher/tsrc/UsbOtgWatcherTest/src/UsbOtgWatcherTestBlocks.cpp Wed Sep 15 13:20:24 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,674 +0,0 @@ -/* -* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -// [INCLUDE FILES] - do not remove -#include -#include -#include -#include "UsbOtgWatcherTest.h" -#include "testdebug.h" -#include "panic.h" -//#include "UsbWatcherInternalPSKeys.h" -#include "mockusbman.h" -#include "mockcusbnotifmanager.h" -#include - -// EXTERNAL DATA STRUCTURES - -// EXTERNAL FUNCTION PROTOTYPES - -// CONSTANTS - -// MACROS - -// LOCAL CONSTANTS AND MACROS - -// MODULE DATA STRUCTURES - -// LOCAL FUNCTION PROTOTYPES - -// FORWARD DECLARATIONS - -// ============================= LOCAL FUNCTIONS =============================== - -// ----------------------------------------------------------------------------- -// ----------------------------------------------------------------------------- - -// ============================ MEMBER FUNCTIONS =============================== - -// ----------------------------------------------------------------------------- -// CtUsbOtgWatcher::TestConstructL -// Construct here all test resources for test methods. -// Called from ConstructL. -// ----------------------------------------------------------------------------- - -void CtUsbOtgWatcher::TestConstructL() - { - TRACE_FUNC_ENTRY - - iStubber = CStubber::NewL(); - - TRACE_FUNC_EXIT - } - -// ----------------------------------------------------------------------------- -// CtUsbOtgWatcher::TestDelete -// Delete here all resources allocated and opened from test methods. -// Called from destructor. -// ----------------------------------------------------------------------------- - -void CtUsbOtgWatcher::TestDelete() - { - TRACE_FUNC_ENTRY - - delete iStubber; - - TRACE_FUNC_EXIT - } - -// ----------------------------------------------------------------------------- -// CtUsbOtgWatcher::TestBlocksInfoL -// Add new test block parameter entries below -// ----------------------------------------------------------------------------- - -void CtUsbOtgWatcher::TestBlocksInfoL() - { - - TESTENTRY( "ExampleTestL", CtUsbOtgWatcher::ExampleTestL ) - { - TESTPARAM( eGetString, eTestOption1 ) - TESTPARAM( eGetString, eTestOption2 ) - TESTPARAM( eGetInt, eTestIntOption1 ) - TESTPARAM( eGetChar, eTestCharOption1 ) - } - - TESTENTRY( "SetupTearDown", CtUsbOtgWatcher::SetupTearDownL ) - { - TESTPARAM( eGetString, eTestOption1 ) - } - - TESTENTRY( "PinOnTest_Success", CtUsbOtgWatcher::PinOnTest_SuccessL ) - { - TESTPARAM( eGetString, eTestOption1 ) - } - - TESTENTRY( "PinOffTest_Success", CtUsbOtgWatcher::PinOffTest_SuccessL ) - { - TESTPARAM( eGetString, eTestOption1 ) - } - - TESTENTRY( "PinOnTest_EmptyCable", CtUsbOtgWatcher::PinOnTest_EmptyCableL ) - { - TESTPARAM( eGetString, eTestOption1 ) - } - - TESTENTRY( "PinOnTest_TryStartError", CtUsbOtgWatcher::PinOnTest_TryStartErrorL ) - { - TESTPARAM( eGetString, eTestOption1 ) - } - - TESTENTRY( "PinOnTest_BusRequestError", CtUsbOtgWatcher::PinOnTest_BusRequestErrorL ) - { - TESTPARAM( eGetString, eTestOption1 ) - } - - TESTENTRY( "DeviceAttached_BadHubPostion", CtUsbOtgWatcher::DeviceAttached_BadHubPostionL ) - { - TESTPARAM( eGetString, eTestOption1 ) - } - - TESTENTRY( "DeviceAttached_TooMuchRequired", CtUsbOtgWatcher::DeviceAttached_TooMuchRequiredL ) - { - TESTPARAM( eGetString, eTestOption1 ) - } - - TESTENTRY( "DeviceAttached_SupportedDevice", CtUsbOtgWatcher::DeviceAttached_SupportedDeviceL ) - { - TESTPARAM( eGetString, eTestOption1 ) - } - - TESTENTRY( "DeviceDetached_SupportedDevice", CtUsbOtgWatcher::DeviceDetached_SupportedDeviceL ) - { - TESTPARAM( eGetString, eTestOption1 ) - } - } - -// Add test block methods implementation here -// ----------------------------------------------------------------------------- -// CtUsbOtgWatcher::ExampleTestL -// ----------------------------------------------------------------------------- - -void CtUsbOtgWatcher::ExampleTestL( TUsbOtgWatcherTestBlockParams& aParams, - TUsbOtgWatcherTestResult& aTestResult ) - { - TRACE_FUNC_ENTRY - - //iStubber -> EnqueBehavior( TApiBehavior( KUsbManStubAgentDll, ETryStartAsync, 0, 0, _L8( "stub" ) ) ); - - if ( !aParams.iTestOption1.Compare( _L( "API" ) ) ) - { - TRACE_INFO( "Api test option: %S", &aParams.iTestOption1 ) - TRACE_INFO( "Api test sub-option: %S", &aParams.iTestOption2 ) - TRACE_INFO( "Api test int option: %d", aParams.iTestIntOption1 ) - TRACE_INFO( "Api test char option: %c", TText( aParams.iTestCharOption1 ) ) - } - else if ( !aParams.iTestOption1.Compare( _L( "MODULE" ) ) ) - { - TRACE_INFO( "Module test option: %S", &aParams.iTestOption1 ) - TRACE_INFO( "Module test sub-option: %S", &aParams.iTestOption2 ) - TRACE_INFO( "Module test int option: %d", aParams.iTestIntOption1 ) - TRACE_INFO( "Module test char option: %c", TText( aParams.iTestCharOption1 ) ) - } - else if ( !aParams.iTestOption1.Compare( _L( "BRANCH" ) ) ) - { - TRACE_INFO( "Branch test option: %S", &aParams.iTestOption1 ) - TRACE_INFO( "Branch test sub-option: %S", &aParams.iTestOption2 ) - TRACE_INFO( "Branch test int option: %d", aParams.iTestIntOption1 ) - TRACE_INFO( "Branch test char option: %c", TText( aParams.iTestCharOption1 ) ) - } - else - { - TRACE( "Invalid test parameter" ) - TRACE_FUNC_EXIT - User::Leave( KErrNotFound ); - } - - aTestResult = ETestCasePassed; - TRACE_FUNC_EXIT - } - - -void CtUsbOtgWatcher::SetupTearDownL( TUsbOtgWatcherTestBlockParams& aParams, - TUsbOtgWatcherTestResult& aTestResult ) - { - TRACE_FUNC_ENTRY; - - TRACE( "Create classes of the state machine" ); - SetupL(); - - TRACE( "Destroy classes of the state machine" ); - TearDown(); - - aTestResult = ETestCasePassed; - } - - -void CtUsbOtgWatcher::PinOnTest_SuccessL( TUsbOtgWatcherTestBlockParams& aParams, - TUsbOtgWatcherTestResult& aTestResult ) - { - TRACE(">>CtUsbOtgWatcher::PinOnTest_SuccessL"); - - SetupL(); - - // Idpin observer should be subscribed - STIF_ASSERT_TRUE(iWatcher->IdPinObserver()->iObserver != NULL); - - TRACE( "State machine initialized" ); - CUsbStateHostAInitiate* aInitiate = (CUsbStateHostAInitiate*)(iWatcher->State(EUsbStateHostAInitiate)); - STIF_ASSERT_NOT_NULL(aInitiate); - - STIF_ASSERT_EQUALS(CUsbVBusObserver::EVBusDown, iWatcher->VBusObserver()->VBus()); - - TRACE( "Trigger pin on" ); - iStubber -> EnqueBehavior( TApiBehavior( KUsbManStubAgentDll, EServiceState, 0, 0, _L8( "EUsbServiceIdle" ) ) ); - iStubber -> EnqueBehavior( TApiBehavior( KUsbManStubAgentDll, EGetCurrentPersonalityId, 0, 0, _L8( "UsbPersonalityIdMTP" ) ) ); - iStubber -> EnqueBehavior( TApiBehavior( KUsbManStubAgentDll, EServiceState, 0, 0, _L8( "EUsbServiceStarted" ) ) ); - iStubber -> EnqueBehavior( TApiBehavior( KUsbManStubAgentDll, EServiceState, 0, 0, _L8( "EUsbServiceStarted" ) ) ); - iStubber -> EnqueBehavior( TApiBehavior( KUsbManStubAgentDll, EGetCurrentPersonalityId, 0, 0, _L8( "UsbPersonalityIdMTP" ) ) ); -// iStubber -> EnqueBehavior( TApiBehavior( KUsbManStubAgentDll, EServiceState, 0, 0, _L8( "EUsbServiceStarted" ) ) ); - - STIF_ASSERT_NOT_LEAVES(iWatcher->IdPinObserver()->TriggerPinOnL()); - TRACE_INFO("Status iWatcher->iUsbServiceControl->iStatus: %d",iWatcher->iUsbServiceControl->iStatus.Int()); - - iWatcher->iUsbServiceControl->RunL(); - - TRACE_INFO("iWatcher->IdPinObserver()->IsTestResultNoneError(): %d", iWatcher->IdPinObserver()->IsTestResultNoneError() ? 1 : 0 ); - STIF_ASSERT_TRUE(iWatcher->IdPinObserver()->IsTestResultNoneError()); - - TRACE_INFO("iWatcher->VBusObserver()->iObserver: %d", iWatcher->VBusObserver()->iObserver ? 1 : 0 ); - STIF_ASSERT_TRUE(iWatcher->VBusObserver()->iObserver != NULL); - - TRACE_INFO("iWatcher->OtgStateObserver()->iObserver: %d", iWatcher->OtgStateObserver()->iObserver ? 1 : 0 ); - STIF_ASSERT_TRUE(iWatcher->OtgStateObserver()->iObserver != NULL); - - TRACE_INFO("iWatcher->BusActivityObserver()->iObserver: %d", iWatcher->BusActivityObserver()->iObserver ? 1 : 0 ); - STIF_ASSERT_TRUE(iWatcher->BusActivityObserver()->iObserver != NULL); - - TRACE_INFO("iWatcher->HostEventNotificationObserver()->iObserver: %d", iWatcher->HostEventNotificationObserver()->iObserver ? 1 : 0 ); - STIF_ASSERT_TRUE(iWatcher->HostEventNotificationObserver()->iObserver != NULL); - - TRACE_INFO("iWatcher->MessageNotificationObserver()->iObserver: %d", iWatcher->MessageNotificationObserver()->iObserver ? 1 : 0 ); - STIF_ASSERT_TRUE(iWatcher->MessageNotificationObserver()->iObserver != NULL); - - TRACE_INFO("CUsbVBusObserver::EVBusUp == iWatcher->VBusObserver()->VBus(): %d", CUsbVBusObserver::EVBusUp == iWatcher->VBusObserver()->VBus() ? 1 : 0 ); - STIF_ASSERT_EQUALS(CUsbVBusObserver::EVBusUp, iWatcher->VBusObserver()->VBus()); - - - TRACE( "Trigger vbus on" ); - STIF_ASSERT_NOT_LEAVES(iWatcher->VBusObserver()->TriggerVBusUpL()); - - TRACE_INFO("iWatcher->VBusObserver()->IsTestResultNoneError(): %d", iWatcher->VBusObserver()->IsTestResultNoneError() ? 1 : 0 ); - STIF_ASSERT_TRUE(iWatcher->VBusObserver()->IsTestResultNoneError()); - - STIF_ASSERT_EQUALS(CUsbVBusObserver::EVBusUp, iWatcher->VBusObserver()->VBus()); - - TRACE_INFO("iWatcher->CurrentHostState() == iWatcher->iStates[EUsbStateHostAInitiate]: %d", iWatcher->CurrentHostState() == iWatcher->iStates[EUsbStateHostAInitiate] ? 1 : 0 ); - STIF_ASSERT_TRUE(iWatcher->CurrentHostState() == iWatcher->iStates[EUsbStateHostAInitiate]); - - TRACE_INFO("aInitiate->iAttachmentTimer->IsActive(): %d", aInitiate->iAttachmentTimer->IsActive() ? 1 : 0 ); - STIF_ASSERT_TRUE(aInitiate->iAttachmentTimer->IsActive()); - - TRACE_INFO("CUsbVBusObserver::EVBusUp == iWatcher->VBusObserver()->VBus(): %d", CUsbVBusObserver::EVBusUp == iWatcher->VBusObserver()->VBus() ? 1 : 0 ); - STIF_ASSERT_EQUALS(CUsbVBusObserver::EVBusUp, iWatcher->VBusObserver()->VBus()); - -// iUsbMan->StartCancel(iWatcher->iUsbServiceControl->iStatus); - - TearDown(); - - aTestResult = ETestCasePassed; - - TRACE("<>CtUsbOtgWatcher::PinOffTest_SuccessL"); - SetupL(); - - // Idpin observer should be subscribed - STIF_ASSERT_TRUE(iWatcher->IdPinObserver()->iObserver != NULL); - - STIF_ASSERT_EQUALS(CUsbVBusObserver::EVBusDown, iWatcher->VBusObserver()->VBus()); - - TRACE( "Trigger pin on" ); - iStubber -> EnqueBehavior( TApiBehavior( KUsbManStubAgentDll, ETryStartAsync, 0, 0, _L8( "stub" ) ) ); - iStubber -> EnqueBehavior( TApiBehavior( KUsbManStubAgentDll, EServiceState, 0, 0, _L8( "EUsbServiceIdle" ) ) ); - iStubber -> EnqueBehavior( TApiBehavior( KUsbManStubAgentDll, EServiceState, 0, 0, _L8( "EUsbServiceStarted" ) ) ); - iStubber -> EnqueBehavior( TApiBehavior( KUsbManStubAgentDll, EServiceState, 0, 0, _L8( "EUsbServiceStarted" ) ) ); - iStubber -> EnqueBehavior( TApiBehavior( KUsbManStubAgentDll, EGetCurrentPersonalityId, 0, 0, _L8( "UsbPersonalityIdMTP" ) ) ); - iStubber -> EnqueBehavior( TApiBehavior( KUsbManStubAgentDll, EGetCurrentPersonalityId, 0, 0, _L8( "UsbPersonalityIdMTP" ) ) ); -// iStubber -> EnqueBehavior( TApiBehavior( KUsbManStubAgentDll, EServiceState, 0, 0, _L8( "EUsbServiceStarted" ) ) ); - iWatcher->IdPinObserver()->TriggerPinOnL(); - iWatcher->iUsbServiceControl->RunL(); - - TRACE( "Trigger vbus on" ); - iWatcher->VBusObserver()->TriggerVBusUpL(); - - STIF_ASSERT_TRUE(iWatcher->CurrentHostState() == iWatcher->iStates[EUsbStateHostAInitiate]); - STIF_ASSERT_EQUALS(CUsbVBusObserver::EVBusUp, iWatcher->VBusObserver()->VBus()); -// iUsbMan->StartCancel(iWatcher->iUsbServiceControl->iStatus); - - TRACE( "Trigger vbus off" ); - iWatcher->IdPinObserver()->TriggerPinOffL(); - iWatcher->iUsbServiceControl->RunL(); - - STIF_ASSERT_TRUE(iWatcher->CurrentHostState() != NULL); - - STIF_ASSERT_TRUE(iWatcher->CurrentHostState() != iWatcher->iStates[EUsbStateHostAInitiate]); - STIF_ASSERT_TRUE(iWatcher->VBusObserver()->IsTestResultNoneError()); - STIF_ASSERT_TRUE(iWatcher->IdPinObserver()->IsTestResultNoneError()); - STIF_ASSERT_TRUE(iWatcher->VBusObserver()->iObserver != NULL); - STIF_ASSERT_TRUE(iWatcher->OtgStateObserver()->iObserver != NULL); - STIF_ASSERT_TRUE(iWatcher->BusActivityObserver()->iObserver != NULL); - STIF_ASSERT_TRUE(iWatcher->HostEventNotificationObserver()->iObserver != NULL); - STIF_ASSERT_TRUE(iWatcher->MessageNotificationObserver()->iObserver != NULL); - -// iUsbMan->StartCancel(iWatcher->iUsbServiceControl->iStatus); - TearDown(); - - aTestResult = ETestCasePassed; - - TRACE("<>CtUsbOtgWatcher::PinOnTest_EmptyCable"); - SetupL(); - - TRACE("State machine initialized"); - CUsbStateHostAInitiate* aInitiate = (CUsbStateHostAInitiate*)(iWatcher->State(EUsbStateHostAInitiate)); - - TRACE( "Trigger pin on" ); - iStubber -> EnqueBehavior( TApiBehavior( KUsbManStubAgentDll, ETryStartAsync, 0, 0, _L8( "stub" ) ) ); - iStubber -> EnqueBehavior( TApiBehavior( KUsbManStubAgentDll, EServiceState, 0, 0, _L8( "EUsbServiceStarted" ) ) ); - iStubber -> EnqueBehavior( TApiBehavior( KUsbManStubAgentDll, EServiceState, 0, 0, _L8( "EUsbServiceStarted" ) ) ); - iStubber -> EnqueBehavior( TApiBehavior( KUsbManStubAgentDll, EGetCurrentPersonalityId, 0, 0, _L8( "UsbPersonalityIdMTP" ) ) ); - iStubber -> EnqueBehavior( TApiBehavior( KUsbManStubAgentDll, EGetCurrentPersonalityId, 0, 0, _L8( "UsbPersonalityIdMTP" ) ) ); -// iStubber -> EnqueBehavior( TApiBehavior( KUsbManStubAgentDll, EServiceState, 0, 0, _L8( "EUsbServiceStarted" ) ) ); - - STIF_ASSERT_NOT_LEAVES(iWatcher->IdPinObserver()->TriggerPinOnL()); - iWatcher->iUsbServiceControl->RunL(); - - TRACE( "Trigger vbus on" ); - STIF_ASSERT_NOT_LEAVES(iWatcher->VBusObserver()->TriggerVBusUpL()); - -// STIF_ASSERT_TRUE(iWatcher->NotifManager()->GetUsbIconBlinking()); - - TRACE( "Trigger attachment timer elapsed" ); - STIF_ASSERT_NOT_LEAVES(aInitiate->iAttachmentTimer->TriggerTimerElapsedL()); - aInitiate->iAttachmentTimer->TriggerTimerElapsedL(); - STIF_ASSERT_TRUE(aInitiate->iAttachmentTimer->IsTestResultNoneError()); - - STIF_ASSERT_TRUE(iWatcher->CurrentHostState() == iWatcher->iStates[EUsbStateHostHandleDropping]); - STIF_ASSERT_TRUE(KUsbUiNotifOtgError == iWatcher->iNotifManager->iCat); - STIF_ASSERT_TRUE(EUsbOtgErrorAttachTimedOut == iWatcher->iNotifManager->iNotifId); - - STIF_ASSERT_TRUE(NULL != iWatcher->iNotifManager->iObserver); - STIF_ASSERT_FALSE(iWatcher->iNotifManager->iUsbIconBlinking); - STIF_ASSERT_FALSE(iWatcher->iNotifManager->iUsbIconShown); - - STIF_ASSERT_EQUALS(CUsbVBusObserver::EVBusDown, iWatcher->VBusObserver()->VBus()); - TearDown(); - - aTestResult = ETestCasePassed; - - TRACE("<>CtUsbOtgWatcher::PinOnTest_TryStartErrorL"); - - SetupL(); - - CUsbStateHostAInitiate* aInitiate = (CUsbStateHostAInitiate*)(iWatcher->State(EUsbStateHostAInitiate)); - STIF_ASSERT_NOT_NULL(aInitiate); - - iStubber -> EnqueBehavior( TApiBehavior( KUsbManStubAgentDll, ETryStartAsync, 0, 0, _L8( "stub" ) ) ); - iWatcher->Usb().SetTryStartError(KErrGeneral); - STIF_ASSERT_PANIC(ECanNotStartUsbServices, iWatcher->IdPinObserver()->TriggerPinOnL()); - - TestModuleIf().SetExitReason( CTestModuleIf::ENormal, KErrNone ); - - TearDown(); - - aTestResult = ETestCasePassed; - - TRACE("<>CtUsbOtgWatcher::PinOnTest_BusRequestErrorL"); - - SetupL(); - - CUsbStateHostAInitiate* aInitiate = (CUsbStateHostAInitiate*)(iWatcher->State(EUsbStateHostAInitiate)); - STIF_ASSERT_NOT_NULL(aInitiate); - - iStubber -> EnqueBehavior( TApiBehavior( KUsbManStubAgentDll, ETryStartAsync, 0, 0, _L8( "stub" ) ) ); - iWatcher->Usb().SetBusRequestError(KErrGeneral); - STIF_ASSERT_PANIC(EBusRequestError, iWatcher->IdPinObserver()->TriggerPinOnL()); - - TestModuleIf().SetExitReason( CTestModuleIf::ENormal, KErrNone ); - - TearDown(); - - aTestResult = ETestCasePassed; - - TRACE("<>CtUsbOtgWatcher::DeviceAttached_BadHubPostionL"); - SetupL(); - - iStubber -> EnqueBehavior( TApiBehavior( KUsbManStubAgentDll, ETryStartAsync, 0, 0, _L8( "stub" ) ) ); - iStubber -> EnqueBehavior( TApiBehavior( KUsbManStubAgentDll, EServiceState, 0, 0, _L8( "EUsbServiceIdle" ) ) ); - iStubber -> EnqueBehavior( TApiBehavior( KUsbManStubAgentDll, EServiceState, 0, 0, _L8( "EUsbServiceStarted" ) ) ); - iStubber -> EnqueBehavior( TApiBehavior( KUsbManStubAgentDll, EServiceState, 0, 0, _L8( "EUsbServiceStarted" ) ) ); - iStubber -> EnqueBehavior( TApiBehavior( KUsbManStubAgentDll, EGetCurrentPersonalityId, 0, 0, _L8( "UsbPersonalityIdMTP" ) ) ); - iStubber -> EnqueBehavior( TApiBehavior( KUsbManStubAgentDll, EGetCurrentPersonalityId, 0, 0, _L8( "UsbPersonalityIdMTP" ) ) ); -// iStubber -> EnqueBehavior( TApiBehavior( KUsbManStubAgentDll, EServiceState, 0, 0, _L8( "EUsbServiceStarted" ) ) ); - - TRACE( "PinOn triggered" ); - STIF_ASSERT_NOT_LEAVES(iWatcher->IdPinObserver()->TriggerPinOnL()); - iWatcher->iUsbServiceControl->RunL(); - - TRACE( "Trigger vbus on" ); - STIF_ASSERT_NOT_LEAVES(iWatcher->VBusObserver()->TriggerVBusUpL()); - - TRACE( "BadHubPosition triggered" ); - STIF_ASSERT_NOT_LEAVES(iWatcher->MessageNotificationObserver()->TriggerBadHubPositionL()); - TRACE( "BadHubPosition test result" ); - STIF_ASSERT_TRUE(iWatcher->MessageNotificationObserver()->IsTestResultNoneError()); - - TRACE( "Poscondition check" ); - STIF_ASSERT_TRUE(KUsbUiNotifOtgError == iWatcher->iNotifManager->iCat); - STIF_ASSERT_TRUE(EUsbOtgHubUnsupported == iWatcher->iNotifManager->iNotifId); - STIF_ASSERT_TRUE(NULL != iWatcher->iNotifManager->iObserver); - - STIF_ASSERT_EQUALS(CUsbVBusObserver::EVBusDown, iWatcher->VBusObserver()->VBus()); - - TearDown(); - - aTestResult = ETestCasePassed; - - TRACE("< EnqueBehavior( TApiBehavior( KUsbManStubAgentDll, ETryStartAsync, 0, 0, _L8( "stub" ) ) ); - iStubber -> EnqueBehavior( TApiBehavior( KUsbManStubAgentDll, EServiceState, 0, 0, _L8( "EUsbServiceIdle" ) ) ); - iStubber -> EnqueBehavior( TApiBehavior( KUsbManStubAgentDll, EServiceState, 0, 0, _L8( "EUsbServiceStarted" ) ) ); - iStubber -> EnqueBehavior( TApiBehavior( KUsbManStubAgentDll, EServiceState, 0, 0, _L8( "EUsbServiceStarted" ) ) ); - iStubber -> EnqueBehavior( TApiBehavior( KUsbManStubAgentDll, EGetCurrentPersonalityId, 0, 0, _L8( "UsbPersonalityIdMTP" ) ) ); - iStubber -> EnqueBehavior( TApiBehavior( KUsbManStubAgentDll, EGetCurrentPersonalityId, 0, 0, _L8( "UsbPersonalityIdMTP" ) ) ); -// iStubber -> EnqueBehavior( TApiBehavior( KUsbManStubAgentDll, EServiceState, 0, 0, _L8( "EUsbServiceStarted" ) ) ); - - TRACE( "PinOn triggered" ); - STIF_ASSERT_NOT_LEAVES(iWatcher->IdPinObserver()->TriggerPinOnL()); - iWatcher->iUsbServiceControl->RunL(); - - TRACE( "Trigger vbus on" ); - STIF_ASSERT_NOT_LEAVES(iWatcher->VBusObserver()->TriggerVBusUpL()); - -// STIF_ASSERT_TRUE(iWatcher->iNotifManager->GetUsbIconBlinking()); - TDeviceEventInformation eventInfo; - eventInfo.iEventType = EDeviceAttachment; - eventInfo.iError = KErrBadPower; - TRACE( "Trigger device attched - KErrBadPower" ); - iWatcher->HostEventNotificationObserver()->TriggerDeviceAttachedL(eventInfo); - - STIF_ASSERT_TRUE(iWatcher->CurrentHostState() == iWatcher->iStates[EUsbStateHostDelayNotAttachedHandle]); -// STIF_ASSERT_TRUE(iWatcher->CurrentHostState() == iWatcher->iStates[EUsbStateHostHandleDropping]); - - STIF_ASSERT_EQUALS(CUsbVBusObserver::EVBusUp, iWatcher->VBusObserver()->VBus()); - -// TRACE( "Trigger timer ETooMuchPowerRequiredTimer elapsed" ); -// CUsbStateHostHandle* stateHostHandle = (CUsbStateHostHandle*)iWatcher->CurrentHostState(); -// STIF_ASSERT_NOT_LEAVES( stateHostHandle->iTooMuchPowerTimer->TriggerTimerElapsedL() ); - -// STIF_ASSERT_FALSE(iWatcher->iNotifManager->iUsbIconBlinking); -// STIF_ASSERT_FALSE(iWatcher->iNotifManager->iUsbIconShown); - -// STIF_ASSERT_EQUALS(CUsbVBusObserver::EVBusDown, iWatcher->VBusObserver()->VBus()); - - TearDown(); - - aTestResult = ETestCasePassed; - - TRACE("<>CtUsbOtgWatcher::DeviceAttached_SupportedDeviceL"); - - SetupL(); - - iStubber -> EnqueBehavior( TApiBehavior( KUsbManStubAgentDll, ETryStartAsync, 0, 0, _L8( "stub" ) ) ); - iStubber -> EnqueBehavior( TApiBehavior( KUsbManStubAgentDll, EServiceState, 0, 0, _L8( "EUsbServiceIdle" ) ) ); - iStubber -> EnqueBehavior( TApiBehavior( KUsbManStubAgentDll, EServiceState, 0, 0, _L8( "EUsbServiceStarted" ) ) ); - iStubber -> EnqueBehavior( TApiBehavior( KUsbManStubAgentDll, EServiceState, 0, 0, _L8( "EUsbServiceStarted" ) ) ); - iStubber -> EnqueBehavior( TApiBehavior( KUsbManStubAgentDll, EGetCurrentPersonalityId, 0, 0, _L8( "UsbPersonalityIdMTP" ) ) ); - iStubber -> EnqueBehavior( TApiBehavior( KUsbManStubAgentDll, EGetCurrentPersonalityId, 0, 0, _L8( "UsbPersonalityIdMTP" ) ) ); -// iStubber -> EnqueBehavior( TApiBehavior( KUsbManStubAgentDll, EServiceState, 0, 0, _L8( "EUsbServiceStarted" ) ) ); - - iLog->Log(_L("PinOn triggered")); - STIF_ASSERT_NOT_LEAVES(iWatcher->IdPinObserver()->TriggerPinOnL()); - iWatcher->iUsbServiceControl->RunL(); - iLog->Log(_L("Trigger vbus on")); - STIF_ASSERT_NOT_LEAVES(iWatcher->VBusObserver()->TriggerVBusUpL()); - - TDeviceEventInformation eventInfo; - eventInfo.iEventType = EDeviceAttachment; - eventInfo.iError = 0; - iLog->Log(_L("Trigger device attached")); - iWatcher->HostEventNotificationObserver()->TriggerDeviceAttachedL(eventInfo); - - eventInfo.iEventType = EDriverLoad; - eventInfo.iError = 0; - iLog->Log(_L("Trigger device driver loaded")); - iWatcher->HostEventNotificationObserver()->TriggerDriverLoadSuccessL(eventInfo); - STIF_ASSERT_TRUE(iWatcher->CurrentHostState() == iWatcher->iStates[EUsbStateHostAHost]); - -// STIF_ASSERT_FALSE(iWatcher->iNotifManager->iUsbIconBlinking); -// -// STIF_ASSERT_TRUE(iWatcher->iNotifManager->iUsbIconShown); - - STIF_ASSERT_EQUALS(CUsbVBusObserver::EVBusUp, iWatcher->VBusObserver()->VBus()); - - TearDown(); - - aTestResult = ETestCasePassed; - - TRACE("<>CtUsbOtgWatcher::DeviceDetached_SupportedDeviceL"); - - SetupL(); - - iStubber -> EnqueBehavior( TApiBehavior( KUsbManStubAgentDll, ETryStartAsync, 0, 0, _L8( "stub" ) ) ); - iStubber -> EnqueBehavior( TApiBehavior( KUsbManStubAgentDll, EServiceState, 0, 0, _L8( "EUsbServiceIdle" ) ) ); - iStubber -> EnqueBehavior( TApiBehavior( KUsbManStubAgentDll, EServiceState, 0, 0, _L8( "EUsbServiceStarted" ) ) ); - iStubber -> EnqueBehavior( TApiBehavior( KUsbManStubAgentDll, EServiceState, 0, 0, _L8( "EUsbServiceStarted" ) ) ); - iStubber -> EnqueBehavior( TApiBehavior( KUsbManStubAgentDll, EGetCurrentPersonalityId, 0, 0, _L8( "UsbPersonalityIdMTP" ) ) ); - iStubber -> EnqueBehavior( TApiBehavior( KUsbManStubAgentDll, EGetCurrentPersonalityId, 0, 0, _L8( "UsbPersonalityIdMTP" ) ) ); -// iStubber -> EnqueBehavior( TApiBehavior( KUsbManStubAgentDll, EServiceState, 0, 0, _L8( "EUsbServiceStarted" ) ) ); - - TRACE( "PinOn triggered" ); - STIF_ASSERT_NOT_LEAVES(iWatcher->IdPinObserver()->TriggerPinOnL()); - iWatcher->iUsbServiceControl->RunL(); - TRACE( "Trigger vbus on" ); - STIF_ASSERT_NOT_LEAVES(iWatcher->VBusObserver()->TriggerVBusUpL()); - - TDeviceEventInformation eventInfo; - eventInfo.iEventType = EDeviceAttachment; - eventInfo.iError = 0; - TRACE( "Trigger device attached" ); - iWatcher->HostEventNotificationObserver()->TriggerDeviceAttachedL(eventInfo); - - eventInfo.iEventType = EDriverLoad; - eventInfo.iError = 0; - TRACE( "Trigger device driver loaded" ); - iWatcher->HostEventNotificationObserver()->TriggerDriverLoadSuccessL(eventInfo); - - eventInfo.iEventType = EDeviceDetachment; - eventInfo.iError = 0; - TRACE( "Trigger device detached" ); - iWatcher->HostEventNotificationObserver()->TriggerDeviceDetachedL(eventInfo); - - STIF_ASSERT_TRUE(iWatcher->CurrentHostState() == iWatcher->iStates[EUsbStateHostAInitiate]); - -// STIF_ASSERT_TRUE(iWatcher->iNotifManager->iUsbIconBlinking); - - STIF_ASSERT_EQUALS(CUsbVBusObserver::EVBusUp, iWatcher->VBusObserver()->VBus()); - - TearDown(); - - aTestResult = ETestCasePassed; - - TRACE("<SetUsbServiceState(EUsbServiceIdle); - - err = iUsbMan->GetServiceState(serviceState); - TRACE_INFO( "UsbMan.GetServiceState err: %d", err ); - User::LeaveIfError(err); - - TRACE_INFO( "UsbMan.GetServiceState serviceState: %d, exspected: %d", serviceState, EUsbServiceIdle ); - if(serviceState != EUsbServiceIdle) - { - TRACE("UsbMan ServiceState didn't set properly!"); - User::Leave(KErrNotFound); - } - - TRACE( "UsbOtgWatcher initialization" ); - iWatcher = CUsbOtgWatcher::NewL(*iUsbMan); - if( !iWatcher ) - { - TRACE("CUsbOtgWatcher::NewL Failed!"); - User::LeaveIfNull(iWatcher); - } - - iWatcher->VBusObserver()->SetRUsb(iUsbMan); - - TRACE_FUNC_EXIT; - } - -void CtUsbOtgWatcher::TearDown() - { - TRACE_FUNC_ENTRY; - - TRACE("delete iWatcher"); - if (iWatcher) - delete iWatcher; - - TRACE("delete iUsbMan"); - if (iUsbMan) - delete iUsbMan; - - TRACE_FUNC_EXIT; - } - -// ========================== OTHER EXPORTED FUNCTIONS ========================= -// None - -// [End of File] - Do not remove diff -r 703a2b94c06c -r dde4619868dc usbengines/usbotgwatcher/tsrc/UsbOtgWatcherTest/src/UsbOtgWatcherTest_exe.cpp --- a/usbengines/usbotgwatcher/tsrc/UsbOtgWatcherTest/src/UsbOtgWatcherTest_exe.cpp Wed Sep 15 13:20:24 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,66 +0,0 @@ -/* -* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - - - -// INCLUDE FILES -#include -#include -#include -// EXTERNAL DATA STRUCTURES - -// EXTERNAL FUNCTION PROTOTYPES - -// ================= OTHER EXPORTED FUNCTIONS ================================= - -/* -------------------------------------------------------------------------------- - - Class: - - - Method: E32Main - - Description: - - Parameters: None - - Return Values: TInt: Symbian error code - - Errors/Exceptions: None - - Status: Draft - -------------------------------------------------------------------------------- -*/ -GLDEF_C TInt E32Main() - { - _LIT( KProcessMsgStart, "New process starting" ); - RDebug::Print( KProcessMsgStart ); - - - // This starts a new session that get capabilites that is used in - // UsbOtgWatcherTest_exe.mmp file. - TInt r = StartSession(); - - _LIT( KProcessMsgEnd, "New process ends" ); - RDebug::Print( KProcessMsgEnd ); - - return r; - - } - -// End of File diff -r 703a2b94c06c -r dde4619868dc usbengines/usbotgwatcher/tsrc/UsbOtgWatcherTest/src/mockcusbbusactivityobserver.cpp --- a/usbengines/usbotgwatcher/tsrc/UsbOtgWatcherTest/src/mockcusbbusactivityobserver.cpp Wed Sep 15 13:20:24 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,104 +0,0 @@ -/* -* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#include -#include - -#include "stifassertmacros.h" - -#include "mockcusbbusactivityobserver.h" - -#include "debug.h" -#include "panic.h" - -// --------------------------------------------------------------------------- -// ?description_if_needed -// --------------------------------------------------------------------------- -// -CUsbBusActivityObserver::CUsbBusActivityObserver() : - iBusActivity(0) - { - } - -// --------------------------------------------------------------------------- -// ?description_if_needed -// --------------------------------------------------------------------------- -// -void CUsbBusActivityObserver::ConstructL() - { - } - -CUsbBusActivityObserver* CUsbBusActivityObserver::NewL() - { - LOG( "[USBOTGWATCHER]\tMockCUsbBusActivityObserver::NewL" ); - - CUsbBusActivityObserver* self = new( ELeave ) CUsbBusActivityObserver(); - CleanupStack::PushL(self); - self->ConstructL(); - CleanupStack::Pop(self); - return self; - } - -// --------------------------------------------------------------------------- -// ?description_if_needed -// --------------------------------------------------------------------------- -// -CUsbBusActivityObserver::~CUsbBusActivityObserver() - { - LOG( ( "[USBOTGWATCHER]\tMockCUsbBusActivityObserver::~CUsbBusActivityObserver" ) ); - } - -// --------------------------------------------------------------------------- -// ?description_if_needed -// --------------------------------------------------------------------------- -// -CUsbBusActivityObserver::TBusActivity CUsbBusActivityObserver::BusActivity() - { - LOG1( "[USBOTGWATCHER]\tMockCUsbBusActivityObserver::State = %d", iBusActivity); - - return (0 == iBusActivity ? EBusActive : EBusIdle); - } - -void CUsbBusActivityObserver::SubscribeL(MUsbBusActivityObserver& aObserver) - { - LOG( ("[USBOTGWATCHER]\tMockCUsbBusActivityObserver::SubscribeL")); - STIF_ASSERT_NOT_NULL(&aObserver); - - iObserver = &aObserver; - } - -void CUsbBusActivityObserver::UnsubscribeL(MUsbBusActivityObserver& aObserver) - { - LOG( ("[USBOTGWATCHER]\tMockCUsbBusActivityObserver::UnsubscribeL")); - STIF_ASSERT_NOT_NULL(&aObserver); - - iObserver = NULL; - } - -void CUsbBusActivityObserver::TriggerBusIdleL() - { - STIF_ASSERT_NOT_NULL(iObserver); - - iObserver->BusIdleL(); - } - -void CUsbBusActivityObserver::TriggerBusActiveL() - { - STIF_ASSERT_NOT_NULL(iObserver); - - iObserver->BusActiveL(); - } diff -r 703a2b94c06c -r dde4619868dc usbengines/usbotgwatcher/tsrc/UsbOtgWatcherTest/src/mockcusbhosteventnotificationobserver.cpp --- a/usbengines/usbotgwatcher/tsrc/UsbOtgWatcherTest/src/mockcusbhosteventnotificationobserver.cpp Wed Sep 15 13:20:24 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,125 +0,0 @@ -/* -* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#include -#include - -#include "stifassertmacros.h" - -#include "mockcusbhosteventnotificationobserver.h" - -#include "debug.h" -#include "panic.h" - -// --------------------------------------------------------------------------- -// ?description_if_needed -// --------------------------------------------------------------------------- -// -CUsbHostEventNotificationObserver::CUsbHostEventNotificationObserver( - RUsb* aUsb) : - iUsb(aUsb) - { - } - -// --------------------------------------------------------------------------- -// ?description_if_needed -// --------------------------------------------------------------------------- -// -void CUsbHostEventNotificationObserver::ConstructL() - { - } - -CUsbHostEventNotificationObserver* CUsbHostEventNotificationObserver::NewL( - RUsb* aUsb) - { - LOG(( "[USBOTGWATCHER]\tMockCUsbHostEventNotificationObserver::NewL" ) ); - - CUsbHostEventNotificationObserver* self = new( ELeave ) CUsbHostEventNotificationObserver(aUsb); - CleanupStack::PushL(self); - self->ConstructL(); - CleanupStack::Pop(self); - return self; - } - -// --------------------------------------------------------------------------- -// ?description_if_needed -// --------------------------------------------------------------------------- -// -CUsbHostEventNotificationObserver::~CUsbHostEventNotificationObserver() - { - LOG(( "[USBOTGWATCHER]\tMockCUsbHostEventNotificationObserver::~CUsbHostEventNotificationObserver" ) ); - } - -void CUsbHostEventNotificationObserver::SubscribeL( - MUsbHostEventNotificationObserver& aObserver) - { - LOG(("[USBOTGWATCHER]\tMockCUsbHostEventNotificationObserver::SubscribeL")); - STIF_ASSERT_NOT_NULL(&aObserver); - - iObserver = &aObserver; - } - -void CUsbHostEventNotificationObserver::UnsubscribeL( - MUsbHostEventNotificationObserver& aObserver) - { - LOG(("[USBOTGWATCHER]\tMockCUsbHostEventNotificationObserver::UnsubscribeL")); - STIF_ASSERT_NOT_NULL(&aObserver); - - iObserver = NULL; - } - -void CUsbHostEventNotificationObserver::TriggerDeviceAttachedL(TDeviceEventInformation eventInfo) - { - STIF_ASSERT_NOT_NULL(iObserver); - - //.iEventType = EDeviceAttachment - iObserver->DeviceAttachedL(eventInfo); - - } - -void CUsbHostEventNotificationObserver::TriggerDeviceDetachedL(TDeviceEventInformation eventInfo) - { - STIF_ASSERT_NOT_NULL(iObserver); - - //.iEventType = EDeviceDetachment - iObserver->DeviceDetachedL(eventInfo); - } - -void CUsbHostEventNotificationObserver::TriggerDriverLoadSuccessL(TDeviceEventInformation eventInfo) - { - STIF_ASSERT_NOT_NULL(iObserver); - - //.iEventType = EDriverLoad, .iDriverLoadStatus = EDriverLoadSuccess - iObserver->DriverLoadSuccessL(eventInfo); - } - -void CUsbHostEventNotificationObserver::TriggerDriverLoadPartialSuccessL(TDeviceEventInformation eventInfo) - { - STIF_ASSERT_NOT_NULL(iObserver); - - //.iEventType = EDriverLoad, .iDriverLoadStatus = EDriverLoadPartialSuccess - iObserver->DriverLoadPartialSuccessL(eventInfo); - } - -void CUsbHostEventNotificationObserver::TriggerDriverLoadFailureL(TDeviceEventInformation eventInfo) - { - STIF_ASSERT_NOT_NULL(iObserver); - - //.iEventType = EDriverLoad, .iDriverLoadStatus = EDriverLoadFailure - iObserver->DriverLoadFailureL(eventInfo); - } - diff -r 703a2b94c06c -r dde4619868dc usbengines/usbotgwatcher/tsrc/UsbOtgWatcherTest/src/mockcusbidpinobserver.cpp --- a/usbengines/usbotgwatcher/tsrc/UsbOtgWatcherTest/src/mockcusbidpinobserver.cpp Wed Sep 15 13:20:24 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,112 +0,0 @@ -/* -* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#include -#include - -#include "stifassertmacros.h" -#include "mockcusbidpinobserver.h" - -#include "debug.h" -#include "panic.h" - -// --------------------------------------------------------------------------- -// ?description_if_needed -// --------------------------------------------------------------------------- -// -CUsbIdPinObserver::CUsbIdPinObserver() : iIdPinOn(EFalse) - { - } - - -// --------------------------------------------------------------------------- -// ?description_if_needed -// --------------------------------------------------------------------------- -// -void CUsbIdPinObserver::ConstructL() - { - iWait = new ( ELeave )CActiveSchedulerWait(); - } - -CUsbIdPinObserver* CUsbIdPinObserver::NewL() - { - LOG( "[USBOTGWATCHER]\tMockCUsbIdPinObserver::NewL" ); - - CUsbIdPinObserver* self = new( ELeave ) CUsbIdPinObserver(); - CleanupStack::PushL( self ); - self->ConstructL(); - CleanupStack::Pop( self ); - return self; - } - -// --------------------------------------------------------------------------- -// ?description_if_needed -// --------------------------------------------------------------------------- -// -CUsbIdPinObserver::~CUsbIdPinObserver() - { - LOG( ( "[USBOTGWATCHER]\tMockCUsbIdPinObserver::~CUsbIdPinObserver" ) ); - } - -// --------------------------------------------------------------------------- -// ?description_if_needed -// --------------------------------------------------------------------------- -// -CUsbIdPinObserver::TState CUsbIdPinObserver::IdPin() /* const! But for some reason RProperty::Get is not const! */ - { - // not found in Symbian docs clear definition of this property. Verification is needed - return (0 == iIdPinOn? EIdPinOff : EIdPinOn); - } - - -void CUsbIdPinObserver::SubscribeL(MUsbIdPinObserver& aObserver) - { - //iLog->Log(_L("[USBOTGWATCHER] >>MockCUsbIdPinObserver::SubscribeL")); - LOG(("[USBOTGWATCHER]\tMockCUsbIdPinObserver::SubscribeL")); - STIF_ASSERT_NOT_NULL(&aObserver); - - iObserver = &aObserver; - - //iLog->Log(_L("[USBOTGWATCHER] <IdPinOnL(); - LOG(("[USBOTGWATCHER] <IdPinOffL(); - } diff -r 703a2b94c06c -r dde4619868dc usbengines/usbotgwatcher/tsrc/UsbOtgWatcherTest/src/mockcusbmessagenotificationobserver.cpp --- a/usbengines/usbotgwatcher/tsrc/UsbOtgWatcherTest/src/mockcusbmessagenotificationobserver.cpp Wed Sep 15 13:20:24 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,123 +0,0 @@ -/* -* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#include -#include - -#include "stifassertmacros.h" - -#include "mockcusbmessagenotificationobserver.h" - -#include "debug.h" -#include "panic.h" - -// --------------------------------------------------------------------------- -// ?description_if_needed -// --------------------------------------------------------------------------- -// -CUsbMessageNotificationObserver::CUsbMessageNotificationObserver(RUsb* aUsb) : - iUsb(aUsb) - { - } - -// --------------------------------------------------------------------------- -// ?description_if_needed -// --------------------------------------------------------------------------- -// -void CUsbMessageNotificationObserver::ConstructL() - { - } - -CUsbMessageNotificationObserver* CUsbMessageNotificationObserver::NewL( - RUsb* aUsb) - { - LOG( ( "[USBOTGWATCHER]\tMockCUsbMessageNotificationObserver::NewL" ) ); - - CUsbMessageNotificationObserver* self = new( ELeave ) CUsbMessageNotificationObserver(aUsb); - CleanupStack::PushL(self); - self->ConstructL(); - CleanupStack::Pop(self); - return self; - } - -// --------------------------------------------------------------------------- -// ?description_if_needed -// --------------------------------------------------------------------------- -// -CUsbMessageNotificationObserver::~CUsbMessageNotificationObserver() - { - LOG( ( "[USBOTGWATCHER]\tMockCUsbMessageNotificationObserver::~CUsbMessageNotificationObserver" ) ); - } - -void CUsbMessageNotificationObserver::SubscribeL( - MUsbMessageNotificationObserver& aObserver) - { - LOG( ("[USBOTGWATCHER]\tMockCUsbMessageNotificationObserver::SubscribeL")); - STIF_ASSERT_NOT_NULL(&aObserver); - - iObserver = &aObserver; - } - -void CUsbMessageNotificationObserver::UnsubscribeL( - MUsbMessageNotificationObserver& aObserver) - { - LOG( ("[USBOTGWATCHER]\tMockCUsbMessageNotificationObserver::UnsubscribeL")); - STIF_ASSERT_NOT_NULL(&aObserver); - - iObserver = NULL; - } - -void CUsbMessageNotificationObserver::TriggerMessageNotificationReceivedL( - TInt aMessage) - { - STIF_ASSERT_NOT_NULL(iObserver); - - // default, others - iObserver->MessageNotificationReceivedL(aMessage); - } - -void CUsbMessageNotificationObserver::TriggerBadHubPositionL() - { - STIF_ASSERT_NOT_NULL(iObserver); - - //KErrUsbBadHubPosition - iObserver->BadHubPositionL(); - } - -void CUsbMessageNotificationObserver::TriggerVBusErrorL() - { - STIF_ASSERT_NOT_NULL(iObserver); - - //KErrUsbOtgVbusError - iObserver->VBusErrorL(); - } - -void CUsbMessageNotificationObserver::TriggerSrpReceivedL() - { - STIF_ASSERT_NOT_NULL(iObserver); - - //KUsbMessageSrpReceived - iObserver->SrpReceivedL(); - } - -void CUsbMessageNotificationObserver::TriggerSessionRequestedL() - { - STIF_ASSERT_NOT_NULL(iObserver); - - //KUsbMessageRequestSession - iObserver->SessionRequestedL(); - } diff -r 703a2b94c06c -r dde4619868dc usbengines/usbotgwatcher/tsrc/UsbOtgWatcherTest/src/mockcusbnotifmanager.cpp --- a/usbengines/usbotgwatcher/tsrc/UsbOtgWatcherTest/src/mockcusbnotifmanager.cpp Wed Sep 15 13:20:24 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,113 +0,0 @@ -/* -* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#include -#include - -#include "stifassertmacros.h" - -#include "mockcusbnotifmanager.h" - -#include "debug.h" -#include "panic.h" - -// --------------------------------------------------------------------------- -// ?description_if_needed -// --------------------------------------------------------------------------- -// -CUsbNotifManager::CUsbNotifManager() : - iNotifId(INVALID_VALUE), - iObserver(INVALID_VALUE), - iUsbIconBlinking(EFalse), - iUsbIconShown(EFalse) - { - iCat.iUid = INVALID_VALUE; - } - -// --------------------------------------------------------------------------- -// ?description_if_needed -// --------------------------------------------------------------------------- -// -void CUsbNotifManager::ConstructL() - { - LOG( ( "[USBOTGWATCHER]\tMockCUsbNotifManager::ConstructL" ) ); - - } - -CUsbNotifManager* CUsbNotifManager::NewL(CUsbOtgWatcher& aOtgWatcher) - { - LOG( ( "[USBOTGWATCHER]\tMockCUsbNotifManager::NewL" ) ); - - CUsbNotifManager* self = new( ELeave ) CUsbNotifManager(); - CleanupStack::PushL( self ); - self->ConstructL(); - CleanupStack::Pop( self ); - return self; - } - -// --------------------------------------------------------------------------- -// ?description_if_needed -// --------------------------------------------------------------------------- -// -CUsbNotifManager::~CUsbNotifManager() - { - LOG( ( "[USBOTGWATCHER]\tMockCUsbNotifManager::~CUsbNotifManager" ) ); - - } - -// --------------------------------------------------------------------------- -// ?description_if_needed -// --------------------------------------------------------------------------- -// -void CUsbNotifManager::ShowNotifierL(TUid aCat, TUint aNotifId, MWaitNotifierObserver* aObserver ) -{ - LOG3 ("[USBOTGWATCHER]\tMockCUsbNotifManager::ShowNotifier aCat = 0x%X aNotifId = %d, aObserver=0x%X", aCat, aNotifId, aObserver); - iCat = aCat; - iNotifId = aNotifId; - iObserver = aObserver; -} - -void CUsbNotifManager::BlinkIndicatorL(TBool aBlinking) - { - LOG1 ( "[USBOTGWATCHER]\tMockCUsbNotifManager::BlinkIndicatorL, aBlinking=%d", aBlinking); - - iUsbIconBlinking = aBlinking; - } - -void CUsbNotifManager::ShowIndicatorL(TBool aVisible) - { - LOG1 ( "[USBOTGWATCHER]\tMockCUsbNotifManager::ShowIndicatorL, aVisible=%d", aVisible); - - iUsbIconShown = aVisible; - iUsbIconBlinking = EFalse; - } - -// --------------------------------------------------------------------------- -// --------------------------------------------------------------------------- -// -void CUsbNotifManager::NotifierShowCompletedL(CUsbNotifier& aWaitNotifier, TInt aResult, TInt aFeedback) -{ - LOG1 ( "[USBOTGWATCHER]\tMockCUsbNotifManager::NotifierShowCompleted aResult = %d", aResult); - -} - -void CUsbNotifManager::CloseAllNotifiers() -{ - LOG( ( "[USBOTGWATCHER]\tMockCUsbNotifManager::CloseAllNotifiers" ) ); - -} - diff -r 703a2b94c06c -r dde4619868dc usbengines/usbotgwatcher/tsrc/UsbOtgWatcherTest/src/mockcusbotgstateobserver.cpp --- a/usbengines/usbotgwatcher/tsrc/UsbOtgWatcherTest/src/mockcusbotgstateobserver.cpp Wed Sep 15 13:20:24 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,145 +0,0 @@ -/* -* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#include -#include - -#include "stifassertmacros.h" - -#include "mockcusbotgstateobserver.h" - -#include "debug.h" -#include "panic.h" - -// --------------------------------------------------------------------------- -// ?description_if_needed -// --------------------------------------------------------------------------- -// -CUsbOtgStateObserver::CUsbOtgStateObserver() - { - } - -// --------------------------------------------------------------------------- -// ?description_if_needed -// --------------------------------------------------------------------------- -// -void CUsbOtgStateObserver::ConstructL() - { - } - -CUsbOtgStateObserver* CUsbOtgStateObserver::NewL() - { - LOG(("[USBOTGWATCHER]\tMockCUsbOtgStateObserver::NewL" )); - - CUsbOtgStateObserver* self = new( ELeave ) CUsbOtgStateObserver(); - CleanupStack::PushL(self); - self->ConstructL(); - CleanupStack::Pop(self); - return self; - } - -// --------------------------------------------------------------------------- -// ?description_if_needed -// --------------------------------------------------------------------------- -// -CUsbOtgStateObserver::~CUsbOtgStateObserver() - { - LOG(("[USBOTGWATCHER]\tMockCUsbOtgStateObserver::~CUsbOtgStateObserver" )); - } - -// --------------------------------------------------------------------------- -// ?description_if_needed -// --------------------------------------------------------------------------- -// -TUsbOtgState CUsbOtgStateObserver::OtgState() - { - return (TUsbOtgState)iOtgState; - } - -void CUsbOtgStateObserver::SubscribeL(MUsbOtgStateObserver& aObserver) - { - LOG(("[USBOTGWATCHER]\tMockCUsbOtgStateObserver::SubscribeL")); - STIF_ASSERT_NOT_NULL(&aObserver); - - iObserver = &aObserver; - } - -void CUsbOtgStateObserver::UnsubscribeL(MUsbOtgStateObserver& aObserver) - { - LOG(("[USBOTGWATCHER]\tMockCUsbOtgStateObserver::UnsubscribeL")); - STIF_ASSERT_NOT_NULL(&aObserver); - - iObserver = NULL; - } - -//ignore EUsbOtgStateReset - -void CUsbOtgStateObserver::TriggerAIdleL() - { - STIF_ASSERT_NOT_NULL(iObserver); - - //EUsbOtgStateAIdle - iObserver->AIdleL(); - } - -void CUsbOtgStateObserver::TriggerAHostL() - { - STIF_ASSERT_NOT_NULL(iObserver); - - //EUsbOtgStateAHost - iObserver->AHostL(); - } - -void CUsbOtgStateObserver::TriggerAPeripheralL() - { - STIF_ASSERT_NOT_NULL(iObserver); - - //EUsbOtgStateAPeripheral - iObserver->APeripheralL(); - } - -void CUsbOtgStateObserver::TriggerAVBusErrorL() - { - STIF_ASSERT_NOT_NULL(iObserver); - - //EUsbOtgStateAVbusError - iObserver->AVBusErrorL(); - } - -void CUsbOtgStateObserver::TriggerBIdleL() - { - STIF_ASSERT_NOT_NULL(iObserver); - - //EUsbOtgStateBIdle - iObserver->BIdleL(); - } - -void CUsbOtgStateObserver::TriggerBPeripheralL() - { - STIF_ASSERT_NOT_NULL(iObserver); - - //EUsbOtgStateBPeripheral - iObserver->BPeripheralL(); - } - -void CUsbOtgStateObserver::TriggerBHostL() - { - STIF_ASSERT_NOT_NULL(iObserver); - - //EUsbOtgStateBHost - iObserver->BHostL(); - } diff -r 703a2b94c06c -r dde4619868dc usbengines/usbotgwatcher/tsrc/UsbOtgWatcherTest/src/mockcusbtimer.cpp --- a/usbengines/usbotgwatcher/tsrc/UsbOtgWatcherTest/src/mockcusbtimer.cpp Wed Sep 15 13:20:24 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,78 +0,0 @@ -/* -* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#include -#include - -#include "stifassertmacros.h" - -#include "mockcusbtimer.h" - -#include "debug.h" - -CUsbTimer::CUsbTimer(MUsbTimerObserver& aObserver, TUsbTimerId aTimerId) : - iObserver(&aObserver), - iActive(EFalse), - iTimerId(aTimerId) - { - } - -CUsbTimer::~CUsbTimer() - { - LOG( ( "[USBOTGWATCHER]\tMockCUsbTimer::~CUsbTimer" ) ); - } - -void CUsbTimer::ConstructL() - { - } - -CUsbTimer* CUsbTimer::NewL(MUsbTimerObserver& anObserver, TUsbTimerId aTimerId) - { - LOG( ( "[USBOTGWATCHER]\tMockCUsbTimer::NewL" ) ); - - CUsbTimer* self = new ( ELeave ) CUsbTimer(anObserver, aTimerId); - CleanupStack::PushL(self); - self->ConstructL(); - CleanupStack::Pop(); // pop self - return self; - } - -void CUsbTimer::After(TInt aMilliseconds) - { - LOG1 ( "[USBOTGWATCHER]\tMockCUsbTimer::After aMilliseconds %d", aMilliseconds); - iActive = ETrue; - } - -void CUsbTimer::Cancel() - { - } - -TBool CUsbTimer::IsActive() - { - return iActive; - } - -void CUsbTimer::TriggerTimerElapsedL() - { - //STIF_ASSERT_NOT_NULL(iObserver); - LOG1( "[USBOTGWATCHER]\tMockCUsbTimer::TriggerTimerElapsedL iObserver: %d", (iObserver ? 1 : 0 )); - LOG1( "[USBOTGWATCHER]\tMockCUsbTimer::TriggerTimerElapsedL iTimerId: %d", (iTimerId ? 1 : 0 )); - - iObserver->TimerElapsedL(iTimerId); - LOG( ( "[USBOTGWATCHER]\tMockCUsbTimer::TriggerTimerElapsedL" ) ); - iActive = EFalse; - } diff -r 703a2b94c06c -r dde4619868dc usbengines/usbotgwatcher/tsrc/UsbOtgWatcherTest/src/mockcusbvbusobserver.cpp --- a/usbengines/usbotgwatcher/tsrc/UsbOtgWatcherTest/src/mockcusbvbusobserver.cpp Wed Sep 15 13:20:24 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,115 +0,0 @@ -/* -* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#include -#include - -#include "mockusbman.h" - -#include "stifassertmacros.h" - -#include "mockcusbvbusobserver.h" - -#include "debug.h" -#include "panic.h" - -// --------------------------------------------------------------------------- -// ?description_if_needed -// --------------------------------------------------------------------------- -// -CUsbVBusObserver::CUsbVBusObserver() - { - } - - -// --------------------------------------------------------------------------- -// ?description_if_needed -// --------------------------------------------------------------------------- -// -void CUsbVBusObserver::ConstructL() - { - } - -CUsbVBusObserver* CUsbVBusObserver::NewL() - { - LOG(("[USBOTGWATCHER]\tMockCUsbVBusObserver::NewL")); - - CUsbVBusObserver* self = new( ELeave ) CUsbVBusObserver(); - CleanupStack::PushL( self ); - self->ConstructL(); - CleanupStack::Pop( self ); - return self; - } - -// --------------------------------------------------------------------------- -// ?description_if_needed -// --------------------------------------------------------------------------- -// -CUsbVBusObserver::~CUsbVBusObserver() - { - LOG(("[USBOTGWATCHER]\tMockCUsbVBusObserver::~CUsbVBusObserver")); - } - -// --------------------------------------------------------------------------- -// ?description_if_needed -// --------------------------------------------------------------------------- -// -CUsbVBusObserver::TState CUsbVBusObserver::VBus() /* const! But for some reason RProperty::Get is not const! */ - { - LOG(("[USBOTGWATCHER]\tMockCUsbVBusObserver::VBus")); - - return (iUsb->GetVBusUp() ? EVBusUp : EVBusDown); - //return (iVBusDown ? EVBusDown : EVBusUp); - } - -void CUsbVBusObserver::SubscribeL(MUsbVBusObserver& aObserver) - { - LOG(("[USBOTGWATCHER]\tMockCUsbVBusObserver::SubscribeL")); - STIF_ASSERT_NOT_NULL(&aObserver); - iObserver = &aObserver; - } - -void CUsbVBusObserver::UnsubscribeL(MUsbVBusObserver& aObserver) - { - LOG(("[USBOTGWATCHER]\tMockCUsbVBusObserver::UnsubscribeL")); - STIF_ASSERT_NOT_NULL(&aObserver); - iObserver = NULL; - } - -void CUsbVBusObserver::SetRUsb(RUsb* aRUsb) - { - iUsb = aRUsb; - } - -void CUsbVBusObserver::TriggerVBusUpL() - { - LOG(("[USBOTGWATCHER]\tMockCUsbVBusObserver::TriggerVBusUpL")); - STIF_ASSERT_NOT_NULL(iObserver); - //STIF_ASSERT_TRUE(iUsb->GetVBusUp() == EVBusUp); - //iVBusDown = EFalse; - iObserver->VBusUpL(); - } - -void CUsbVBusObserver::TriggerVBusDownL() - { - LOG(("[USBOTGWATCHER]\tMockCUsbVBusObserver::TriggerVBusDownL")); - //STIF_ASSERT_NOT_NULL(iObserver); - //STIF_ASSERT_TRUE(iUsb->GetVBusUp() == EVBusDown); - - //iVBusDown = ETrue; - iObserver->VBusDownL(); - } diff -r 703a2b94c06c -r dde4619868dc usbengines/usbotgwatcher/tsrc/UsbOtgWatcherTest/src/mockrusb.cpp --- a/usbengines/usbotgwatcher/tsrc/UsbOtgWatcherTest/src/mockrusb.cpp Wed Sep 15 13:20:24 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,388 +0,0 @@ -/* -* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#include -#include - -#include -#include -#include - -#include "mockusbman.h" -#include "stifassertmacros.h" - -#include "mockcusbvbusobserver.h" -#include "debug.h" - -// ======== MEMBER FUNCTIONS ======== - -RUsb* RUsb::NewL() - { - LOG( ( " MockRUsb::NewL" ) ); - RUsb* self = new ( ELeave ) RUsb(); - CleanupStack::PushL(self); - self->ConstructL(); - CleanupStack::Pop(); // pop self - return self; - } - -void RUsb::ConstructL() - { - - } - -// --------------------------------------------------------------------------- -// From class MUsb -// ?implementation_description -// --------------------------------------------------------------------------- -// -RUsb::RUsb() : - iBusCleared(EFalse), - iBusRequested(EFalse), - iServiceStateNotificationRequested(EFalse), - iTryStartError(KErrNone), - iBusRequestError(KErrNone), - iCurrentPersonalityId(0), - iUsbServiceState(EUsbServiceIdle) - { - LOG1 (" MockRUsb::RUsb: %d", iUsbServiceState ); - } - -RUsb::~RUsb() - { - } - -// --------------------------------------------------------------------------- -// From class MUsb -// ?implementation_description -// --------------------------------------------------------------------------- -// -void RUsb::TryStart(TInt aPersonalityId, TRequestStatus& aStatus) - { - LOG( (" MockRUsb::TryStart")); - -// CStubber* stubber = CStubber::NewL(); -// TApiBehavior beh( KUsbManStubAgentDll, ETryStartAsync, 0, 0, KNullDesC8 ); -// stubber -> InvokeApi( beh ); -// -// delete stubber; -// stubber = NULL; -// -// if ( beh.iOutput != KNullDesC8 ) -// { - TRequestStatus* status = &aStatus; - User::RequestComplete(status, iTryStartError); -// } - } - -void RUsb::StartCancel(TRequestStatus& aStatus) - { - LOG( (" MockRUsb::StartCancel")); - - TRequestStatus* status = &aStatus; - User::RequestComplete(status, iTryStartError); - - } - -// --------------------------------------------------------------------------- -// From class MUsb -// ?implementation_description -// --------------------------------------------------------------------------- -// -void RUsb::TryStop(TRequestStatus& aStatus) - { - LOG( (" MockRUsb::TryStop")); - -// CStubber* stubber = CStubber::NewL(); -// TApiBehavior beh( KUsbManStubAgentDll, ETryStartAsync, 0, 0, KNullDesC8 ); -// stubber -> InvokeApi( beh ); -// -// delete stubber; -// stubber = NULL; -// -// if ( beh.iOutput != KNullDesC8 ) -// { - TRequestStatus* status = &aStatus; - User::RequestComplete(status, KErrNone); -// } - } - -// --------------------------------------------------------------------------- -// From class MUsb -// ?implementation_description -// --------------------------------------------------------------------------- -// -void RUsb::MessageNotification(TRequestStatus& aStatus, TInt& aMessage) - { - LOG( (" MockRUsb::MessageNotification")); - - } - -// --------------------------------------------------------------------------- -// From class MUsb -// ?implementation_description -// --------------------------------------------------------------------------- -// -void RUsb::MessageNotificationCancel() - { - LOG( (" MockRUsb::MessageNotificationCancel")); - - } - -// --------------------------------------------------------------------------- -// From class MUsb -// ?implementation_description -// --------------------------------------------------------------------------- -// -void RUsb::HostEventNotification(TRequestStatus& aStatus, - TDeviceEventInformation& aDeviceInformation) - { - LOG( (" MockRUsb::HostEventNotification")); - - } - -// --------------------------------------------------------------------------- -// From class MUsb -// ?implementation_description -// --------------------------------------------------------------------------- -// -void RUsb::HostEventNotificationCancel() - { - LOG( (" MockRUsb::HostEventNotificationCancel")); - - } - -// --------------------------------------------------------------------------- -// From class MUsb -// ?implementation_description -// --------------------------------------------------------------------------- -// -TInt RUsb::EnableFunctionDriverLoading() - { - LOG( (" MockRUsb::EnableFunctionDriverLoading")); - - return KErrNone; - } - -// --------------------------------------------------------------------------- -// From class MUsb -// ?implementation_description -// --------------------------------------------------------------------------- -// -void RUsb::DisableFunctionDriverLoading() - { - LOG( (" MockRUsb::DisableFunctionDriverLoading")); - - } - -// --------------------------------------------------------------------------- -// From class MUsb -// ?implementation_description -// --------------------------------------------------------------------------- -// -TInt RUsb::BusRequest() - { - LOG1 (" MockRUsb::BusRequest, ret=%d", iBusRequestError ); - - iBusRequested = ETrue; - - return iBusRequestError; - } - -// --------------------------------------------------------------------------- -// From class MUsb -// ?implementation_description -// --------------------------------------------------------------------------- -// -TInt RUsb::BusRespondSrp() - { - LOG( (" MockRUsb::BusRespondSrp")); - - return KErrNone; - } - -// --------------------------------------------------------------------------- -// From class MUsb -// ?implementation_description -// --------------------------------------------------------------------------- -// -TInt RUsb::BusClearError() - { - LOG( (" MockRUsb::BusClearError")); - iBusCleared = ETrue; - - return KErrNone; - } - -// --------------------------------------------------------------------------- -// From class MUsb -// ?implementation_description -// --------------------------------------------------------------------------- -// -TInt RUsb::BusDrop() - { - LOG( (" MockRUsb::BusDrop")); - - iBusRequested = EFalse; - - return KErrNone; - } - -// --------------------------------------------------------------------------- -// From class RSessionBase -// ?implementation_description -// --------------------------------------------------------------------------- -// -void RUsb::Close() - { - LOG( (" MockRUsb::Close")); - - } - -void RUsb::SetTryStartError(TInt aError) - { - iTryStartError = aError; - } - -void RUsb::SetBusRequestError(TInt aError) - { - iBusRequestError = aError; - } - -void RUsb::SetUsbServiceState(TUsbServiceState aUsbServiceState) - { - LOG2 (" MockRUsb::SetUsbServiceState: %d, %d", iUsbServiceState, aUsbServiceState ); - iUsbServiceState = aUsbServiceState; - } - -TBool RUsb::GetVBusUp() - { - LOG2 (" MockRUsb::GetVBusUp, iBusRequested=%d, iBusRequestError=%d", iBusRequested , iBusRequestError); - - return iBusRequested && !iBusRequestError; - } - -TInt RUsb::GetServiceState(TUsbServiceState& aState) - { - LOG( (" MockRUsb::GetServiceState")); - aState = iUsbServiceState; - - CStubber* stubber = CStubber::NewL(); - TApiBehavior beh( KUsbManStubAgentDll, EServiceState, 0, 0, KNullDesC8 ); - stubber -> InvokeApi( beh ); - - delete stubber; - stubber = NULL; - - if ( beh.iOutput != KNullDesC8 ) - { - if ( !beh.iOutput.Compare( _L8( "EUsbServiceIdle" ) ) ) - aState = EUsbServiceIdle; - else if ( !beh.iOutput.Compare( _L8( "EUsbServiceStarting" ) ) ) - aState = EUsbServiceStarting; - else if ( !beh.iOutput.Compare( _L8( "EUsbServiceStarted" ) ) ) - aState = EUsbServiceStarted; - else if ( !beh.iOutput.Compare( _L8( "EUsbServiceStopping" ) ) ) - aState = EUsbServiceStopping; - else if ( !beh.iOutput.Compare( _L8( "EUsbServiceFatalError" ) ) ) - aState = EUsbServiceFatalError; - } - - LOG1 (" iUsbServiceState: %d", aState); - - return KErrNone; - } - -void RUsb::ServiceStateNotification(TUsbServiceState &aState, TRequestStatus &aStatus) -{ - LOG( (" MockRUsb::ServiceStateNotification")); - if(iServiceStateNotificationRequested) - { - TRequestStatus* status = &aStatus; - User::RequestComplete(status, KErrGeneral); // already requested - return; - } - - iServiceStateNotificationRequested = ETrue; - TRequestStatus* status = &aStatus; - User::RequestComplete(status, KErrNone); -} - -TInt RUsb::GetCurrentPersonalityId(TInt &aPersonalityId) -{ - LOG( (" MockRUsb::GetCurrentPersonalityId")); - - CStubber* stubber = CStubber::NewL(); - TApiBehavior beh( KUsbManStubAgentDll, EGetCurrentPersonalityId, 0, 0, KNullDesC8 ); - stubber -> InvokeApi( beh ); - - delete stubber; - stubber = NULL; - - if ( beh.iOutput != KNullDesC8 ) - { - if ( !beh.iOutput.Compare( _L8( "UsbPersonalityIdPCSuite" ) ) ) - aPersonalityId = KUsbPersonalityIdPCSuite; - else if ( !beh.iOutput.Compare( _L8( "UsbPersonalityIdMS" ) ) ) - aPersonalityId = KUsbPersonalityIdMS; - else if ( !beh.iOutput.Compare( _L8( "UsbPersonalityIdPTP" ) ) ) - aPersonalityId = KUsbPersonalityIdPTP; - else if ( !beh.iOutput.Compare( _L8( "UsbPersonalityIdMTP" ) ) ) - aPersonalityId = KUsbPersonalityIdMTP; - else if ( !beh.iOutput.Compare( _L8( "UsbPersonalityIdPCSuiteMTP" ) ) ) - aPersonalityId = KUsbPersonalityIdPCSuiteMTP; - - LOG1( " MockRUsb::GetCurrentPersonalityId iStubbedPersonalityId: %d", aPersonalityId); - } - else - aPersonalityId = iCurrentPersonalityId; - - LOG1( " MockRUsb::GetCurrentPersonalityId iCurrentPersonalityId: %d", iCurrentPersonalityId); - - return KErrNone; -} - -TInt RUsb::CancelInterest(TUsbReqType aMessageId) // to pending op. of usb service state -{ - LOG( (" MockRUsb::CancelInterest")); - iServiceStateNotificationRequested = EFalse; - return KErrNone; -} - -void RUsb::ServiceStateNotificationCancel() -{ - LOG( (" MockRUsb::ServiceStateNotificationCancel")); - iServiceStateNotificationRequested = EFalse; -} - -void RUsb::SetCurrentPersonality(TInt aPersonalityId) -{ - LOG( (" MockRUsb::SetCurrentPersonality")); - iCurrentPersonalityId = aPersonalityId; -} - -TInt RUsb::GetOtgDescriptor(TUint aDeviceId, TOtgDescriptor& aDescriptor) -{ - LOG( (" MockRUsb::GetOtgDescriptor")); - - aDescriptor.iAttributes = 1; - aDescriptor.iDeviceId = 2; - - return KErrNone; -} - -// End of File diff -r 703a2b94c06c -r dde4619868dc usbengines/usbremotepersonality/tsrc/USBRemotePersonalityTest/conf/USBRemotePersonalityTest.cfg --- a/usbengines/usbremotepersonality/tsrc/USBRemotePersonalityTest/conf/USBRemotePersonalityTest.cfg Wed Sep 15 13:20:24 2010 +0300 +++ b/usbengines/usbremotepersonality/tsrc/USBRemotePersonalityTest/conf/USBRemotePersonalityTest.cfg Wed Oct 13 15:41:46 2010 +0300 @@ -92,6 +92,14 @@ // USBRemotePersonalityTest Module Tests (... tc) +/* +[Test] +title Example Api Test +create USBRemotePersonalityTest tester +tester ExecuteModuleTest ExampleModuleTest +delete tester +[Endtest] +*/ // Add new module tests here // ... @@ -99,6 +107,14 @@ // USBRemotePersonalityTest Branch Tests (... tc) +/* +[Test] +title Example Api Test +create USBRemotePersonalityTest tester +tester ExecuteBranchTest ExampleBranchTest +delete tester +[Endtest] +*/ // Add new branch tests here // ... diff -r 703a2b94c06c -r dde4619868dc usbengines/usbremotepersonality/tsrc/USBRemotePersonalityTest/group/build_sis_ats.bat --- a/usbengines/usbremotepersonality/tsrc/USBRemotePersonalityTest/group/build_sis_ats.bat Wed Sep 15 13:20:24 2010 +0300 +++ b/usbengines/usbremotepersonality/tsrc/USBRemotePersonalityTest/group/build_sis_ats.bat Wed Oct 13 15:41:46 2010 +0300 @@ -14,10 +14,7 @@ @rem Description: @rem -call sbs -c armv5_udeb clean -call sbs -c armv5_udeb.test -call sbs -c armv5_udeb.test freeze -call sbs -c armv5_udeb.test - +call bldmake bldfiles +call abld test build armv5 call makesis USBRemotePersonalityTest_ats.pkg -call signsis USBRemotePersonalityTest_ats.sis USBRemotePersonalityTest_ats.sisx x:\rd.cer x:\rd-key.pem +call signsis USBRemotePersonalityTest_ats.sis USBRemotePersonalityTest_ats.sisx rd.cer rd-key.pem diff -r 703a2b94c06c -r dde4619868dc usbengines/usbremotepersonality/tsrc/USBRemotePersonalityTest/group/build_sis_phone.bat --- a/usbengines/usbremotepersonality/tsrc/USBRemotePersonalityTest/group/build_sis_phone.bat Wed Sep 15 13:20:24 2010 +0300 +++ b/usbengines/usbremotepersonality/tsrc/USBRemotePersonalityTest/group/build_sis_phone.bat Wed Oct 13 15:41:46 2010 +0300 @@ -14,10 +14,7 @@ @rem Description: @rem -call sbs -c armv5_udeb clean -call sbs -c armv5_udeb.test -call sbs -c armv5_udeb.test freeze -call sbs -c armv5_udeb.test - +call bldmake bldfiles +call abld test build armv5 call makesis USBRemotePersonalityTest_phone.pkg -call signsis USBRemotePersonalityTest_phone.sis USBRemotePersonalityTest_phone.sisx x:\rd.cer x:\rd-key.pem +call signsis USBRemotePersonalityTest_phone.sis USBRemotePersonalityTest_phone.sisx rd.cer rd-key.pem diff -r 703a2b94c06c -r dde4619868dc usbengines/usbwatcher/conf/usbwatcher.confml Binary file usbengines/usbwatcher/conf/usbwatcher.confml has changed diff -r 703a2b94c06c -r dde4619868dc usbengines/usbwatcher/conf/usbwatcher_101F8801.crml Binary file usbengines/usbwatcher/conf/usbwatcher_101F8801.crml has changed diff -r 703a2b94c06c -r dde4619868dc usbengines/usbwatcher/inc/cusbactivepersonalityhandler.h --- a/usbengines/usbwatcher/inc/cusbactivepersonalityhandler.h Wed Sep 15 13:20:24 2010 +0300 +++ b/usbengines/usbwatcher/inc/cusbactivepersonalityhandler.h Wed Oct 13 15:41:46 2010 +0300 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2002-2010 Nokia Corporation and/or its subsidiary(-ies). +* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). * All rights reserved. * This component and the accompanying materials are made available * under the terms of "Eclipse Public License v1.0" @@ -76,10 +76,11 @@ * * @since Series 60 3.2 * @param aPersonalityId Identification of the personality to be loaded. + * @param aAskOnConnectionSetting When this parameter is ETrue, "ask on connection" query is shown. * @param aStatus Used to complete outstanding request. */ void StartPersonality( TInt& aPersonalityId, - TRequestStatus& aStatus ); + TInt aAskOnConnectionSetting, TRequestStatus& aStatus ); /** * Stop current personality. @@ -232,6 +233,11 @@ TInt *iPersonalityId; /** + * Ask on connection is either on (1) or off (0). + */ + TInt iAskOnConnectionSetting; + + /** * When value is ETrue then serial number is written to P&S. */ TBool iSerialNumberWritten; diff -r 703a2b94c06c -r dde4619868dc usbengines/usbwatcher/inc/cusbwatcher.h --- a/usbengines/usbwatcher/inc/cusbwatcher.h Wed Sep 15 13:20:24 2010 +0300 +++ b/usbengines/usbwatcher/inc/cusbwatcher.h Wed Oct 13 15:41:46 2010 +0300 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2002-2010 Nokia Corporation and/or its subsidiary(-ies). +* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). * All rights reserved. * This component and the accompanying materials are made available * under the terms of "Eclipse Public License v1.0" @@ -248,6 +248,16 @@ */ void DoCancel(); + /** + * Check if there is an observer with ask on connection suppression. + * Check if one or more sessions have suppressed the ask on + * connection mode query. + * + * @since S60 5.0 + * @return ETrue if suppression found + */ + TBool IsAskOnConnectionSuppression(); + private: /** @@ -352,6 +362,11 @@ TInt iOldPrevPersonalityId; /** + * Current ask on connection setting + */ + TInt iAskOnConnectionSetting; + + /** * State for USB starting/stoping */ TUsbState iState; diff -r 703a2b94c06c -r dde4619868dc usbengines/usbwatcher/inc/cusbwatchersession.h --- a/usbengines/usbwatcher/inc/cusbwatchersession.h Wed Sep 15 13:20:24 2010 +0300 +++ b/usbengines/usbwatcher/inc/cusbwatchersession.h Wed Oct 13 15:41:46 2010 +0300 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2002-2010 Nokia Corporation and/or its subsidiary(-ies). +* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). * All rights reserved. * This component and the accompanying materials are made available * under the terms of "Eclipse Public License v1.0" @@ -40,6 +40,12 @@ virtual void Notify(TInt iPersonalityId, TInt aStatus); + /** + * Check if ask on connection mode query is suppressed in this session. + * From MUsbWatcherNotify + */ + virtual TBool IsAskOnConnectionSuppressed(); + protected: CUsbWatcherSession(CUsbWatcherServer* aServer); void ConstructL(); @@ -60,6 +66,14 @@ TInt SetPreviousPersonalityOnDisconnect(const RMessage2& aMessage, TBool& aComplete); + /** + * Prevent showing ask on connection mode query in this session. + * This affects to the next cable connections. The currently shown + * mode query is not closed. + * aSuppress ETrue prevents showing the mode query. + */ + void SetAskOnConnectionSuppression(TBool aSuppress); + CUsbWatcherServer* iUsbWatcherServer; RMessage2 iSetPersonalityMessage; RMessage2 iCancelSetPersonalityMessage; @@ -70,6 +84,7 @@ TBool iSetPreviousPersonalityOutstanding; TBool iCancelSetPreviousPersonalityOutstanding; + TBool iSuppressAskOnConnection; // Prevent ask on connection mode query }; #endif diff -r 703a2b94c06c -r dde4619868dc usbengines/usbwatcher/inc/musbwatchernotify.h --- a/usbengines/usbwatcher/inc/musbwatchernotify.h Wed Sep 15 13:20:24 2010 +0300 +++ b/usbengines/usbwatcher/inc/musbwatchernotify.h Wed Oct 13 15:41:46 2010 +0300 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2002-2010 Nokia Corporation and/or its subsidiary(-ies). +* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). * All rights reserved. * This component and the accompanying materials are made available * under the terms of "Eclipse Public License v1.0" @@ -24,6 +24,10 @@ public: virtual void Notify( TInt aPersonalityId, TInt aStatus ) = 0; + /** + * Check if ask on connection mode query is suppressed in this session. + */ + virtual TBool IsAskOnConnectionSuppressed() = 0; }; #endif diff -r 703a2b94c06c -r dde4619868dc usbengines/usbwatcher/src/cusbactivepersonalityhandler.cpp --- a/usbengines/usbwatcher/src/cusbactivepersonalityhandler.cpp Wed Sep 15 13:20:24 2010 +0300 +++ b/usbengines/usbwatcher/src/cusbactivepersonalityhandler.cpp Wed Oct 13 15:41:46 2010 +0300 @@ -186,17 +186,19 @@ // ---------------------------------------------------------------------------- // void CUsbActivePersonalityHandler::StartPersonality( TInt& aPersonalityId, - TRequestStatus& aStatus ) + TInt aAskOnConnectionSetting, TRequestStatus& aStatus ) { LOG_FUNC - LOG1( "PersonalityId = %d ", aPersonalityId); + LOG2( "PersonalityId = %d, AskOnConnectionSetting = %d", aPersonalityId, + aAskOnConnectionSetting ); // Remove all notes. iPersonalityNotifier->CancelAll(); iPersonalityId = &aPersonalityId; + iAskOnConnectionSetting = aAskOnConnectionSetting; aStatus = KRequestPending; iRequestStatus = &aStatus; @@ -270,9 +272,10 @@ { case EUsbDeviceStateAddress: { - if ((aStateOld != EUsbDeviceStateSuspended) && (aStateOld - != EUsbDeviceStateConfigured) && (ESwStateCharging - != CUsbGlobalSystemStateObserver::GlobalSystemState())) + if( iAskOnConnectionSetting && + ( aStateOld != EUsbDeviceStateSuspended ) && + ( aStateOld != EUsbDeviceStateConfigured ) + ) { iPersonalityParams->PersonalityNotifier().ShowQuery( KCableConnectedNotifierUid, iDummy, @@ -317,13 +320,9 @@ iQueryParams, iDummyBuf); break; case KErrDiskFull: - if (ESwStateCharging - != CUsbGlobalSystemStateObserver::GlobalSystemState()) - { - iQueryParams().iQuery = EUSBDiskFull; - iPersonalityParams->PersonalityNotifier().ShowQuery( - KQueriesNotifier, iQueryParams, iDummyBuf); - } + iQueryParams().iQuery = EUSBDiskFull; + iPersonalityParams->PersonalityNotifier().ShowQuery(KQueriesNotifier, + iQueryParams, iDummyBuf); break; default: LOG( "Ignored" ); @@ -439,6 +438,7 @@ delete iCurrentPersonalityHandler; iCurrentPersonalityHandler = NULL; + //iAskOnConnectionSetting may be have been set to off if ( iDeviceState == EUsbDeviceStateUndefined ) { iPersonalityParams->PersonalityNotifier().CancelQuery( diff -r 703a2b94c06c -r dde4619868dc usbengines/usbwatcher/src/cusbwatcher.cpp --- a/usbengines/usbwatcher/src/cusbwatcher.cpp Wed Sep 15 13:20:24 2010 +0300 +++ b/usbengines/usbwatcher/src/cusbwatcher.cpp Wed Oct 13 15:41:46 2010 +0300 @@ -254,6 +254,15 @@ } LOG1( "Starting USB personality in device state: %d", aStateNew ); iPersonalityHandler->StateChangeNotify( aStateOld, aStateNew ); + // Check AskOnConnection setting every time + if( ( iSupportedPersonalities.Count() > 1 ) && + !IsAskOnConnectionSuppression() ) + { + // read setting if there is more than one personality + iPersonalityRepository->Get( + KUsbWatcherChangeOnConnectionSetting, + iAskOnConnectionSetting ); + } if( ( iState == EUsbIdle ) && !iPersonalityChangeOngoing ) { @@ -265,6 +274,10 @@ Start(); } + // Let's turn ask on connection off after start cause we will + // issue it only when cable is connected + iAskOnConnectionSetting = KUsbWatcherChangeOnConnectionOff; + //start usbdevcon only in normal global state TInt globalState = CUsbGlobalSystemStateObserver::GlobalSystemState(); @@ -517,7 +530,17 @@ if( EUsbDeviceStateAttached == state || EUsbDeviceStatePowered == state) { LOG( "Starting USB personality" ); - Start(); + TInt err = iPersonalityRepository->Get( + KUsbWatcherChangeOnConnectionSetting, iAskOnConnectionSetting ); + if( KErrNone == err ) + { + Start(); + iAskOnConnectionSetting = KUsbWatcherChangeOnConnectionOff; + } + else + { + LOG1( "Error: CRepository::Get = %d", err ); + } } } @@ -747,7 +770,8 @@ iStarted = ETrue; // Restore personality to normal in charging mode iSetPreviousPersonalityOnDisconnect = ETrue; - iPersonalityHandler->StartPersonality( iPersonalityId, iStatus ); + iPersonalityHandler->StartPersonality( iPersonalityId, + KUsbWatcherChangeOnConnectionOff, iStatus ); } else { @@ -766,7 +790,8 @@ RProperty::Set( KPSUidUsbWatcher, KUsbWatcherSelectedPersonality, iPersonalityId ); iStarted = ETrue; - iPersonalityHandler->StartPersonality( iPersonalityId, iStatus ); + iPersonalityHandler->StartPersonality( iPersonalityId, + iAskOnConnectionSetting, iStatus ); } else { @@ -788,10 +813,8 @@ } else { - //Start may have been called because device lock was unlocking. The - //personality may be already starting, so nothing needs to be done. - LOG1( "Trying to call CUsbWatcher::Start in non-idle state %d", - iState ); + LOG( "Tryign to call CUsbWatcher::Start in non-idle state " ); + PANIC( KErrGeneral ); } } @@ -1011,6 +1034,27 @@ } // ---------------------------------------------------------------------------- +// Check if there is an observer with ask on connection suppression +// ---------------------------------------------------------------------------- +// +TBool CUsbWatcher::IsAskOnConnectionSuppression() + { + LOG_FUNC + + TBool ret( EFalse ); + for( TInt i = 0; i < iObservers.Count(); i++ ) + { + if( iObservers[i]->IsAskOnConnectionSuppressed() ) + { + ret = ETrue; + break; + } + } + LOG1( "Return = %d", ret ); + return ret; + } + +// ---------------------------------------------------------------------------- // Check current A or B device state // ---------------------------------------------------------------------------- // diff -r 703a2b94c06c -r dde4619868dc usbengines/usbwatcher/src/cusbwatchersession.cpp --- a/usbengines/usbwatcher/src/cusbwatchersession.cpp Wed Sep 15 13:20:24 2010 +0300 +++ b/usbengines/usbwatcher/src/cusbwatchersession.cpp Wed Oct 13 15:41:46 2010 +0300 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2006-2010 Nokia Corporation and/or its subsidiary(-ies). +* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). * All rights reserved. * This component and the accompanying materials are made available * under the terms of "Eclipse Public License v1.0" @@ -159,6 +159,9 @@ aComplete = EFalse; iSetPersonalityOutstanding = ETrue; + //Set force parameter to this session. + SetAskOnConnectionSuppression( aMessage.Int1() ); + iUsbWatcherServer->Watcher().SetPersonality( aMessage.Int0(), static_cast( aMessage.Int2() ) ); @@ -180,6 +183,7 @@ return KErrNone; } + SetAskOnConnectionSuppression( EFalse ); aComplete = EFalse; iCancelSetPersonalityMessage = aMessage; iCancelSetPersonalityOutstanding = ETrue; @@ -207,6 +211,7 @@ // Cancel all other pending requests iUsbWatcherServer->Watcher().Notify( KErrCancel ); + SetAskOnConnectionSuppression( EFalse ); iSetPreviousPersonalityOutstanding = ETrue; iSetPreviousPersonalityMessage = aMessage; aComplete = EFalse; @@ -234,6 +239,7 @@ // Cancel all other pending requests iUsbWatcherServer->Watcher().Notify( KErrCancel ); + SetAskOnConnectionSuppression( EFalse ); iUsbWatcherServer->Watcher().SetPreviousPersonality(); return KErrNone; @@ -271,6 +277,8 @@ { LOG_FUNC + //connected currently, so ask on connection can be enabled + SetAskOnConnectionSuppression( EFalse ); iUsbWatcherServer->Watcher().SetPreviousPersonalityOnDisconnect(); return KErrNone; @@ -315,4 +323,26 @@ } } +// ---------------------------------------------------------------------------- +// Set or clear AskOnConnection suppression +// ---------------------------------------------------------------------------- +// +void CUsbWatcherSession::SetAskOnConnectionSuppression( TBool aSuppress ) + { + LOG_FUNC + + iSuppressAskOnConnection = aSuppress; + } + +// ---------------------------------------------------------------------------- +// Check if AskOnConnection is suppressed +// ---------------------------------------------------------------------------- +// +TBool CUsbWatcherSession::IsAskOnConnectionSuppressed() + { + LOG_FUNC + + return iSuppressAskOnConnection; + } + // End of file diff -r 703a2b94c06c -r dde4619868dc usbengines/usbwatcher/tsrc/UsbWatcherTest/Bmarm/UsbWatcherTestu.def --- a/usbengines/usbwatcher/tsrc/UsbWatcherTest/Bmarm/UsbWatcherTestu.def Wed Sep 15 13:20:24 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,3 +0,0 @@ -EXPORTS - LibEntryL__FR13CTestModuleIf @ 1 NONAME R3UNUSED ; LibEntryL(CTestModuleIf &) - diff -r 703a2b94c06c -r dde4619868dc usbengines/usbwatcher/tsrc/UsbWatcherTest/Bwins/UsbWatcherTestu.def --- a/usbengines/usbwatcher/tsrc/UsbWatcherTest/Bwins/UsbWatcherTestu.def Wed Sep 15 13:20:24 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,3 +0,0 @@ -EXPORTS - ?LibEntryL@@YAPAVCScriptBase@@AAVCTestModuleIf@@@Z @ 1 NONAME ; class CScriptBase * __cdecl LibEntryL(class CTestModuleIf &) - diff -r 703a2b94c06c -r dde4619868dc usbengines/usbwatcher/tsrc/UsbWatcherTest/conf/UsbWatcherTest.cfg --- a/usbengines/usbwatcher/tsrc/UsbWatcherTest/conf/UsbWatcherTest.cfg Wed Sep 15 13:20:24 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,209 +0,0 @@ -/* -* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -//[StifSettings] -//CapsModifier= UsbWatcherTest.exe -//[EndStifSettings] - -// UsbWatcherTest Module - total 23 tc - -// UsbWatcherTest Api Tests (23 tc) - -// USB watcher initialization tests (2) - -[Test] -title Connect USB Watcher (USB Watcher Connection Test) -create UsbWatcherTest tester -tester InitializationTest SINGLE_CONN -delete tester -[Endtest] - -[Test] -title Return Server Version (USB Watcher Initialization Test) -create UsbWatcherTest tester -tester InitializationTest VERSION -delete tester -[Endtest] - -// USB personality management tests (18) - -[Test] -title Set PCSuite Personality (USB Personality Management Test) -create UsbWatcherTest tester -tester PersonalityManagementTest PCSUITE SET_PERSONALITY -delete tester -[Endtest] - -[Test] -title Set MS Personality (USB Personality Management Test) -create UsbWatcherTest tester -tester PersonalityManagementTest MS SET_PERSONALITY -delete tester -[Endtest] - - -[Test] -title Set Modem Personality (USB Personality Management Test) -create UsbWatcherTest tester -tester PersonalityManagementTest Modem SET_PERSONALITY -delete tester -[Endtest] - -[Test] -title Set MTP Personality (USB Personality Management Test) -create UsbWatcherTest tester -tester PersonalityManagementTest MTP SET_PERSONALITY -delete tester -[Endtest] - -[Test] -title Set Previous Personality (USB Personality Management Test) -create UsbWatcherTest tester -tester PersonalityManagementTest MS SET_PREVIOUS_PERSONALITY -delete tester -[Endtest] - -[Test] -title Set Previous Personality On Disconnect (USB Personality Management Test) -create UsbWatcherTest tester -tester PersonalityManagementTest MS SET_PREVIOUS_PERSONALITY_ON_DISC -delete tester -[Endtest] - -[Test] -title Set Previous Personality Sync (USB Personality Management Test) -create UsbWatcherTest tester -tester PersonalityManagementTest MS SET_PREVIOUS_PERSONALITY_SYNC -delete tester -[Endtest] - -[Test] -title Set PCSuite Personality/Cable Disconnected (USB Personality Management Test) -create UsbWatcherTest tester -tester PersonalityManagementTest PCSUITE SET_PERSONALITY_DISC -delete tester -[Endtest] - -[Test] -title Set MS Personality/Cable Disconnected (USB Personality Management Test) -create UsbWatcherTest tester -tester PersonalityManagementTest MS SET_PERSONALITY_DISC -delete tester -[Endtest] - -[Test] -title Set Modem Personality/Cable Disconnected (USB Personality Management Test) -create UsbWatcherTest tester -tester PersonalityManagementTest Modem SET_PERSONALITY_DISC -delete tester -[Endtest] - -[Test] -title Set MTP Personality/Cable Disconnected (USB Personality Management Test) -create UsbWatcherTest tester -tester PersonalityManagementTest MTP SET_PERSONALITY_DISC -delete tester -[Endtest] - -[Test] -title Cancel Set Personality/Cable Disconnected (USB Personality Management Test) -create UsbWatcherTest tester -tester PersonalityManagementTest MS CANCEL_SET_PERSONALITY_DISC -delete tester -[Endtest] - -[Test] -title Set Previous Personality/Cable Disconnected (USB Personality Management Test) -create UsbWatcherTest tester -tester PersonalityManagementTest MS SET_PREVIOUS_PERSONALITY_DISC -delete tester -[Endtest] - -[Test] -title Set Previous Personality On Disconnect/Cable Disconnected (USB Personality Management Test) -create UsbWatcherTest tester -tester PersonalityManagementTest MS SET_PREVIOUS_PERSONALITY_ON_DISC_DISC -delete tester -[Endtest] - -[Test] -title Set Previous Personality Sync/Cable Disconnected (USB Personality Management Test) -create UsbWatcherTest tester -tester PersonalityManagementTest MS SET_PREVIOUS_PERSONALITY_SYNC_DISC -delete tester -[Endtest] - -[Test] -title Cancel Set Previous Personality/Cable Disconnected (USB Personality Management Test) -create UsbWatcherTest tester -tester PersonalityManagementTest MS CANCEL_SET_PREVIOUS_PERSONALITY_DISC -delete tester -[Endtest] - -[Test] -title Set Unknown Personality (USB Personality Management Test) -create UsbWatcherTest tester -tester PersonalityManagementTest MS SET_UNKNOWN_PERSONALITY -delete tester -[Endtest] - -[Test] -title Interrupt Personality Set (USB Personality Management Test) -create UsbWatcherTest tester -tester PersonalityManagementTest MS INTERRUPT_PERSONALITY_SET -delete tester -[Endtest] - -// USB watcher branch tests (3) - -[Test] -title Set Same Personality (USB Watcher Branch Test) -create UsbWatcherTest tester -tester BranchTest SAME_PERSONALITY_SET -delete tester -[Endtest] - -[Test] -title Set Personality/Personality Switch Blocking On (USB Watcher Branch Test) -create UsbWatcherTest tester -tester BranchTest NON_BLOCKING -delete tester -[Endtest] - -[Test] -title Set Personality/Ask On Connection Not Shown(USB Watcher Branch Test) -create UsbWatcherTest tester -tester BranchTest FORCE_SWITCH -delete tester -[Endtest] - -// Add new api tests here -// ... - - -// UsbWatcherTest Module Tests (... tc) - - -// Add new module tests here -// ... - - -// UsbWatcherTest Branch Tests (... tc) - - -// Add new branch tests here -// ... diff -r 703a2b94c06c -r dde4619868dc usbengines/usbwatcher/tsrc/UsbWatcherTest/eabi/UsbWatcherTestu.def --- a/usbengines/usbwatcher/tsrc/UsbWatcherTest/eabi/UsbWatcherTestu.def Wed Sep 15 13:20:24 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,3 +0,0 @@ -EXPORTS - _Z9LibEntryLR13CTestModuleIf @ 1 NONAME - diff -r 703a2b94c06c -r dde4619868dc usbengines/usbwatcher/tsrc/UsbWatcherTest/group/UsbWatcherTest.mmp --- a/usbengines/usbwatcher/tsrc/UsbWatcherTest/group/UsbWatcherTest.mmp Wed Sep 15 13:20:24 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,69 +0,0 @@ -/* -* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - - -#if defined(__S60_) - // To get the MW_LAYER_SYSTEMINCLUDE-definition - #include -#endif - -TARGET UsbWatcherTest.dll -TARGETTYPE dll -UID 0x1000008D 0x101FB3E3 - -CAPABILITY ALL -TCB - -DEFFILE UsbWatcherTest.def - -MW_LAYER_SYSTEMINCLUDE - -//includes for stubbing -SYSTEMINCLUDE /epoc32/include/mw/stubsrv/ -SYSTEMINCLUDE /epoc32/include/mw/taf/ - -USERINCLUDE ../inc -USERINCLUDE ../../../inc -SOURCEPATH ../src - -SOURCE UsbWatcherTest.cpp -SOURCE UsbWatcherTestBlocks.cpp - -//RESOURCE resource_file -//RESOURCE resource_file2 - -//standart lib for stif testing -LIBRARY euser.lib -LIBRARY stiftestinterface.lib -LIBRARY stiftestengine.lib - -//lib for stubbing -LIBRARY apibehavior.lib -LIBRARY stubber.lib - - -//lib for component testing -//LIBRARY -LIBRARY usbman.lib -LIBRARY usbwatcher.lib -LIBRARY centralrepository.lib -LIBRARY efsrv.lib - -LANG SC - - - -// End of File diff -r 703a2b94c06c -r dde4619868dc usbengines/usbwatcher/tsrc/UsbWatcherTest/group/UsbWatcherTest_ats.pkg --- a/usbengines/usbwatcher/tsrc/UsbWatcherTest/group/UsbWatcherTest_ats.pkg Wed Sep 15 13:20:24 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,69 +0,0 @@ -; -; Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -; All rights reserved. -; This component and the accompanying materials are made available -; under the terms of "Eclipse Public License v1.0" -; which accompanies this distribution, and is available -; at the URL "http://www.eclipse.org/legal/epl-v10.html". -; -; Initial Contributors: -; Nokia Corporation - initial contribution. -; -; Contributors: -; -; Description: Installation file for STIF -; - - -; -; Installation file for STIF -; - -; Languages -&EN - -; Provide value for uid -#{"UsbWatcherTest"},(0x00000000),1,1,0,TYPE=SA - -; Series60 product id for S60 5.2 -[0x20022E6D], 0, 0, 0, {"Series60ProductID"} - -; Localised Vendor name -%{"Nokia"} - -; Unique Vendor name; -:"Nokia" - - -; Logo -; None - -; Package signature - Optional -; None - -; Start of Package body - -; Condition blocks -; None - -; Options list -; None - -; Install files -"/epoc32/release/armv5/udeb/UsbWatcherTest.dll"-"C:/Sys/Bin/UsbWatcherTest.dll" -;"/epoc32/release/armv5/udeb/UsbWatcherTest.exe"-"C:/Sys/Bin/UsbWatcherTest.exe" - -"../conf/UsbWatcherTest.cfg"-"E:/testing/conf/UsbWatcherTest.cfg" -"../init/UsbWatcherTest_ats.ini"-"E:/testing/init/UsbWatcherTest.ini" - -; Embedded SIS -; None - -; End of Package body - -; PKG dependencies -; None - -; PKG capabilities -; None - diff -r 703a2b94c06c -r dde4619868dc usbengines/usbwatcher/tsrc/UsbWatcherTest/group/UsbWatcherTest_phone.pkg --- a/usbengines/usbwatcher/tsrc/UsbWatcherTest/group/UsbWatcherTest_phone.pkg Wed Sep 15 13:20:24 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,64 +0,0 @@ - -; Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -; All rights reserved. -; This component and the accompanying materials are made available -; under the terms of "Eclipse Public License v1.0" -; which accompanies this distribution, and is available -; at the URL "http://www.eclipse.org/legal/epl-v10.html". -; -; Initial Contributors: -; Nokia Corporation - initial contribution. -; -; Contributors: -; -; Description: Installation file for STIF -; - -; Languages -&EN - -; Provide value for uid -#{"UsbWatcherTest"},(0x00000000),1,1,0,TYPE=SA - -; Series60 product id for S60 5.2 -[0x20022E6D], 0, 0, 0, {"Series60ProductID"} - -; Localised Vendor name -%{"Nokia"} - -; Unique Vendor name; -:"Nokia" - - -; Logo -; None - -; Package signature - Optional -; None - -; Start of Package body - -; Condition blocks -; None - -; Options list -; None - -; Install files -"/epoc32/release/armv5/udeb/UsbWatcherTest.dll" - "C:/Sys/Bin/UsbWatcherTest.dll" -;"/epoc32/release/armv5/udeb/UsbWatcherTest.exe" - "C:/Sys/Bin/UsbWatcherTest.exe" - -"../conf/UsbWatcherTest.cfg"-"C:/testframework/UsbWatcherTest.cfg" -"../init/UsbWatcherTest_phone.ini"-"C:/testframework/testframework.ini" - -; Embedded SIS -; None - -; End of Package body - -; PKG dependencies -; None - -; PKG capabilities -; None - diff -r 703a2b94c06c -r dde4619868dc usbengines/usbwatcher/tsrc/UsbWatcherTest/group/bld.inf --- a/usbengines/usbwatcher/tsrc/UsbWatcherTest/group/bld.inf Wed Sep 15 13:20:24 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,32 +0,0 @@ -/* -* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - - - -PRJ_PLATFORMS -DEFAULT - -PRJ_TESTEXPORTS -PRJ_EXPORTS - -PRJ_TESTMMPFILES -UsbWatcherTest.mmp - -PRJ_MMPFILES - - -// End of File diff -r 703a2b94c06c -r dde4619868dc usbengines/usbwatcher/tsrc/UsbWatcherTest/group/build_sis_ats.bat --- a/usbengines/usbwatcher/tsrc/UsbWatcherTest/group/build_sis_ats.bat Wed Sep 15 13:20:24 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,23 +0,0 @@ -@rem -@rem Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -@rem All rights reserved. -@rem This component and the accompanying materials are made available -@rem under the terms of "Eclipse Public License v1.0" -@rem which accompanies this distribution, and is available -@rem at the URL "http://www.eclipse.org/legal/epl-v10.html". -@rem -@rem Initial Contributors: -@rem Nokia Corporation - initial contribution. -@rem -@rem Contributors: -@rem -@rem Description: -@rem - -call sbs -c armv5_udeb clean -call sbs -c armv5_udeb.test -call sbs -c armv5_udeb.test freeze -call sbs -c armv5_udeb.test - -call makesis UsbWatcherTest_ats.pkg -call signsis UsbWatcherTest_ats.sis UsbWatcherTest_ats.sisx x:\rd.cer x:\rd-key.pem diff -r 703a2b94c06c -r dde4619868dc usbengines/usbwatcher/tsrc/UsbWatcherTest/group/build_sis_phone.bat --- a/usbengines/usbwatcher/tsrc/UsbWatcherTest/group/build_sis_phone.bat Wed Sep 15 13:20:24 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,25 +0,0 @@ -@rem -@rem Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -@rem All rights reserved. -@rem This component and the accompanying materials are made available -@rem under the terms of "Eclipse Public License v1.0" -@rem which accompanies this distribution, and is available -@rem at the URL "http://www.eclipse.org/legal/epl-v10.html". -@rem -@rem Initial Contributors: -@rem Nokia Corporation - initial contribution. -@rem -@rem Contributors: -@rem -@rem Description: -@rem - - -call sbs -c armv5_udeb clean -call sbs -c armv5_udeb.test -call sbs -c armv5_udeb.test freeze -call sbs -c armv5_udeb.test - - -call makesis UsbWatcherTest_phone.pkg -call signsis UsbWatcherTest_phone.sis UsbWatcherTest_phone.sisx x:\rd.cer x:\rd-key.pem \ No newline at end of file diff -r 703a2b94c06c -r dde4619868dc usbengines/usbwatcher/tsrc/UsbWatcherTest/inc/UsbWatcherTest.h --- a/usbengines/usbwatcher/tsrc/UsbWatcherTest/inc/UsbWatcherTest.h Wed Sep 15 13:20:24 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,274 +0,0 @@ -/* -* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - - -#ifndef TEMPLATESTUBSCRIPTUsbWatcherTest_H -#define TEMPLATESTUBSCRIPTUsbWatcherTest_H - -// INCLUDES -#include -#include -#include -#include - -#include -#include -#include -#include -#include "usbwatchershared.h" -// INCLUDES FOR STUBS -#include -#include -#include -#include - -// CONSTANTS -// Logging path -//_LIT( KUsbWatcherTestLogPath, "\\logs\\testframework\\UsbWatcherTest\\" ); - -// Logging path for ATS - for phone builds comment this line -_LIT( KUsbWatcherTestLogPath, "e:\\testing\\stiflogs\\" ); - -// Log file -_LIT( KUsbWatcherTestLogFile, "UsbWatcherTest.txt" ); -_LIT( KUsbWatcherTestLogFileWithTitle, "UsbWatcherTest_[%S].txt" ); - -// MACROS -#define TEST_CLASS_VERSION_MAJOR 0 -#define TEST_CLASS_VERSION_MINOR 0 -#define TEST_CLASS_VERSION_BUILD 0 - -// Macros used to extract test block parameters -#define TESTENTRY( A, B )\ - if ( !iTestBlockParams.iTestBlockName.Compare( TPtrC( ( TText* ) L ##A ) ) )\ - { iTestBlockFunction = &B; iTestBlockFound = ETrue; }\ - if ( !iTestBlockParams.iTestBlockName.Compare( TPtrC( ( TText* ) L ##A ) ) ) - -#define TESTPARAM( A, B )\ - GetTestBlockParamL( ( TGetTestBlockParamOperation ) A, ( TTestBlockParamName ) B ); - -// FUNCTION PROTOTYPES - -// FORWARD DECLARATIONS - -// DATA TYPES - -// Enum type used to determine test block execution result -enum TUsbWatcherTestResult - { - ETestCasePassed, - ETestCaseFailed - }; - -// Enum type indicating test block parameter which should be used to store -// data extracted from test script -enum TTestBlockParamName - { - eTestOption1, - eTestOption2, - eTestOption3, - eTestIntOption1, - eTestIntOption2, - eTestIntOption3, - eTestCharOption1, - eTestCharOption2, - eTestCharOption3 - }; - -// Enum type used to indicate which get parameter function should be used -enum TGetTestBlockParamOperation - { - eGetString, - eGetInt, - eGetChar - }; - -// CLASS DECLARATION -/** -* TUsbWatcherTestBlockParams test class for storing test block parameters. -*/ -NONSHARABLE_CLASS( TUsbWatcherTestBlockParams ) - { - public: - TPtrC iTestBlockName; - - TPtrC iTestOption1; - TPtrC iTestOption2; - TPtrC iTestOption3; - - TInt iTestIntOption1; - TInt iTestIntOption2; - TInt iTestIntOption3; - - TChar iTestCharOption1; - TChar iTestCharOption2; - TChar iTestCharOption3; - }; - -/** -* CUsbWatcherTest test class for STIF Test Framework TestScripter. -*/ -NONSHARABLE_CLASS( CUsbWatcherTest ) : public CScriptBase - { - public: // Constructors and destructor - - /** - * Two-phased constructor. - */ - static CUsbWatcherTest* NewL( CTestModuleIf& aTestModuleIf ); - - /** - * Destructor. - */ - virtual ~CUsbWatcherTest(); - - public: // New functions - public: // Functions from base classes - - /** - * From CScriptBase Runs a script line. - * @since ?Series60_version - * @param aItem Script line containing method name and parameters - * @return Symbian OS error code - */ - virtual TInt RunMethodL( CStifItemParser& aItem ); - - protected: // New functions - protected: // Functions from base classes - private: - - /** - * C++ default constructor. - */ - CUsbWatcherTest( CTestModuleIf& aTestModuleIf ); - - /** - * By default Symbian 2nd phase constructor is private. - */ - void ConstructL(); - - /** - * Frees all resources allocated from test methods. - * @since ?Series60_version - */ - void TestDelete(); - - /** - * Constructs all test resources for test methods. - */ - void TestConstructL(); - - /** - * Extracts test block parameters from script file - */ - void TestBlocksInfoL(); - - /** - * Executes test block - */ - TInt ExecuteTestBlock( CStifItemParser& aItem ); - - /** - * Executes proper get parameter function indicated by its arguments - */ - void GetTestBlockParamL( TGetTestBlockParamOperation aOperation, - TTestBlockParamName aParamName ); - - /** - * Method used to log version of test class - */ - void SendTestClassVersion(); - - // ADD NEW METHOD DEC HERE - // [TestMethods] - Do not remove - void ExampleTestL( TUsbWatcherTestBlockParams& aParams, - TUsbWatcherTestResult& aTestResult ); - - /** - * Test methods are listed below. - */ - - void InitializationTestL( TUsbWatcherTestBlockParams& aParams, - TUsbWatcherTestResult& aTestResult ); - - void PersonalityManagementTestL( TUsbWatcherTestBlockParams& aParams, - TUsbWatcherTestResult& aTestResult ); - - void PersonalitySwitchTestL( TUsbWatcherTestBlockParams& aParams, - TUsbWatcherTestResult& aTestResult ); - - void BranchTestL( TUsbWatcherTestBlockParams& aParams, - TUsbWatcherTestResult& aTestResult ); - - TInt BackupPersonalitySetting(); - TInt RestorePersonalitySetting(); - - TInt GetPersonalityIdFromString( TPtrC& aUsbPersonalityName, TInt& aUsbPersonalityId ); - TUsbWatcherTestResult SetPersonalityTest( TInt aNewPersonalityId, TBool aCableConnected ); - TUsbWatcherTestResult CancelSetPersonalityTest( TInt aNewPersonalityId, TBool aCableConnected ); - TUsbWatcherTestResult SetPreviousPersonalityTest( TInt aNewPersonalityId, TBool aCableConnected ); - TUsbWatcherTestResult SetPreviousPersonalityOnDiscTest( TInt aNewPersonalityId, TBool aCableConnected ); - TUsbWatcherTestResult SetPreviousPersonalitySyncTest( TInt aNewPersonalityId, TBool aCableConnected ); - TUsbWatcherTestResult CancelSetPreviousPersonalityTest( TInt aNewPersonalityId, TBool aCableConnected ); - TUsbWatcherTestResult SetUnknownPersonalityTest(); - TUsbWatcherTestResult InterruptPersonalitySetTest( TInt aNewPersonalityId ); - - TUsbWatcherTestResult FastPersonalitySwitchTest(); - TUsbWatcherTestResult DelayedPersonalitySwitchTest(); - - TUsbWatcherTestResult SetSamePersonalityTest(); - TUsbWatcherTestResult SetPersonalityBlockingOn(); - TUsbWatcherTestResult SetPersonalityAskOnConnectionOff(); - - - public: // Data - protected: // Data - private: // Data - - // Member object used to store test block parameters - TUsbWatcherTestBlockParams iTestBlockParams; - - // Used to indicate if test block with specified parameters exist - TBool iTestBlockFound; - - // Function pointer used to call proper test block methods - void ( CUsbWatcherTest::*iTestBlockFunction ) - ( TUsbWatcherTestBlockParams&, TUsbWatcherTestResult& ); - - // Not own - CStifItemParser* iItem; - CStubber * iStubber; - RUsbWatcher* iWatcher; - RUsb* iUsbMan; - CRepository* iCenRep; - - // Reserved pointer for future extension - //TAny* iReserved; - - // ADD NEW DATA DEC HERE - - TInt iPersonalityIdBackup; - - - public: // Friend classes - protected: // Friend classes - private: // Friend classes - - }; -#endif // TEMPLATESTUBSCRIPTUsbWatcherTest_H - -// End of File diff -r 703a2b94c06c -r dde4619868dc usbengines/usbwatcher/tsrc/UsbWatcherTest/inc/UsbWatcherTestDebug.inl --- a/usbengines/usbwatcher/tsrc/UsbWatcherTest/inc/UsbWatcherTestDebug.inl Wed Sep 15 13:20:24 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,93 +0,0 @@ -/* -* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#include - -NONSHARABLE_CLASS( TOverflowTruncate8 ) : public TDes8Overflow - { -public: - void Overflow( TDes8& /*aDes*/ ) {} - }; - -NONSHARABLE_CLASS( TOverflowTruncate16 ) : public TDes16Overflow - { -public: - void Overflow( TDes16& /*aDes*/ ) {} - }; - -_LIT8(KStifTestPrefix8, "[STIF_LOG] "); -_LIT( KStifTestPrefix, "[STIF_LOG] "); -_LIT8( KStifEntryPrefix8, ">>> %S" ); -_LIT8( KStifExitPrefix8, "<<< %S" ); - -const TInt KMaxLogLineLength = 512; - -#define TRACE_INFO( p ) { Trace p; } -#define TRACE_FUNC_ENTRY { TPtrC8 ptr8( ( TUint8* ) __FUNCTION__ ); Trace( KStifEntryPrefix8, &ptr8 ); } -#define TRACE_FUNC_EXIT { TPtrC8 ptr8( ( TUint8* ) __FUNCTION__ ); Trace( KStifExitPrefix8, &ptr8 ); } - -void CUsbWatcherTest::Trace(TRefByValue aFmt, ...) - { - VA_LIST list; - VA_START( list, aFmt ); - TOverflowTruncate8 overflow; - - RBuf8 buf8; - RBuf8 bufStifLog8; - - buf8.Create( KMaxLogLineLength ); - buf8.Append( KStifTestPrefix8 ); - buf8.AppendFormatList( aFmt, list, &overflow ); - bufStifLog8.Create( KMaxLogLineLength ); - bufStifLog8.AppendFormatList( aFmt, list, &overflow ); - - RBuf16 buf16; - RBuf16 bufStifLog16; - - buf16.Create( KMaxLogLineLength ); - buf16.Copy( buf8 ); - bufStifLog16.Create( KMaxLogLineLength ); - bufStifLog16.Copy( bufStifLog8 ); - - RDebug::Print( buf16 ); - iLog->Log( bufStifLog16 ); - buf8.Close(); - bufStifLog8.Close(); - buf16.Close(); - bufStifLog16.Close(); - }; - -void CUsbWatcherTest::Trace(TRefByValue aFmt, ...) - { - VA_LIST list; - VA_START(list,aFmt); - TOverflowTruncate16 overflow; - - RBuf16 buf; - RBuf16 bufStifLog; - - buf.Create( KMaxLogLineLength ); - buf.Append( KStifTestPrefix ); - buf.AppendFormatList( aFmt, list, &overflow ); - bufStifLog.Create( KMaxLogLineLength ); - bufStifLog.AppendFormatList( aFmt, list, &overflow ); - - RDebug::Print( buf ); - iLog->Log( bufStifLog ); - buf.Close(); - bufStifLog.Close(); - }; diff -r 703a2b94c06c -r dde4619868dc usbengines/usbwatcher/tsrc/UsbWatcherTest/inc/testdebug.h --- a/usbengines/usbwatcher/tsrc/UsbWatcherTest/inc/testdebug.h Wed Sep 15 13:20:24 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,66 +0,0 @@ -/* -* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifndef TESTDEBUG_H_ -#define TESTDEBUG_H_ - -// INCLUDES -#include -#include - -// CONSTANTS -_LIT8(KStifTestPrefix8, "[STIF_LOG] "); -_LIT( KStifTestPrefix, "[STIF_LOG] "); -_LIT8( KStifEntryPrefix8, ">>> %S" ); -_LIT8( KStifExitPrefix8, "<<< %S" ); - -const TInt KMaxLogLineLength = 512; -typedef TBuf8< KMaxLogLineLength > TLogBuf8; -typedef TBuf16< KMaxLogLineLength > TLogBuf16; - -// CLASS DECLARATION -NONSHARABLE_CLASS( TTestLogger ) - { -public: - static inline TLogBuf16 CreateLogBuf( TRefByValue aFmt, ... ); - static inline TLogBuf16 CreateLogBuf( TRefByValue aFmt, ... ); - static inline void Trace( CStifLogger& aLog, TLogBuf16 aLogBuf ); - }; - -// MACROS -#define TRACE( p ) {\ - TLogBuf16 buf = TTestLogger::CreateLogBuf( _L( p ) );\ - TTestLogger::Trace( *iLog, buf );\ - } -#define TRACE_INFO( p, args... ) {\ - TLogBuf16 buf = TTestLogger::CreateLogBuf( _L( p ), args );\ - TTestLogger::Trace( *iLog, buf );\ - } -#define TRACE_FUNC_ENTRY {\ - TPtrC8 ptr8( ( TUint8* ) __FUNCTION__ );\ - TLogBuf16 buf = TTestLogger::CreateLogBuf( KStifEntryPrefix8, &ptr8 );\ - TTestLogger::Trace( *iLog, buf );\ - } -#define TRACE_FUNC_EXIT {\ - TPtrC8 ptr8( ( TUint8* ) __FUNCTION__ );\ - TLogBuf16 buf = TTestLogger::CreateLogBuf( KStifExitPrefix8, &ptr8 );\ - TTestLogger::Trace( *iLog, buf );\ - } - -#include "testdebug.inl" - -#endif /* TESTDEBUG_H_ */ diff -r 703a2b94c06c -r dde4619868dc usbengines/usbwatcher/tsrc/UsbWatcherTest/inc/testdebug.inl --- a/usbengines/usbwatcher/tsrc/UsbWatcherTest/inc/testdebug.inl Wed Sep 15 13:20:24 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,69 +0,0 @@ -/* -* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#include - -NONSHARABLE_CLASS( TOverflowTruncate8 ) : public TDes8Overflow - { -public: - void Overflow( TDes8& /*aDes*/ ) {} - }; - -NONSHARABLE_CLASS( TOverflowTruncate16 ) : public TDes16Overflow - { -public: - void Overflow( TDes16& /*aDes*/ ) {} - }; - -TLogBuf16 TTestLogger::CreateLogBuf( TRefByValue aFmt, ... ) - { - VA_LIST list; - VA_START( list, aFmt ); - TOverflowTruncate8 overflow; - TLogBuf8 buf8; - TLogBuf16 buf16; - buf8.AppendFormatList( aFmt, list, &overflow ); - buf16.Copy( buf8 ); - return buf16; - }; - -TLogBuf16 TTestLogger::CreateLogBuf( TRefByValue aFmt, ... ) - { - VA_LIST list; - VA_START( list, aFmt ); - TOverflowTruncate16 overflow; - TLogBuf16 buf16; - buf16.AppendFormatList( aFmt, list, &overflow ); - return buf16; - }; - -void TTestLogger::Trace( CStifLogger& aLog, TLogBuf16 aLogBuf ) - { - RBuf16 buf; - RBuf16 bufStifLog; - - buf.Create( KMaxLogLineLength ); - buf.Append( KStifTestPrefix ); - buf.Append( aLogBuf ); - bufStifLog.Create( KMaxLogLineLength ); - bufStifLog.Append( aLogBuf ); - - RDebug::Print( buf ); - aLog.Log( bufStifLog ); - buf.Close(); - bufStifLog.Close(); - }; diff -r 703a2b94c06c -r dde4619868dc usbengines/usbwatcher/tsrc/UsbWatcherTest/init/UsbWatcherTest_ats.ini --- a/usbengines/usbwatcher/tsrc/UsbWatcherTest/init/UsbWatcherTest_ats.ini Wed Sep 15 13:20:24 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,232 +0,0 @@ -# Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -# All rights reserved. -# This component and the accompanying materials are made available -# under the terms of "Eclipse Public License v1.0" -# which accompanies this distribution, and is available -# at the URL "http://www.eclipse.org/legal/epl-v10.html". -# -# Initial Contributors: -# Nokia Corporation - initial contribution. -# -# Contributors: -# -# Description: Installation file for STIF -# - - -# -# This is STIF initialization file -# Comment lines start with '#'-character. -# See STIF TestFramework users guide.doc for instructions - -# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -# Set following test engine settings: -# - Set Test Reporting mode. TestReportMode's possible values are: -# + 'Summary': Summary of the tested test cases. -# + 'Environment': Hardware and software info. -# + 'TestCases': Test case report. -# + 'FullReport': Set of all above ones. -# + Example 'TestReportMode= Summary TestCases' -# -# - CreateTestReport setting controls report creation mode -# + YES, Test report will created. -# + NO, No Test report. -# -# - File path indicates the base path of the test report. -# - File name indicates the name of the test report. -# -# - File format indicates the type of the test report. -# + TXT, Test report file will be txt type, for example 'TestReport.txt'. -# + HTML, Test report will be html type, for example 'TestReport.html'. -# -# - File output indicates output source of the test report. -# + FILE, Test report logging to file. -# + RDEBUG, Test report logging to using rdebug. -# -# - File Creation Mode indicates test report overwriting if file exist. -# + OVERWRITE, Overwrites if the Test report file exist. -# + APPEND, Continue logging after the old Test report information if -# report exist. -# - Sets a device reset module's dll name(Reboot). -# + If Nokia specific reset module is not available or it is not correct one -# StifHWResetStub module may use as a template for user specific reset -# module. -# - Sets STIF test measurement disable options. e.g. pluging1 and pluging2 disablation -# DisableMeasurement= stifmeasurementplugin01 stifmeasurementplugin02 -# - -[Engine_Defaults] - -TestReportMode= FullReport # Possible values are: 'Empty', 'Summary', 'Environment', - 'TestCases' or 'FullReport' - -CreateTestReport= YES # Possible values: YES or NO - -TestReportFilePath= E:/Testing/Logs/ -TestReportFileName= UsbWatcherTest_TestReport.log - -TestReportFormat= TXT # Possible values: TXT or HTML -TestReportOutput= FILE # Possible values: FILE or RDEBUG -TestReportFileCreationMode= OVERWRITE # Possible values: OVERWRITE or APPEND - -DeviceResetDllName= StifResetForNokia.dll # e.g. 'StifHWResetStub.dll' for user specific reseting - -DisableMeasurement= stifmeasurementdisablenone # Possible values are: - # 'stifmeasurementdisablenone', 'stifmeasurementdisableall' - # 'stifmeasurementplugin01', 'stifmeasurementplugin02', - # 'stifmeasurementplugin03', 'stifmeasurementplugin04', - # 'stifmeasurementplugin05' or 'stifbappeaprofiler' - -Timeout= 0 # Default timeout value for each test case. In milliseconds -UITestingSupport= YES # Possible values: YES or NO -#SeparateProcesses= YES # Possible values: YES or NO (default: NO) -[End_Defaults] -# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - - - -# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -# Module configurations start -# Modules are added between module tags -# tags. Module name is specified after ModuleName= tag, like -# ModuleName= UsbWatcherTestUsbWatcherTestUsbWatcherTest -# Modules might have initialisation file, specified as -# IniFile= c:/testframework/YYYYYY -# Modules might have several configuration files, like -# TestCaseFile= c:/testframework/NormalCases.txt -# TestCaseFile= c:/testframework/SmokeCases.txt -# TestCaseFile= c:/testframework/ManualCases.txt - -# (TestCaseFile is synonym for old term ConfigFile) - -# Following case specifies demo module settings. Demo module -# does not read any settings from file, so tags -# IniFile and TestCaseFile are not used. -# In the simplest case it is enough to specify only the -# name of the test module when adding new test module - -[New_Module] -ModuleName= TestScripter -TestCaseFile= E:/testing/conf/UsbWatcherTest.cfg -[End_Module] - - -# Load testmoduleUsbWatcherTest, optionally with initialization file and/or test case files -#[New_Module] -#ModuleName= testmodulexxx - -#TestModuleUsbWatcherTest used initialization file -#IniFile= c:/testframework/init.txt - -#TestModuleUsbWatcherTest used configuration file(s) -#TestCaseFile= c:/testframework/testcases1.cfg -#TestCaseFile= c:/testframework/testcases2.cfg -#TestCaseFile= c:/testframework/manualtestcases.cfg - -#[End_Module] -# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - - - -# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -# Set STIF logging overwrite parameters for Logger. -# Hardware and emulator environment logging path and styles can -# be configured from here to overwrite the Logger's implemented values. -# -# Settings description: -# - Indicates option for creation log directory/directories. If log directory/directories -# is/are not created by user they will make by software. -# + YES, Create log directory/directories if not allready exist. -# + NO, Log directory/directories not created. Only created one is used. -# -# - Overwrite emulator path setting. -# + Example: If 'EmulatorBasePath= C:/LOGS/TestFramework/' and in code is defined -# Logger's path 'D://LOGS//Module//' with those definition the path -# will be 'C:/LOGS/TestFramework/LOGS/Module/' -# -# - Overwrite emulator's logging format. -# + TXT, Log file(s) will be txt type(s), for example 'Module.txt'. -# + HTML, Log file(s) will be html type(s), for example 'Module.html'. -# -# - Overwrited emulator logging output source. -# + FILE, Logging to file(s). -# + RDEBUG, Logging to using rdebug(s). -# -# - Overwrite hardware path setting (Same description as above in emulator path). -# - Overwrite hardware's logging format(Same description as above in emulator format). -# - Overwrite hardware's logging output source(Same description as above in emulator output). -# -# - File Creation Mode indicates file overwriting if file exist. -# + OVERWRITE, Overwrites if file(s) exist. -# + APPEND, Continue logging after the old logging information if file(s) exist. -# -# - Will thread id include to the log filename. -# + YES, Thread id to log file(s) name, Example filename 'Module_b9.txt'. -# + NO, No thread id to log file(s), Example filename 'Module.txt'. -# -# - Will time stamps include the to log file. -# + YES, Time stamp added to each line in log file(s). Time stamp is -# for example'12.Nov.2003 115958 LOGGING INFO' -# + NO, No time stamp(s). -# -# - Will line breaks include to the log file. -# + YES, Each logging event includes line break and next log event is in own line. -# + NO, No line break(s). -# -# - Will event ranking include to the log file. -# + YES, Event ranking number added to each line in log file(s). Ranking number -# depends on environment's tics, for example(includes time stamp also) -# '012 12.Nov.2003 115958 LOGGING INFO' -# + NO, No event ranking. -# -# - Will write log file in unicode format. -# + YES, Log file will be written in unicode format -# + NO, Log will be written as normal, not unicode, file. -# - -[Logger_Defaults] - -#NOTE: If you want to set Logger using next setting(s) remove comment(s)'#' -#NOTE: TestEngine and TestServer logging settings cannot change here - -CreateLogDirectories= YES # Possible values: YES or NO - -#EmulatorBasePath= C:/LOGS/TestFramework/ -#EmulatorFormat= HTML # Possible values: TXT or HTML -#EmulatorOutput= FILE # Possible values: FILE or RDEBUG - -#HardwareBasePath= D:/LOGS/TestFramework/ -#HardwareFormat= HTML # Possible values: TXT or HTML -#HardwareOutput= FILE # Possible values: FILE or RDEBUG - -#FileCreationMode= OVERWRITE # Possible values: OVERWRITE or APPEND - -#ThreadIdToLogFile= YES # Possible values: YES or NO -#WithTimeStamp= YES # Possible values: YES or NO -#WithLineBreak= YES # Possible values: YES or NO -#WithEventRanking= YES # Possible values: YES or NO - -#FileUnicode= YES # Possible values: YES or NO -#AddTestCaseTitle= YES # Possible values: YES or NO -[End_Logger_Defaults] -# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - - - -# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -# Set filters to be used by ConsoleUI. -# If you want to use filter with ConsoleUI, simply remove comments -# from section below and provide valid filter entries. -# Each filter line has to start with "filter= " keyword. -# Filter can contain special wildcard characters: -# * which stands for none or any literal; -# ? which stands for single character. -# Filters are not case-sensitive. - -#[Filters] -#filter= *math* -#filter= *radio* -#[End_Filters] -# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - -# End of file \ No newline at end of file diff -r 703a2b94c06c -r dde4619868dc usbengines/usbwatcher/tsrc/UsbWatcherTest/init/UsbWatcherTest_phone.ini --- a/usbengines/usbwatcher/tsrc/UsbWatcherTest/init/UsbWatcherTest_phone.ini Wed Sep 15 13:20:24 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,233 +0,0 @@ -# Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -# All rights reserved. -# This component and the accompanying materials are made available -# under the terms of "Eclipse Public License v1.0" -# which accompanies this distribution, and is available -# at the URL "http://www.eclipse.org/legal/epl-v10.html". -# -# Initial Contributors: -# Nokia Corporation - initial contribution. -# -# Contributors: -# -# Description: Installation file for STIF -# - - - -# -# This is STIF initialization file -# Comment lines start with '#'-character. -# See STIF TestFramework users guide.doc for instructions - -# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -# Set following test engine settings: -# - Set Test Reporting mode. TestReportMode's possible values are: -# + 'Summary': Summary of the tested test cases. -# + 'Environment': Hardware and software info. -# + 'TestCases': Test case report. -# + 'FullReport': Set of all above ones. -# + Example 'TestReportMode= Summary TestCases' -# -# - CreateTestReport setting controls report creation mode -# + YES, Test report will created. -# + NO, No Test report. -# -# - File path indicates the base path of the test report. -# - File name indicates the name of the test report. -# -# - File format indicates the type of the test report. -# + TXT, Test report file will be txt type, for example 'TestReport.txt'. -# + HTML, Test report will be html type, for example 'TestReport.html'. -# -# - File output indicates output source of the test report. -# + FILE, Test report logging to file. -# + RDEBUG, Test report logging to using rdebug. -# -# - File Creation Mode indicates test report overwriting if file exist. -# + OVERWRITE, Overwrites if the Test report file exist. -# + APPEND, Continue logging after the old Test report information if -# report exist. -# - Sets a device reset module's dll name(Reboot). -# + If Nokia specific reset module is not available or it is not correct one -# StifHWResetStub module may use as a template for user specific reset -# module. -# - Sets STIF test measurement disable options. e.g. pluging1 and pluging2 disablation -# DisableMeasurement= stifmeasurementplugin01 stifmeasurementplugin02 -# - -[Engine_Defaults] - -TestReportMode= FullReport # Possible values are: 'Empty', 'Summary', 'Environment', - 'TestCases' or 'FullReport' - -CreateTestReport= YES # Possible values: YES or NO - -TestReportFilePath= c:\logs\testframework\TemplateScriptUsbWatcherTest\ -TestReportFileName= UsbWatcherTest_TestReport.log - -TestReportFormat= TXT # Possible values: TXT or HTML -TestReportOutput= FILE # Possible values: FILE or RDEBUG -TestReportFileCreationMode= OVERWRITE # Possible values: OVERWRITE or APPEND - -DeviceResetDllName= StifResetForNokia.dll # e.g. 'StifHWResetStub.dll' for user specific reseting - -DisableMeasurement= stifmeasurementdisablenone # Possible values are: - # 'stifmeasurementdisablenone', 'stifmeasurementdisableall' - # 'stifmeasurementplugin01', 'stifmeasurementplugin02', - # 'stifmeasurementplugin03', 'stifmeasurementplugin04', - # 'stifmeasurementplugin05' or 'stifbappeaprofiler' - -Timeout= 0 # Default timeout value for each test case. In milliseconds -UITestingSupport= YES # Possible values: YES or NO -#SeparateProcesses= YES # Possible values: YES or NO (default: NO) -[End_Defaults] -# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - - - -# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -# Module configurations start -# Modules are added between module tags -# tags. Module name is specified after ModuleName= tag, like -# ModuleName= UsbWatcherTestUsbWatcherTestUsbWatcherTest -# Modules might have initialisation file, specified as -# IniFile= c:/testframework/YYYYYY -# Modules might have several configuration files, like -# TestCaseFile= c:/testframework/NormalCases.txt -# TestCaseFile= c:/testframework/SmokeCases.txt -# TestCaseFile= c:/testframework/ManualCases.txt - -# (TestCaseFile is synonym for old term ConfigFile) - -# Following case specifies demo module settings. Demo module -# does not read any settings from file, so tags -# IniFile and TestCaseFile are not used. -# In the simplest case it is enough to specify only the -# name of the test module when adding new test module - -[New_Module] -ModuleName= TestScripter -TestCaseFile= c:\testframework\UsbWatcherTest.cfg -[End_Module] - - -# Load testmoduleUsbWatcherTest, optionally with initialization file and/or test case files -#[New_Module] -#ModuleName= testmodulexxx - -#TestModuleUsbWatcherTest used initialization file -#IniFile= c:/testframework/init.txt - -#TestModuleUsbWatcherTest used configuration file(s) -#TestCaseFile= c:/testframework/testcases1.cfg -#TestCaseFile= c:/testframework/testcases2.cfg -#TestCaseFile= c:/testframework/manualtestcases.cfg - -#[End_Module] -# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - - - -# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -# Set STIF logging overwrite parameters for Logger. -# Hardware and emulator environment logging path and styles can -# be configured from here to overwrite the Logger's implemented values. -# -# Settings description: -# - Indicates option for creation log directory/directories. If log directory/directories -# is/are not created by user they will make by software. -# + YES, Create log directory/directories if not allready exist. -# + NO, Log directory/directories not created. Only created one is used. -# -# - Overwrite emulator path setting. -# + Example: If 'EmulatorBasePath= C:/LOGS/TestFramework/' and in code is defined -# Logger's path 'D://LOGS//Module//' with those definition the path -# will be 'C:/LOGS/TestFramework/LOGS/Module/' -# -# - Overwrite emulator's logging format. -# + TXT, Log file(s) will be txt type(s), for example 'Module.txt'. -# + HTML, Log file(s) will be html type(s), for example 'Module.html'. -# -# - Overwrited emulator logging output source. -# + FILE, Logging to file(s). -# + RDEBUG, Logging to using rdebug(s). -# -# - Overwrite hardware path setting (Same description as above in emulator path). -# - Overwrite hardware's logging format(Same description as above in emulator format). -# - Overwrite hardware's logging output source(Same description as above in emulator output). -# -# - File Creation Mode indicates file overwriting if file exist. -# + OVERWRITE, Overwrites if file(s) exist. -# + APPEND, Continue logging after the old logging information if file(s) exist. -# -# - Will thread id include to the log filename. -# + YES, Thread id to log file(s) name, Example filename 'Module_b9.txt'. -# + NO, No thread id to log file(s), Example filename 'Module.txt'. -# -# - Will time stamps include the to log file. -# + YES, Time stamp added to each line in log file(s). Time stamp is -# for example'12.Nov.2003 115958 LOGGING INFO' -# + NO, No time stamp(s). -# -# - Will line breaks include to the log file. -# + YES, Each logging event includes line break and next log event is in own line. -# + NO, No line break(s). -# -# - Will event ranking include to the log file. -# + YES, Event ranking number added to each line in log file(s). Ranking number -# depends on environment's tics, for example(includes time stamp also) -# '012 12.Nov.2003 115958 LOGGING INFO' -# + NO, No event ranking. -# -# - Will write log file in unicode format. -# + YES, Log file will be written in unicode format -# + NO, Log will be written as normal, not unicode, file. -# - -[Logger_Defaults] - -#NOTE: If you want to set Logger using next setting(s) remove comment(s)'#' -#NOTE: TestEngine and TestServer logging settings cannot change here - -CreateLogDirectories= YES # Possible values: YES or NO - -#EmulatorBasePath= C:/LOGS/TestFramework/ -#EmulatorFormat= HTML # Possible values: TXT or HTML -#EmulatorOutput= FILE # Possible values: FILE or RDEBUG - -#HardwareBasePath= D:/LOGS/TestFramework/ -#HardwareFormat= HTML # Possible values: TXT or HTML -#HardwareOutput= FILE # Possible values: FILE or RDEBUG - -#FileCreationMode= OVERWRITE # Possible values: OVERWRITE or APPEND - -#ThreadIdToLogFile= YES # Possible values: YES or NO -#WithTimeStamp= YES # Possible values: YES or NO -#WithLineBreak= YES # Possible values: YES or NO -#WithEventRanking= YES # Possible values: YES or NO - -#FileUnicode= YES # Possible values: YES or NO -#AddTestCaseTitle= YES # Possible values: YES or NO -[End_Logger_Defaults] -# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - - - -# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -# Set filters to be used by ConsoleUI. -# If you want to use filter with ConsoleUI, simply remove comments -# from section below and provide valid filter entries. -# Each filter line has to start with "filter= " keyword. -# Filter can contain special wildcard characters: -# * which stands for none or any literal; -# ? which stands for single character. -# Filters are not case-sensitive. - -#[Filters] -#filter= *math* -#filter= *radio* -#[End_Filters] -# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - -# End of file \ No newline at end of file diff -r 703a2b94c06c -r dde4619868dc usbengines/usbwatcher/tsrc/UsbWatcherTest/src/UsbWatcherTest.cpp --- a/usbengines/usbwatcher/tsrc/UsbWatcherTest/src/UsbWatcherTest.cpp Wed Sep 15 13:20:24 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,326 +0,0 @@ -/* -* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -// INCLUDE FILES -#include -#include "UsbWatcherTest.h" -#include -#include "testdebug.h" - -// EXTERNAL DATA STRUCTURES - -// EXTERNAL FUNCTION PROTOTYPES - -// CONSTANTS - -// MACROS - -// LOCAL CONSTANTS AND MACROS - -// MODULE DATA STRUCTURES - -// LOCAL FUNCTION PROTOTYPES - -// FORWARD DECLARATIONS - -// ============================= LOCAL FUNCTIONS =============================== - -// ----------------------------------------------------------------------------- -// ----------------------------------------------------------------------------- - -// ============================ MEMBER FUNCTIONS =============================== - -// ----------------------------------------------------------------------------- -// CUsbWatcherTest::CUsbWatcherTest -// C++ default constructor can NOT contain any code, that -// might leave. -// ----------------------------------------------------------------------------- -// -CUsbWatcherTest::CUsbWatcherTest( - CTestModuleIf& aTestModuleIf ): - CScriptBase( aTestModuleIf ) - { - } - -// ----------------------------------------------------------------------------- -// CUsbWatcherTest::ConstructL -// Symbian 2nd phase constructor can leave. -// ----------------------------------------------------------------------------- -// -void CUsbWatcherTest::ConstructL() - { - //Read logger settings to check whether test case name is to be - //appended to log file name. - RSettingServer settingServer; - TInt ret = settingServer.Connect(); - if(ret != KErrNone) - { - User::Leave(ret); - } - // Struct to StifLogger settigs. - TLoggerSettings loggerSettings; - // Parse StifLogger defaults from STIF initialization file. - ret = settingServer.GetLoggerSettings( loggerSettings ); - if( ret != KErrNone ) - { - User::Leave( ret ); - } - // Close Setting server session - settingServer.Close(); - - TFileName logFileName; - - if( loggerSettings.iAddTestCaseTitle ) - { - TName title; - TestModuleIf().GetTestCaseTitleL( title ); - logFileName.Format( KUsbWatcherTestLogFileWithTitle, &title ); - } - else - { - logFileName.Copy( KUsbWatcherTestLogFile ); - } - - iLog = CStifLogger::NewL( KUsbWatcherTestLogPath, - logFileName, - CStifLogger::ETxt, - CStifLogger::EFile, - EFalse ); - - SendTestClassVersion(); - TestConstructL(); - } - -// ----------------------------------------------------------------------------- -// CUsbWatcherTest::NewL -// Two-phased constructor. -// ----------------------------------------------------------------------------- -// -CUsbWatcherTest* CUsbWatcherTest::NewL( - CTestModuleIf& aTestModuleIf ) - { - CUsbWatcherTest* self = new (ELeave) CUsbWatcherTest( aTestModuleIf ); - CleanupStack::PushL( self ); - self->ConstructL(); - CleanupStack::Pop(); - return self; - } - -// Destructor -CUsbWatcherTest::~CUsbWatcherTest() - { - - // Delete resources allocated from test methods - TestDelete(); - - // Delete logger - delete iLog; - - } - -// ----------------------------------------------------------------------------- -// CUsbWatcherTest::RunMethodL -// Run specified method. Contains also table of test mothods and their names. -// ----------------------------------------------------------------------------- - -TInt CUsbWatcherTest::RunMethodL( - CStifItemParser& aItem ) - { - return ExecuteTestBlock( aItem ); - } - -// ----------------------------------------------------------------------------- -// CUsbWatcherTest::ExecuteTestBlock -// ----------------------------------------------------------------------------- - -TInt CUsbWatcherTest::ExecuteTestBlock( CStifItemParser& aItem ) - { - TRACE_FUNC_ENTRY - iItem = &aItem; - TInt res; - TUsbWatcherTestResult testResult = ETestCaseFailed; - - res = iItem -> GetString( _L( "tester" ), iTestBlockParams.iTestBlockName ); - if ( res != KErrNone ) - { - TRACE_INFO( "Getting test block name failed with: %d", res ) - TRACE_FUNC_EXIT - return res; - } - TRACE_INFO( "Test block name: %S", &iTestBlockParams.iTestBlockName ) - - TRACE( "Extracting test block parameters..." ) - TRAP( res, TestBlocksInfoL() ); - if ( res != KErrNone ) - { - TRACE_INFO( "Extracting parameters failed: %d", res ) - TRACE_FUNC_EXIT - return res; - } - if ( !iTestBlockFound ) - { - TRACE( "Test block not found!" ) - TRACE_FUNC_EXIT - return KErrNotFound; - } - TRACE( "Extracting parameters successful" ) - - TRAP( res, ( this ->*iTestBlockFunction )( iTestBlockParams, testResult ) ); - if ( res != KErrNone ) - { - TRACE_INFO( "ExecuteTestBlockL error: %d", res ) - TRACE_FUNC_EXIT - return res; - } - - STIF_ASSERT_EQUALS( ETestCasePassed, testResult ); - TRACE( "Test block passed!" ); - TRACE_FUNC_EXIT - return KErrNone; - } - -// ----------------------------------------------------------------------------- -// CUsbWatcherTest::GetTestBlockParamL -// ----------------------------------------------------------------------------- - -void CUsbWatcherTest::GetTestBlockParamL( TGetTestBlockParamOperation aOperation, TTestBlockParamName aParamName ) - { - switch( aOperation ) - { - case eGetString: - { - switch ( aParamName ) - { - case eTestOption1: - { - User::LeaveIfError( iItem -> GetNextString( iTestBlockParams.iTestOption1 ) ); - break; - } - case eTestOption2: - { - User::LeaveIfError( iItem -> GetNextString( iTestBlockParams.iTestOption2 ) ); - break; - } - case eTestOption3: - { - User::LeaveIfError( iItem -> GetNextString( iTestBlockParams.iTestOption3 ) ); - break; - } - default: - { - User::Leave( KErrArgument ); - break; - } - } - break; - } - case eGetInt: - { - switch ( aParamName ) - { - case eTestIntOption1: - { - User::LeaveIfError( iItem -> GetNextInt( iTestBlockParams.iTestIntOption1 ) ); - break; - } - case eTestIntOption2: - { - User::LeaveIfError( iItem -> GetNextInt( iTestBlockParams.iTestIntOption2 ) ); - break; - } - case eTestIntOption3: - { - User::LeaveIfError( iItem -> GetNextInt( iTestBlockParams.iTestIntOption3 ) ); - break; - } - default: - { - User::Leave( KErrArgument ); - break; - } - } - break; - } - case eGetChar: - { - switch ( aParamName ) - { - case eTestCharOption1: - { - User::LeaveIfError( iItem -> GetNextChar( iTestBlockParams.iTestCharOption1 ) ); - break; - } - case eTestCharOption2: - { - User::LeaveIfError( iItem -> GetNextChar( iTestBlockParams.iTestCharOption2 ) ); - break; - } - case eTestCharOption3: - { - User::LeaveIfError( iItem -> GetNextChar( iTestBlockParams.iTestCharOption3 ) ); - break; - } - default: - { - User::Leave( KErrArgument ); - } - } - break; - } - default: - { - User::Leave( KErrArgument ); - } - } - } - -//----------------------------------------------------------------------------- -// CUsbWatcherTest::SendTestClassVersion -// Method used to send version of test class -//----------------------------------------------------------------------------- -// -void CUsbWatcherTest::SendTestClassVersion() - { - TVersion moduleVersion; - moduleVersion.iMajor = TEST_CLASS_VERSION_MAJOR; - moduleVersion.iMinor = TEST_CLASS_VERSION_MINOR; - moduleVersion.iBuild = TEST_CLASS_VERSION_BUILD; - - TFileName moduleName; - moduleName = _L("UsbWatcherTest.dll"); - - TBool newVersionOfMethod = ETrue; - TestModuleIf().SendTestModuleVersion(moduleVersion, moduleName, newVersionOfMethod); - } - -// ========================== OTHER EXPORTED FUNCTIONS ========================= - -// ----------------------------------------------------------------------------- -// LibEntryL is a polymorphic Dll entry point. -// Returns: CScriptBase: New CScriptBase derived object -// ----------------------------------------------------------------------------- -// -EXPORT_C CScriptBase* LibEntryL( - CTestModuleIf& aTestModuleIf ) // Backpointer to STIF Test Framework - { - - return ( CScriptBase* ) CUsbWatcherTest::NewL( aTestModuleIf ); - - } - - -// End of File diff -r 703a2b94c06c -r dde4619868dc usbengines/usbwatcher/tsrc/UsbWatcherTest/src/UsbWatcherTestBlocks.cpp --- a/usbengines/usbwatcher/tsrc/UsbWatcherTest/src/UsbWatcherTestBlocks.cpp Wed Sep 15 13:20:24 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1126 +0,0 @@ -/* -* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -// [INCLUDE FILES] - do not remove -#include -#include -#include -#include "UsbWatcherTest.h" -#include "testdebug.h" - -// EXTERNAL DATA STRUCTURES - -// EXTERNAL FUNCTION PROTOTYPES - -// CONSTANTS - -// MACROS - -// LOCAL CONSTANTS AND MACROS - -// MODULE DATA STRUCTURES - -// LOCAL FUNCTION PROTOTYPES - -// FORWARD DECLARATIONS - -// ============================= LOCAL FUNCTIONS =============================== - -// ----------------------------------------------------------------------------- -// ----------------------------------------------------------------------------- - -// ============================ MEMBER FUNCTIONS =============================== - -// ----------------------------------------------------------------------------- -// CUsbWatcherTest::TestConstructL -// Construct here all test resources for test methods. -// Called from ConstructL. -// ----------------------------------------------------------------------------- - -void CUsbWatcherTest::TestConstructL() - { - TRACE_FUNC_ENTRY - - iStubber = CStubber::NewL(); - - iWatcher = new ( ELeave ) RUsbWatcher(); - iCenRep = CRepository::NewL( KCRUidUsbWatcher ); - STIF_LOG( "Usb man initialization" ); - iUsbMan = new ( ELeave ) RUsb(); - User::LeaveIfError( iUsbMan -> Connect() ); - User::LeaveIfError( BackupPersonalitySetting() ); - - TRACE_FUNC_EXIT - } - -// ----------------------------------------------------------------------------- -// CUsbWatcherTest::TestDelete -// Delete here all resources allocated and opened from test methods. -// Called from destructor. -// ----------------------------------------------------------------------------- - -void CUsbWatcherTest::TestDelete() - { - TRACE_FUNC_ENTRY - - if ( RestorePersonalitySetting() != KErrNone ) - STIF_LOG( "Warning: personality restore failed" ); - - delete iWatcher; - iWatcher = NULL; - - delete iCenRep; - iCenRep = NULL; - - iUsbMan -> Close(); - delete iUsbMan; - iUsbMan = NULL; - - delete iStubber; - iStubber = NULL; - - TRACE_FUNC_EXIT - } - -// ----------------------------------------------------------------------------- -// CUsbWatcherTest::TestBlocksInfoL -// Add new test block parameter entries below -// ----------------------------------------------------------------------------- - -void CUsbWatcherTest::TestBlocksInfoL() - { - - TESTENTRY( "ExampleTestL", CUsbWatcherTest::ExampleTestL ) - { - TESTPARAM( eGetString, eTestOption1 ) - TESTPARAM( eGetString, eTestOption2 ) - TESTPARAM( eGetInt, eTestIntOption1 ) - TESTPARAM( eGetChar, eTestCharOption1 ) - } - - TESTENTRY( "InitializationTest", CUsbWatcherTest::InitializationTestL ) - { - TESTPARAM( eGetString, eTestOption1 ) - } - - TESTENTRY( "PersonalityManagementTest", CUsbWatcherTest::PersonalityManagementTestL ) - { - TESTPARAM( eGetString, eTestOption1 ) - TESTPARAM( eGetString, eTestOption2 ) - } - - TESTENTRY( "PersonalitySwitchTest", CUsbWatcherTest::PersonalitySwitchTestL ) - { - TESTPARAM( eGetString, eTestOption1 ) - } - - TESTENTRY( "BranchTest", CUsbWatcherTest::BranchTestL ) - { - TESTPARAM( eGetString, eTestOption1 ) - } - } - -// Add test block methods implementation here -// ----------------------------------------------------------------------------- -// CUsbWatcherTest::ExampleTestL -// ----------------------------------------------------------------------------- - -void CUsbWatcherTest::ExampleTestL( TUsbWatcherTestBlockParams& aParams, TUsbWatcherTestResult& aTestResult ) - { - TRACE_FUNC_ENTRY - - //iStubber -> EnqueBehavior( TApiBehavior( KUsbManStubAgentDll, ETryStartAsync, 0, 0, _L8( "stub" ) ) ); - - if ( !aParams.iTestOption1.Compare( _L( "API" ) ) ) - { - TRACE_INFO( "Api test option: %S", &aParams.iTestOption1 ) - TRACE_INFO( "Api test sub-option: %S", &aParams.iTestOption2 ) - TRACE_INFO( "Api test int option: %d", aParams.iTestIntOption1 ) - TRACE_INFO( "Api test char option: %c", TText( aParams.iTestCharOption1 ) ) - } - else if ( !aParams.iTestOption1.Compare( _L( "MODULE" ) ) ) - { - TRACE_INFO( "Module test option: %S", &aParams.iTestOption1 ) - TRACE_INFO( "Module test sub-option: %S", &aParams.iTestOption2 ) - TRACE_INFO( "Module test int option: %d", aParams.iTestIntOption1 ) - TRACE_INFO( "Module test char option: %c", TText( aParams.iTestCharOption1 ) ) - } - else if ( !aParams.iTestOption1.Compare( _L( "BRANCH" ) ) ) - { - TRACE_INFO( "Branch test option: %S", &aParams.iTestOption1 ) - TRACE_INFO( "Branch test sub-option: %S", &aParams.iTestOption2 ) - TRACE_INFO( "Branch test int option: %d", aParams.iTestIntOption1 ) - TRACE_INFO( "Branch test char option: %c", TText( aParams.iTestCharOption1 ) ) - } - else - { - TRACE( "Invalid test parameter" ) - TRACE_FUNC_EXIT - User::Leave( KErrNotFound ); - } - - aTestResult = ETestCasePassed; - TRACE_FUNC_EXIT - } - - -// Add other member functions implementation here - -// ----------------------------------------------------------------------------- -// CUSBWatcherApiTest::InitializationTest -// ----------------------------------------------------------------------------- - -void CUsbWatcherTest::InitializationTestL( TUsbWatcherTestBlockParams& aParams, - TUsbWatcherTestResult& aTestResult ) - { - TInt res; - TPtrC testOptionName( aParams.iTestOption1 ); - - if ( !testOptionName.Compare( _L( "VERSION" ) ) ) - { - TRACE( "Test option: VERSION" ); - TVersion returnedVersion; - TVersion expectedVersion( KUsbWatcherSrvMajorVersionNumber, - KUsbWatcherSrvMinorVersionNumber, - KUsbWatcherSrvBuildVersionNumber ); - TRACE( " >Version" ); - returnedVersion = iWatcher -> Version(); - TRACE( " Connect" ); - res = iWatcher -> Connect(); - TRACE( " EnqueBehavior( TApiBehavior( KUsbManStubAgentDll, EGetPersonalityProperty, 0, 0, _L8( "stub" ) ) ); - - res = iUsbMan -> GetCurrentPersonalityId( currentPersonalityId ); - if ( res != KErrNone ) - { - TRACE_INFO( "GetCurrentPersonalityId failed with value: %d", res ); - User::Leave(res); - } - - res = GetPersonalityIdFromString( usbPersonalityName, newPersonalityId ); - if ( res != KErrNone ) - { - TRACE_INFO( "GetPersonalityIdFromString failed with value: %d", res ); - User::Leave(res); - } - - TRACE( " >Connect" ); - res = iWatcher -> Connect(); - TRACE( " EnqueBehavior( TApiBehavior( KUsbManStubAgentDll, EGetDeviceState, 0, 0, _L8( "EUsbDeviceStateConfigured" ) ) ); - iStubber -> EnqueBehavior( TApiBehavior( KUsbManStubAgentDll, EDeviceStateNotification, 0, 0, _L8( "EUsbDeviceStateConfigured" ) ) ); - iStubber -> EnqueBehavior( TApiBehavior( KUsbManStubAgentDll, ETryStopAsync, 0, 0, _L8( "stub" ) ) ); - iStubber -> EnqueBehavior( TApiBehavior( KUsbManStubAgentDll, ETryStartAsync, 0, 0, _L8( "stub" ) ) ); - iStubber -> EnqueBehavior( TApiBehavior( KUsbManStubAgentDll, EDeviceStateNotification, 0, 0, _L8( "EUsbDeviceStateConfigured" ) ) ); - iStubber -> EnqueBehavior( TApiBehavior( KUsbManStubAgentDll, EDeviceStateNotification, 0, 0, _L8( "EUsbDeviceStateConfigured" ) ) ); - } - - res = iUsbMan -> GetCurrentPersonalityId( currentPersonalityId ); - - TRACE( " >SetPersonality" ); - iWatcher -> SetPersonality( status, KUsbPersonalityIdMS, EFalse, EFalse ); - User::WaitForRequest( status ); - TRACE( " Get( KUsbWatcherPersonality, setPersonalityId ); - TRACE_INFO( "Set initial test personality value: %d, personality ID: %d", status.Int(), setPersonalityId ); - User::LeaveIfError( status.Int() ); - if( KUsbPersonalityIdMS != setPersonalityId ) - User::Leave(KErrNotFound); - } - else - { - TRequestStatus status; - TInt setPersonalityId; - - if ( currentPersonalityId != newPersonalityId ) - { - iStubber -> EnqueBehavior( TApiBehavior( KUsbManStubAgentDll, EGetDeviceState, 0, 0, _L8( "EUsbDeviceStateConfigured" ) ) ); - iStubber -> EnqueBehavior( TApiBehavior( KUsbManStubAgentDll, EDeviceStateNotification, 0, 0, _L8( "EUsbDeviceStateConfigured" ) ) ); - iStubber -> EnqueBehavior( TApiBehavior( KUsbManStubAgentDll, ETryStopAsync, 0, 0, _L8( "stub" ) ) ); - iStubber -> EnqueBehavior( TApiBehavior( KUsbManStubAgentDll, ETryStartAsync, 0, 0, _L8( "stub" ) ) ); - } - - TRACE( " >SetPersonality" ); - iWatcher -> SetPersonality( status, KUsbPersonalityIdPCSuiteMTP, EFalse, EFalse ); - User::WaitForRequest( status ); - TRACE( " Get( KUsbWatcherPersonality, setPersonalityId ); - TRACE_INFO( "Set initial test personality value: %d, personality ID: %d", status.Int(), setPersonalityId ); - User::LeaveIfError( status.Int() ); - if( KUsbPersonalityIdPCSuiteMTP != setPersonalityId ) - User::Leave(KErrNotFound); - } - - if ( !testOptionName.Compare( _L( "SET_PERSONALITY" ) ) ) - { - TRACE( "Test option: SET_PERSONALITY" ); - aTestResult = SetPersonalityTest( newPersonalityId, ETrue ); - } - else if ( !testOptionName.Compare( _L( "CANCEL_SET_PERSONALITY" ) ) ) - { - TRACE( "Test option: CANCEL_SET_PERSONALITY" ); - aTestResult = CancelSetPersonalityTest( newPersonalityId, ETrue ); - } - else if ( !testOptionName.Compare( _L( "SET_PREVIOUS_PERSONALITY" ) ) ) - { - TRACE( "Test option: SET_PREVIOUS_PERSONALITY" ); - aTestResult = SetPreviousPersonalityTest( newPersonalityId, ETrue ); - } - else if ( !testOptionName.Compare( _L( "SET_PREVIOUS_PERSONALITY_ON_DISC" ) ) ) - { - TRACE( "Test option: SET_PREVIOUS_PERSONALITY_ON_DISC" ); - aTestResult = SetPreviousPersonalityOnDiscTest( newPersonalityId, ETrue ); - } - else if ( !testOptionName.Compare( _L( "SET_PREVIOUS_PERSONALITY_SYNC" ) ) ) - { - TRACE( "Test option: SET_PREVIOUS_PERSONALITY_SYNC" ); - aTestResult = SetPreviousPersonalitySyncTest( newPersonalityId, ETrue ); - } - else if ( !testOptionName.Compare( _L( "CANCEL_SET_PREVIOUS_PERSONALITY" ) ) ) - { - TRACE( "Test option: CANCEL_SET_PREVIOUS_PERSONALITY" ); - aTestResult = CancelSetPreviousPersonalityTest( newPersonalityId, ETrue ); - } - else if ( !testOptionName.Compare( _L( "SET_PERSONALITY_DISC" ) ) ) - { - TRACE( "Test option: SET_PERSONALITY_DISC" ); - aTestResult = SetPersonalityTest( newPersonalityId, EFalse ); - } - else if ( !testOptionName.Compare( _L( "CANCEL_SET_PERSONALITY_DISC" ) ) ) - { - TRACE( "Test option: CANCEL_SET_PERSONALITY_DISC" ); - aTestResult = CancelSetPersonalityTest( newPersonalityId, EFalse ); - } - else if ( !testOptionName.Compare( _L( "SET_PREVIOUS_PERSONALITY_DISC" ) ) ) - { - TRACE( "Test option: SET_PREVIOUS_PERSONALITY_DISC" ); - aTestResult = SetPreviousPersonalityTest( newPersonalityId, EFalse ); - } - else if ( !testOptionName.Compare( _L( "SET_PREVIOUS_PERSONALITY_ON_DISC_DISC" ) ) ) - { - TRACE( "Test option: SET_PREVIOUS_PERSONALITY_ON_DISC_DISC" ); - aTestResult = SetPreviousPersonalityOnDiscTest( newPersonalityId, EFalse ); - } - else if ( !testOptionName.Compare( _L( "SET_PREVIOUS_PERSONALITY_SYNC_DISC" ) ) ) - { - TRACE( "Test option: SET_PREVIOUS_PERSONALITY_SYNC_DISC" ); - aTestResult = SetPreviousPersonalitySyncTest( newPersonalityId, EFalse ); - } - else if ( !testOptionName.Compare( _L( "CANCEL_SET_PREVIOUS_PERSONALITY_DISC" ) ) ) - { - TRACE( "Test option: CANCEL_SET_PREVIOUS_PERSONALITY_DISC" ); - aTestResult = CancelSetPreviousPersonalityTest( newPersonalityId, EFalse ); - } - else if ( !testOptionName.Compare( _L( "SET_UNKNOWN_PERSONALITY" ) ) ) - { - TRACE( "Test option: SET_UNKNOWN_PERSONALITY" ); - aTestResult = SetUnknownPersonalityTest(); - } - else if ( !testOptionName.Compare( _L( "INTERRUPT_PERSONALITY_SET" ) ) ) - { - TRACE( "Test option: INTERRUPT_PERSONALITY_SET" ); - aTestResult = InterruptPersonalitySetTest( newPersonalityId ); - } - else - { - TRACE( "Test option: not supported" ); - User::Leave(KErrNotFound); - } - } - -TUsbWatcherTestResult CUsbWatcherTest::SetPersonalityTest( TInt aNewPersonalityId, TBool aCableConnected ) - { - TRequestStatus stat; - TInt currentPersonalityId; - TInt res; - - TRACE( "Checking test results:" ); - - if ( aCableConnected ) - { - iStubber -> EnqueBehavior( TApiBehavior( KUsbManStubAgentDll, EGetDeviceState, 0, 0, _L8( "EUsbDeviceStateConfigured" ) ) ); - iStubber -> EnqueBehavior( TApiBehavior( KUsbManStubAgentDll, ETryStopAsync, 0, 0, _L8( "stub" ) ) ); - iStubber -> EnqueBehavior( TApiBehavior( KUsbManStubAgentDll, ETryStartAsync, 0, 0, _L8( "stub" ) ) ); - } - - TRACE( " >SetPersonality" ); - iWatcher -> SetPersonality( stat, aNewPersonalityId, EFalse, EFalse ); - User::WaitForRequest( stat ); - TRACE( " Get( KUsbWatcherPersonality, currentPersonalityId ); - TRACE_INFO("GetCurrentPersonalityId value: %d, expected %d", res, KErrNone ); - TRACE_INFO("Current personality ID: %d, expected: %d", currentPersonalityId, aNewPersonalityId ); - - if ( stat.Int() != KErrNone || res != KErrNone || currentPersonalityId != aNewPersonalityId ) - return ETestCaseFailed; - - return ETestCasePassed; - } - -TUsbWatcherTestResult CUsbWatcherTest::CancelSetPersonalityTest( TInt aNewPersonalityId, TBool aCableConnected ) - { - TRequestStatus stat; - TInt previousPersonalityId; - TInt currentPersonalityId; - TInt res; - - res = iCenRep -> Get( KUsbWatcherPersonality, previousPersonalityId ); - TRACE_INFO("GetCurrentPersonalityId value: %d, expected %d", res, KErrNone ); - TRACE_INFO("Original personality ID: %d", previousPersonalityId ); - if ( res != KErrNone ) - return ETestCaseFailed; - - TRACE( "Checking test results:" ); - - if ( aCableConnected ) - { - iStubber -> EnqueBehavior( TApiBehavior( KUsbManStubAgentDll, EGetDeviceState, 0, 0, _L8( "EUsbDeviceStateConfigured" ) ) ); - iStubber -> EnqueBehavior( TApiBehavior( KUsbManStubAgentDll, EGetDeviceState, 0, 0, _L8( "EUsbDeviceStateConfigured" ) ) ); - iStubber -> EnqueBehavior( TApiBehavior( KUsbManStubAgentDll, EDeviceStateNotification, 0, 0, _L8( "EUsbDeviceStateConfigured" ) ) ); - iStubber -> EnqueBehavior( TApiBehavior( KUsbManStubAgentDll, EDeviceStateNotification, 0, 0, _L8( "EUsbDeviceStateConfigured" ) ) ); - iStubber -> EnqueBehavior( TApiBehavior( KUsbManStubAgentDll, ETryStopAsync, 0, 0, _L8( "stub" ) ) ); - iStubber -> EnqueBehavior( TApiBehavior( KUsbManStubAgentDll, ETryStartAsync, 0, 0, _L8( "stub" ) ) ); - iStubber -> EnqueBehavior( TApiBehavior( KUsbManStubAgentDll, EGetPersonalityProperty, 0, 0, _L8( "stub" ) ) ); - } - - - TRACE( " >SetPersonality" ); - iWatcher -> SetPersonality( stat, aNewPersonalityId, EFalse, EFalse ); - TRACE( " >CancelSetPersonality" ); - iWatcher -> CancelSetPersonality(); - User::WaitForRequest( stat ); - TRACE( " Get( KUsbWatcherPersonality, currentPersonalityId ); - TRACE_INFO("GetCurrentPersonalityId value: %d, expected %d", res, KErrNone ); - TRACE_INFO("Current personality ID: %d", currentPersonalityId ); - - if ( aCableConnected ) - { - if ( stat.Int() != KErrCancel || res != KErrNone || currentPersonalityId != previousPersonalityId ) - return ETestCaseFailed; - } - else - { - if ( stat.Int() != KErrNone || res != KErrNone || currentPersonalityId != aNewPersonalityId ) - return ETestCaseFailed; - } - - return ETestCasePassed; - } - -TUsbWatcherTestResult CUsbWatcherTest::SetPreviousPersonalityTest( TInt aNewPersonalityId, TBool aCableConnected ) - { - TRequestStatus stat; - TInt previousPersonalityId; - TInt currentPersonalityId; - TInt res; - - res = iCenRep -> Get( KUsbWatcherPersonality, previousPersonalityId ); - TRACE_INFO("GetCurrentPersonalityId value: %d, expected %d", res, KErrNone ); - TRACE_INFO("Original personality ID: %d", previousPersonalityId ); - if ( res != KErrNone ) - return ETestCaseFailed; - - TRACE( " >SetPersonality" ); - - iStubber -> EnqueBehavior( TApiBehavior( KUsbManStubAgentDll, EGetDeviceState, 0, 0, _L8( "EUsbDeviceStateConfigured" ) ) ); - iStubber -> EnqueBehavior( TApiBehavior( KUsbManStubAgentDll, EDeviceStateNotification, 0, 0, _L8( "EUsbDeviceStateConfigured" ) ) ); - iStubber -> EnqueBehavior( TApiBehavior( KUsbManStubAgentDll, ETryStopAsync, 0, 0, _L8( "stub" ) ) ); - iStubber -> EnqueBehavior( TApiBehavior( KUsbManStubAgentDll, ETryStartAsync, 0, 0, _L8( "stub" ) ) ); - - iWatcher -> SetPersonality( stat, aNewPersonalityId, EFalse, EFalse ); - User::WaitForRequest( stat ); - TRACE( " Get( KUsbWatcherPersonality, currentPersonalityId ); - TRACE_INFO("GetCurrentPersonalityId value: %d, expected %d", res, KErrNone ); - TRACE_INFO("Current personality ID: %d, expected: %d", currentPersonalityId, aNewPersonalityId ); - - if ( stat.Int() != KErrNone || res != KErrNone || currentPersonalityId != aNewPersonalityId ) - return ETestCaseFailed; - - TRACE( "Checking test results:" ); - - if ( aCableConnected ) - { - iStubber -> EnqueBehavior( TApiBehavior( KUsbManStubAgentDll, EGetDeviceState, 0, 0, _L8( "EUsbDeviceStateConfigured" ) ) ); - iStubber -> EnqueBehavior( TApiBehavior( KUsbManStubAgentDll, EDeviceStateNotification, 0, 0, _L8( "EUsbDeviceStateConfigured" ) ) ); - iStubber -> EnqueBehavior( TApiBehavior( KUsbManStubAgentDll, ETryStopAsync, 0, 0, _L8( "stub" ) ) ); - iStubber -> EnqueBehavior( TApiBehavior( KUsbManStubAgentDll, ETryStartAsync, 0, 0, _L8( "stub" ) ) ); - } - - TRACE( " >SetPreviousPersonality" ); - iWatcher -> SetPreviousPersonality( stat ); - User::WaitForRequest( stat ); - TRACE( " Get( KUsbWatcherPersonality, currentPersonalityId ); - TRACE_INFO("GetCurrentPersonalityId value: %d, expected %d", res, KErrNone ); - TRACE_INFO("Current personality ID: %d, expected: %d", currentPersonalityId, previousPersonalityId ); - - if ( stat.Int() != KErrNone || res != KErrNone || currentPersonalityId != previousPersonalityId ) - return ETestCaseFailed; - - return ETestCasePassed; - } - -TUsbWatcherTestResult CUsbWatcherTest::SetPreviousPersonalityOnDiscTest( TInt aNewPersonalityId, TBool aCableConnected ) - { - TRequestStatus stat; - TInt previousPersonalityId; - TInt currentPersonalityId; - TInt res; - - res = iCenRep -> Get( KUsbWatcherPersonality, previousPersonalityId ); - TRACE_INFO("GetCurrentPersonalityId value: %d, expected %d", res, KErrNone ); - TRACE_INFO("Original personality ID: %d", previousPersonalityId ); - if ( res != KErrNone ) - return ETestCaseFailed; - - iStubber -> EnqueBehavior( TApiBehavior( KUsbManStubAgentDll, EGetDeviceState, 0, 0, _L8( "EUsbDeviceStateConfigured" ) ) ); - iStubber -> EnqueBehavior( TApiBehavior( KUsbManStubAgentDll, EDeviceStateNotification, 0, 0, _L8( "EUsbDeviceStateConfigured" ) ) ); - iStubber -> EnqueBehavior( TApiBehavior( KUsbManStubAgentDll, ETryStopAsync, 0, 0, _L8( "stub" ) ) ); - iStubber -> EnqueBehavior( TApiBehavior( KUsbManStubAgentDll, ETryStartAsync, 0, 0, _L8( "stub" ) ) ); - - TRACE( " >SetPersonality" ); - iWatcher -> SetPersonality( stat, aNewPersonalityId, EFalse, EFalse ); - User::WaitForRequest( stat ); - TRACE( " EnqueBehavior( TApiBehavior( KUsbManStubAgentDll, EGetDeviceState, 0, 0, _L8( "EUsbDeviceStateConfigured" ) ) ); - - TRACE( " >SetPreviousPersonalityOnDisconnect" ); - iWatcher -> SetPreviousPersonalityOnDisconnect(); - TRACE( " Get( KUsbWatcherPersonality, currentPersonalityId ); - TRACE_INFO("GetCurrentPersonalityId value: %d, expected %d", res, KErrNone ); - TRACE_INFO("Current personality ID: %d, expected: %d", currentPersonalityId, aNewPersonalityId ); - - if ( stat.Int() != KErrNone || res != KErrNone || currentPersonalityId != aNewPersonalityId ) - return ETestCaseFailed; - - return ETestCasePassed; - } - -TUsbWatcherTestResult CUsbWatcherTest::SetPreviousPersonalitySyncTest( TInt aNewPersonalityId, TBool aCableConnected ) - { - TRequestStatus stat; - TInt previousPersonalityId; - TInt currentPersonalityId; - TInt res; - - res = iCenRep -> Get( KUsbWatcherPersonality, previousPersonalityId ); - TRACE_INFO("GetCurrentPersonalityId value: %d, expected %d", res, KErrNone ); - TRACE_INFO("Original personality ID: %d", previousPersonalityId ); - if ( res != KErrNone ) - return ETestCaseFailed; - - iStubber -> EnqueBehavior( TApiBehavior( KUsbManStubAgentDll, EGetDeviceState, 0, 0, _L8( "EUsbDeviceStateConfigured" ) ) ); - iStubber -> EnqueBehavior( TApiBehavior( KUsbManStubAgentDll, ETryStopAsync, 0, 0, _L8( "stub" ) ) ); - iStubber -> EnqueBehavior( TApiBehavior( KUsbManStubAgentDll, ETryStartAsync, 0, 0, _L8( "stub" ) ) ); - - TRACE( " >SetPersonality" ); - iWatcher -> SetPersonality( stat, aNewPersonalityId, EFalse, EFalse ); - User::WaitForRequest( stat ); - TRACE( " Get( KUsbWatcherPersonality, currentPersonalityId ); - TRACE_INFO("GetCurrentPersonalityId value: %d, expected %d", res, KErrNone ); - TRACE_INFO("Current personality ID: %d, expected: %d", currentPersonalityId, aNewPersonalityId ); - - if ( stat.Int() != KErrNone || res != KErrNone || currentPersonalityId != aNewPersonalityId ) - return ETestCaseFailed; - - TRACE( "Checking test results:" ); - - if ( aCableConnected ) - { - iStubber -> EnqueBehavior( TApiBehavior( KUsbManStubAgentDll, EGetDeviceState, 0, 0, _L8( "EUsbDeviceStateConfigured" ) ) ); - iStubber -> EnqueBehavior( TApiBehavior( KUsbManStubAgentDll, ETryStopAsync, 0, 0, _L8( "stub" ) ) ); - iStubber -> EnqueBehavior( TApiBehavior( KUsbManStubAgentDll, ETryStartAsync, 0, 0, _L8( "stub" ) ) ); - } - - TRACE( " >SetPreviousPersonality" ); - iWatcher -> SetPreviousPersonality(); - TRACE( " Get( KUsbWatcherPersonality, currentPersonalityId ); - TRACE_INFO("GetCurrentPersonalityId value: %d, expected %d", res, KErrNone ); - TRACE_INFO("Current personality ID: %d, expected: %d", currentPersonalityId, previousPersonalityId ); - - if ( res != KErrNone || currentPersonalityId != previousPersonalityId ) - return ETestCaseFailed; - - return ETestCasePassed; - } - -TUsbWatcherTestResult CUsbWatcherTest::CancelSetPreviousPersonalityTest( TInt aNewPersonalityId, TBool aCableConnected ) - { - TRequestStatus stat; - TInt previousPersonalityId; - TInt currentPersonalityId; - TInt res; - - res = iCenRep -> Get( KUsbWatcherPersonality, previousPersonalityId ); - TRACE_INFO("GetCurrentPersonalityId value: %d, expected %d", res, KErrNone ); - TRACE_INFO("Original personality ID: %d", previousPersonalityId ); - if ( res != KErrNone ) - return ETestCaseFailed; - - iStubber -> EnqueBehavior( TApiBehavior( KUsbManStubAgentDll, EGetDeviceState, 0, 0, _L8( "EUsbDeviceStateConfigured" ) ) ); - iStubber -> EnqueBehavior( TApiBehavior( KUsbManStubAgentDll, ETryStopAsync, 0, 0, _L8( "stub" ) ) ); - iStubber -> EnqueBehavior( TApiBehavior( KUsbManStubAgentDll, ETryStartAsync, 0, 0, _L8( "stub" ) ) ); - - TRACE( " >SetPersonality" ); - iWatcher -> SetPersonality( stat, aNewPersonalityId, EFalse, EFalse ); - User::WaitForRequest( stat ); - TRACE( " Get( KUsbWatcherPersonality, currentPersonalityId ); - TRACE_INFO("GetCurrentPersonalityId value: %d, expected %d", res, KErrNone ); - TRACE_INFO("Current personality ID: %d, expected: %d", currentPersonalityId, aNewPersonalityId ); - - if ( stat.Int() != KErrNone || res != KErrNone || currentPersonalityId != aNewPersonalityId ) - return ETestCaseFailed; - - TRACE( "Checking test results:" ); - - if ( aCableConnected ) - { - iStubber -> EnqueBehavior( TApiBehavior( KUsbManStubAgentDll, EGetDeviceState, 0, 0, _L8( "EUsbDeviceStateConfigured" ) ) ); - iStubber -> EnqueBehavior( TApiBehavior( KUsbManStubAgentDll, EGetDeviceState, 0, 0, _L8( "EUsbDeviceStateConfigured" ) ) ); - iStubber -> EnqueBehavior( TApiBehavior( KUsbManStubAgentDll, ETryStopAsync, 0, 0, _L8( "stub" ) ) ); - iStubber -> EnqueBehavior( TApiBehavior( KUsbManStubAgentDll, ETryStartAsync, 0, 0, _L8( "stub" ) ) ); - } - - TRACE( " >SetPreviousPersonality" ); - iWatcher -> SetPreviousPersonality( stat ); - TRACE( " >CancelSetPreviousPersonality" ); - iWatcher -> CancelSetPreviousPersonality(); - User::WaitForRequest( stat ); - TRACE( " Get( KUsbWatcherPersonality, currentPersonalityId ); - TRACE_INFO("GetCurrentPersonalityId value: %d, expected %d", res, KErrNone ); - TRACE_INFO("Current personality ID: %d", currentPersonalityId ); - - if ( aCableConnected ) - { - if ( stat.Int() != KErrCancel || res != KErrNone || currentPersonalityId != aNewPersonalityId ) - return ETestCaseFailed; - } - else - { - if ( stat.Int() != KErrNone || res != KErrNone || currentPersonalityId != previousPersonalityId ) - return ETestCaseFailed; - } - - - return ETestCasePassed; - } - -TUsbWatcherTestResult CUsbWatcherTest::SetUnknownPersonalityTest() - { - TRequestStatus stat; - TInt unknownPersonalityId = 0xFFFF; - - TRACE( "Checking test results:" ); - - iStubber -> EnqueBehavior( TApiBehavior( KUsbManStubAgentDll, EGetDeviceState, 0, 0, _L8( "EUsbDeviceStateConfigured" ) ) ); - iStubber -> EnqueBehavior( TApiBehavior( KUsbManStubAgentDll, ETryStopAsync, 0, 0, _L8( "stub" ) ) ); - iStubber -> EnqueBehavior( TApiBehavior( KUsbManStubAgentDll, ETryStartAsync, 0, 0, _L8( "stub" ) ) ); - - TRACE( " >SetPersonality" ); - iWatcher -> SetPersonality( stat, unknownPersonalityId, EFalse, EFalse ); - User::WaitForRequest( stat ); - TRACE( " Get( KUsbWatcherPersonality, previousPersonalityId ); - TRACE_INFO("GetCurrentPersonalityId value: %d, expected %d", res, KErrNone ); - TRACE_INFO("Original personality ID: %d", previousPersonalityId ); - if ( res != KErrNone ) - return ETestCaseFailed; - - TRACE( "Checking test results:" ); - - iStubber -> EnqueBehavior( TApiBehavior( KUsbManStubAgentDll, EGetDeviceState, 0, 0, _L8( "EUsbDeviceStateConfigured" ) ) ); - iStubber -> EnqueBehavior( TApiBehavior( KUsbManStubAgentDll, ETryStopAsync, 0, 0, _L8( "stub" ) ) ); - - TRACE( " >SetPersonality" ); - iWatcher -> SetPersonality( stat, aNewPersonalityId, EFalse, EFalse ); - TRACE( " >SetPersonality" ); - iWatcher -> SetPersonality( secondStat, previousPersonalityId, EFalse, EFalse ); - User::WaitForRequest( stat ); - TRACE( " Get( KUsbWatcherPersonality, currentPersonalityId ); - TRACE_INFO("GetCurrentPersonalityId value: %d, expected %d", res, KErrNone ); - TRACE_INFO("Current personality ID: %d, expected: %d", currentPersonalityId, previousPersonalityId ); - - if ( stat.Int() != KErrNone || secondStat.Int() != KErrNone || res != KErrNone || currentPersonalityId != previousPersonalityId ) - return ETestCaseFailed; - - return ETestCasePassed; - } - -TInt CUsbWatcherTest::GetPersonalityIdFromString( TPtrC& aUsbPersonalityName, TInt& aUsbPersonalityId ) - { - if ( !aUsbPersonalityName.Compare( _L( "PCSUITE" ) ) ) - { - TRACE( "Test personality ID setting: PCSUITE" ); - aUsbPersonalityId = KUsbPersonalityIdPCSuiteMTP; - } - else if ( !aUsbPersonalityName.Compare( _L( "MS" ) ) ) - { - TRACE( "Test personality ID setting: MS" ); - aUsbPersonalityId = KUsbPersonalityIdMS; - } - else if ( !aUsbPersonalityName.Compare( _L( "PTP" ) ) ) - { - TRACE( "Test personality ID setting: PTP" ); - aUsbPersonalityId = KUsbPersonalityIdPTP; - } - else if ( !aUsbPersonalityName.Compare( _L( "MTP" ) ) ) - { - TRACE( "Test personality ID setting: MTP" ); - aUsbPersonalityId = KUsbPersonalityIdMTP; - } - else if ( !aUsbPersonalityName.Compare( _L( "Modem" ) ) ) - { - TRACE( "Test personality ID setting: Modem" ); - aUsbPersonalityId = KUsbPersonalityIdModemInst; - } - else - { - TRACE( "Test personality ID setting: not supported" ); - return KErrNotFound; - } - - return KErrNone; - } - -// ----------------------------------------------------------------------------- -// CUSBWatcherTest::PersonalitySwitchTest -// ----------------------------------------------------------------------------- - -void CUsbWatcherTest::PersonalitySwitchTestL( TUsbWatcherTestBlockParams& aParams, - TUsbWatcherTestResult& aTestResult ) - { - TInt res; - TRequestStatus stat; - TPtrC testOptionName( aParams.iTestOption1 ); - TInt currentPersonalityId; - - res = iUsbMan -> GetCurrentPersonalityId( currentPersonalityId ); - if ( res != KErrNone ) - { - TRACE_INFO( "GetCurrentPersonalityId failed with value: %d" , res ); - User::Leave( res ); - } - - TRACE( " >Connect" ); - res = iWatcher -> Connect(); - TRACE( " EnqueBehavior( TApiBehavior( KUsbManStubAgentDll, EGetDeviceState, 0, 0, _L8( "EUsbDeviceStateConfigured" ) ) ); - iStubber -> EnqueBehavior( TApiBehavior( KUsbManStubAgentDll, ETryStopAsync, 0, 0, _L8( "stub" ) ) ); - iStubber -> EnqueBehavior( TApiBehavior( KUsbManStubAgentDll, ETryStartAsync, 0, 0, _L8( "stub" ) ) ); - } - - TRACE( " >SetPersonality" ); - iWatcher -> SetPersonality( stat, KUsbPersonalityIdPCSuiteMTP, EFalse, EFalse ); - User::WaitForRequest( stat ); - TRACE( " EnqueBehavior( TApiBehavior( KUsbManStubAgentDll, EGetDeviceState, 0, 0, _L8( "EUsbDeviceStateConfigured" ) ) ); - iStubber -> EnqueBehavior( TApiBehavior( KUsbManStubAgentDll, ETryStopAsync, 0, 0, _L8( "stub" ) ) ); - iStubber -> EnqueBehavior( TApiBehavior( KUsbManStubAgentDll, ETryStartAsync, 0, 0, _L8( "stub" ) ) ); - - TRACE( " >SetPersonality" ); - iWatcher -> SetPersonality( stat, currentPersonalityId, EFalse, EFalse ); - User::WaitForRequest( stat ); - TRACE( " Get( KUsbWatcherPersonality, setPersonalityId ); - TRACE_INFO("Set personality request status: %d, expected %d", stat.Int(), KErrNone ); - TRACE_INFO("GetCurrentPersonalityId value: %d, expected %d", res, KErrNone ); - TRACE_INFO("Current personality ID: %d, expected: %d", currentPersonalityId, setPersonalityId ); - if ( stat.Int() != KErrNone || res != KErrNone || currentPersonalityId != setPersonalityId ) - return ETestCaseFailed; - currentPersonalityId++; - } - } - return ETestCasePassed; - } - -TUsbWatcherTestResult CUsbWatcherTest::DelayedPersonalitySwitchTest() - { - TInt res; - TInt numberOfPersonalities = 4; - TInt currentPersonalityId; - TInt setPersonalityId; - TRequestStatus stat; - - TRACE( "Checking test results:" ); - currentPersonalityId = KUsbPersonalityIdMS; - - for ( int j = 0; j< numberOfPersonalities; j++ ) - { - iStubber -> EnqueBehavior( TApiBehavior( KUsbManStubAgentDll, EGetDeviceState, 0, 0, _L8( "EUsbDeviceStateConfigured" ) ) ); - iStubber -> EnqueBehavior( TApiBehavior( KUsbManStubAgentDll, ETryStopAsync, 0, 0, _L8( "stub" ) ) ); - iStubber -> EnqueBehavior( TApiBehavior( KUsbManStubAgentDll, ETryStartAsync, 0, 0, _L8( "stub" ) ) ); - - TRACE( " >SetPersonality" ); - iWatcher -> SetPersonality( stat, currentPersonalityId, EFalse, EFalse ); - User::WaitForRequest( stat ); - TRACE( " Get( KUsbWatcherPersonality, setPersonalityId ); - TRACE_INFO("Set personality request status: %d, expected %d", stat.Int(), KErrNone ); - TRACE_INFO("GetCurrentPersonalityId value: %d, expected %d", res, KErrNone ); - TRACE_INFO("Current personality ID: %d, expected: %d", currentPersonalityId, setPersonalityId ); - if ( stat.Int() != KErrNone || res != KErrNone || currentPersonalityId != setPersonalityId ) - return ETestCaseFailed; - currentPersonalityId++; - User::After( 7000*1000 ); - } - return ETestCasePassed; - } - -// ----------------------------------------------------------------------------- -// CUSBWatcherTest::BranchTest -// ----------------------------------------------------------------------------- - -void CUsbWatcherTest::BranchTestL( TUsbWatcherTestBlockParams& aParams, - TUsbWatcherTestResult& aTestResult ) - { - TInt res; - TRequestStatus stat; - TPtrC testOptionName( aParams.iTestOption1 ); - TInt currentPersonalityId; - - res = iUsbMan -> GetCurrentPersonalityId( currentPersonalityId ); - if ( res != KErrNone ) - { - TRACE_INFO( "GetCurrentPersonalityId failed with value: %d", res ); - User::Leave( res ); - } - - TRACE( " >Connect" ); - res = iWatcher -> Connect(); - TRACE( " EnqueBehavior( TApiBehavior( KUsbManStubAgentDll, EGetDeviceState, 0, 0, _L8( "EUsbDeviceStateConfigured" ) ) ); - iStubber -> EnqueBehavior( TApiBehavior( KUsbManStubAgentDll, ETryStopAsync, 0, 0, _L8( "stub" ) ) ); - iStubber -> EnqueBehavior( TApiBehavior( KUsbManStubAgentDll, ETryStartAsync, 0, 0, _L8( "stub" ) ) ); - } - - TRACE( "Initial SetPersonality" ); - - TRACE( " >SetPersonality" ); - iWatcher -> SetPersonality( stat, KUsbPersonalityIdPCSuiteMTP, EFalse, EFalse ); - User::WaitForRequest( stat ); - TRACE( " SetPersonality" ); - iWatcher -> SetPersonality( stat, KUsbPersonalityIdPCSuiteMTP, EFalse, EFalse ); - User::WaitForRequest( stat ); - TRACE( " Get( KUsbWatcherPersonality, currentPersonalityId ); - TRACE_INFO("GetCurrentPersonalityId value: %d, expected %d", res, KErrNone ); - TRACE_INFO("Current personality ID: %d, expected: %d", currentPersonalityId, KUsbPersonalityIdPCSuiteMTP ); - - if ( stat.Int() != KErrNone || res != KErrNone || currentPersonalityId != KUsbPersonalityIdPCSuiteMTP ) - return ETestCaseFailed; - - return ETestCasePassed; - } - -TUsbWatcherTestResult CUsbWatcherTest::SetPersonalityBlockingOn() - { - TRequestStatus stat; - TInt currentPersonalityId; - TInt res; - - TRACE( "Checking test results:" ); - - iStubber -> EnqueBehavior( TApiBehavior( KUsbManStubAgentDll, EGetDeviceState, 0, 0, _L8( "EUsbDeviceStateConfigured" ) ) ); - iStubber -> EnqueBehavior( TApiBehavior( KUsbManStubAgentDll, ETryStopAsync, 0, 0, _L8( "stub" ) ) ); - iStubber -> EnqueBehavior( TApiBehavior( KUsbManStubAgentDll, ETryStartAsync, 0, 0, _L8( "stub" ) ) ); - - TRACE( " >SetPersonality" ); - iWatcher -> SetPersonality( stat, KUsbPersonalityIdMS, EFalse, ETrue ); - User::WaitForRequest( stat ); - TRACE( " Get( KUsbWatcherPersonality, currentPersonalityId ); - TRACE_INFO("GetCurrentPersonalityId value: %d, expected %d", res, KErrNone ); - TRACE_INFO("Current personality ID: %d, expected: %d", currentPersonalityId, KUsbPersonalityIdMS ); - - if ( stat.Int() != KErrNone || res != KErrNone || currentPersonalityId != KUsbPersonalityIdMS ) - return ETestCaseFailed; - - return ETestCasePassed; - } - -TUsbWatcherTestResult CUsbWatcherTest::SetPersonalityAskOnConnectionOff() - { - TRequestStatus stat; - TInt currentPersonalityId; - TInt res; - - TRACE( "Checking test results:" ); - - iStubber -> EnqueBehavior( TApiBehavior( KUsbManStubAgentDll, EGetDeviceState, 0, 0, _L8( "EUsbDeviceStateConfigured" ) ) ); - iStubber -> EnqueBehavior( TApiBehavior( KUsbManStubAgentDll, ETryStopAsync, 0, 0, _L8( "stub" ) ) ); - iStubber -> EnqueBehavior( TApiBehavior( KUsbManStubAgentDll, ETryStartAsync, 0, 0, _L8( "stub" ) ) ); - - TRACE( " >SetPersonality" ); - iWatcher -> SetPersonality( stat, KUsbPersonalityIdMS, ETrue, EFalse ); - User::WaitForRequest( stat ); - TRACE( " Get( KUsbWatcherPersonality, currentPersonalityId ); - TRACE_INFO("GetCurrentPersonalityId value: %d, expected %d", res, KErrNone ); - TRACE_INFO("Current personality ID: %d, expected: %d", currentPersonalityId, KUsbPersonalityIdMS ); - - if ( stat.Int() != KErrNone || res != KErrNone || currentPersonalityId != KUsbPersonalityIdMS ) - return ETestCaseFailed; - - return ETestCasePassed; - } - -// ----------------------------------------------------------------------------- -// CUSBWatcherTest:: Other functions -// ----------------------------------------------------------------------------- - -TInt CUsbWatcherTest::BackupPersonalitySetting() - { - TRACE( "> GetCurrentPersonalityId( iPersonalityIdBackup ); - } - -TInt CUsbWatcherTest::RestorePersonalitySetting() - { - TRequestStatus stat; - TInt currentPersonalityId; - - TRACE( ">Restore personality setting" ) - TRACE( " >Close" ); - iWatcher -> Close(); - TRACE( " GetCurrentPersonalityId( currentPersonalityId ); - if ( currentPersonalityId != iPersonalityIdBackup ) - { - TRACE( " >Connect" ); - iWatcher -> Connect(); - TRACE( " EnqueBehavior( TApiBehavior( KUsbManStubAgentDll, EGetDeviceState, 0, 0, _L8( "EUsbDeviceStateConfigured" ) ) ); - iStubber -> EnqueBehavior( TApiBehavior( KUsbManStubAgentDll, ETryStopAsync, 0, 0, _L8( "stub" ) ) ); - iStubber -> EnqueBehavior( TApiBehavior( KUsbManStubAgentDll, ETryStartAsync, 0, 0, _L8( "stub" ) ) ); - - TRACE( " >SetPersonality" ); - iWatcher -> SetPersonality( stat, iPersonalityIdBackup, EFalse, EFalse ); - User::WaitForRequest( stat ); - TRACE( " Close" ); - iWatcher -> Close(); - TRACE( " -#include -#include -// EXTERNAL DATA STRUCTURES - -// EXTERNAL FUNCTION PROTOTYPES - -// ================= OTHER EXPORTED FUNCTIONS ================================= - -/* -------------------------------------------------------------------------------- - - Class: - - - Method: E32Main - - Description: - - Parameters: None - - Return Values: TInt: Symbian error code - - Errors/Exceptions: None - - Status: Draft - -------------------------------------------------------------------------------- -*/ -GLDEF_C TInt E32Main() - { - _LIT( KProcessMsgStart, "New process starting" ); - RDebug::Print( KProcessMsgStart ); - - - // This starts a new session that get capabilites that is used in - // UsbWatcherTest_exe.mmp file. - TInt r = StartSession(); - - _LIT( KProcessMsgEnd, "New process ends" ); - RDebug::Print( KProcessMsgEnd ); - - return r; - - } - -// End of File diff -r 703a2b94c06c -r dde4619868dc usbservices_plat/usb_personality_plugin_api/tsrc/usbpersonalitypluginapitest/Bmarm/UsbPersonalityPluginTestu.def --- a/usbservices_plat/usb_personality_plugin_api/tsrc/usbpersonalitypluginapitest/Bmarm/UsbPersonalityPluginTestu.def Wed Sep 15 13:20:24 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,3 +0,0 @@ -EXPORTS - LibEntryL__FR13CTestModuleIf @ 1 NONAME R3UNUSED ; LibEntryL(CTestModuleIf &) - diff -r 703a2b94c06c -r dde4619868dc usbservices_plat/usb_personality_plugin_api/tsrc/usbpersonalitypluginapitest/Bwins/UsbPersonalityPluginTestu.def --- a/usbservices_plat/usb_personality_plugin_api/tsrc/usbpersonalitypluginapitest/Bwins/UsbPersonalityPluginTestu.def Wed Sep 15 13:20:24 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,3 +0,0 @@ -EXPORTS - ?LibEntryL@@YAPAVCScriptBase@@AAVCTestModuleIf@@@Z @ 1 NONAME ; class CScriptBase * __cdecl LibEntryL(class CTestModuleIf &) - diff -r 703a2b94c06c -r dde4619868dc usbservices_plat/usb_personality_plugin_api/tsrc/usbpersonalitypluginapitest/conf/UsbPersonalityPluginTest.cfg --- a/usbservices_plat/usb_personality_plugin_api/tsrc/usbpersonalitypluginapitest/conf/UsbPersonalityPluginTest.cfg Wed Sep 15 13:20:24 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,102 +0,0 @@ -/* -* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -[StifSettings] -CapsModifier = UsbPersonalityPluginTest.exe -[EndStifSettings] - - -// UsbPersonalityPluginTest Module - total ... tc - -// UsbPersonalityPluginTest Api Tests (... tc) - -[Test] -title Initialization Test -create UsbPersonalityPluginTest tester -tester InitializationTestL API -delete tester -[Endtest] - -[Test] -title Set Personality ID -create UsbPersonalityPluginTest tester -tester SetPersonalityTestL API MS -delete tester -[Endtest] - -[Test] -title Show Query -create UsbPersonalityPluginTest tester -tester ShowQueryTestL API -delete tester -[Endtest] - -[Test] -title Show Connection Note -create UsbPersonalityPluginTest tester -tester ShowConnectionNoteTestL API MTP -delete tester -[Endtest] - -[Test] -title Create Mass Storage Plugin -create UsbPersonalityPluginTest tester -tester CreatePersonalityPluginTestL API MS -delete tester -[Endtest] - -[Test] -title Create PC Suite Plugin -create UsbPersonalityPluginTest tester -tester CreatePersonalityPluginTestL API PCS -delete tester -[Endtest] - -[Test] -title Create Media Transfer Plugin -create UsbPersonalityPluginTest tester -tester CreatePersonalityPluginTestL API MTP -delete tester -[Endtest] - -[Test] -title Prepare Personality Start -create UsbPersonalityPluginTest tester -tester PreparePersonalityStartTestL API PCS -delete tester -[Endtest] - -[Test] -title Finish Personality Start -create UsbPersonalityPluginTest tester -tester FinishPersonalityStartTestL API PCS -delete tester -[Endtest] - -[Test] -title Prepare Personality Stop -create UsbPersonalityPluginTest tester -tester PreparePersonalityStopTestL API PCS -delete tester -[Endtest] - -[Test] -title Finish Personality Stop -create UsbPersonalityPluginTest tester -tester FinishPersonalityStopTestL API PCS -delete tester -[Endtest] \ No newline at end of file diff -r 703a2b94c06c -r dde4619868dc usbservices_plat/usb_personality_plugin_api/tsrc/usbpersonalitypluginapitest/eabi/UsbPersonalityPluginTestu.def --- a/usbservices_plat/usb_personality_plugin_api/tsrc/usbpersonalitypluginapitest/eabi/UsbPersonalityPluginTestu.def Wed Sep 15 13:20:24 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,5 +0,0 @@ -EXPORTS - _Z9LibEntryLR13CTestModuleIf @ 1 NONAME - _ZTI33CUsbPersonalityPluginActiveObject @ 2 NONAME - _ZTV33CUsbPersonalityPluginActiveObject @ 3 NONAME - diff -r 703a2b94c06c -r dde4619868dc usbservices_plat/usb_personality_plugin_api/tsrc/usbpersonalitypluginapitest/group/UsbPersonalityPluginTest.mmp --- a/usbservices_plat/usb_personality_plugin_api/tsrc/usbpersonalitypluginapitest/group/UsbPersonalityPluginTest.mmp Wed Sep 15 13:20:24 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,52 +0,0 @@ -/* -* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - - -#if defined(__S60_) - // To get the OSEXT_LAYER_SYSTEMINCLUDE-definition - #include -#endif - -TARGET UsbPersonalityPluginTest.dll -TARGETTYPE dll -UID 0x1000008D 0x101FB3E3 - -//CAPABILITY ALL -TCB -CAPABILITY LocalServices ReadDeviceData NetworkControl WriteDeviceData DiskAdmin ReadUserData WriteUserData ProtServ - -DEFFILE UsbPersonalityPluginTest.def - -MW_LAYER_SYSTEMINCLUDE - -USERINCLUDE ../inc - -SOURCEPATH ../src -SOURCE UsbPersonalityPluginTest.cpp -SOURCE UsbPersonalityPluginTestBlocks.cpp UsbPersonalityPluginActiveObject.cpp - -LIBRARY euser.lib -LIBRARY stiftestinterface.lib -LIBRARY stiftestengine.lib -LIBRARY usbman.lib -LIBRARY usbpersonality.lib -LIBRARY platformver.lib -LIBRARY efsrv.lib -LIBRARY ecom.lib - -LANG SC - -// End of File diff -r 703a2b94c06c -r dde4619868dc usbservices_plat/usb_personality_plugin_api/tsrc/usbpersonalitypluginapitest/group/UsbPersonalityPluginTest_ats.pkg --- a/usbservices_plat/usb_personality_plugin_api/tsrc/usbpersonalitypluginapitest/group/UsbPersonalityPluginTest_ats.pkg Wed Sep 15 13:20:24 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,60 +0,0 @@ -; -; Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -; All rights reserved. -; This component and the accompanying materials are made available -; under the terms of "Eclipse Public License v1.0" -; which accompanies this distribution, and is available -; at the URL "http://www.eclipse.org/legal/epl-v10.html". -; -; Initial Contributors: -; Nokia Corporation - initial contribution. -; -; Contributors: -; -; Description: -; - -; Languages -&EN - -; Provide value for uid -#{"STIF"},(0x00000000),1,1,0,TYPE=SA - -; Series60 product id for S60 5.2 -[0x20022E6D], 0, 0, 0, {"Series60ProductID"} - -; Localised Vendor name -%{"Nokia"} - -; Unique Vendor name -:"Nokia" - -; Logo -; None - -; Package signature - Optional -; None - -; Start of Package body - -; Condition blocks -; None - -; Options list -; None - -; Install files -"/epoc32/release/armv5/udeb/UsbPersonalityPluginTest.dll"-"c:/Sys/Bin/UsbPersonalityPluginTest.dll" -"../init/UsbPersonalityPluginTest_ats.ini"-"e:/testing/init/UsbPersonalityPluginTest.ini" -"../conf/UsbPersonalityPluginTest.cfg"-"e:/testing/conf/UsbPersonalityPluginTest.cfg" - -; Embedded SIS -; None - -; End of Package body - -; PKG dependencies -; None - -; PKG capabilities -; None diff -r 703a2b94c06c -r dde4619868dc usbservices_plat/usb_personality_plugin_api/tsrc/usbpersonalitypluginapitest/group/UsbPersonalityPluginTest_exe.mmp --- a/usbservices_plat/usb_personality_plugin_api/tsrc/usbpersonalitypluginapitest/group/UsbPersonalityPluginTest_exe.mmp Wed Sep 15 13:20:24 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,49 +0,0 @@ -/* -* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This material, including documentation and any related computer -* programs, is protected by copyright controlled by Nokia. All -* rights are reserved. Copying, including reproducing, storing -* adapting or translating, any or all of this material requires the -* prior written consent of Nokia. This material also contains -* confidential information which may not be disclosed to others -* without the prior written consent of Nokia. -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#if defined(__S60_) - // To get the OS_LAYER_SYSTEMINCLUDE-definition - #include -#endif - -TARGET UsbPersonalityPluginTest.exe -TARGETTYPE exe -UID 0 0xEF4892C6 - -/* Specify the capabilities according to your test environment */ -CAPABILITY LocalServices ReadDeviceData NetworkControl WriteDeviceData DiskAdmin ReadUserData WriteUserData ProtServ -/* Remove comments and replace 0x00000000 with correct vendor id */ -// VENDORID 0x00000000 -/* Remove comments and replace 0x00000000 with correct secure id */ -// SECUREID 0x00000000 - -MW_LAYER_SYSTEMINCLUDE -SOURCEPATH ../src - - -SOURCE UsbPersonalityPluginTest_exe.cpp - -/* Used libraries */ -LIBRARY euser.lib -LIBRARY stiftestinterface.lib - -EPOCSTACKSIZE 40960 - -// End of File diff -r 703a2b94c06c -r dde4619868dc usbservices_plat/usb_personality_plugin_api/tsrc/usbpersonalitypluginapitest/group/UsbPersonalityPluginTest_phone.pkg --- a/usbservices_plat/usb_personality_plugin_api/tsrc/usbpersonalitypluginapitest/group/UsbPersonalityPluginTest_phone.pkg Wed Sep 15 13:20:24 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,62 +0,0 @@ -; -; Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -; All rights reserved. -; This component and the accompanying materials are made available -; under the terms of "Eclipse Public License v1.0" -; which accompanies this distribution, and is available -; at the URL "http://www.eclipse.org/legal/epl-v10.html". -; -; Initial Contributors: -; Nokia Corporation - initial contribution. -; -; Contributors: -; -; Description: -; - -; Languages -&EN - -; Provide value for uid -#{"STIF"},(0x00000000),1,1,0,TYPE=SA - -; Series60 product id for S60 5.2 -[0x20022E6D], 0, 0, 0, {"Series60ProductID"} - -; Localised Vendor name -%{"Nokia"} - -; Unique Vendor name -:"Nokia" - -; Logo -; None - -; Package signature - Optional -; None - -; Start of Package body - -; Condition blocks -; None - -; Options list -; None - -; Install files -"/epoc32/release/armv5/urel/UsbPersonalityPluginTest.dll"-"c:/Sys/Bin/UsbPersonalityPluginTest.dll" -"/epoc32/release/armv5/urel/UsbPersonalityPluginTest.exe"-"c:/Sys/Bin/UsbPersonalityPluginTest.exe" - -"../init/UsbPersonalityPluginTest_phone.ini"-"c:/testframework/testframework.ini" -"../conf/UsbPersonalityPluginTest.cfg"-"c:/testframework/UsbPersonalityPluginTest.cfg" - -; Embedded SIS -; None - -; End of Package body - -; PKG dependencies -; None - -; PKG capabilities -; None diff -r 703a2b94c06c -r dde4619868dc usbservices_plat/usb_personality_plugin_api/tsrc/usbpersonalitypluginapitest/group/bld.inf --- a/usbservices_plat/usb_personality_plugin_api/tsrc/usbpersonalitypluginapitest/group/bld.inf Wed Sep 15 13:20:24 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,32 +0,0 @@ -/* -* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - - -PRJ_PLATFORMS -DEFAULT - -PRJ_TESTEXPORTS - -PRJ_EXPORTS - -PRJ_TESTMMPFILES -UsbPersonalityPluginTest.mmp -UsbPersonalityPluginTest_exe.mmp - -PRJ_MMPFILES - -// End of File diff -r 703a2b94c06c -r dde4619868dc usbservices_plat/usb_personality_plugin_api/tsrc/usbpersonalitypluginapitest/group/build_sis_ats.bat --- a/usbservices_plat/usb_personality_plugin_api/tsrc/usbpersonalitypluginapitest/group/build_sis_ats.bat Wed Sep 15 13:20:24 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,20 +0,0 @@ -@rem -@rem Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -@rem All rights reserved. -@rem This component and the accompanying materials are made available -@rem under the terms of "Eclipse Public License v1.0" -@rem which accompanies this distribution, and is available -@rem at the URL "http://www.eclipse.org/legal/epl-v10.html". -@rem -@rem Initial Contributors: -@rem Nokia Corporation - initial contribution. -@rem -@rem Contributors: -@rem -@rem Description: -@rem - - -call sbs -c armv5.test -call makesis UsbPersonalityPluginTest_ats.pkg -call signsis UsbPersonalityPluginTest_ats.sis UsbPersonalityPluginTest_ats.sisx x:\rd.cer x:\rd-key.pem diff -r 703a2b94c06c -r dde4619868dc usbservices_plat/usb_personality_plugin_api/tsrc/usbpersonalitypluginapitest/group/build_sis_phone.bat --- a/usbservices_plat/usb_personality_plugin_api/tsrc/usbpersonalitypluginapitest/group/build_sis_phone.bat Wed Sep 15 13:20:24 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,20 +0,0 @@ -@rem -@rem Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -@rem All rights reserved. -@rem This component and the accompanying materials are made available -@rem under the terms of "Eclipse Public License v1.0" -@rem which accompanies this distribution, and is available -@rem at the URL "http://www.eclipse.org/legal/epl-v10.html". -@rem -@rem Initial Contributors: -@rem Nokia Corporation - initial contribution. -@rem -@rem Contributors: -@rem -@rem Description: -@rem - - -call sbs -c armv5.test -call makesis UsbPersonalityPluginTest_phone.pkg -call signsis UsbPersonalityPluginTest_phone.sis UsbPersonalityPluginTest_phone.sisx x:\rd.cer x:\rd-key.pem diff -r 703a2b94c06c -r dde4619868dc usbservices_plat/usb_personality_plugin_api/tsrc/usbpersonalitypluginapitest/inc/UsbPersonalityPluginActiveObject.h --- a/usbservices_plat/usb_personality_plugin_api/tsrc/usbpersonalitypluginapitest/inc/UsbPersonalityPluginActiveObject.h Wed Sep 15 13:20:24 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,83 +0,0 @@ -/* - * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). - * All rights reserved. - * This component and the accompanying materials are made available - * under the terms of "Eclipse Public License v1.0" - * which accompanies this distribution, and is available - * at the URL "http://www.eclipse.org/legal/epl-v10.html". - * - * Initial Contributors: - * Nokia Corporation - initial contribution. - * - * Contributors: - * - * Description: - * - */ - -#ifndef USBPERSONALITYPLUGINACTIVEOBJECT_H -#define USBPERSONALITYPLUGINACTIVEOBJECT_H - -#include // For CActive, link against: euser.lib -#include // For RTimer, link against: euser.lib - -#include -#include - -#include -#include -#include - - -class CUsbPersonalityPluginActiveObject : public CActive - { -public: - // Cancel and destroy - ~CUsbPersonalityPluginActiveObject(); - - // Two-phased constructor. - static CUsbPersonalityPluginActiveObject* NewL( CUsbPersonalityPlugin*, CStifLogger*, TUsbPersonalityParams* ); - - // Two-phased constructor. - static CUsbPersonalityPluginActiveObject* NewLC( CUsbPersonalityPlugin*, CStifLogger*, TUsbPersonalityParams* ); - -public: - // New functions - // Function for making the initial request - void PreparePersonalityStart( TRequestStatus& aStatus); - - void FinishPersonalityStart( TRequestStatus& aStatus); - - void PreparePersonalityStop( TRequestStatus& aStatus); - - void FinishPersonalityStop( TRequestStatus& aStatus); - - void ConfirmPersonalityUnload( TRequestStatus& aStatus); -private: - // C++ constructor - CUsbPersonalityPluginActiveObject( CUsbPersonalityPlugin*, CStifLogger*, TUsbPersonalityParams* ); - - // Second-phase constructor - void ConstructL(); - -private: - // From CActive - // Handle completion - void RunL(); - - // How to cancel me - void DoCancel(); - - // Override to handle leaves from RunL(). Default implementation causes - // the active scheduler to panic. - TInt RunError(TInt aError); - -private: - -private: - CUsbPersonalityPlugin* iPlugin; - CStifLogger* iLog; - TUsbPersonalityParams* iParams; - }; - -#endif // USBPERSONALITYPLUGINACTIVEOBJECT_H diff -r 703a2b94c06c -r dde4619868dc usbservices_plat/usb_personality_plugin_api/tsrc/usbpersonalitypluginapitest/inc/UsbPersonalityPluginTest.h --- a/usbservices_plat/usb_personality_plugin_api/tsrc/usbpersonalitypluginapitest/inc/UsbPersonalityPluginTest.h Wed Sep 15 13:20:24 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,271 +0,0 @@ -/* - * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). - * All rights reserved. - * This component and the accompanying materials are made available - * under the terms of "Eclipse Public License v1.0" - * which accompanies this distribution, and is available - * at the URL "http://www.eclipse.org/legal/epl-v10.html". - * - * Initial Contributors: - * Nokia Corporation - initial contribution. - * - * Contributors: - * - * Description: - * - */ -#ifndef USBPERSONALITYPLUGINTEST_H -#define USBPERSONALITYPLUGINTEST_H -// INCLUDES -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "UsbPersonalityPluginActiveObject.h" - -// CONSTANTS -// Logging path -_LIT( KUsbPersonalityPluginTestLogPath, "\\logs\\testframework\\UsbPersonalityPluginTest\\" ); -// Logging path for ATS - for phone builds comment this line -//_LIT( KUsbPersonalityPluginTestLogPath, "e:\\testing\\stiflogs\\" ); -// Log file -_LIT( KUsbPersonalityPluginTestLogFile, "UsbPersonalityPluginTest.txt" ); -_LIT( KUsbPersonalityPluginTestLogFileWithTitle, "UsbPersonalityPluginTest_[%S].txt" ); - -// MACROS -#define TEST_CLASS_VERSION_MAJOR 0 -#define TEST_CLASS_VERSION_MINOR 0 -#define TEST_CLASS_VERSION_BUILD 0 - -// Macros used to extract test block parameters -#define TESTENTRY( A, B )\ - if ( !iTestBlockParams.iTestBlockName.Compare( TPtrC( ( TText* ) L ##A ) ) )\ - { iTestBlockFunction = &B; iTestBlockFound = ETrue; }\ - if ( !iTestBlockParams.iTestBlockName.Compare( TPtrC( ( TText* ) L ##A ) ) ) - -#define TESTPARAM( A, B )\ - GetTestBlockParamL( ( TGetTestBlockParamOperation ) A, ( TTestBlockParamName ) B ); - -// FUNCTION PROTOTYPES - -// FORWARD DECLARATIONS - -// DATA TYPES - -// Enum type used to determine test block execution result -enum TUsbPersonalityPluginTestResult - { - ETestCasePassed, ETestCaseFailed - }; - -// Enum type indicating test block parameter which should be used to store -// data extracted from test script -enum TTestBlockParamName - { - eTestOption1, - eTestOption2, - eTestOption3, - eTestIntOption1, - eTestIntOption2, - eTestIntOption3, - eTestCharOption1, - eTestCharOption2, - eTestCharOption3 - }; - -// Enum type used to indicate which get parameter function should be used -enum TGetTestBlockParamOperation - { - eGetString, eGetInt, eGetChar - }; - -enum TUsbPersonalityIds - { - EMassStorage = 2, EMediaTransfer = 4, EPCSuite = 5 - }; -// CLASS DECLARATION -/** - * TUsbPersonalityPluginTestBlockParams test class for storing test block parameters. - */ -NONSHARABLE_CLASS( TUsbPersonalityPluginTestBlockParams ) - { -public: - TPtrC iTestBlockName; - - TPtrC iTestOption1; - TPtrC iTestOption2; - TPtrC iTestOption3; - - TInt iTestIntOption1; - TInt iTestIntOption2; - TInt iTestIntOption3; - - TChar iTestCharOption1; - TChar iTestCharOption2; - TChar iTestCharOption3; - }; - -/** - * CUsbPersonalityPluginTest test class for STIF Test Framework TestScripter. - */ -NONSHARABLE_CLASS( CUsbPersonalityPluginTest ) : public CScriptBase - { -public: - // Constructors and destructor - - /** - * Two-phased constructor. - */ - static CUsbPersonalityPluginTest* NewL(CTestModuleIf& aTestModuleIf); - - /** - * Destructor. - */ - virtual ~CUsbPersonalityPluginTest(); - -public: - // New functions -public: - // Functions from base classes - - /** - * From CScriptBase Runs a script line. - * @since ?Series60_version - * @param aItem Script line containing method name and parameters - * @return Symbian OS error code - */ - virtual TInt RunMethodL(CStifItemParser& aItem); - -protected: - // New functions -protected: - // Functions from base classes -private: - - /** - * C++ default constructor. - */ - CUsbPersonalityPluginTest(CTestModuleIf& aTestModuleIf); - - /** - * By default Symbian 2nd phase constructor is private. - */ - void ConstructL(); - - /** - * Frees all resources allocated from test methods. - * @since ?Series60_version - */ - void TestDelete(); - - /** - * Constructs all test resources for test methods. - */ - void TestConstructL(); - - /** - * Extracts test block parameters from script file - */ - void TestBlocksInfoL(); - - /** - * Executes test block - */ - TInt ExecuteTestBlock(CStifItemParser& aItem); - - /** - * Executes proper get parameter function indicated by its arguments - */ - void GetTestBlockParamL(TGetTestBlockParamOperation aOperation, - TTestBlockParamName aParamName); - - /** - * Method used to log version of test class - */ - void SendTestClassVersion(); - - // ADD NEW METHOD DEC HERE - // [TestMethods] - Do not remove - void ExampleTestL(TUsbPersonalityPluginTestBlockParams& aParams, - TUsbPersonalityPluginTestResult& aTestResult); - void InitializationTestL(TUsbPersonalityPluginTestBlockParams& aParams, - TUsbPersonalityPluginTestResult& aTestResult); - void SetPersonalityTestL(TUsbPersonalityPluginTestBlockParams& aParams, - TUsbPersonalityPluginTestResult& aTestResult); - void ShowNoteTestL(TUsbPersonalityPluginTestBlockParams& aParams, - TUsbPersonalityPluginTestResult& aTestResult); - void ShowQueryTestL(TUsbPersonalityPluginTestBlockParams& aParams, - TUsbPersonalityPluginTestResult& aTestResult); - void ShowConnectionNoteTestL( - TUsbPersonalityPluginTestBlockParams& aParams, - TUsbPersonalityPluginTestResult& aTestResult); - void CreatePersonalityPluginTestL( - TUsbPersonalityPluginTestBlockParams& aParams, - TUsbPersonalityPluginTestResult& aTestResult); - void PreparePersonalityStartTestL( - TUsbPersonalityPluginTestBlockParams& aParams, - TUsbPersonalityPluginTestResult& aTestResult); - void FinishPersonalityStartTestL( - TUsbPersonalityPluginTestBlockParams& aParams, - TUsbPersonalityPluginTestResult& aTestResult); - void PreparePersonalityStopTestL( - TUsbPersonalityPluginTestBlockParams& aParams, - TUsbPersonalityPluginTestResult& aTestResult); - void FinishPersonalityStopTestL( - TUsbPersonalityPluginTestBlockParams& aParams, - TUsbPersonalityPluginTestResult& aTestResult); - - TInt GetIdFromString(TPtrC aBuffer); - TUid GetUidFromId(TInt aId); - - void InitializeTestObjectsL(); - void DeleteTestObjects(); - -public: - // Data -protected: - // Data -private: - // Data - - // Member object used to store test block parameters - TUsbPersonalityPluginTestBlockParams iTestBlockParams; - - // Used to indicate if test block with specified parameters exist - TBool iTestBlockFound; - - // Function pointer used to call proper test block methods - void (CUsbPersonalityPluginTest::*iTestBlockFunction)( - TUsbPersonalityPluginTestBlockParams&, - TUsbPersonalityPluginTestResult&); - - // Not own - CStifItemParser* iItem; - - RUsb* iUsbMan; - CUsbPersonalityNotifier* iNotifier; - TUsbPersonalityParams* iParams; - CUsbPersonalityPlugin* iPlugin; - CUsbPersonalityPluginActiveObject* iActive; - TRequestStatus iRequestStatus; - // Reserved pointer for future extension - //TAny* iReserved; - - // ADD NEW DATA DEC HERE - - -public: - // Friend classes -protected: - // Friend classes -private: - // Friend classes - - }; -#endif // USBPERSONALITYPLUGINTEST_H -// End of File diff -r 703a2b94c06c -r dde4619868dc usbservices_plat/usb_personality_plugin_api/tsrc/usbpersonalitypluginapitest/inc/UsbPersonalityPluginTestDebug.inl --- a/usbservices_plat/usb_personality_plugin_api/tsrc/usbpersonalitypluginapitest/inc/UsbPersonalityPluginTestDebug.inl Wed Sep 15 13:20:24 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,93 +0,0 @@ -/* -* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#include - -NONSHARABLE_CLASS( TOverflowTruncate8 ) : public TDes8Overflow - { -public: - void Overflow( TDes8& /*aDes*/ ) {} - }; - -NONSHARABLE_CLASS( TOverflowTruncate16 ) : public TDes16Overflow - { -public: - void Overflow( TDes16& /*aDes*/ ) {} - }; - -_LIT8(KStifTestPrefix8, "[STIF_LOG] "); -_LIT( KStifTestPrefix, "[STIF_LOG] "); -_LIT8( KStifEntryPrefix8, ">>> %S" ); -_LIT8( KStifExitPrefix8, "<<< %S" ); - -const TInt KMaxLogLineLength = 512; - -#define TRACE_INFO( p ) { Trace p; } -#define TRACE_FUNC_ENTRY { TPtrC8 ptr8( ( TUint8* ) __FUNCTION__ ); Trace( KStifEntryPrefix8, &ptr8 ); } -#define TRACE_FUNC_EXIT { TPtrC8 ptr8( ( TUint8* ) __FUNCTION__ ); Trace( KStifExitPrefix8, &ptr8 ); } - -void CUsbPersonalityPluginTest::Trace(TRefByValue aFmt, ...) - { - VA_LIST list; - VA_START( list, aFmt ); - TOverflowTruncate8 overflow; - - RBuf8 buf8; - RBuf8 bufStifLog8; - - buf8.Create( KMaxLogLineLength ); - buf8.Append( KStifTestPrefix8 ); - buf8.AppendFormatList( aFmt, list, &overflow ); - bufStifLog8.Create( KMaxLogLineLength ); - bufStifLog8.AppendFormatList( aFmt, list, &overflow ); - - RBuf16 buf16; - RBuf16 bufStifLog16; - - buf16.Create( KMaxLogLineLength ); - buf16.Copy( buf8 ); - bufStifLog16.Create( KMaxLogLineLength ); - bufStifLog16.Copy( bufStifLog8 ); - - RDebug::Print( buf16 ); - iLog->Log( bufStifLog16 ); - buf8.Close(); - bufStifLog8.Close(); - buf16.Close(); - bufStifLog16.Close(); - }; - -void CUsbPersonalityPluginTest::Trace(TRefByValue aFmt, ...) - { - VA_LIST list; - VA_START(list,aFmt); - TOverflowTruncate16 overflow; - - RBuf16 buf; - RBuf16 bufStifLog; - - buf.Create( KMaxLogLineLength ); - buf.Append( KStifTestPrefix ); - buf.AppendFormatList( aFmt, list, &overflow ); - bufStifLog.Create( KMaxLogLineLength ); - bufStifLog.AppendFormatList( aFmt, list, &overflow ); - - RDebug::Print( buf ); - iLog->Log( bufStifLog ); - buf.Close(); - bufStifLog.Close(); - }; diff -r 703a2b94c06c -r dde4619868dc usbservices_plat/usb_personality_plugin_api/tsrc/usbpersonalitypluginapitest/inc/testdebug.h --- a/usbservices_plat/usb_personality_plugin_api/tsrc/usbpersonalitypluginapitest/inc/testdebug.h Wed Sep 15 13:20:24 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,66 +0,0 @@ -/* -* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifndef TESTDEBUG_H_ -#define TESTDEBUG_H_ - -// INCLUDES -#include -#include - -// CONSTANTS -_LIT8(KStifTestPrefix8, "[STIF_LOG] "); -_LIT( KStifTestPrefix, "[STIF_LOG] "); -_LIT8( KStifEntryPrefix8, ">>> %S" ); -_LIT8( KStifExitPrefix8, "<<< %S" ); - -const TInt KMaxLogLineLength = 512; -typedef TBuf8< KMaxLogLineLength > TLogBuf8; -typedef TBuf16< KMaxLogLineLength > TLogBuf16; - -// CLASS DECLARATION -NONSHARABLE_CLASS( TTestLogger ) - { -public: - static inline TLogBuf16 CreateLogBuf( TRefByValue aFmt, ... ); - static inline TLogBuf16 CreateLogBuf( TRefByValue aFmt, ... ); - static inline void Trace( CStifLogger& aLog, TLogBuf16 aLogBuf ); - }; - -// MACROS -#define TRACE( p ) {\ - TLogBuf16 buf = TTestLogger::CreateLogBuf( _L( p ) );\ - TTestLogger::Trace( *iLog, buf );\ - } -#define TRACE_INFO( p, args... ) {\ - TLogBuf16 buf = TTestLogger::CreateLogBuf( _L( p ), args );\ - TTestLogger::Trace( *iLog, buf );\ - } -#define TRACE_FUNC_ENTRY {\ - TPtrC8 ptr8( ( TUint8* ) __FUNCTION__ );\ - TLogBuf16 buf = TTestLogger::CreateLogBuf( KStifEntryPrefix8, &ptr8 );\ - TTestLogger::Trace( *iLog, buf );\ - } -#define TRACE_FUNC_EXIT {\ - TPtrC8 ptr8( ( TUint8* ) __FUNCTION__ );\ - TLogBuf16 buf = TTestLogger::CreateLogBuf( KStifExitPrefix8, &ptr8 );\ - TTestLogger::Trace( *iLog, buf );\ - } - -#include "testdebug.inl" - -#endif /* TESTDEBUG_H_ */ diff -r 703a2b94c06c -r dde4619868dc usbservices_plat/usb_personality_plugin_api/tsrc/usbpersonalitypluginapitest/inc/testdebug.inl --- a/usbservices_plat/usb_personality_plugin_api/tsrc/usbpersonalitypluginapitest/inc/testdebug.inl Wed Sep 15 13:20:24 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,69 +0,0 @@ -/* -* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#include - -NONSHARABLE_CLASS( TOverflowTruncate8 ) : public TDes8Overflow - { -public: - void Overflow( TDes8& /*aDes*/ ) {} - }; - -NONSHARABLE_CLASS( TOverflowTruncate16 ) : public TDes16Overflow - { -public: - void Overflow( TDes16& /*aDes*/ ) {} - }; - -TLogBuf16 TTestLogger::CreateLogBuf( TRefByValue aFmt, ... ) - { - VA_LIST list; - VA_START( list, aFmt ); - TOverflowTruncate8 overflow; - TLogBuf8 buf8; - TLogBuf16 buf16; - buf8.AppendFormatList( aFmt, list, &overflow ); - buf16.Copy( buf8 ); - return buf16; - }; - -TLogBuf16 TTestLogger::CreateLogBuf( TRefByValue aFmt, ... ) - { - VA_LIST list; - VA_START( list, aFmt ); - TOverflowTruncate16 overflow; - TLogBuf16 buf16; - buf16.AppendFormatList( aFmt, list, &overflow ); - return buf16; - }; - -void TTestLogger::Trace( CStifLogger& aLog, TLogBuf16 aLogBuf ) - { - RBuf16 buf; - RBuf16 bufStifLog; - - buf.Create( KMaxLogLineLength ); - buf.Append( KStifTestPrefix ); - buf.Append( aLogBuf ); - bufStifLog.Create( KMaxLogLineLength ); - bufStifLog.Append( aLogBuf ); - - RDebug::Print( buf ); - aLog.Log( bufStifLog ); - buf.Close(); - bufStifLog.Close(); - }; diff -r 703a2b94c06c -r dde4619868dc usbservices_plat/usb_personality_plugin_api/tsrc/usbpersonalitypluginapitest/init/UsbPersonalityPluginTest_ats.ini --- a/usbservices_plat/usb_personality_plugin_api/tsrc/usbpersonalitypluginapitest/init/UsbPersonalityPluginTest_ats.ini Wed Sep 15 13:20:24 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,233 +0,0 @@ -# Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -# All rights reserved. -# This component and the accompanying materials are made available -# under the terms of "Eclipse Public License v1.0" -# which accompanies this distribution, and is available -# at the URL "http://www.eclipse.org/legal/epl-v10.html". -# -# Initial Contributors: -# Nokia Corporation - initial contribution. -# -# Contributors: -# -# Description: -# - -# -# This is STIF initialization file -# Comment lines start with '#'-character. -# See STIF TestFramework users guide.doc for instructions - -# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -# Set following test engine settings: -# - Set Test Reporting mode. TestReportMode's possible values are: -# + 'Summary': Summary of the tested test cases. -# + 'Environment': Hardware and software info. -# + 'TestCases': Test case report. -# + 'FullReport': Set of all above ones. -# + Example 'TestReportMode= Summary TestCases' -# -# - CreateTestReport setting controls report creation mode -# + YES, Test report will created. -# + NO, No Test report. -# -# - File path indicates the base path of the test report. -# - File name indicates the name of the test report. -# -# - File format indicates the type of the test report. -# + TXT, Test report file will be txt type, for example 'TestReport.txt'. -# + HTML, Test report will be html type, for example 'TestReport.html'. -# + XML, Test report will be xml type, for example 'TestReport.xml'. -# Note, that xml format is available only when output is set to FILE. -# -# - File output indicates output source of the test report. -# + FILE, Test report logging to file. -# + RDEBUG, Test report logging to using rdebug. -# -# - File Creation Mode indicates test report overwriting if file exist. -# + OVERWRITE, Overwrites if the Test report file exist. -# + APPEND, Continue logging after the old Test report information if -# report exist. -# - Sets a device reset module's dll name(Reboot). -# + If Nokia specific reset module is not available or it is not correct one -# StifHWResetStub module may use as a template for user specific reset -# module. -# - Sets STIF test measurement disable options. e.g. pluging1 and pluging2 disablation -# DisableMeasurement= stifmeasurementplugin01 stifmeasurementplugin02 -# - -[Engine_Defaults] - -TestReportMode= FullReport # Possible values are: 'Empty', 'Summary', 'Environment', - 'TestCases' or 'FullReport' - -CreateTestReport= YES # Possible values: YES or NO - -TestReportFilePath= e:\testing\logs\ -TestReportFileName= UsbPersonalityPluginTest_TestReport - -TestReportFormat= TXT # Possible values: TXT, HTML or XML -TestReportOutput= FILE # Possible values: FILE or RDEBUG -TestReportFileCreationMode= OVERWRITE # Possible values: OVERWRITE or APPEND - -DeviceResetDllName= StifResetForNokia.dll # e.g. 'StifHWResetStub.dll' for user specific reseting - -DisableMeasurement= stifmeasurementdisablenone # Possible values are: - # 'stifmeasurementdisablenone', 'stifmeasurementdisableall' - # 'stifmeasurementplugin01', 'stifmeasurementplugin02', - # 'stifmeasurementplugin03', 'stifmeasurementplugin04', - # 'stifmeasurementplugin05' or 'stifbappeaprofiler' - -Timeout= 0 # Default timeout value for each test case. In milliseconds -UITestingSupport= YES # Possible values: YES or NO -#SeparateProcesses= YES # Possible values: YES or NO (default: NO) -[End_Defaults] -# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - - - -# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -# Module configurations start -# Modules are added between module tags -# tags. Module name is specified after ModuleName= tag, like -# ModuleName= UsbPersonalityPluginTestUsbPersonalityPluginTestUsbPersonalityPluginTest -# Modules might have initialisation file, specified as -# IniFile= c:\testframework\YYYYYY -# Modules might have several configuration files, like -# TestCaseFile= c:\testframework\NormalCases.txt -# TestCaseFile= c:\testframework\SmokeCases.txt -# TestCaseFile= c:\testframework\ManualCases.txt - -# (TestCaseFile is synonym for old term ConfigFile) - -# Following case specifies demo module settings. Demo module -# does not read any settings from file, so tags -# IniFile and TestCaseFile are not used. -# In the simplest case it is enough to specify only the -# name of the test module when adding new test module - -[New_Module] -ModuleName= testscripter -TestCaseFile= e:\testing\conf\UsbPersonalityPluginTest.cfg -[End_Module] - - -# Load testmoduleUsbPersonalityPluginTest, optionally with initialization file and/or test case files -#[New_Module] -#ModuleName= testmodulexxx - -#TestModuleUsbPersonalityPluginTest used initialization file -#IniFile= c:\testframework\init.txt - -#TestModuleUsbPersonalityPluginTest used configuration file(s) -#TestCaseFile= c:\testframework\testcases1.cfg -#TestCaseFile= c:\testframework\testcases2.cfg -#TestCaseFile= c:\testframework\manualtestcases.cfg - -#[End_Module] -# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - - - -# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -# Set STIF logging overwrite parameters for Logger. -# Hardware and emulator environment logging path and styles can -# be configured from here to overwrite the Logger's implemented values. -# -# Settings description: -# - Indicates option for creation log directory/directories. If log directory/directories -# is/are not created by user they will make by software. -# + YES, Create log directory/directories if not allready exist. -# + NO, Log directory/directories not created. Only created one is used. -# -# - Overwrite emulator path setting. -# + Example: If 'EmulatorBasePath= C:\LOGS\TestFramework\' and in code is defined -# Logger's path 'D:\\LOGS\\Module\\' with those definition the path -# will be 'C:\LOGS\TestFramework\LOGS\Module\' -# -# - Overwrite emulator's logging format. -# + TXT, Log file(s) will be txt type(s), for example 'Module.txt'. -# + HTML, Log file(s) will be html type(s), for example 'Module.html'. -# -# - Overwrited emulator logging output source. -# + FILE, Logging to file(s). -# + RDEBUG, Logging to using rdebug(s). -# -# - Overwrite hardware path setting (Same description as above in emulator path). -# - Overwrite hardware's logging format(Same description as above in emulator format). -# - Overwrite hardware's logging output source(Same description as above in emulator output). -# -# - File Creation Mode indicates file overwriting if file exist. -# + OVERWRITE, Overwrites if file(s) exist. -# + APPEND, Continue logging after the old logging information if file(s) exist. -# -# - Will thread id include to the log filename. -# + YES, Thread id to log file(s) name, Example filename 'Module_b9.txt'. -# + NO, No thread id to log file(s), Example filename 'Module.txt'. -# -# - Will time stamps include the to log file. -# + YES, Time stamp added to each line in log file(s). Time stamp is -# for example'12.Nov.2003 115958 LOGGING INFO' -# + NO, No time stamp(s). -# -# - Will line breaks include to the log file. -# + YES, Each logging event includes line break and next log event is in own line. -# + NO, No line break(s). -# -# - Will event ranking include to the log file. -# + YES, Event ranking number added to each line in log file(s). Ranking number -# depends on environment's tics, for example(includes time stamp also) -# '012 12.Nov.2003 115958 LOGGING INFO' -# + NO, No event ranking. -# -# - Will write log file in unicode format. -# + YES, Log file will be written in unicode format -# + NO, Log will be written as normal, not unicode, file. -# - -[Logger_Defaults] - -#NOTE: If you want to set Logger using next setting(s) remove comment(s)'#' -#NOTE: TestEngine and TestServer logging settings cannot change here - -#CreateLogDirectories= YES # Possible values: YES or NO - -#EmulatorBasePath= C:\LOGS\TestFramework\ -#EmulatorFormat= HTML # Possible values: TXT or HTML -#EmulatorOutput= FILE # Possible values: FILE or RDEBUG - -#HardwareBasePath= D:\LOGS\TestFramework\ -#HardwareFormat= HTML # Possible values: TXT or HTML -#HardwareOutput= FILE # Possible values: FILE or RDEBUG - -#FileCreationMode= OVERWRITE # Possible values: OVERWRITE or APPEND - -#ThreadIdToLogFile= YES # Possible values: YES or NO -#WithTimeStamp= YES # Possible values: YES or NO -#WithLineBreak= YES # Possible values: YES or NO -#WithEventRanking= YES # Possible values: YES or NO - -#FileUnicode= YES # Possible values: YES or NO -#AddTestCaseTitle= YES # Possible values: YES or NO -[End_Logger_Defaults] -# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - - - -# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -# Set filters to be used by ConsoleUI. -# If you want to use filter with ConsoleUI, simply remove comments -# from section below and provide valid filter entries. -# Each filter line has to start with "filter= " keyword. -# Filter can contain special wildcard characters: -# * which stands for none or any literal; -# ? which stands for single character. -# Filters are not case-sensitive. - -#[Filters] -#filter= *math* -#filter= *radio* -#[End_Filters] -# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - -# End of file diff -r 703a2b94c06c -r dde4619868dc usbservices_plat/usb_personality_plugin_api/tsrc/usbpersonalitypluginapitest/init/UsbPersonalityPluginTest_phone.ini --- a/usbservices_plat/usb_personality_plugin_api/tsrc/usbpersonalitypluginapitest/init/UsbPersonalityPluginTest_phone.ini Wed Sep 15 13:20:24 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,234 +0,0 @@ -# Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -# All rights reserved. -# This component and the accompanying materials are made available -# under the terms of "Eclipse Public License v1.0" -# which accompanies this distribution, and is available -# at the URL "http://www.eclipse.org/legal/epl-v10.html". -# -# Initial Contributors: -# Nokia Corporation - initial contribution. -# -# Contributors: -# -# Description: -# - - -# -# This is STIF initialization file -# Comment lines start with '#'-character. -# See STIF TestFramework users guide.doc for instructions - -# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -# Set following test engine settings: -# - Set Test Reporting mode. TestReportMode's possible values are: -# + 'Summary': Summary of the tested test cases. -# + 'Environment': Hardware and software info. -# + 'TestCases': Test case report. -# + 'FullReport': Set of all above ones. -# + Example 'TestReportMode= Summary TestCases' -# -# - CreateTestReport setting controls report creation mode -# + YES, Test report will created. -# + NO, No Test report. -# -# - File path indicates the base path of the test report. -# - File name indicates the name of the test report. -# -# - File format indicates the type of the test report. -# + TXT, Test report file will be txt type, for example 'TestReport.txt'. -# + HTML, Test report will be html type, for example 'TestReport.html'. -# + XML, Test report will be xml type, for example 'TestReport.xml'. -# Note, that xml format is available only when output is set to FILE. -# -# - File output indicates output source of the test report. -# + FILE, Test report logging to file. -# + RDEBUG, Test report logging to using rdebug. -# -# - File Creation Mode indicates test report overwriting if file exist. -# + OVERWRITE, Overwrites if the Test report file exist. -# + APPEND, Continue logging after the old Test report information if -# report exist. -# - Sets a device reset module's dll name(Reboot). -# + If Nokia specific reset module is not available or it is not correct one -# StifHWResetStub module may use as a template for user specific reset -# module. -# - Sets STIF test measurement disable options. e.g. pluging1 and pluging2 disablation -# DisableMeasurement= stifmeasurementplugin01 stifmeasurementplugin02 -# - -[Engine_Defaults] - -TestReportMode= FullReport # Possible values are: 'Empty', 'Summary', 'Environment', - 'TestCases' or 'FullReport' - -CreateTestReport= YES # Possible values: YES or NO - -TestReportFilePath= c:\logs\testframework\UsbPersonalityPluginTest\ -TestReportFileName= testreport - -TestReportFormat= TXT # Possible values: TXT, HTML or XML -TestReportOutput= FILE # Possible values: FILE or RDEBUG -TestReportFileCreationMode= OVERWRITE # Possible values: OVERWRITE or APPEND - -DeviceResetDllName= StifResetForNokia.dll # e.g. 'StifHWResetStub.dll' for user specific reseting - -DisableMeasurement= stifmeasurementdisablenone # Possible values are: - # 'stifmeasurementdisablenone', 'stifmeasurementdisableall' - # 'stifmeasurementplugin01', 'stifmeasurementplugin02', - # 'stifmeasurementplugin03', 'stifmeasurementplugin04', - # 'stifmeasurementplugin05' or 'stifbappeaprofiler' - -Timeout= 0 # Default timeout value for each test case. In milliseconds -UITestingSupport= YES # Possible values: YES or NO -#SeparateProcesses= YES # Possible values: YES or NO (default: NO) -[End_Defaults] -# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - - - -# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -# Module configurations start -# Modules are added between module tags -# tags. Module name is specified after ModuleName= tag, like -# ModuleName= UsbPersonalityPluginTestUsbPersonalityPluginTestUsbPersonalityPluginTest -# Modules might have initialisation file, specified as -# IniFile= c:\testframework\YYYYYY -# Modules might have several configuration files, like -# TestCaseFile= c:\testframework\NormalCases.txt -# TestCaseFile= c:\testframework\SmokeCases.txt -# TestCaseFile= c:\testframework\ManualCases.txt - -# (TestCaseFile is synonym for old term ConfigFile) - -# Following case specifies demo module settings. Demo module -# does not read any settings from file, so tags -# IniFile and TestCaseFile are not used. -# In the simplest case it is enough to specify only the -# name of the test module when adding new test module - -[New_Module] -ModuleName= testscripter -TestCaseFile= c:\testframework\UsbPersonalityPluginTest.cfg -[End_Module] - - -# Load testmoduleUsbPersonalityPluginTest, optionally with initialization file and/or test case files -#[New_Module] -#ModuleName= testmodulexxx - -#TestModuleUsbPersonalityPluginTest used initialization file -#IniFile= c:\testframework\init.txt - -#TestModuleUsbPersonalityPluginTest used configuration file(s) -#TestCaseFile= c:\testframework\testcases1.cfg -#TestCaseFile= c:\testframework\testcases2.cfg -#TestCaseFile= c:\testframework\manualtestcases.cfg - -#[End_Module] -# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - - - -# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -# Set STIF logging overwrite parameters for Logger. -# Hardware and emulator environment logging path and styles can -# be configured from here to overwrite the Logger's implemented values. -# -# Settings description: -# - Indicates option for creation log directory/directories. If log directory/directories -# is/are not created by user they will make by software. -# + YES, Create log directory/directories if not allready exist. -# + NO, Log directory/directories not created. Only created one is used. -# -# - Overwrite emulator path setting. -# + Example: If 'EmulatorBasePath= C:\LOGS\TestFramework\' and in code is defined -# Logger's path 'D:\\LOGS\\Module\\' with those definition the path -# will be 'C:\LOGS\TestFramework\LOGS\Module\' -# -# - Overwrite emulator's logging format. -# + TXT, Log file(s) will be txt type(s), for example 'Module.txt'. -# + HTML, Log file(s) will be html type(s), for example 'Module.html'. -# -# - Overwrited emulator logging output source. -# + FILE, Logging to file(s). -# + RDEBUG, Logging to using rdebug(s). -# -# - Overwrite hardware path setting (Same description as above in emulator path). -# - Overwrite hardware's logging format(Same description as above in emulator format). -# - Overwrite hardware's logging output source(Same description as above in emulator output). -# -# - File Creation Mode indicates file overwriting if file exist. -# + OVERWRITE, Overwrites if file(s) exist. -# + APPEND, Continue logging after the old logging information if file(s) exist. -# -# - Will thread id include to the log filename. -# + YES, Thread id to log file(s) name, Example filename 'Module_b9.txt'. -# + NO, No thread id to log file(s), Example filename 'Module.txt'. -# -# - Will time stamps include the to log file. -# + YES, Time stamp added to each line in log file(s). Time stamp is -# for example'12.Nov.2003 115958 LOGGING INFO' -# + NO, No time stamp(s). -# -# - Will line breaks include to the log file. -# + YES, Each logging event includes line break and next log event is in own line. -# + NO, No line break(s). -# -# - Will event ranking include to the log file. -# + YES, Event ranking number added to each line in log file(s). Ranking number -# depends on environment's tics, for example(includes time stamp also) -# '012 12.Nov.2003 115958 LOGGING INFO' -# + NO, No event ranking. -# -# - Will write log file in unicode format. -# + YES, Log file will be written in unicode format -# + NO, Log will be written as normal, not unicode, file. -# - -[Logger_Defaults] - -#NOTE: If you want to set Logger using next setting(s) remove comment(s)'#' -#NOTE: TestEngine and TestServer logging settings cannot change here - -#CreateLogDirectories= YES # Possible values: YES or NO - -#EmulatorBasePath= C:\LOGS\TestFramework\ -#EmulatorFormat= HTML # Possible values: TXT or HTML -#EmulatorOutput= FILE # Possible values: FILE or RDEBUG - -#HardwareBasePath= D:\LOGS\TestFramework\ -#HardwareFormat= HTML # Possible values: TXT or HTML -#HardwareOutput= FILE # Possible values: FILE or RDEBUG - -#FileCreationMode= OVERWRITE # Possible values: OVERWRITE or APPEND - -#ThreadIdToLogFile= YES # Possible values: YES or NO -#WithTimeStamp= YES # Possible values: YES or NO -#WithLineBreak= YES # Possible values: YES or NO -#WithEventRanking= YES # Possible values: YES or NO - -#FileUnicode= YES # Possible values: YES or NO -#AddTestCaseTitle= YES # Possible values: YES or NO -[End_Logger_Defaults] -# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - - - -# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -# Set filters to be used by ConsoleUI. -# If you want to use filter with ConsoleUI, simply remove comments -# from section below and provide valid filter entries. -# Each filter line has to start with "filter= " keyword. -# Filter can contain special wildcard characters: -# * which stands for none or any literal; -# ? which stands for single character. -# Filters are not case-sensitive. - -#[Filters] -#filter= *math* -#filter= *radio* -#[End_Filters] -# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - -# End of file diff -r 703a2b94c06c -r dde4619868dc usbservices_plat/usb_personality_plugin_api/tsrc/usbpersonalitypluginapitest/src/UsbPersonalityPluginActiveObject.cpp --- a/usbservices_plat/usb_personality_plugin_api/tsrc/usbpersonalitypluginapitest/src/UsbPersonalityPluginActiveObject.cpp Wed Sep 15 13:20:24 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,113 +0,0 @@ -/* - * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). - * All rights reserved. - * This component and the accompanying materials are made available - * under the terms of "Eclipse Public License v1.0" - * which accompanies this distribution, and is available - * at the URL "http://www.eclipse.org/legal/epl-v10.html". - * - * Initial Contributors: - * Nokia Corporation - initial contribution. - * - * Contributors: - * - * Description: - * - */ - -#include "UsbPersonalityPluginActiveObject.h" - -CUsbPersonalityPluginActiveObject::CUsbPersonalityPluginActiveObject( CUsbPersonalityPlugin* aPlugin, CStifLogger* aLog, TUsbPersonalityParams* aParams) : CActive( EPriorityStandard ) // Standard priority - { - iPlugin = aPlugin; - iLog = aLog; - iParams = aParams; - } - -CUsbPersonalityPluginActiveObject* CUsbPersonalityPluginActiveObject::NewLC(CUsbPersonalityPlugin* aPlugin, CStifLogger* aLog, TUsbPersonalityParams* aParams) - { - CUsbPersonalityPluginActiveObject* self = - new (ELeave) CUsbPersonalityPluginActiveObject( aPlugin, aLog, aParams); - CleanupStack::PushL(self); - self->ConstructL(); - return self; - } - -CUsbPersonalityPluginActiveObject* CUsbPersonalityPluginActiveObject::NewL(CUsbPersonalityPlugin* aPlugin, CStifLogger* aLog, TUsbPersonalityParams* aParams) - { - CUsbPersonalityPluginActiveObject* self = - CUsbPersonalityPluginActiveObject::NewLC( aPlugin, aLog, aParams); - CleanupStack::Pop(); // self; - return self; - } - -void CUsbPersonalityPluginActiveObject::ConstructL() - { - CActiveScheduler::Add(this); // Add to scheduler - } - -CUsbPersonalityPluginActiveObject::~CUsbPersonalityPluginActiveObject() - { - Cancel(); // Cancel any request, if outstanding - // Delete instance variables if any - } - -void CUsbPersonalityPluginActiveObject::DoCancel() - { - } - -void CUsbPersonalityPluginActiveObject::RunL() - { - CActiveScheduler::Stop(); - } - -TInt CUsbPersonalityPluginActiveObject::RunError(TInt aError) - { - return aError; - } - -void CUsbPersonalityPluginActiveObject::PreparePersonalityStart( TRequestStatus& aStatus) - { - iPlugin->PreparePersonalityStart(aStatus); - RDebug::Printf( "prepare personality start, status: %d", aStatus.Int()); - - SetActive(); - CActiveScheduler::Start(); - } - -void CUsbPersonalityPluginActiveObject::FinishPersonalityStart( TRequestStatus& aStatus) - { - iPlugin->FinishPersonalityStart(aStatus); - RDebug::Printf( "finish personality start, status: %d", aStatus.Int()); - - SetActive(); - CActiveScheduler::Start(); - } - -void CUsbPersonalityPluginActiveObject::PreparePersonalityStop( TRequestStatus& aStatus) - { - iPlugin->PreparePersonalityStop(aStatus); - RDebug::Printf( "prepare personality start, status: %d", aStatus.Int()); - - SetActive(); - CActiveScheduler::Start(); - } - -void CUsbPersonalityPluginActiveObject::FinishPersonalityStop( TRequestStatus& aStatus) - { - iPlugin->FinishPersonalityStop(aStatus); - RDebug::Printf( "finish personality start, status: %d", aStatus.Int()); - - SetActive(); - CActiveScheduler::Start(); - } - -void CUsbPersonalityPluginActiveObject::ConfirmPersonalityUnload( TRequestStatus& aStatus) - { - iPlugin->ConfirmPersonalityUnload(aStatus); - RDebug::Printf( "confirm personality unload, status: %d", aStatus.Int()); - - iParams->PersonalityNotifier().CancelQuery(KQueriesNotifier); - SetActive(); - CActiveScheduler::Start(); - } diff -r 703a2b94c06c -r dde4619868dc usbservices_plat/usb_personality_plugin_api/tsrc/usbpersonalitypluginapitest/src/UsbPersonalityPluginTest.cpp --- a/usbservices_plat/usb_personality_plugin_api/tsrc/usbpersonalitypluginapitest/src/UsbPersonalityPluginTest.cpp Wed Sep 15 13:20:24 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,326 +0,0 @@ -/* -* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -// INCLUDE FILES -#include -#include "UsbPersonalityPluginTest.h" -#include -#include "testdebug.h" - -// EXTERNAL DATA STRUCTURES - -// EXTERNAL FUNCTION PROTOTYPES - -// CONSTANTS - -// MACROS - -// LOCAL CONSTANTS AND MACROS - -// MODULE DATA STRUCTURES - -// LOCAL FUNCTION PROTOTYPES - -// FORWARD DECLARATIONS - -// ============================= LOCAL FUNCTIONS =============================== - -// ----------------------------------------------------------------------------- -// ----------------------------------------------------------------------------- - -// ============================ MEMBER FUNCTIONS =============================== - -// ----------------------------------------------------------------------------- -// CUsbPersonalityPluginTest::CUsbPersonalityPluginTest -// C++ default constructor can NOT contain any code, that -// might leave. -// ----------------------------------------------------------------------------- -// -CUsbPersonalityPluginTest::CUsbPersonalityPluginTest( - CTestModuleIf& aTestModuleIf ): - CScriptBase( aTestModuleIf ) - { - } - -// ----------------------------------------------------------------------------- -// CUsbPersonalityPluginTest::ConstructL -// Symbian 2nd phase constructor can leave. -// ----------------------------------------------------------------------------- -// -void CUsbPersonalityPluginTest::ConstructL() - { - //Read logger settings to check whether test case name is to be - //appended to log file name. - RSettingServer settingServer; - TInt ret = settingServer.Connect(); - if(ret != KErrNone) - { - User::Leave(ret); - } - // Struct to StifLogger settigs. - TLoggerSettings loggerSettings; - // Parse StifLogger defaults from STIF initialization file. - ret = settingServer.GetLoggerSettings( loggerSettings ); - if( ret != KErrNone ) - { - User::Leave( ret ); - } - // Close Setting server session - settingServer.Close(); - - TFileName logFileName; - - if( loggerSettings.iAddTestCaseTitle ) - { - TName title; - TestModuleIf().GetTestCaseTitleL( title ); - logFileName.Format( KUsbPersonalityPluginTestLogFileWithTitle, &title ); - } - else - { - logFileName.Copy( KUsbPersonalityPluginTestLogFile ); - } - - iLog = CStifLogger::NewL( KUsbPersonalityPluginTestLogPath, - logFileName, - CStifLogger::ETxt, - CStifLogger::EFile, - EFalse ); - - SendTestClassVersion(); - TestConstructL(); - } - -// ----------------------------------------------------------------------------- -// CUsbPersonalityPluginTest::NewL -// Two-phased constructor. -// ----------------------------------------------------------------------------- -// -CUsbPersonalityPluginTest* CUsbPersonalityPluginTest::NewL( - CTestModuleIf& aTestModuleIf ) - { - CUsbPersonalityPluginTest* self = new (ELeave) CUsbPersonalityPluginTest( aTestModuleIf ); - CleanupStack::PushL( self ); - self->ConstructL(); - CleanupStack::Pop(); - return self; - } - -// Destructor -CUsbPersonalityPluginTest::~CUsbPersonalityPluginTest() - { - - // Delete resources allocated from test methods - TestDelete(); - - // Delete logger - delete iLog; - - } - -// ----------------------------------------------------------------------------- -// CUsbPersonalityPluginTest::RunMethodL -// Run specified method. Contains also table of test mothods and their names. -// ----------------------------------------------------------------------------- - -TInt CUsbPersonalityPluginTest::RunMethodL( - CStifItemParser& aItem ) - { - return ExecuteTestBlock( aItem ); - } - -// ----------------------------------------------------------------------------- -// CUsbPersonalityPluginTest::ExecuteTestBlock -// ----------------------------------------------------------------------------- - -TInt CUsbPersonalityPluginTest::ExecuteTestBlock( CStifItemParser& aItem ) - { - TRACE_FUNC_ENTRY - iItem = &aItem; - TInt res; - TUsbPersonalityPluginTestResult testResult; - - res = iItem -> GetString( _L( "tester" ), iTestBlockParams.iTestBlockName ); - if ( res != KErrNone ) - { - TRACE_INFO( "Getting test block name failed with: %d", res ) - TRACE_FUNC_EXIT - return res; - } - TRACE_INFO( "Test block name: %S", &iTestBlockParams.iTestBlockName ) - - TRACE( "Extracting test block parameters..." ) - TRAP( res, TestBlocksInfoL() ); - if ( res != KErrNone ) - { - TRACE_INFO( "Extracting parameters failed: %d", res ) - TRACE_FUNC_EXIT - return res; - } - if ( !iTestBlockFound ) - { - TRACE( "Test block not found!" ) - TRACE_FUNC_EXIT - return KErrNotFound; - } - TRACE( "Extracting parameters successful" ) - - TRAP( res, ( this ->*iTestBlockFunction )( iTestBlockParams, testResult ) ); - if ( res != KErrNone ) - { - TRACE_INFO( "ExecuteTestBlockL error: %d", res ) - TRACE_FUNC_EXIT - return res; - } - - STIF_ASSERT_EQUALS( ETestCasePassed, testResult ); - TRACE( "Test block passed!" ); - TRACE_FUNC_EXIT - return KErrNone; - } - -// ----------------------------------------------------------------------------- -// CUsbPersonalityPluginTest::GetTestBlockParamL -// ----------------------------------------------------------------------------- - -void CUsbPersonalityPluginTest::GetTestBlockParamL( TGetTestBlockParamOperation aOperation, TTestBlockParamName aParamName ) - { - switch( aOperation ) - { - case eGetString: - { - switch ( aParamName ) - { - case eTestOption1: - { - User::LeaveIfError( iItem -> GetNextString( iTestBlockParams.iTestOption1 ) ); - break; - } - case eTestOption2: - { - User::LeaveIfError( iItem -> GetNextString( iTestBlockParams.iTestOption2 ) ); - break; - } - case eTestOption3: - { - User::LeaveIfError( iItem -> GetNextString( iTestBlockParams.iTestOption3 ) ); - break; - } - default: - { - User::Leave( KErrArgument ); - break; - } - } - break; - } - case eGetInt: - { - switch ( aParamName ) - { - case eTestIntOption1: - { - User::LeaveIfError( iItem -> GetNextInt( iTestBlockParams.iTestIntOption1 ) ); - break; - } - case eTestIntOption2: - { - User::LeaveIfError( iItem -> GetNextInt( iTestBlockParams.iTestIntOption2 ) ); - break; - } - case eTestIntOption3: - { - User::LeaveIfError( iItem -> GetNextInt( iTestBlockParams.iTestIntOption3 ) ); - break; - } - default: - { - User::Leave( KErrArgument ); - break; - } - } - break; - } - case eGetChar: - { - switch ( aParamName ) - { - case eTestCharOption1: - { - User::LeaveIfError( iItem -> GetNextChar( iTestBlockParams.iTestCharOption1 ) ); - break; - } - case eTestCharOption2: - { - User::LeaveIfError( iItem -> GetNextChar( iTestBlockParams.iTestCharOption2 ) ); - break; - } - case eTestCharOption3: - { - User::LeaveIfError( iItem -> GetNextChar( iTestBlockParams.iTestCharOption3 ) ); - break; - } - default: - { - User::Leave( KErrArgument ); - } - } - break; - } - default: - { - User::Leave( KErrArgument ); - } - } - } - -//----------------------------------------------------------------------------- -// CUsbPersonalityPluginTest::SendTestClassVersion -// Method used to send version of test class -//----------------------------------------------------------------------------- -// -void CUsbPersonalityPluginTest::SendTestClassVersion() - { - TVersion moduleVersion; - moduleVersion.iMajor = TEST_CLASS_VERSION_MAJOR; - moduleVersion.iMinor = TEST_CLASS_VERSION_MINOR; - moduleVersion.iBuild = TEST_CLASS_VERSION_BUILD; - - TFileName moduleName; - moduleName = _L("UsbPersonalityPluginTest.dll"); - - TBool newVersionOfMethod = ETrue; - TestModuleIf().SendTestModuleVersion(moduleVersion, moduleName, newVersionOfMethod); - } - -// ========================== OTHER EXPORTED FUNCTIONS ========================= - -// ----------------------------------------------------------------------------- -// LibEntryL is a polymorphic Dll entry point. -// Returns: CScriptBase: New CScriptBase derived object -// ----------------------------------------------------------------------------- -// -EXPORT_C CScriptBase* LibEntryL( - CTestModuleIf& aTestModuleIf ) // Backpointer to STIF Test Framework - { - - return ( CScriptBase* ) CUsbPersonalityPluginTest::NewL( aTestModuleIf ); - - } - - -// End of File diff -r 703a2b94c06c -r dde4619868dc usbservices_plat/usb_personality_plugin_api/tsrc/usbpersonalitypluginapitest/src/UsbPersonalityPluginTestBlocks.cpp --- a/usbservices_plat/usb_personality_plugin_api/tsrc/usbpersonalitypluginapitest/src/UsbPersonalityPluginTestBlocks.cpp Wed Sep 15 13:20:24 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,508 +0,0 @@ -/* - * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). - * All rights reserved. - * This component and the accompanying materials are made available - * under the terms of "Eclipse Public License v1.0" - * which accompanies this distribution, and is available - * at the URL "http://www.eclipse.org/legal/epl-v10.html". - * - * Initial Contributors: - * Nokia Corporation - initial contribution. - * - * Contributors: - * - * Description: - * - */ - -// [INCLUDE FILES] - do not remove -#include -#include -#include -#include "UsbPersonalityPluginTest.h" -#include "testdebug.h" -#include - -// EXTERNAL DATA STRUCTURES - -// EXTERNAL FUNCTION PROTOTYPES - -// CONSTANTS - -const TInt KIdPCSuite = 5; -const TInt KIdMediaTransfer = 4; -const TInt KIdMassStorage = 2; - -const TUid KUidPCSuite = - { - 0x102068DF - }; -const TUid KUidMediaTransfer = - { - 0x10282C70 - }; -//const TUid KUidPCSuite2 = -// { -// 0x2000B5D2 -// }; -//const TUid KUidPhoneAsModem = -// { -// 0x20029E41 -// }; -const TUid KUidMassStorage = - { - 0x1020DF7B - }; - -// MACROS - -// LOCAL CONSTANTS AND MACROS - -// MODULE DATA STRUCTURES - -// LOCAL FUNCTION PROTOTYPES - -// FORWARD DECLARATIONS - -// ============================= LOCAL FUNCTIONS =============================== - -// ----------------------------------------------------------------------------- -// ----------------------------------------------------------------------------- - -// ============================ MEMBER FUNCTIONS =============================== - -// ----------------------------------------------------------------------------- -// CUsbPersonalityPluginTest::TestConstructL -// Construct here all test resources for test methods. -// Called from ConstructL. -// ----------------------------------------------------------------------------- - -void CUsbPersonalityPluginTest::TestConstructL() - { - TRACE_FUNC_ENTRY - - iUsbMan = new (ELeave) RUsb; - iUsbMan->Connect(); - iNotifier = CUsbPersonalityNotifier::NewL(); - iParams = new (ELeave) TUsbPersonalityParams(*iUsbMan, *iNotifier); - - TRACE_FUNC_EXIT - } - -// ----------------------------------------------------------------------------- -// CUsbPersonalityPluginTest::TestDelete -// Delete here all resources allocated and opened from test methods. -// Called from destructor. -// ----------------------------------------------------------------------------- - -void CUsbPersonalityPluginTest::TestDelete() - { - TRACE_FUNC_ENTRY - - if (iUsbMan) - { - iUsbMan->Close(); - delete iUsbMan; - iUsbMan = NULL; - } - if (iNotifier) - { - delete iNotifier; - iNotifier = NULL; - } - if (iParams) - { - delete iParams; - iParams = NULL; - } - if (iPlugin) - { - delete iPlugin; - iPlugin = NULL; - } - - REComSession::FinalClose(); - - TRACE_FUNC_EXIT - } - -// ----------------------------------------------------------------------------- -// CUsbPersonalityPluginTest::TestBlocksInfoL -// Add new test block parameter entries below -// ----------------------------------------------------------------------------- - -void CUsbPersonalityPluginTest::TestBlocksInfoL() - { - - TESTENTRY( "InitializationTestL", CUsbPersonalityPluginTest::InitializationTestL ) - { - TESTPARAM( eGetString, eTestOption1 ) - } - TESTENTRY( "SetPersonalityTestL", CUsbPersonalityPluginTest::SetPersonalityTestL ) - { - TESTPARAM( eGetString, eTestOption1 ) - TESTPARAM( eGetString, eTestOption2 ) - } - TESTENTRY( "ShowQueryTestL", CUsbPersonalityPluginTest::ShowQueryTestL ) - { - TESTPARAM( eGetString, eTestOption1 ) - } - TESTENTRY( "ShowConnectionNoteTestL", CUsbPersonalityPluginTest::ShowConnectionNoteTestL ) - { - TESTPARAM( eGetString, eTestOption1 ) - TESTPARAM( eGetString, eTestOption2 ) - } - TESTENTRY( "CreatePersonalityPluginTestL", CUsbPersonalityPluginTest::CreatePersonalityPluginTestL ) - { - TESTPARAM( eGetString, eTestOption1 ) - TESTPARAM( eGetString, eTestOption2 ) - } - TESTENTRY( "PreparePersonalityStartTestL", CUsbPersonalityPluginTest::PreparePersonalityStartTestL ) - { - TESTPARAM( eGetString, eTestOption1 ) - TESTPARAM( eGetString, eTestOption2 ) - } - TESTENTRY( "FinishPersonalityStartTestL", CUsbPersonalityPluginTest::FinishPersonalityStartTestL ) - { - TESTPARAM( eGetString, eTestOption1 ) - TESTPARAM( eGetString, eTestOption2 ) - } - TESTENTRY( "PreparePersonalityStopTestL", CUsbPersonalityPluginTest::PreparePersonalityStopTestL ) - { - TESTPARAM( eGetString, eTestOption1 ) - TESTPARAM( eGetString, eTestOption2 ) - } - TESTENTRY( "FinishPersonalityStopTestL", CUsbPersonalityPluginTest::FinishPersonalityStopTestL ) - { - TESTPARAM( eGetString, eTestOption1 ) - TESTPARAM( eGetString, eTestOption2 ) - } - } - -// Add test block methods implementation here -// ----------------------------------------------------------------------------- -// CUsbPersonalityPluginTest::ExampleTestL -// ----------------------------------------------------------------------------- - -void CUsbPersonalityPluginTest::ExampleTestL( - TUsbPersonalityPluginTestBlockParams& aParams, - TUsbPersonalityPluginTestResult& aTestResult) - { - TRACE_FUNC_ENTRY - - if (!aParams.iTestOption1.Compare(_L( "API" ))) - { - TRACE_INFO( "Api test option: %S", &aParams.iTestOption1 ) - TRACE_INFO( "Api test sub-option: %S", &aParams.iTestOption2 ) - TRACE_INFO( "Api test int option: %d", aParams.iTestIntOption1 ) - TRACE_INFO( "Api test char option: %c", TText( aParams.iTestCharOption1 ) ) - } - else if (!aParams.iTestOption1.Compare(_L( "MODULE" ))) - { - TRACE_INFO( "Module test option: %S", &aParams.iTestOption1 ) - TRACE_INFO( "Module test sub-option: %S", &aParams.iTestOption2 ) - TRACE_INFO( "Module test int option: %d", aParams.iTestIntOption1 ) - TRACE_INFO( "Module test char option: %c", TText( aParams.iTestCharOption1 ) ) - } - else if (!aParams.iTestOption1.Compare(_L( "BRANCH" ))) - { - TRACE_INFO( "Branch test option: %S", &aParams.iTestOption1 ) - TRACE_INFO( "Branch test sub-option: %S", &aParams.iTestOption2 ) - TRACE_INFO( "Branch test int option: %d", aParams.iTestIntOption1 ) - TRACE_INFO( "Branch test char option: %c", TText( aParams.iTestCharOption1 ) ) - } - else - { - TRACE( "Invalid test parameter" ) - TRACE_FUNC_EXIT - User::Leave(KErrNotFound); - } - - aTestResult = ETestCasePassed; - TRACE_FUNC_EXIT - } - -// Add other member functions implementation here -void CUsbPersonalityPluginTest::InitializeTestObjectsL() - { - iActive = CUsbPersonalityPluginActiveObject::NewL(iPlugin, iLog, iParams); - TRACE ( " test objects initialized " ); - } - -void CUsbPersonalityPluginTest::DeleteTestObjects() - { - delete iActive; - iActive = NULL; - } - -void CUsbPersonalityPluginTest::InitializationTestL( - TUsbPersonalityPluginTestBlockParams& aParams, - TUsbPersonalityPluginTestResult& aTestResult) - { - TRACE_FUNC_ENTRY - aTestResult = ETestCaseFailed; - - if (iNotifier) - { - aTestResult = ETestCasePassed; - } - - TRACE_FUNC_EXIT - } - -void CUsbPersonalityPluginTest::SetPersonalityTestL( - TUsbPersonalityPluginTestBlockParams& aParams, - TUsbPersonalityPluginTestResult& aTestResult) - { - TRACE_FUNC_ENTRY - aTestResult = ETestCaseFailed; - TInt id = GetIdFromString(aParams.iTestOption2); - TRACE_INFO( " Set personality ID: %d", id ); - - iParams->SetPersonalityId(id); - if (iParams->PersonalityId() == id) - { - aTestResult = ETestCasePassed; - } - - TRACE_FUNC_EXIT - } - -void CUsbPersonalityPluginTest::ShowQueryTestL( - TUsbPersonalityPluginTestBlockParams& aParams, - TUsbPersonalityPluginTestResult& aTestResult) - { - TRACE_FUNC_ENTRY - aTestResult = ETestCaseFailed; - - TBuf8<8> iDummyBuf; - - TUSBQueriesNotifierParamsPckg queryParams; - queryParams().iQuery = EUSBNotEnoughRam; - - TInt res = iNotifier->ShowQuery(KQueriesNotifier, queryParams, iDummyBuf); - User::After(3000000); - TRACE_INFO( " Query show ret %d ", res ) - if (res == KErrNone) - { - aTestResult = ETestCasePassed; - } - - TRACE_FUNC_EXIT - } - -void CUsbPersonalityPluginTest::ShowConnectionNoteTestL( - TUsbPersonalityPluginTestBlockParams& aParams, - TUsbPersonalityPluginTestResult& aTestResult) - { - TRACE_FUNC_ENTRY - aTestResult = ETestCaseFailed; - - TBuf8<8> iDummyBuf; - - TUSBConnectionNotifierParamsPckg noteParams; -// noteParams().iPersonalityId = personalityId; - - TInt res = iNotifier->ShowQuery(KCableConnectedNotifierUid, noteParams, - iDummyBuf); - User::After(3000000); - TRACE_INFO( " Connection note show ret %d ", res ) - if (res == KErrNone) - { - aTestResult = ETestCasePassed; - } - - TRACE_FUNC_EXIT - } - -TInt CUsbPersonalityPluginTest::GetIdFromString(TPtrC aBuffer) - { - - if (!aBuffer.Compare(_L("MS"))) - { - TRACE( " mass storage " ); - return KIdMassStorage; - } - else if (!aBuffer.Compare(_L("PCS"))) - { - TRACE( " pc suite " ); - return KIdPCSuite; - } - else if (!aBuffer.Compare(_L("MTP"))) - { - TRACE( " media transfer " ); - return KIdMediaTransfer; - } - else - { - TRACE( " not found " ); - return 0; - } - } - -TUid CUsbPersonalityPluginTest::GetUidFromId(TInt aId) - { - switch (aId) - { - case KIdMassStorage: - return KUidMassStorage; - case KIdPCSuite: - return KUidPCSuite; - case KIdMediaTransfer: - return KUidMediaTransfer; - default: - return TUid::Uid(0x0); - } - } - -void CUsbPersonalityPluginTest::CreatePersonalityPluginTestL( - TUsbPersonalityPluginTestBlockParams& aParams, - TUsbPersonalityPluginTestResult& aTestResult) - { - TRACE_FUNC_ENTRY - aTestResult = ETestCaseFailed; - - TInt id = GetIdFromString(aParams.iTestOption2); - TUid uid = GetUidFromId(id); - - iPlugin = CUsbPersonalityPlugin::NewL(*iParams, uid); - - if (iPlugin) - { - TRACE( " plugin created ") - aTestResult = ETestCasePassed; - } - - TRACE_FUNC_EXIT - } - -void CUsbPersonalityPluginTest::PreparePersonalityStartTestL( - TUsbPersonalityPluginTestBlockParams& aParams, - TUsbPersonalityPluginTestResult& aTestResult) - { - TRACE_FUNC_ENTRY - - aTestResult = ETestCaseFailed; - - TInt id = GetIdFromString(aParams.iTestOption2); - TUid uid = GetUidFromId(id); - iPlugin = CUsbPersonalityPlugin::NewL(*iParams, uid); - - InitializeTestObjectsL(); - - iActive->PreparePersonalityStart(iRequestStatus); - - TRACE_INFO( "prepare personality start status: %d, expected: %d", iRequestStatus.Int(), KErrNone ); - User::LeaveIfError(iRequestStatus.Int()); - - aTestResult = ETestCasePassed; - DeleteTestObjects(); - - TRACE_FUNC_EXIT - } - -void CUsbPersonalityPluginTest::FinishPersonalityStartTestL( - TUsbPersonalityPluginTestBlockParams& aParams, - TUsbPersonalityPluginTestResult& aTestResult) - { - TRACE_FUNC_ENTRY - - aTestResult = ETestCaseFailed; - - TInt id = GetIdFromString(aParams.iTestOption2); - TUid uid = GetUidFromId(id); - iPlugin = CUsbPersonalityPlugin::NewL(*iParams, uid); - - InitializeTestObjectsL(); - - iActive->PreparePersonalityStart(iRequestStatus); - TRACE_INFO( "prepare personality start status: %d, expected: %d", iRequestStatus.Int(), KErrNone ); - User::LeaveIfError(iRequestStatus.Int()); - - iActive->FinishPersonalityStart(iRequestStatus); - TRACE_INFO( "finish personality start status: %d, expected: %d", iRequestStatus.Int(), KErrNone ); - - iActive->PreparePersonalityStop(iRequestStatus); - iActive->FinishPersonalityStart(iRequestStatus); - User::LeaveIfError(iRequestStatus.Int()); - - aTestResult = ETestCasePassed; - - DeleteTestObjects(); - - TRACE_FUNC_EXIT - } - -void CUsbPersonalityPluginTest::PreparePersonalityStopTestL( - TUsbPersonalityPluginTestBlockParams& aParams, - TUsbPersonalityPluginTestResult& aTestResult) - { - TRACE_FUNC_ENTRY - - aTestResult = ETestCaseFailed; - - TInt id = GetIdFromString(aParams.iTestOption2); - TUid uid = GetUidFromId(id); - iPlugin = CUsbPersonalityPlugin::NewL(*iParams, uid); - - InitializeTestObjectsL(); - - iActive->PreparePersonalityStart(iRequestStatus); - TRACE_INFO( "prepare personality start status: %d, expected: %d", iRequestStatus.Int(), KErrNone ); - User::LeaveIfError(iRequestStatus.Int()); - - iActive->FinishPersonalityStart(iRequestStatus); - TRACE_INFO( "finish personality start status: %d, expected: %d", iRequestStatus.Int(), KErrNone ); - User::LeaveIfError(iRequestStatus.Int()); - - iActive->PreparePersonalityStop(iRequestStatus); - TRACE_INFO( "prepare personality stop status: %d, expected: %d", iRequestStatus.Int(), KErrNone ); - User::LeaveIfError(iRequestStatus.Int()); - - aTestResult = ETestCasePassed; - - DeleteTestObjects(); - - TRACE_FUNC_EXIT - } - -void CUsbPersonalityPluginTest::FinishPersonalityStopTestL( - TUsbPersonalityPluginTestBlockParams& aParams, - TUsbPersonalityPluginTestResult& aTestResult) - { - TRACE_FUNC_ENTRY - - aTestResult = ETestCaseFailed; - - TInt id = GetIdFromString(aParams.iTestOption2); - TUid uid = GetUidFromId(id); - iPlugin = CUsbPersonalityPlugin::NewL(*iParams, uid); - - InitializeTestObjectsL(); - - iActive->PreparePersonalityStart(iRequestStatus); - TRACE_INFO( "prepare personality start status: %d, expected: %d", iRequestStatus.Int(), KErrNone ); - User::LeaveIfError(iRequestStatus.Int()); - - iActive->FinishPersonalityStart(iRequestStatus); - TRACE_INFO( "finish personality start status: %d, expected: %d", iRequestStatus.Int(), KErrNone ); - User::LeaveIfError(iRequestStatus.Int()); - - iActive->PreparePersonalityStop(iRequestStatus); - TRACE_INFO( "prepare personality stop status: %d, expected: %d", iRequestStatus.Int(), KErrNone ); - User::LeaveIfError(iRequestStatus.Int()); - - iActive->FinishPersonalityStop(iRequestStatus); - TRACE_INFO( "finish personality stop status: %d, expected: %d", iRequestStatus.Int(), KErrNone ); - User::LeaveIfError(iRequestStatus.Int()); - - aTestResult = ETestCasePassed; - - DeleteTestObjects(); - - TRACE_FUNC_EXIT - } -// ========================== OTHER EXPORTED FUNCTIONS ========================= -// None - -// [End of File] - Do not remove diff -r 703a2b94c06c -r dde4619868dc usbservices_plat/usb_personality_plugin_api/tsrc/usbpersonalitypluginapitest/src/UsbPersonalityPluginTest_exe.cpp --- a/usbservices_plat/usb_personality_plugin_api/tsrc/usbpersonalitypluginapitest/src/UsbPersonalityPluginTest_exe.cpp Wed Sep 15 13:20:24 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,67 +0,0 @@ -/* -* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This material, including documentation and any related computer -* programs, is protected by copyright controlled by Nokia. All -* rights are reserved. Copying, including reproducing, storing -* adapting or translating, any or all of this material requires the -* prior written consent of Nokia. This material also contains -* confidential information which may not be disclosed to others -* without the prior written consent of Nokia. -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -// INCLUDE FILES -#include -#include -#include -// EXTERNAL DATA STRUCTURES - -// EXTERNAL FUNCTION PROTOTYPES - -// ================= OTHER EXPORTED FUNCTIONS ================================= - -/* -------------------------------------------------------------------------------- - - Class: - - - Method: E32Main - - Description: - - Parameters: None - - Return Values: TInt: Symbian error code - - Errors/Exceptions: None - - Status: Draft - -------------------------------------------------------------------------------- -*/ -GLDEF_C TInt E32Main() - { - _LIT( KProcessMsgStart, "New process starting" ); - RDebug::Print( KProcessMsgStart ); - - - // This starts a new session that get capabilites that is used in - // usbpersonalityplugintest_exe.mmp file. - TInt r = StartSession(); - - _LIT( KProcessMsgEnd, "New process ends" ); - RDebug::Print( KProcessMsgEnd ); - - return r; - - } - -// End of File