|
1 // Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // Client that calls the plugin that does the actual coverage tests |
|
15 // |
|
16 // |
|
17 |
|
18 /** |
|
19 @file |
|
20 @test |
|
21 @internalComponent - Internal Symbian coverage test code, |
|
22 */ |
|
23 |
|
24 #include "wsgdcov.h" |
|
25 |
|
26 const TUid KGraphicDrawerCoverageInterfaceId = {0x10285D5A}; |
|
27 const TUid KGraphicDrawerCoverageImplId = {0x10285D5B}; |
|
28 |
|
29 EXPORT_C CWsGdCoverage* CWsGdCoverage::NewL() |
|
30 { |
|
31 return NewL(0); |
|
32 } |
|
33 |
|
34 EXPORT_C CWsGdCoverage* CWsGdCoverage::NewL(TInt aScreenId) |
|
35 { |
|
36 CWsGdCoverage* self = new(ELeave) CWsGdCoverage; |
|
37 CleanupStack::PushL(self); |
|
38 TBuf8<1> data; |
|
39 data.Append((TUint8)aScreenId); |
|
40 self->BaseConstructL(KGraphicDrawerCoverageInterfaceId, KGraphicDrawerCoverageImplId, data); |
|
41 CleanupStack::Pop(self); |
|
42 self->iIsReady = ETrue; |
|
43 return self; |
|
44 } |
|
45 |
|
46 EXPORT_C CWsGdCoverage::~CWsGdCoverage() |
|
47 { |
|
48 iIsReady = EFalse; |
|
49 } |
|
50 |
|
51 void CWsGdCoverage::HandleMessage(const TDesC8& aData) |
|
52 { |
|
53 if (aData.Size()>1 && aData[0]==KGdCoverageInfoSig) |
|
54 { |
|
55 if (aData.Size() <= sizeof(TGdCoverageInfo)) |
|
56 { |
|
57 Mem::Copy(iReq, aData.Ptr(), aData.Size()); |
|
58 } |
|
59 } |
|
60 iCallBack.CallBack(); |
|
61 } |
|
62 |
|
63 void CWsGdCoverage::OnReplace() |
|
64 { |
|
65 } |
|
66 |
|
67 EXPORT_C TInt CWsGdCoverage::RunTest(TInt aCode) |
|
68 { |
|
69 if (!iIsReady) |
|
70 return KErrNotReady; |
|
71 |
|
72 TBuf8<1> cmd; |
|
73 cmd.Append(aCode); |
|
74 |
|
75 SendMessage(cmd); |
|
76 return Flush(); |
|
77 } |
|
78 |
|
79 EXPORT_C TInt CWsGdCoverage::QueryPlugin(TGdCoverageInfo& aInfo) |
|
80 { |
|
81 TBuf8<1> cmd; |
|
82 cmd.Append(KGdCoverageCmdQuery); |
|
83 SendMessage(cmd); |
|
84 TInt err = Flush(); |
|
85 if (err!=KErrNone) |
|
86 return err; |
|
87 iReq = &aInfo; |
|
88 return KErrNone; |
|
89 } |
|
90 |
|
91 EXPORT_C void CWsGdCoverage::SetCallBack(TCallBack aCallBack) |
|
92 { |
|
93 iCallBack = aCallBack; |
|
94 } |