sl@0
|
1 |
// Copyright (c) 2008-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 |
//
|
sl@0
|
15 |
|
sl@0
|
16 |
#include "twdp.h"
|
sl@0
|
17 |
#include "utils.h"
|
sl@0
|
18 |
|
sl@0
|
19 |
namespace t_fbservwdptest
|
sl@0
|
20 |
{
|
sl@0
|
21 |
_LIT(KT_WDPTestCaseNumber,"CaseNumber");
|
sl@0
|
22 |
_LIT(KT_TestPanicTxt, "t_fbservwdptest");
|
sl@0
|
23 |
}
|
sl@0
|
24 |
|
sl@0
|
25 |
using namespace t_fbservwdptest;
|
sl@0
|
26 |
|
sl@0
|
27 |
CTWDP::CTWDP(CTestStep* aStep):
|
sl@0
|
28 |
CTGraphicsBase(aStep),
|
sl@0
|
29 |
iFbs(NULL)
|
sl@0
|
30 |
{
|
sl@0
|
31 |
}
|
sl@0
|
32 |
|
sl@0
|
33 |
CTWDP::~CTWDP()
|
sl@0
|
34 |
{
|
sl@0
|
35 |
iSharedHeapChunk.Close();
|
sl@0
|
36 |
iBitmapChunk.Close();
|
sl@0
|
37 |
RFbsSession::Disconnect();
|
sl@0
|
38 |
}
|
sl@0
|
39 |
|
sl@0
|
40 |
void CTWDP::ConstructL()
|
sl@0
|
41 |
{
|
sl@0
|
42 |
User::LeaveIfError(RFbsSession::Connect());
|
sl@0
|
43 |
iFbs = RFbsSession::GetSession();
|
sl@0
|
44 |
}
|
sl@0
|
45 |
|
sl@0
|
46 |
void CTWDP::RunTestCaseL(TInt aCurTestCase)
|
sl@0
|
47 |
{
|
sl@0
|
48 |
TBool res = iStep->GetIntFromConfig(iStep->ConfigSection(), KT_WDPTestCaseNumber, aCurTestCase);
|
sl@0
|
49 |
if(!res)
|
sl@0
|
50 |
{
|
sl@0
|
51 |
User::Leave(KErrNotFound);
|
sl@0
|
52 |
}
|
sl@0
|
53 |
|
sl@0
|
54 |
switch(aCurTestCase)
|
sl@0
|
55 |
{
|
sl@0
|
56 |
case 1:
|
sl@0
|
57 |
TestFbservPaged();
|
sl@0
|
58 |
break;
|
sl@0
|
59 |
case 2:
|
sl@0
|
60 |
TestFbservUnPaged();
|
sl@0
|
61 |
break;
|
sl@0
|
62 |
case 3:
|
sl@0
|
63 |
TestBitmapDataPagedL();
|
sl@0
|
64 |
break;
|
sl@0
|
65 |
case 4:
|
sl@0
|
66 |
TestBitmapDataAndSharedHeapPagedL();
|
sl@0
|
67 |
break;
|
sl@0
|
68 |
default:
|
sl@0
|
69 |
User::Panic(KT_TestPanicTxt, KErrNotFound); //Unexpected value!
|
sl@0
|
70 |
break;
|
sl@0
|
71 |
}
|
sl@0
|
72 |
|
sl@0
|
73 |
TestComplete();
|
sl@0
|
74 |
}
|
sl@0
|
75 |
|
sl@0
|
76 |
void CTWDP::TestFbservPaged()
|
sl@0
|
77 |
{
|
sl@0
|
78 |
TBool ret=DefaultDataPaged();
|
sl@0
|
79 |
if (ret)
|
sl@0
|
80 |
{
|
sl@0
|
81 |
INFO_PRINTF1(_L("fbserv.DefaultDataPaged() returned --> 1, Expected --> 1"));
|
sl@0
|
82 |
}
|
sl@0
|
83 |
else
|
sl@0
|
84 |
{
|
sl@0
|
85 |
INFO_PRINTF1(_L("fbserv.DefaultDataPaged() returned --> 0, Expected --> 1"));
|
sl@0
|
86 |
}
|
sl@0
|
87 |
TEST(ret);
|
sl@0
|
88 |
}
|
sl@0
|
89 |
|
sl@0
|
90 |
void CTWDP::TestFbservUnPaged()
|
sl@0
|
91 |
{
|
sl@0
|
92 |
TBool ret=DefaultDataPaged();
|
sl@0
|
93 |
if (!ret)
|
sl@0
|
94 |
{
|
sl@0
|
95 |
INFO_PRINTF1(_L("fbserv.DefaultDataPaged() returned --> 0, Expected --> 0"));
|
sl@0
|
96 |
}
|
sl@0
|
97 |
else
|
sl@0
|
98 |
{
|
sl@0
|
99 |
INFO_PRINTF1(_L("fbserv.DefaultDataPaged() returned --> 1, Expected --> 0"));
|
sl@0
|
100 |
}
|
sl@0
|
101 |
TEST(!ret);
|
sl@0
|
102 |
}
|
sl@0
|
103 |
|
sl@0
|
104 |
void CTWDP::TestBitmapDataPagedL()
|
sl@0
|
105 |
{
|
sl@0
|
106 |
TEST(BitmapDataPagedL());
|
sl@0
|
107 |
}
|
sl@0
|
108 |
|
sl@0
|
109 |
void CTWDP::TestBitmapDataAndSharedHeapPagedL()
|
sl@0
|
110 |
{
|
sl@0
|
111 |
TBool ret = BitmapDataPagedL();
|
sl@0
|
112 |
if (ret)
|
sl@0
|
113 |
{
|
sl@0
|
114 |
User::LeaveIfError(iSharedHeapChunk.OpenGlobal(KFBSERVSharedChunkName,ETrue));
|
sl@0
|
115 |
ret = iSharedHeapChunk.IsPaged();
|
sl@0
|
116 |
if (ret)
|
sl@0
|
117 |
{
|
sl@0
|
118 |
INFO_PRINTF1(_L("iSharedHeapChunk.IsPaged() returned --> 1, Expected --> 1"));
|
sl@0
|
119 |
}
|
sl@0
|
120 |
else
|
sl@0
|
121 |
{
|
sl@0
|
122 |
INFO_PRINTF1(_L("iSharedHeapChunk.IsPaged() returned --> 0, Expected --> 1"));
|
sl@0
|
123 |
}
|
sl@0
|
124 |
}
|
sl@0
|
125 |
TEST(ret);
|
sl@0
|
126 |
}
|
sl@0
|
127 |
|
sl@0
|
128 |
TBool CTWDP::DefaultDataPaged()
|
sl@0
|
129 |
{
|
sl@0
|
130 |
RProcess proc = RProcess();
|
sl@0
|
131 |
_LIT(KPattern, "*fbserv*");
|
sl@0
|
132 |
TFindProcess findProc(KPattern);
|
sl@0
|
133 |
TFullName fullName;
|
sl@0
|
134 |
TInt err=KErrNone;
|
sl@0
|
135 |
|
sl@0
|
136 |
INFO_PRINTF2(_L("TFindProcess: Find a process whose name match the pattern %S "), &KPattern());
|
sl@0
|
137 |
if(findProc.Next(fullName)!= KErrNone)
|
sl@0
|
138 |
{
|
sl@0
|
139 |
INFO_PRINTF1(_L("Error: Process whose name match the above pattern not found"));
|
sl@0
|
140 |
User::LeaveIfError(err);
|
sl@0
|
141 |
}
|
sl@0
|
142 |
else
|
sl@0
|
143 |
{
|
sl@0
|
144 |
INFO_PRINTF2(_L("TFindProcess.Next() found process --> %S "), &fullName );
|
sl@0
|
145 |
}
|
sl@0
|
146 |
|
sl@0
|
147 |
if(findProc.Next(fullName) != KErrNotFound)
|
sl@0
|
148 |
{
|
sl@0
|
149 |
INFO_PRINTF2(_L("Error: TFindProcess found more than 1 process matching the pattern --> %S "), &fullName );
|
sl@0
|
150 |
User::Leave(KErrGeneral);
|
sl@0
|
151 |
}
|
sl@0
|
152 |
|
sl@0
|
153 |
if( (err=proc.Open(fullName)) != KErrNone)
|
sl@0
|
154 |
{
|
sl@0
|
155 |
INFO_PRINTF2(_L("Error: RProcess.Open() returned --> %d"), err);
|
sl@0
|
156 |
User::LeaveIfError(err);
|
sl@0
|
157 |
}
|
sl@0
|
158 |
|
sl@0
|
159 |
TBool ret = proc.DefaultDataPaged();
|
sl@0
|
160 |
proc.Close();
|
sl@0
|
161 |
return ret;
|
sl@0
|
162 |
}
|
sl@0
|
163 |
|
sl@0
|
164 |
TBool CTWDP::BitmapDataPagedL()
|
sl@0
|
165 |
{
|
sl@0
|
166 |
User::LeaveIfError(iBitmapChunk.OpenGlobal(KFBSERVLargeChunkName,ETrue));
|
sl@0
|
167 |
TBool ret=iBitmapChunk.IsPaged();
|
sl@0
|
168 |
if (ret)
|
sl@0
|
169 |
{
|
sl@0
|
170 |
INFO_PRINTF1(_L("iBitmapChunk.IsPaged() returned --> 1, Expected --> 1"));
|
sl@0
|
171 |
}
|
sl@0
|
172 |
else
|
sl@0
|
173 |
{
|
sl@0
|
174 |
INFO_PRINTF1(_L("iBitmapChunk.IsPaged() returned --> 0, Expected --> 1"));
|
sl@0
|
175 |
}
|
sl@0
|
176 |
return ret;
|
sl@0
|
177 |
}
|
sl@0
|
178 |
|
sl@0
|
179 |
//--------------
|
sl@0
|
180 |
__CONSTRUCT_STEP__(WDP)
|