sl@0: // Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // Client that calls the plugin that does the actual coverage tests sl@0: // sl@0: // sl@0: sl@0: /** sl@0: @file sl@0: @test sl@0: @internalComponent - Internal Symbian coverage test code, sl@0: */ sl@0: sl@0: #include "wsgdcov.h" sl@0: sl@0: const TUid KGraphicDrawerCoverageInterfaceId = {0x10285D5A}; sl@0: const TUid KGraphicDrawerCoverageImplId = {0x10285D5B}; sl@0: sl@0: EXPORT_C CWsGdCoverage* CWsGdCoverage::NewL() sl@0: { sl@0: return NewL(0); sl@0: } sl@0: sl@0: EXPORT_C CWsGdCoverage* CWsGdCoverage::NewL(TInt aScreenId) sl@0: { sl@0: CWsGdCoverage* self = new(ELeave) CWsGdCoverage; sl@0: CleanupStack::PushL(self); sl@0: TBuf8<1> data; sl@0: data.Append((TUint8)aScreenId); sl@0: self->BaseConstructL(KGraphicDrawerCoverageInterfaceId, KGraphicDrawerCoverageImplId, data); sl@0: CleanupStack::Pop(self); sl@0: self->iIsReady = ETrue; sl@0: return self; sl@0: } sl@0: sl@0: EXPORT_C CWsGdCoverage::~CWsGdCoverage() sl@0: { sl@0: iIsReady = EFalse; sl@0: } sl@0: sl@0: void CWsGdCoverage::HandleMessage(const TDesC8& aData) sl@0: { sl@0: if (aData.Size()>1 && aData[0]==KGdCoverageInfoSig) sl@0: { sl@0: if (aData.Size() <= sizeof(TGdCoverageInfo)) sl@0: { sl@0: Mem::Copy(iReq, aData.Ptr(), aData.Size()); sl@0: } sl@0: } sl@0: iCallBack.CallBack(); sl@0: } sl@0: sl@0: void CWsGdCoverage::OnReplace() sl@0: { sl@0: } sl@0: sl@0: EXPORT_C TInt CWsGdCoverage::RunTest(TInt aCode) sl@0: { sl@0: if (!iIsReady) sl@0: return KErrNotReady; sl@0: sl@0: TBuf8<1> cmd; sl@0: cmd.Append(aCode); sl@0: sl@0: SendMessage(cmd); sl@0: return Flush(); sl@0: } sl@0: sl@0: EXPORT_C TInt CWsGdCoverage::QueryPlugin(TGdCoverageInfo& aInfo) sl@0: { sl@0: TBuf8<1> cmd; sl@0: cmd.Append(KGdCoverageCmdQuery); sl@0: SendMessage(cmd); sl@0: TInt err = Flush(); sl@0: if (err!=KErrNone) sl@0: return err; sl@0: iReq = &aInfo; sl@0: return KErrNone; sl@0: } sl@0: sl@0: EXPORT_C void CWsGdCoverage::SetCallBack(TCallBack aCallBack) sl@0: { sl@0: iCallBack = aCallBack; sl@0: }