1 // Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). |
1 // Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). |
2 // All rights reserved. |
2 // All rights reserved. |
3 // This component and the accompanying materials are made available |
3 // This component and the accompanying materials are made available |
4 // under the terms of the License "Eclipse Public License v1.0" |
4 // under the terms of "Eclipse Public License v1.0" |
5 // which accompanies this distribution, and is available |
5 // which accompanies this distribution, and is available |
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
7 // |
7 // |
8 // Initial Contributors: |
8 // Initial Contributors: |
9 // Nokia Corporation - initial contribution. |
9 // Nokia Corporation - initial contribution. |
11 // Contributors: |
11 // Contributors: |
12 // |
12 // |
13 // Description: |
13 // Description: |
14 // Tests Application Apparc base classes and utility functions to get application's data.\n |
14 // Tests Application Apparc base classes and utility functions to get application's data.\n |
15 // |
15 // |
|
16 // t_prostep.cpp |
16 // |
17 // |
17 |
18 |
18 |
19 /** |
19 |
20 @file t_prostep.cpp |
20 /** |
|
21 @file |
|
22 @test |
21 @test |
23 @internalComponent - Internal Symbian test code |
22 @internalComponent - Internal Symbian test code |
24 */ |
23 */ |
25 |
24 |
26 #include <f32file.h> |
25 #include <f32file.h> |
27 #include <fbs.h> |
26 #include <fbs.h> |
28 #include <s32std.h> |
27 #include <s32std.h> |
29 #include <s32stor.h> |
28 #include <s32stor.h> |
30 #include <s32file.h> |
29 #include <s32file.h> |
31 #include <ecom.h> |
30 #include <ecom/ecom.h> |
32 |
31 |
33 #include <apaid.h> |
32 #include <apaid.h> |
34 #include "..\apparc\apadll.h" |
33 #include "../apparc/apadll.h" |
35 #include "..\apgrfx\apgstd.h" |
34 #include "../apgrfx/APGSTD.H" |
36 #include <apgaplst.h> |
35 #include <apgaplst.h> |
37 #include <apgicnfl.h> |
36 #include <apgicnfl.h> |
38 #include <apgdoor.h> |
37 #include <apgdoor.h> |
39 #include <apfrec.h> |
38 #include <apfrec.h> |
40 #include <apfctlf.h> |
39 #include <apfctlf.h> |
267 rootName = _L("c:\\path\\nomemory.ext"); |
266 rootName = _L("c:\\path\\nomemory.ext"); |
268 ret=CApaApplication::GenerateFileName(iFs,rootName); |
267 ret=CApaApplication::GenerateFileName(iFs,rootName); |
269 TEST(ret==KErrNoMemory); |
268 TEST(ret==KErrNoMemory); |
270 __UHEAP_MARKEND; |
269 __UHEAP_MARKEND; |
271 __UHEAP_RESET; |
270 __UHEAP_RESET; |
272 |
|
273 // tidy up |
271 // tidy up |
274 file.Close(); |
272 file.Close(); |
275 iFs.Delete(_L("c:\\path\\name")); |
273 iFs.Delete(_L("c:\\path\\name")); |
276 iFs.Delete(_L("c:\\path\\name.ext")); |
274 iFs.Delete(_L("c:\\path\\name.ext")); |
277 |
275 |
1308 |
1306 |
1309 CFileMan* fileMan = CFileMan::NewL (iFs); |
1307 CFileMan* fileMan = CFileMan::NewL (iFs); |
1310 CleanupStack::PushL(fileMan); |
1308 CleanupStack::PushL(fileMan); |
1311 |
1309 |
1312 INFO_PRINTF1(_L("Copy tstapp files to C: drive.......")); |
1310 INFO_PRINTF1(_L("Copy tstapp files to C: drive.......")); |
1313 TInt ret = iFs.MkDir(KTempAppDir); |
1311 TInt ret = iFs.MkDirAll(KTempAppDir); |
1314 TEST(ret==KErrNone || ret==KErrAlreadyExists); |
1312 TEST(ret==KErrNone || ret==KErrAlreadyExists); |
1315 TEST(fileMan->Copy(regPath, KTempRegPath)==KErrNone); //Just to start the idle update. |
1313 TEST(fileMan->Copy(regPath, KTempRegPath)==KErrNone); //Just to start the idle update. |
1316 |
1314 |
1317 User::After(8000000); |
1315 User::After(8000000); |
1318 |
1316 |
1348 /** |
1346 /** |
1349 Auxiliary Fn for all Test Cases. |
1347 Auxiliary Fn for all Test Cases. |
1350 |
1348 |
1351 This method creates and installs an active scheduler and puts the |
1349 This method creates and installs an active scheduler and puts the |
1352 test code on the scheduler as a CIdle object. The method initiates |
1350 test code on the scheduler as a CIdle object. The method initiates |
1353 all tests by calling the static method CT_ProStepCallBack::CallBack(). |
1351 all tests by calling the static method CT_ProStepCallBack::CallBackL(). |
1354 |
1352 |
1355 */ |
1353 */ |
1356 void CT_ProStep::DoStepTestsInCallbackL() |
1354 void CT_ProStep::DoStepTestsInCallbackL() |
1357 { |
1355 { |
1358 // create an active scheduler |
1356 // create an active scheduler |
1365 CleanupStack::PushL(idle); |
1363 CleanupStack::PushL(idle); |
1366 |
1364 |
1367 CT_ProStepCallBack* callBack = new(ELeave) CT_ProStepCallBack(this); |
1365 CT_ProStepCallBack* callBack = new(ELeave) CT_ProStepCallBack(this); |
1368 CleanupStack::PushL(callBack); |
1366 CleanupStack::PushL(callBack); |
1369 |
1367 |
1370 idle->Start(TCallBack(CT_ProStepCallBack::CallBack,callBack)); |
1368 idle->Start(TCallBack(CT_ProStepCallBack::CallBackL,callBack)); |
1371 // start the test code |
1369 // start the test code |
1372 CActiveScheduler::Start(); |
1370 CActiveScheduler::Start(); |
1373 |
1371 |
1374 // all outstanding requests complete - kill the scheduler |
1372 // all outstanding requests complete - kill the scheduler |
1375 CleanupStack::PopAndDestroy(3); //scheduler, callBack, idle |
1373 CleanupStack::PopAndDestroy(3); //scheduler, callBack, idle |
1376 } |
1374 } |
1377 |
1375 |
1378 /** |
1376 /** |
1379 This static method is the callback function of CIdle object. The method |
1377 This static method is the callback function of CIdle object. The method |
1380 calls the non-static method DoStepTests() which initiates all the tests. |
1378 calls the non-static method DoStepTestsL() which initiates all the tests. |
1381 */ |
1379 */ |
1382 TInt CT_ProStepCallBack::CallBack(TAny* callBack /*aThis*/) |
1380 TInt CT_ProStepCallBack::CallBackL(TAny* callBack /*aThis*/) |
1383 { |
1381 { |
1384 //Call Test Step func |
1382 //Call Test Step func |
1385 ((CT_ProStepCallBack *)callBack)->iTestStep->DoStepTests(); |
1383 ((CT_ProStepCallBack *)callBack)->iTestStep->DoStepTestsL(); |
1386 |
1384 |
1387 CActiveScheduler::Stop(); |
1385 CActiveScheduler::Stop(); |
1388 return EFalse; // don't call back again |
1386 return EFalse; // don't call back again |
1389 } |
1387 } |
1390 |
1388 |
1406 |
1404 |
1407 /** |
1405 /** |
1408 Auxiliary Fn for all Test Cases. |
1406 Auxiliary Fn for all Test Cases. |
1409 The method initiates all tests to be performed. |
1407 The method initiates all tests to be performed. |
1410 */ |
1408 */ |
1411 void CT_ProStep::DoStepTests() |
1409 void CT_ProStep::DoStepTestsL() |
1412 { |
1410 { |
1413 INFO_PRINTF1(_L("Test AppListInvalidTest......")); |
1411 INFO_PRINTF1(_L("Test AppListInvalidTest......")); |
1414 RTestableApaLsSession ls; |
1412 RTestableApaLsSession ls; |
1415 TEST(KErrNone == ls.Connect()); |
1413 TEST(KErrNone == ls.Connect()); |
1416 CleanupClosePushL(ls); |
1414 CleanupClosePushL(ls); |