sl@0
|
1 |
// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
|
sl@0
|
2 |
// All rights reserved.
|
sl@0
|
3 |
// This component and the accompanying materials are made available
|
sl@0
|
4 |
// under the terms of "Eclipse Public License v1.0"
|
sl@0
|
5 |
// which accompanies this distribution, and is available
|
sl@0
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
sl@0
|
7 |
//
|
sl@0
|
8 |
// Initial Contributors:
|
sl@0
|
9 |
// Nokia Corporation - initial contribution.
|
sl@0
|
10 |
//
|
sl@0
|
11 |
// Contributors:
|
sl@0
|
12 |
//
|
sl@0
|
13 |
// Description:
|
sl@0
|
14 |
// Example CTestStep derived implementation
|
sl@0
|
15 |
//
|
sl@0
|
16 |
//
|
sl@0
|
17 |
|
sl@0
|
18 |
/**
|
sl@0
|
19 |
@file TestStartStep.cpp
|
sl@0
|
20 |
@internalTechnology
|
sl@0
|
21 |
*/
|
sl@0
|
22 |
#include "testsetprimaryfltstep.h"
|
sl@0
|
23 |
#include "te_uloggerclientsuitedefs.h"
|
sl@0
|
24 |
|
sl@0
|
25 |
CTestSetPrimaryFltStep::~CTestSetPrimaryFltStep()
|
sl@0
|
26 |
/**
|
sl@0
|
27 |
* Destructor
|
sl@0
|
28 |
*/
|
sl@0
|
29 |
{
|
sl@0
|
30 |
}
|
sl@0
|
31 |
|
sl@0
|
32 |
CTestSetPrimaryFltStep::CTestSetPrimaryFltStep()
|
sl@0
|
33 |
/**
|
sl@0
|
34 |
* Constructor
|
sl@0
|
35 |
*/
|
sl@0
|
36 |
{
|
sl@0
|
37 |
// **MUST** call SetTestStepName in the constructor as the controlling
|
sl@0
|
38 |
// framework uses the test step name immediately following construction to set
|
sl@0
|
39 |
// up the step's unique logging ID.
|
sl@0
|
40 |
SetTestStepName(KTestSetPrimaryFltStep);
|
sl@0
|
41 |
}
|
sl@0
|
42 |
|
sl@0
|
43 |
TVerdict CTestSetPrimaryFltStep::doTestStepPreambleL()
|
sl@0
|
44 |
/**
|
sl@0
|
45 |
* @return - TVerdict code
|
sl@0
|
46 |
* Override of base class virtual
|
sl@0
|
47 |
*/
|
sl@0
|
48 |
{
|
sl@0
|
49 |
CTestUloggerClientApiStepBase::doTestStepPreambleL();
|
sl@0
|
50 |
return TestStepResult();
|
sl@0
|
51 |
}
|
sl@0
|
52 |
|
sl@0
|
53 |
TVerdict CTestSetPrimaryFltStep::doTestStepL()
|
sl@0
|
54 |
/**
|
sl@0
|
55 |
* @return - TVerdict code
|
sl@0
|
56 |
* Override of base class pure virtual
|
sl@0
|
57 |
* Our implementation only gets called if the base class doTestStepPreambleL() did
|
sl@0
|
58 |
* not leave. That being the case, the current test result value will be EPass.
|
sl@0
|
59 |
*/
|
sl@0
|
60 |
{
|
sl@0
|
61 |
CArrayFixFlat<TUint8> *setfilters = new (ELeave)CArrayFixFlat<TUint8>(10);
|
sl@0
|
62 |
CArrayFixFlat<TUint8> *getfilters = new (ELeave)CArrayFixFlat<TUint8>(10);
|
sl@0
|
63 |
|
sl@0
|
64 |
if (TestStepResult()==EPass)
|
sl@0
|
65 |
{
|
sl@0
|
66 |
setfilters->AppendL(KPrimaryFlt);
|
sl@0
|
67 |
|
sl@0
|
68 |
/**************First set primary filter*************/
|
sl@0
|
69 |
|
sl@0
|
70 |
iSession->Connect();
|
sl@0
|
71 |
TInt iErrCode = iSession->SetPrimaryFiltersEnabled(*setfilters, ETrue);
|
sl@0
|
72 |
|
sl@0
|
73 |
if( iErrCode == KErrNone )
|
sl@0
|
74 |
{
|
sl@0
|
75 |
INFO_PRINTF2(_L("Primary filter has been set with single filter, %d, check log"), setfilters->At(0));
|
sl@0
|
76 |
|
sl@0
|
77 |
setfilters->Reset();
|
sl@0
|
78 |
|
sl@0
|
79 |
iSession->GetPrimaryFiltersEnabled(*setfilters);
|
sl@0
|
80 |
|
sl@0
|
81 |
if( setfilters->Count() > 0 )
|
sl@0
|
82 |
{
|
sl@0
|
83 |
if( setfilters->At(0) == KPrimaryFlt )
|
sl@0
|
84 |
{
|
sl@0
|
85 |
INFO_PRINTF1(_L("Get primary filter successful"));
|
sl@0
|
86 |
SetTestStepResult(EPass);
|
sl@0
|
87 |
}
|
sl@0
|
88 |
else
|
sl@0
|
89 |
{
|
sl@0
|
90 |
INFO_PRINTF1(_L("Get primary filter failed"));
|
sl@0
|
91 |
SetTestStepResult(EFail);;
|
sl@0
|
92 |
}
|
sl@0
|
93 |
}
|
sl@0
|
94 |
else
|
sl@0
|
95 |
{
|
sl@0
|
96 |
INFO_PRINTF1(_L("GetFilter() Failed, can not varify the test output"));
|
sl@0
|
97 |
SetTestStepResult(EFail);
|
sl@0
|
98 |
}
|
sl@0
|
99 |
}
|
sl@0
|
100 |
}
|
sl@0
|
101 |
|
sl@0
|
102 |
if(TestStepResult() == EPass)
|
sl@0
|
103 |
{
|
sl@0
|
104 |
setfilters->Reset();
|
sl@0
|
105 |
getfilters->Reset();
|
sl@0
|
106 |
|
sl@0
|
107 |
for(TInt i = 0; i < 256 ; i++ )
|
sl@0
|
108 |
{
|
sl@0
|
109 |
setfilters->AppendL((TUint8)(i));
|
sl@0
|
110 |
}
|
sl@0
|
111 |
|
sl@0
|
112 |
TRAPD(err, iSession->SetPrimaryFiltersEnabled(*setfilters, ETrue));
|
sl@0
|
113 |
if( KErrNone == err )
|
sl@0
|
114 |
{
|
sl@0
|
115 |
INFO_PRINTF1(_L("Primary filter has been set with multiple filters,from 0 to 255"));
|
sl@0
|
116 |
SetTestStepResult(EPass);
|
sl@0
|
117 |
}
|
sl@0
|
118 |
else
|
sl@0
|
119 |
{
|
sl@0
|
120 |
INFO_PRINTF2(_L("Multiple primary filters have not been set succesfully, error code %d"), err);
|
sl@0
|
121 |
SetTestStepResult(EFail);
|
sl@0
|
122 |
}
|
sl@0
|
123 |
|
sl@0
|
124 |
//Now get the primary filter set above
|
sl@0
|
125 |
iSession->GetPrimaryFiltersEnabled(*getfilters);
|
sl@0
|
126 |
|
sl@0
|
127 |
if( getfilters->Count() == setfilters->Count() )
|
sl@0
|
128 |
{
|
sl@0
|
129 |
INFO_PRINTF1(_L("setfilter and getfilter have the same count"));
|
sl@0
|
130 |
for(TInt i = 0; i < getfilters->Count(); i++)
|
sl@0
|
131 |
{
|
sl@0
|
132 |
for(TInt j = 0; j < setfilters->Count(); j++)
|
sl@0
|
133 |
{
|
sl@0
|
134 |
if(getfilters->At(i) == setfilters->At(j))
|
sl@0
|
135 |
SetTestStepResult(EPass);
|
sl@0
|
136 |
else
|
sl@0
|
137 |
SetTestStepResult(EFail);
|
sl@0
|
138 |
}
|
sl@0
|
139 |
}
|
sl@0
|
140 |
}
|
sl@0
|
141 |
else
|
sl@0
|
142 |
{
|
sl@0
|
143 |
INFO_PRINTF1(_L("setfilter and getfilter have different counts"));
|
sl@0
|
144 |
INFO_PRINTF2(_L("setfilter has %d"), setfilters->Count());
|
sl@0
|
145 |
INFO_PRINTF2(_L("getfilter has %d"), getfilters->Count());
|
sl@0
|
146 |
SetTestStepResult(EFail);
|
sl@0
|
147 |
}
|
sl@0
|
148 |
}
|
sl@0
|
149 |
|
sl@0
|
150 |
setfilters->Reset();
|
sl@0
|
151 |
getfilters->Reset();
|
sl@0
|
152 |
|
sl@0
|
153 |
if(setfilters)
|
sl@0
|
154 |
{
|
sl@0
|
155 |
delete setfilters;
|
sl@0
|
156 |
setfilters=NULL;
|
sl@0
|
157 |
}
|
sl@0
|
158 |
|
sl@0
|
159 |
if(getfilters)
|
sl@0
|
160 |
{
|
sl@0
|
161 |
delete getfilters;
|
sl@0
|
162 |
getfilters=NULL;
|
sl@0
|
163 |
}
|
sl@0
|
164 |
|
sl@0
|
165 |
return TestStepResult();
|
sl@0
|
166 |
}
|
sl@0
|
167 |
|
sl@0
|
168 |
TVerdict CTestSetPrimaryFltStep::doTestStepPostambleL()
|
sl@0
|
169 |
/**
|
sl@0
|
170 |
* @return - TVerdict code
|
sl@0
|
171 |
* Override of base class virtual
|
sl@0
|
172 |
*/
|
sl@0
|
173 |
{
|
sl@0
|
174 |
INFO_PRINTF1(_L("TestSetPrimaryFltStep completed"));
|
sl@0
|
175 |
CTestUloggerClientApiStepBase::doTestStepPostambleL();
|
sl@0
|
176 |
return TestStepResult();
|
sl@0
|
177 |
}
|