Update contrib.
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".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
19 namespace t_fbservwdptest
21 _LIT(KT_WDPTestCaseNumber,"CaseNumber");
22 _LIT(KT_TestPanicTxt, "t_fbservwdptest");
25 using namespace t_fbservwdptest;
27 CTWDP::CTWDP(CTestStep* aStep):
28 CTGraphicsBase(aStep),
35 iSharedHeapChunk.Close();
37 RFbsSession::Disconnect();
40 void CTWDP::ConstructL()
42 User::LeaveIfError(RFbsSession::Connect());
43 iFbs = RFbsSession::GetSession();
46 void CTWDP::RunTestCaseL(TInt aCurTestCase)
48 TBool res = iStep->GetIntFromConfig(iStep->ConfigSection(), KT_WDPTestCaseNumber, aCurTestCase);
51 User::Leave(KErrNotFound);
63 TestBitmapDataPagedL();
66 TestBitmapDataAndSharedHeapPagedL();
69 User::Panic(KT_TestPanicTxt, KErrNotFound); //Unexpected value!
76 void CTWDP::TestFbservPaged()
78 TBool ret=DefaultDataPaged();
81 INFO_PRINTF1(_L("fbserv.DefaultDataPaged() returned --> 1, Expected --> 1"));
85 INFO_PRINTF1(_L("fbserv.DefaultDataPaged() returned --> 0, Expected --> 1"));
90 void CTWDP::TestFbservUnPaged()
92 TBool ret=DefaultDataPaged();
95 INFO_PRINTF1(_L("fbserv.DefaultDataPaged() returned --> 0, Expected --> 0"));
99 INFO_PRINTF1(_L("fbserv.DefaultDataPaged() returned --> 1, Expected --> 0"));
104 void CTWDP::TestBitmapDataPagedL()
106 TEST(BitmapDataPagedL());
109 void CTWDP::TestBitmapDataAndSharedHeapPagedL()
111 TBool ret = BitmapDataPagedL();
114 User::LeaveIfError(iSharedHeapChunk.OpenGlobal(KFBSERVSharedChunkName,ETrue));
115 ret = iSharedHeapChunk.IsPaged();
118 INFO_PRINTF1(_L("iSharedHeapChunk.IsPaged() returned --> 1, Expected --> 1"));
122 INFO_PRINTF1(_L("iSharedHeapChunk.IsPaged() returned --> 0, Expected --> 1"));
128 TBool CTWDP::DefaultDataPaged()
130 RProcess proc = RProcess();
131 _LIT(KPattern, "*fbserv*");
132 TFindProcess findProc(KPattern);
136 INFO_PRINTF2(_L("TFindProcess: Find a process whose name match the pattern %S "), &KPattern());
137 if(findProc.Next(fullName)!= KErrNone)
139 INFO_PRINTF1(_L("Error: Process whose name match the above pattern not found"));
140 User::LeaveIfError(err);
144 INFO_PRINTF2(_L("TFindProcess.Next() found process --> %S "), &fullName );
147 if(findProc.Next(fullName) != KErrNotFound)
149 INFO_PRINTF2(_L("Error: TFindProcess found more than 1 process matching the pattern --> %S "), &fullName );
150 User::Leave(KErrGeneral);
153 if( (err=proc.Open(fullName)) != KErrNone)
155 INFO_PRINTF2(_L("Error: RProcess.Open() returned --> %d"), err);
156 User::LeaveIfError(err);
159 TBool ret = proc.DefaultDataPaged();
164 TBool CTWDP::BitmapDataPagedL()
166 User::LeaveIfError(iBitmapChunk.OpenGlobal(KFBSERVLargeChunkName,ETrue));
167 TBool ret=iBitmapChunk.IsPaged();
170 INFO_PRINTF1(_L("iBitmapChunk.IsPaged() returned --> 1, Expected --> 1"));
174 INFO_PRINTF1(_L("iBitmapChunk.IsPaged() returned --> 0, Expected --> 1"));
180 __CONSTRUCT_STEP__(WDP)