localisation/apparchitecture/tef/T_NonNativeAppsStep.cpp
branchSymbian3
changeset 57 b8d18c84f71c
parent 6 c108117318cb
equal deleted inserted replaced
56:aa99f2208aad 57:b8d18c84f71c
     1 // Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
     1 // Copyright (c) 2005-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 //
    14 //
    15 
    15 
    16 
       
    17 
       
    18 /**
    16 /**
    19  @file
    17  @file
    20  @test
    18  @test
    21  @internalComponent - Internal Symbian test code  
    19  @internalComponent - Internal Symbian test code  
    22 */
    20 */
    23 
    21 
    24 #include <E32STD.H>
    22 #include <e32std.h>
    25 #include <E32BASE.H>
    23 #include <e32base.h>
    26 #include <F32FILE.H>
    24 #include <f32file.h>
    27 #include <APGCLI.H>
    25 #include <apgcli.h>
    28 #include <APMREC.H>
    26 #include <apmrec.h>
    29 #include <APAID.H>
    27 #include <apaid.h>
    30 #include "testableapalssession.h"
    28 #include "testableapalssession.h"
    31 #include <APGICNFL.H>
    29 #include <apgicnfl.h>
    32 #include <APMSTD.H>
    30 #ifdef SYMBIAN_ENABLE_SPLIT_HEADERS
    33 #include <APACMDLN.H>
    31 #include <apaidpartner.h>
    34 #include <E32PROPERTY.H>
    32 #include <apgicnflpartner.h>
       
    33 //#include <apgicnflinternal.h>
       
    34 #endif //SYMBIAN_ENABLE_SPLIT_HEADERS
       
    35 #include <apmstd.h>
       
    36 #include <apacmdln.h>
       
    37 #include <e32property.h>
    35 #include <apgnotif.h>
    38 #include <apgnotif.h>
    36 
    39 
    37 #include "..\tef\TNonNative\tnnapp1.h"
    40 #include "../tef/TNonNative/TNNApp1.h"
    38 #include "T_NonNativeAppsStep.h"
    41 #include "T_NonNativeAppsStep.h"
    39 #include <appfwk_test.h>
    42 #include "appfwk_test.h"
    40 
    43 
    41 
    44 
    42 const TUint KApplicationType=0x10207f90;
    45 const TUint KApplicationType=0x10207f90;
    43 const TUint KApplicationA=0x10207f91;
    46 const TUint KApplicationA=0x10207f91;
    44 TUint KApplicationB = 0x2002237C;
    47 TUint KApplicationB = 0x2002237C;
    59 _LIT(KLitDocumentName3, "nnapp2:3");
    62 _LIT(KLitDocumentName3, "nnapp2:3");
    60 _LIT(KLitNativeExecutable, "z:\\sys\\bin\\TNNAPP2.EXE");
    63 _LIT(KLitNativeExecutable, "z:\\sys\\bin\\TNNAPP2.EXE");
    61 _LIT8(KLitMimeTypeA, "x-epoc/a-nnapp2");
    64 _LIT8(KLitMimeTypeA, "x-epoc/a-nnapp2");
    62 _LIT8(KLitMimeTypeB, "x-epoc/dummy");
    65 _LIT8(KLitMimeTypeB, "x-epoc/dummy");
    63 
    66 
    64 enum TOption 
       
    65 	{
       
    66 	EAppA,
       
    67 	EAppB
       
    68 	};
       
    69 
       
    70 
    67 
    71 LOCAL_C void DeregisterNonNativeL(TAny* aApparcServer)
    68 LOCAL_C void DeregisterNonNativeL(TAny* aApparcServer)
    72 	{
    69 	{
    73 	RApaLsSession& apparcServer=*STATIC_CAST(RApaLsSession*, aApparcServer);
    70 	RApaLsSession& apparcServer=*STATIC_CAST(RApaLsSession*, aApparcServer);
    74 	apparcServer.PrepareNonNativeApplicationsUpdatesL();
    71 	apparcServer.PrepareNonNativeApplicationsUpdatesL();
   117 
   114 
   118 TInt RTstAppService::DoTestL(TUid aServiceUid, TBool aPassingFileByHandle, const TDesC& aFileNameWithoutDriveOrPath)
   115 TInt RTstAppService::DoTestL(TUid aServiceUid, TBool aPassingFileByHandle, const TDesC& aFileNameWithoutDriveOrPath)
   119 	{ // static
   116 	{ // static
   120 	RTstAppService appService(aServiceUid);
   117 	RTstAppService appService(aServiceUid);
   121 	CleanupClosePushL(appService);
   118 	CleanupClosePushL(appService);
   122 	appService.ConnectL();
   119 
       
   120 	TInt error=KErrNone;
       
   121 	
       
   122 	//Try maximum 6 times to connect to server application
       
   123     for(TInt loopCount=0; loopCount<6; loopCount++)
       
   124         {
       
   125         TRAP(error, appService.ConnectL());
       
   126         if(error==KErrNone)
       
   127             break;
       
   128         
       
   129         if(error!=KErrNotFound)
       
   130             User::Leave(error);
       
   131         
       
   132         User::After(1000000); //wait till one second before trying again
       
   133         }
       
   134 
       
   135     User::LeaveIfError(error);
       
   136     
   123 	TRequestStatus requestStatus;
   137 	TRequestStatus requestStatus;
   124 	appService.ReceiveTestResult(requestStatus, aPassingFileByHandle, aFileNameWithoutDriveOrPath);
   138 	appService.ReceiveTestResult(requestStatus, aPassingFileByHandle, aFileNameWithoutDriveOrPath);
   125 	User::WaitForRequest(requestStatus);
   139 	User::WaitForRequest(requestStatus);
   126 	const TInt result=User::LeaveIfError(requestStatus.Int());
   140 	const TInt result=User::LeaveIfError(requestStatus.Int());
   127 	CleanupStack::PopAndDestroy(&appService);
   141 	CleanupStack::PopAndDestroy(&appService);
   500 			TThreadId threadId;
   514 			TThreadId threadId;
   501 			//due to access of file in private folder
   515 			//due to access of file in private folder
   502 			APPFWK_EXPECTED_PLATSEC_START;
   516 			APPFWK_EXPECTED_PLATSEC_START;
   503 			User::LeaveIfError(aApparcServer.StartDocument(fullFileName, threadId));
   517 			User::LeaveIfError(aApparcServer.StartDocument(fullFileName, threadId));
   504 			APPFWK_EXPECTED_PLATSEC_FINISH;
   518 			APPFWK_EXPECTED_PLATSEC_FINISH;
   505 			User::After(1500000);
       
   506 			TEST(RTstAppService::DoTestL(serviceUid, EFalse, fileNameWithoutDriveOrPath) == KCheckPass);
   519 			TEST(RTstAppService::DoTestL(serviceUid, EFalse, fileNameWithoutDriveOrPath) == KCheckPass);
   507 			}
   520 			}
   508 
   521 
   509 			{
   522 			{
   510 			TThreadId threadId;
   523 			TThreadId threadId;
   511 			User::LeaveIfError(aApparcServer.StartDocument(fullFileName, TDataType(expectedDataType), threadId));
   524 			User::LeaveIfError(aApparcServer.StartDocument(fullFileName, TDataType(expectedDataType), threadId));
   512 			User::After(1500000);
       
   513 			TEST(RTstAppService::DoTestL(serviceUid, EFalse, fileNameWithoutDriveOrPath) == KCheckPass);
   525 			TEST(RTstAppService::DoTestL(serviceUid, EFalse, fileNameWithoutDriveOrPath) == KCheckPass);
   514 			}
   526 			}
   515 
   527 
   516 			{
   528 			{
   517 			TThreadId threadId;
   529 			TThreadId threadId;
   518 			User::LeaveIfError(aApparcServer.StartDocument(fullFileName, TUid::Uid(0x10207f92), threadId));
   530 			User::LeaveIfError(aApparcServer.StartDocument(fullFileName, TUid::Uid(0x10207f92), threadId));
   519 			User::After(1500000);
       
   520 			TEST(RTstAppService::DoTestL(serviceUid, EFalse, fileNameWithoutDriveOrPath) == KCheckPass);
   531 			TEST(RTstAppService::DoTestL(serviceUid, EFalse, fileNameWithoutDriveOrPath) == KCheckPass);
   521 			}
   532 			}
   522 			}
   533 			}
   523 		}
   534 		}
   524 	//avoid race conditions
   535 	//avoid race conditions
   547 	TEST(propertyValue.CompareF(aExpectedNewValue)==0);
   558 	TEST(propertyValue.CompareF(aExpectedNewValue)==0);
   548 	User::LeaveIfError(property.Set(KNullDesC)); // reset it to an empty descriptor
   559 	User::LeaveIfError(property.Set(KNullDesC)); // reset it to an empty descriptor
   549 	CleanupStack::PopAndDestroy(&property);
   560 	CleanupStack::PopAndDestroy(&property);
   550 	}
   561 	}
   551 
   562 
   552 void CT_NonNativeAppsStep::CheckApplicationLaunchesOkayL(RApaLsSession& aApparcServer, const CApaCommandLine& aCommandLine, TAny* aOption)
   563 void CT_NonNativeAppsStep::CheckApplicationLaunchesOkayL(RApaLsSession& aApparcServer, const CApaCommandLine& aCommandLine, TOption aOption)
   553 	{
   564 	{
   554 	TThreadId notUsed;
   565 	TThreadId notUsed;
   555 	const TInt option = TInt(aOption);
   566 	switch(aOption)
   556 	switch(option)
       
   557 		{
   567 		{
   558 			case EAppA:
   568 			case EAppA:
   559 				INFO_PRINTF1(_L("..Checking ApplicationLaunchesOkayL for app 'A'.."));
   569 				INFO_PRINTF1(_L("..Checking ApplicationLaunchesOkayL for app 'A'.."));
   560 				User::LeaveIfError(aApparcServer.StartDocument(KLitDocumentName1, TDataType(KLitMimeTypeA), notUsed));
   570 				User::LeaveIfError(aApparcServer.StartDocument(KLitDocumentName1, TDataType(KLitMimeTypeA), notUsed));
   561 				CheckPropertyUpdateAndResetL(KLitDocumentName1);
   571 				CheckPropertyUpdateAndResetL(KLitDocumentName1);
   563 				CheckPropertyUpdateAndResetL(KLitDocumentName2);
   573 				CheckPropertyUpdateAndResetL(KLitDocumentName2);
   564 				break;
   574 				break;
   565 			case EAppB:
   575 			case EAppB:
   566 				INFO_PRINTF1(_L("..Checking ApplicationLaunchesOkayL for app 'B'.."));
   576 				INFO_PRINTF1(_L("..Checking ApplicationLaunchesOkayL for app 'B'.."));
   567 				TEST( aApparcServer.StartDocument(KLitDocumentName3, TDataType(KLitMimeTypeB), notUsed) == KErrNone);
   577 				TEST( aApparcServer.StartDocument(KLitDocumentName3, TDataType(KLitMimeTypeB), notUsed) == KErrNone);
       
   578 				CheckPropertyUpdateAndResetL(KLitDocumentName3);
   568 				break;
   579 				break;
   569 			default:
   580 			default:
   570 				break;
   581 				break;
   571 		}
   582 		}
   572 	}
   583 	}
   573 
   584 
   574 void CT_NonNativeAppsStep::CheckApplicationFailsToLaunchL(RApaLsSession& aApparcServer, const CApaCommandLine& aCommandLine, TAny* aOption)
   585 void CT_NonNativeAppsStep::CheckApplicationFailsToLaunchL(RApaLsSession& aApparcServer, const CApaCommandLine& aCommandLine, TOption aOption)
   575 	{
   586 	{
   576 	TThreadId notUsed;
   587 	TThreadId notUsed;
   577 	const TInt option = TInt(aOption);
   588 	switch(aOption)
   578 	switch(option)
       
   579 		{
   589 		{
   580 			case EAppA:
   590 			case EAppA:
   581 				INFO_PRINTF1(_L("..Checking ApplicationFailsToLaunchL for app 'A'.."));
   591 				INFO_PRINTF1(_L("..Checking ApplicationFailsToLaunchL for app 'A'.."));
   582 				TEST(aApparcServer.StartDocument(KLitDocumentName1, TDataType(KLitMimeTypeA), notUsed) != KErrNone);
   592 				TEST(aApparcServer.StartDocument(KLitDocumentName1, TDataType(KLitMimeTypeA), notUsed) != KErrNone);
   583 				TEST(aApparcServer.StartApp(aCommandLine)!=KErrNone);
   593 				TEST(aApparcServer.StartApp(aCommandLine)!=KErrNone);
   651 	
   661 	
   652 	INFO_PRINTF1(_L("..registering app using RegisterNonNativeApplicationL() "));
   662 	INFO_PRINTF1(_L("..registering app using RegisterNonNativeApplicationL() "));
   653 	aApparcServer.PrepareNonNativeApplicationsUpdatesL();
   663 	aApparcServer.PrepareNonNativeApplicationsUpdatesL();
   654 	aApparcServer.RegisterNonNativeApplicationL(TUid::Uid(KApplicationType), EDriveC, *registrationResourceFileWriter, NULL, NULL);
   664 	aApparcServer.RegisterNonNativeApplicationL(TUid::Uid(KApplicationType), EDriveC, *registrationResourceFileWriter, NULL, NULL);
   655 	aApparcServer.CommitNonNativeApplicationsUpdatesL();
   665 	aApparcServer.CommitNonNativeApplicationsUpdatesL();
   656 	CheckApplicationLaunchesOkayL(aApparcServer, *nextCommandLine, (TAny*)EAppA);
   666 	CheckApplicationLaunchesOkayL(aApparcServer, *nextCommandLine, EAppA);
   657 	//Check if there is no problem in registering same app again(basically simulating an upgrade)
   667 	//Check if there is no problem in registering same app again(basically simulating an upgrade)
   658 	INFO_PRINTF1(_L("..registering same app again using RegisterNonNativeApplicationL() "));
   668 	INFO_PRINTF1(_L("..registering same app again using RegisterNonNativeApplicationL() "));
   659 	aApparcServer.PrepareNonNativeApplicationsUpdatesL();
   669 	aApparcServer.PrepareNonNativeApplicationsUpdatesL();
   660 	aApparcServer.RegisterNonNativeApplicationL(TUid::Uid(KApplicationType), EDriveC, *registrationResourceFileWriter, NULL, NULL);
   670 	aApparcServer.RegisterNonNativeApplicationL(TUid::Uid(KApplicationType), EDriveC, *registrationResourceFileWriter, NULL, NULL);
   661 	aApparcServer.CommitNonNativeApplicationsUpdatesL();
   671 	aApparcServer.CommitNonNativeApplicationsUpdatesL();
   662 	CheckApplicationLaunchesOkayL(aApparcServer, *nextCommandLine, (TAny*)EAppA);
   672 	CheckApplicationLaunchesOkayL(aApparcServer, *nextCommandLine, EAppA);
   663 	
   673 	
   664 	INFO_PRINTF1(_L("..deregistering app using DeregisterNonNativeApplicationL() "));
   674 	INFO_PRINTF1(_L("..deregistering app using DeregisterNonNativeApplicationL() "));
   665 	aApparcServer.PrepareNonNativeApplicationsUpdatesL();
   675 	aApparcServer.PrepareNonNativeApplicationsUpdatesL();
   666 	aApparcServer.DeregisterNonNativeApplicationL(TUid::Uid(KApplicationA));
   676 	aApparcServer.DeregisterNonNativeApplicationL(TUid::Uid(KApplicationA));
   667 	aApparcServer.CommitNonNativeApplicationsUpdatesL();
   677 	aApparcServer.CommitNonNativeApplicationsUpdatesL();
   668 	CheckApplicationFailsToLaunchL(aApparcServer, *nextCommandLine, (TAny*)EAppA);
   678 	CheckApplicationFailsToLaunchL(aApparcServer, *nextCommandLine, EAppA);
   669 	
   679 	
   670 	_LIT8(KLitOpData, "opaquedata");
   680 	_LIT8(KLitOpData, "opaquedata");
   671 	registrationResourceFileWriter->SetOpaqueDataL(KLitOpData);
   681 	registrationResourceFileWriter->SetOpaqueDataL(KLitOpData);
   672 
   682 
   673 	CApaLocalisableResourceFileWriter* const localisableResourceFileWriter_noIcons=CApaLocalisableResourceFileWriter::NewL(KNullDesC, KLitApplicationCaptionA, 0, KNullDesC);
   683 	CApaLocalisableResourceFileWriter* const localisableResourceFileWriter_noIcons=CApaLocalisableResourceFileWriter::NewL(KNullDesC, KLitApplicationCaptionA, 0, KNullDesC);
   675 	INFO_PRINTF1(_L("..registering app using RegisterNonNativeApplicationL() with localisableResourceFileWriter_noIcons"));
   685 	INFO_PRINTF1(_L("..registering app using RegisterNonNativeApplicationL() with localisableResourceFileWriter_noIcons"));
   676 	aApparcServer.PrepareNonNativeApplicationsUpdatesL();
   686 	aApparcServer.PrepareNonNativeApplicationsUpdatesL();
   677 	aApparcServer.RegisterNonNativeApplicationL(TUid::Uid(KApplicationType), EDriveC, *registrationResourceFileWriter, localisableResourceFileWriter_noIcons, NULL);
   687 	aApparcServer.RegisterNonNativeApplicationL(TUid::Uid(KApplicationType), EDriveC, *registrationResourceFileWriter, localisableResourceFileWriter_noIcons, NULL);
   678 	aApparcServer.CommitNonNativeApplicationsUpdatesL();
   688 	aApparcServer.CommitNonNativeApplicationsUpdatesL();
   679 	CleanupStack::PopAndDestroy(localisableResourceFileWriter_noIcons);
   689 	CleanupStack::PopAndDestroy(localisableResourceFileWriter_noIcons);
   680 	CheckApplicationLaunchesOkayL(aApparcServer, *nextCommandLine, (TAny*)EAppA);
   690 	CheckApplicationLaunchesOkayL(aApparcServer, *nextCommandLine, EAppA);
   681 
   691 
   682 	//Testing with OpaqueData
   692 	//Testing with OpaqueData
   683 	TPtrC8 opData =nextCommandLine->OpaqueData();
   693 	TPtrC8 opData =nextCommandLine->OpaqueData();
   684 	TInt tst=opData.CompareF(KLitOpData);
   694 	TInt tst=opData.CompareF(KLitOpData);
   685 	TEST(opData.CompareF(KLitOpData)==0);
   695 	TEST(opData.CompareF(KLitOpData)==0);
   686 		
   696 		
   687 	INFO_PRINTF1(_L("..deregistering app using DeregisterNonNativeApplicationL() with localisableResourceFileWriter_noIcons"));
   697 	INFO_PRINTF1(_L("..deregistering app using DeregisterNonNativeApplicationL() with localisableResourceFileWriter_noIcons"));
   688 	aApparcServer.PrepareNonNativeApplicationsUpdatesL();
   698 	aApparcServer.PrepareNonNativeApplicationsUpdatesL();
   689 	aApparcServer.DeregisterNonNativeApplicationL(TUid::Uid(KApplicationA));
   699 	aApparcServer.DeregisterNonNativeApplicationL(TUid::Uid(KApplicationA));
   690 	aApparcServer.CommitNonNativeApplicationsUpdatesL();
   700 	aApparcServer.CommitNonNativeApplicationsUpdatesL();
   691 	CheckApplicationFailsToLaunchL(aApparcServer, *nextCommandLine, (TAny*)EAppA);
   701 	CheckApplicationFailsToLaunchL(aApparcServer, *nextCommandLine, EAppA);
   692 
   702 
   693 	//Testing with IconFile
   703 	//Testing with IconFile
   694 	CApaLocalisableResourceFileWriter* const localisableResourceFileWriter_withIcons=CApaLocalisableResourceFileWriter::NewL(KNullDesC, KLitApplicationCaptionA, 2, KNullDesC);
   704 	CApaLocalisableResourceFileWriter* const localisableResourceFileWriter_withIcons=CApaLocalisableResourceFileWriter::NewL(KNullDesC, KLitApplicationCaptionA, 2, KNullDesC);
   695 	CleanupStack::PushL(localisableResourceFileWriter_withIcons);
   705 	CleanupStack::PushL(localisableResourceFileWriter_withIcons);
   696 	INFO_PRINTF1(_L("..registering app using RegisterNonNativeApplicationL() with localisableResourceFileWriter_withIcons"));
   706 	INFO_PRINTF1(_L("..registering app using RegisterNonNativeApplicationL() with localisableResourceFileWriter_withIcons"));
   703 	aApparcServer.RegisterNonNativeApplicationL(TUid::Uid(KApplicationType), EDriveC, *registrationResourceFileWriter, localisableResourceFileWriter_withIcons, &iconFile);
   713 	aApparcServer.RegisterNonNativeApplicationL(TUid::Uid(KApplicationType), EDriveC, *registrationResourceFileWriter, localisableResourceFileWriter_withIcons, &iconFile);
   704 	iconFile.Close();
   714 	iconFile.Close();
   705 	CleanupStack::PopAndDestroy(&iconFile);
   715 	CleanupStack::PopAndDestroy(&iconFile);
   706 	
   716 	
   707 	aApparcServer.CommitNonNativeApplicationsUpdatesL();
   717 	aApparcServer.CommitNonNativeApplicationsUpdatesL();
   708 	CheckApplicationLaunchesOkayL(aApparcServer, *nextCommandLine, (TAny*)EAppA);
   718 	CheckApplicationLaunchesOkayL(aApparcServer, *nextCommandLine, EAppA);
   709 
   719 
   710 	HBufC* iconFileName = NULL;
   720 	HBufC* iconFileName = NULL;
   711 	TInt err = aApparcServer.GetAppIcon(TUid::Uid(KApplicationA),iconFileName);
   721 	TInt err = aApparcServer.GetAppIcon(TUid::Uid(KApplicationA),iconFileName);
   712 	TEST(err == KErrNone);
   722 	TEST(err == KErrNone);
   713 	_LIT(KIconFileName, "tstapp.mbm");
   723 	_LIT(KIconFileName, "tstapp.mbm");
   756 	
   766 	
   757 	INFO_PRINTF1(_L("..deregistering app using DeregisterNonNativeApplicationL() with localisableResourceFileWriter_withIcons"));
   767 	INFO_PRINTF1(_L("..deregistering app using DeregisterNonNativeApplicationL() with localisableResourceFileWriter_withIcons"));
   758 	aApparcServer.PrepareNonNativeApplicationsUpdatesL();
   768 	aApparcServer.PrepareNonNativeApplicationsUpdatesL();
   759 	aApparcServer.DeregisterNonNativeApplicationL(TUid::Uid(KApplicationA));
   769 	aApparcServer.DeregisterNonNativeApplicationL(TUid::Uid(KApplicationA));
   760 	aApparcServer.CommitNonNativeApplicationsUpdatesL();
   770 	aApparcServer.CommitNonNativeApplicationsUpdatesL();
   761 	CheckApplicationFailsToLaunchL(aApparcServer, *nextCommandLine, (TAny*)EAppA);
   771 	CheckApplicationFailsToLaunchL(aApparcServer, *nextCommandLine, EAppA);
   762 	
   772 	
   763 	//Testing GetAppIcon API for non-native application with SVG icon.
   773 	//Testing GetAppIcon API for non-native application with SVG icon.
   764 	TestGetAppIconForNonNativeL(aApparcServer,aFileServer, registrationResourceFileWriter, localisableResourceFileWriter_withIcons);
   774 	TestGetAppIconForNonNativeL(aApparcServer,aFileServer, registrationResourceFileWriter, localisableResourceFileWriter_withIcons);
   765 	
   775 	
   766  	// clean-up
   776  	// clean-up
   877 	//Close icon file
   887 	//Close icon file
   878 	CleanupStack::PopAndDestroy(&iconFile1);
   888 	CleanupStack::PopAndDestroy(&iconFile1);
   879 	}
   889 	}
   880 
   890 
   881 
   891 
       
   892 
   882 /**
   893 /**
   883    @SYMTestCaseID APPFWK-APPARC-0099
   894    @SYMTestCaseID APPFWK-APPARC-0099
   884   
   895   
   885    @SYMDEF	PDEF129466
   896    @SYMDEF	PDEF129467
   886   
   897   
   887    @SYMTestCaseDesc Tests ForceCommitNonNativeApplicationsUpdatesL() API.
   898    @SYMTestCaseDesc Tests ForceCommitNonNativeApplicationsUpdatesL() API.
   888   
   899   
   889    @SYMTestPriority High
   900    @SYMTestPriority High
   890   
   901   
   905 	CApaCommandLine* commandLine=NULL;
   916 	CApaCommandLine* commandLine=NULL;
   906 	User::LeaveIfError(CApaCommandLine::GetCommandLineFromProcessEnvironment(commandLine));
   917 	User::LeaveIfError(CApaCommandLine::GetCommandLineFromProcessEnvironment(commandLine));
   907 	CleanupStack::PushL(commandLine);
   918 	CleanupStack::PushL(commandLine);
   908 	const TPtrC executableName(commandLine->ExecutableName());
   919 	const TPtrC executableName(commandLine->ExecutableName());
   909 
   920 
   910 
       
   911 	_LIT_SECURITY_POLICY_S0(readSecurityPolicy, KMySID);
   921 	_LIT_SECURITY_POLICY_S0(readSecurityPolicy, KMySID);
   912 	_LIT_SECURITY_POLICY_PASS(writeSecurityPolicy);
   922 	_LIT_SECURITY_POLICY_PASS(writeSecurityPolicy);
   913 	
   923 
   914 	//TNNAPP2.exe sets the document name passed as part of the command line to this property.
   924 	//TNNAPP2.exe sets the document name passed as part of the command line to this property.
   915 	const TInt error=RProperty::Define(KPropertyKey, RProperty::EText, readSecurityPolicy, writeSecurityPolicy);
   925 	const TInt error=RProperty::Define(KPropertyKey, RProperty::EText, readSecurityPolicy, writeSecurityPolicy);
   916 	if (error!=KErrAlreadyExists)
   926 	if (error!=KErrAlreadyExists)
   917 		{
   927 		{
   918 		User::LeaveIfError(error);
   928 		User::LeaveIfError(error);
   949 	INFO_PRINTF1(_L("..commiting the registration is done"));	
   959 	INFO_PRINTF1(_L("..commiting the registration is done"));	
   950 	timeTakenToCommitRegistration=endTime.MicroSecondsFrom(startTime);
   960 	timeTakenToCommitRegistration=endTime.MicroSecondsFrom(startTime);
   951 
   961 
   952 	TInt64 value = timeTakenToCommitRegistration.Int64();
   962 	TInt64 value = timeTakenToCommitRegistration.Int64();
   953 	INFO_PRINTF2(_L("..Time taken for registration of application by CommitNonNativeApplicationsUpdatesL is %d micro seconds"), value);	
   963 	INFO_PRINTF2(_L("..Time taken for registration of application by CommitNonNativeApplicationsUpdatesL is %d micro seconds"), value);	
   954 	CheckApplicationLaunchesOkayL(aApparcServer, *nextCommandLine, (TAny*)EAppA);
   964 	CheckApplicationLaunchesOkayL(aApparcServer, *nextCommandLine, EAppA);
   955 	
   965 	
   956 	INFO_PRINTF1(_L("..deregistering app using DeregisterNonNativeApplicationL() "));
   966 	INFO_PRINTF1(_L("..deregistering app using DeregisterNonNativeApplicationL() "));
   957 	aApparcServer.PrepareNonNativeApplicationsUpdatesL();
   967 	aApparcServer.PrepareNonNativeApplicationsUpdatesL();
   958 	aApparcServer.DeregisterNonNativeApplicationL(TUid::Uid(KApplicationA));
   968 	aApparcServer.DeregisterNonNativeApplicationL(TUid::Uid(KApplicationA));
   959 	TTimeIntervalMicroSeconds timeTakenToCommitDeregistration;
   969 	TTimeIntervalMicroSeconds timeTakenToCommitDeregistration;
   963 	endTime.HomeTime();	
   973 	endTime.HomeTime();	
   964 	INFO_PRINTF1(_L("..commiting the deregistration is done"));
   974 	INFO_PRINTF1(_L("..commiting the deregistration is done"));
   965 	timeTakenToCommitDeregistration=endTime.MicroSecondsFrom(startTime);
   975 	timeTakenToCommitDeregistration=endTime.MicroSecondsFrom(startTime);
   966 	value = timeTakenToCommitDeregistration.Int64();
   976 	value = timeTakenToCommitDeregistration.Int64();
   967 	INFO_PRINTF2(_L("..Time taken for deregistration of application by CommitNonNativeApplicationsUpdatesL is %d micro seconds"), value);	
   977 	INFO_PRINTF2(_L("..Time taken for deregistration of application by CommitNonNativeApplicationsUpdatesL is %d micro seconds"), value);	
   968 	CheckApplicationFailsToLaunchL(aApparcServer, *nextCommandLine, (TAny*)EAppA);
   978 	CheckApplicationFailsToLaunchL(aApparcServer, *nextCommandLine, EAppA);
   969 
   979 
   970 	
   980 	
   971 	INFO_PRINTF1(_L("..registering app using RegisterNonNativeApplicationL() "));
   981 	INFO_PRINTF1(_L("..registering app using RegisterNonNativeApplicationL() "));
   972 	aApparcServer.PrepareNonNativeApplicationsUpdatesL();
   982 	aApparcServer.PrepareNonNativeApplicationsUpdatesL();
   973 	aApparcServer.RegisterNonNativeApplicationL(TUid::Uid(KApplicationType), EDriveC, *registrationResourceFileWriter, NULL, NULL);
   983 	aApparcServer.RegisterNonNativeApplicationL(TUid::Uid(KApplicationType), EDriveC, *registrationResourceFileWriter, NULL, NULL);
   981 	value = timeTakenToForceCommitRegistration.Int64();
   991 	value = timeTakenToForceCommitRegistration.Int64();
   982 	INFO_PRINTF2(_L("..Time taken for registration of application by ForceCommitNonNativeApplicationsUpdatesL is %d micro seconds"), value);
   992 	INFO_PRINTF2(_L("..Time taken for registration of application by ForceCommitNonNativeApplicationsUpdatesL is %d micro seconds"), value);
   983 	TRequestStatus appScanCompleted=KRequestPending; 
   993 	TRequestStatus appScanCompleted=KRequestPending; 
   984 	aApparcServer.SetNotify(EFalse,appScanCompleted);    
   994 	aApparcServer.SetNotify(EFalse,appScanCompleted);    
   985 	User::WaitForRequest(appScanCompleted); 
   995 	User::WaitForRequest(appScanCompleted); 
   986 	TEST(appScanCompleted.Int()==MApaAppListServObserver::EAppListChanged);
   996 	TEST(appScanCompleted.Int()==MApaAppListServObserver::EAppListChanged);	
   987 	CheckApplicationLaunchesOkayL(aApparcServer, *nextCommandLine, (TAny*)EAppA);
   997 	CheckApplicationLaunchesOkayL(aApparcServer, *nextCommandLine, EAppA);
   988 	
   998 	
   989 	INFO_PRINTF1(_L("..deregistering app using DeregisterNonNativeApplicationL() "));
   999 	INFO_PRINTF1(_L("..deregistering app using DeregisterNonNativeApplicationL() "));
   990 	aApparcServer.PrepareNonNativeApplicationsUpdatesL();
  1000 	aApparcServer.PrepareNonNativeApplicationsUpdatesL();
   991 	aApparcServer.DeregisterNonNativeApplicationL(TUid::Uid(KApplicationA));
  1001 	aApparcServer.DeregisterNonNativeApplicationL(TUid::Uid(KApplicationA));
   992 	TTimeIntervalMicroSeconds timeTakenToForceCommitDeregistration;
  1002 	TTimeIntervalMicroSeconds timeTakenToForceCommitDeregistration;
   999 	value = timeTakenToForceCommitDeregistration.Int64();
  1009 	value = timeTakenToForceCommitDeregistration.Int64();
  1000 	INFO_PRINTF2(_L("..Time taken for deregistration of application by ForceCommitNonNativeApplicationsUpdatesL is %d micro seconds"), value);
  1010 	INFO_PRINTF2(_L("..Time taken for deregistration of application by ForceCommitNonNativeApplicationsUpdatesL is %d micro seconds"), value);
  1001 	appScanCompleted=KRequestPending; 
  1011 	appScanCompleted=KRequestPending; 
  1002 	aApparcServer.SetNotify(EFalse,appScanCompleted);    
  1012 	aApparcServer.SetNotify(EFalse,appScanCompleted);    
  1003 	User::WaitForRequest(appScanCompleted);
  1013 	User::WaitForRequest(appScanCompleted);
  1004 	TEST(appScanCompleted.Int()==MApaAppListServObserver::EAppListChanged);
  1014 	TEST(appScanCompleted.Int()==MApaAppListServObserver::EAppListChanged);	
  1005 	CheckApplicationFailsToLaunchL(aApparcServer, *nextCommandLine, (TAny*)EAppA);
  1015 	CheckApplicationFailsToLaunchL(aApparcServer, *nextCommandLine, EAppA);
  1006 	TEST(timeTakenToForceCommitRegistration<timeTakenToCommitRegistration);	
  1016 	TEST(timeTakenToForceCommitRegistration<timeTakenToCommitRegistration);	
  1007 	TEST(timeTakenToForceCommitDeregistration<timeTakenToCommitDeregistration);
  1017 	TEST(timeTakenToForceCommitDeregistration<timeTakenToCommitDeregistration);
  1008 	
  1018 	
  1009 	CleanupStack::PopAndDestroy(4, commandLine);
  1019 	CleanupStack::PopAndDestroy(4, commandLine);
  1010 	}
  1020 	}
  1011 	
  1021 	
  1012 /**
  1022 /**
  1013    @SYMTestCaseID 			APPFWK-APPARC-0103
  1023    @SYMTestCaseID 			APPFWK-APPARC-0103
  1014   
  1024   
  1015    @SYMDEF					PDEF134174
  1025    @SYMDEF					PDEF135324
  1016   
  1026   
  1017    @SYMTestCaseDesc 		Tests ForceCommitNonNativeApplicationsUpdatesL() API.
  1027    @SYMTestCaseDesc 		Tests ForceCommitNonNativeApplicationsUpdatesL() API.
  1018   
  1028   
  1019    @SYMTestPriority 		High
  1029    @SYMTestPriority 		High
  1020   
  1030   
  1071 	
  1081 	
  1072 	TApaAppInfo info;
  1082 	TApaAppInfo info;
  1073 	CApaRegistrationResourceFileWriter* const registrationResourceFileWriterB=CApaRegistrationResourceFileWriter::NewL(TUid::Uid(KApplicationB), KLitLogicalExecutableA, TApaAppCapability::ENonNative);
  1083 	CApaRegistrationResourceFileWriter* const registrationResourceFileWriterB=CApaRegistrationResourceFileWriter::NewL(TUid::Uid(KApplicationB), KLitLogicalExecutableA, TApaAppCapability::ENonNative);
  1074 	CleanupStack::PushL(registrationResourceFileWriterB);
  1084 	CleanupStack::PushL(registrationResourceFileWriterB);
  1075 	registrationResourceFileWriterB->AddDataTypeL(KDataTypePriorityNormal, KLitMimeTypeB);
  1085 	registrationResourceFileWriterB->AddDataTypeL(KDataTypePriorityNormal, KLitMimeTypeB);
  1076 	
  1086 
  1077 	TestForceCommitL(aApparcServer, *registrationResourceFileWriter, *registrationResourceFileWriterB, *nextCommandLine);
  1087 	TestForceCommitL(aApparcServer, *registrationResourceFileWriter, *registrationResourceFileWriterB, *nextCommandLine);
  1078 	TestRollbackRegistrationL(aApparcServer, *registrationResourceFileWriter, *registrationResourceFileWriterB, *nextCommandLine);
  1088 	TestRollbackRegistrationL(aApparcServer, *registrationResourceFileWriter, *registrationResourceFileWriterB, *nextCommandLine);
  1079 	TestRollbackDeregistrationL(aApparcServer, *registrationResourceFileWriter, *registrationResourceFileWriterB, *nextCommandLine);
  1089 	TestRollbackDeregistrationL(aApparcServer, *registrationResourceFileWriter, *registrationResourceFileWriterB, *nextCommandLine);
  1080 	
  1090 	
  1081 	CleanupStack::PopAndDestroy(5, commandLine);
  1091 	CleanupStack::PopAndDestroy(5, commandLine);
  1097  	//Register app A and ForceCommitNNAUpdate
  1107  	//Register app A and ForceCommitNNAUpdate
  1098 	INFO_PRINTF1(_L("..registering app 'A' using RegisterNonNativeApplicationL() "));
  1108 	INFO_PRINTF1(_L("..registering app 'A' using RegisterNonNativeApplicationL() "));
  1099 	aApparcServer.PrepareNonNativeApplicationsUpdatesL();
  1109 	aApparcServer.PrepareNonNativeApplicationsUpdatesL();
  1100 	aApparcServer.RegisterNonNativeApplicationL(TUid::Uid(KApplicationType), EDriveC, aRegistrationResourceFileWriter, NULL, NULL);
  1110 	aApparcServer.RegisterNonNativeApplicationL(TUid::Uid(KApplicationType), EDriveC, aRegistrationResourceFileWriter, NULL, NULL);
  1101 	aApparcServer.ForceCommitNonNativeApplicationsUpdatesL();
  1111 	aApparcServer.ForceCommitNonNativeApplicationsUpdatesL();
  1102 	CheckApplicationFailsToLaunchL(aApparcServer, aNextCommandLine, (TAny*)EAppA);//Since applist update has not yet completed
  1112 	CheckApplicationFailsToLaunchL(aApparcServer, aNextCommandLine, EAppA);//Since applist update has not yet completed
  1103 	
  1113 	
  1104 	//Register app B and ForceCommitNNAUpdate
  1114 	//Register app B and ForceCommitNNAUpdate
  1105 	INFO_PRINTF1(_L("..registering app 'B' using RegisterNonNativeApplicationL() "));
  1115 	INFO_PRINTF1(_L("..registering app 'B' using RegisterNonNativeApplicationL() "));
  1106 	aApparcServer.PrepareNonNativeApplicationsUpdatesL();
  1116 	aApparcServer.PrepareNonNativeApplicationsUpdatesL();
  1107 	aApparcServer.RegisterNonNativeApplicationL(TUid::Uid(KApplicationType), EDriveC, aRegistrationResourceFileWriterB, NULL, NULL);
  1117 	aApparcServer.RegisterNonNativeApplicationL(TUid::Uid(KApplicationType), EDriveC, aRegistrationResourceFileWriterB, NULL, NULL);
  1108 	aApparcServer.ForceCommitNonNativeApplicationsUpdatesL();
  1118 	aApparcServer.ForceCommitNonNativeApplicationsUpdatesL();
  1109 	TThreadId notUsed2;
  1119 	TThreadId notUsed2;
  1110 	CheckApplicationFailsToLaunchL(aApparcServer, aNextCommandLine, (TAny*)EAppB);
  1120 	CheckApplicationFailsToLaunchL(aApparcServer, aNextCommandLine, EAppB);
  1111 	
  1121 	
  1112 	//Wait for applist to be updated
  1122 	//Wait for applist to be updated
  1113 	WaitForApplistUpdate(aApparcServer);
  1123 	WaitForApplistUpdate(aApparcServer);
  1114 	CheckApplicationLaunchesOkayL(aApparcServer, aNextCommandLine, (TAny*)EAppA);//Check if app A launches since applist update is complete now
  1124 	CheckApplicationLaunchesOkayL(aApparcServer, aNextCommandLine, EAppA);//Check if app A launches since applist update is complete now
  1115 	CheckApplicationLaunchesOkayL(aApparcServer, aNextCommandLine, (TAny*)EAppB);//Similarly check if app B launches
  1125 	CheckApplicationLaunchesOkayL(aApparcServer, aNextCommandLine, EAppB);//Similarly check if app B launches
  1116 	
  1126 	
  1117 	//DeRegister app B and ForceCommitNNAUpdate
  1127 	//DeRegister app B and ForceCommitNNAUpdate
  1118 	INFO_PRINTF1(_L("..deregistering app 'B' using DeregisterNonNativeApplicationL() "));
  1128 	INFO_PRINTF1(_L("..deregistering app 'B' using DeregisterNonNativeApplicationL() "));
  1119 	aApparcServer.PrepareNonNativeApplicationsUpdatesL();
  1129 	aApparcServer.PrepareNonNativeApplicationsUpdatesL();
  1120 	aApparcServer.DeregisterNonNativeApplicationL(TUid::Uid(KApplicationB));
  1130 	aApparcServer.DeregisterNonNativeApplicationL(TUid::Uid(KApplicationB));
  1121 	aApparcServer.ForceCommitNonNativeApplicationsUpdatesL();
  1131 	aApparcServer.ForceCommitNonNativeApplicationsUpdatesL();
  1122 	//Since applist update has not yet completed, both apps should launch
  1132 	//Since applist update has not yet completed, both apps should launch
  1123 	CheckApplicationLaunchesOkayL(aApparcServer, aNextCommandLine, (TAny*)EAppA); 
  1133 	CheckApplicationLaunchesOkayL(aApparcServer, aNextCommandLine, EAppA); 
  1124 	CheckApplicationLaunchesOkayL(aApparcServer, aNextCommandLine, (TAny*)EAppB);
  1134 	CheckApplicationLaunchesOkayL(aApparcServer, aNextCommandLine, EAppB);
  1125 	
  1135 	
  1126 	//Wait for applist to be updated
  1136 	//Wait for applist to be updated
  1127 	WaitForApplistUpdate(aApparcServer);
  1137 	WaitForApplistUpdate(aApparcServer);
  1128 	CheckApplicationLaunchesOkayL(aApparcServer, aNextCommandLine, (TAny*)EAppA);
  1138 	CheckApplicationLaunchesOkayL(aApparcServer, aNextCommandLine, EAppA);
  1129 	//Check if app B fails to launches Since applist update is complete now
  1139 	//Check if app B fails to launches Since applist update is complete now
  1130 	CheckApplicationFailsToLaunchL(aApparcServer, aNextCommandLine, (TAny*)EAppB);
  1140 	CheckApplicationFailsToLaunchL(aApparcServer, aNextCommandLine, EAppB);
  1131 	
  1141 	
  1132 	//Deregister app A and ForceCommitNNAUpdate
  1142 	//Deregister app A and ForceCommitNNAUpdate
  1133 	INFO_PRINTF1(_L("..deregistering app 'A' using RegisterNonNativeApplicationL() "));
  1143 	INFO_PRINTF1(_L("..deregistering app 'A' using RegisterNonNativeApplicationL() "));
  1134 	aApparcServer.PrepareNonNativeApplicationsUpdatesL();
  1144 	aApparcServer.PrepareNonNativeApplicationsUpdatesL();
  1135 	aApparcServer.DeregisterNonNativeApplicationL(TUid::Uid(KApplicationA));
  1145 	aApparcServer.DeregisterNonNativeApplicationL(TUid::Uid(KApplicationA));
  1136 	aApparcServer.ForceCommitNonNativeApplicationsUpdatesL();
  1146 	aApparcServer.ForceCommitNonNativeApplicationsUpdatesL();
  1137 	WaitForApplistUpdate(aApparcServer);
  1147 	WaitForApplistUpdate(aApparcServer);
  1138 	//Both apps fail to launch since they are deregistered
  1148 	//Both apps fail to launch since they are deregistered
  1139 	CheckApplicationFailsToLaunchL(aApparcServer, aNextCommandLine, (TAny*)EAppA);
  1149 	CheckApplicationFailsToLaunchL(aApparcServer, aNextCommandLine, EAppA);
  1140 	CheckApplicationFailsToLaunchL(aApparcServer, aNextCommandLine, (TAny*)EAppB);
  1150 	CheckApplicationFailsToLaunchL(aApparcServer, aNextCommandLine, EAppB);
  1141 	
  1151 	
  1142 	INFO_PRINTF1(_L("..End Testing TestForceCommitL API..."));
  1152 	INFO_PRINTF1(_L("..End Testing TestForceCommitL API..."));
  1143  	}
  1153  	}
  1144  
  1154  
  1145   void CT_NonNativeAppsStep::TestRollbackRegistrationL(RApaLsSession& aApparcServer, CApaRegistrationResourceFileWriter& aRegistrationResourceFileWriter, CApaRegistrationResourceFileWriter& aRegistrationResourceFileWriterB, CApaCommandLine& aNextCommandLine)
  1155   void CT_NonNativeAppsStep::TestRollbackRegistrationL(RApaLsSession& aApparcServer, CApaRegistrationResourceFileWriter& aRegistrationResourceFileWriter, CApaRegistrationResourceFileWriter& aRegistrationResourceFileWriterB, CApaCommandLine& aNextCommandLine)
  1149  	//Register app A and ForceCommitNNAUpdate
  1159  	//Register app A and ForceCommitNNAUpdate
  1150 	INFO_PRINTF1(_L("..registering app 'A' using RegisterNonNativeApplicationL() "));
  1160 	INFO_PRINTF1(_L("..registering app 'A' using RegisterNonNativeApplicationL() "));
  1151 	aApparcServer.PrepareNonNativeApplicationsUpdatesL();
  1161 	aApparcServer.PrepareNonNativeApplicationsUpdatesL();
  1152 	aApparcServer.RegisterNonNativeApplicationL(TUid::Uid(KApplicationType), EDriveC, aRegistrationResourceFileWriter, NULL, NULL);
  1162 	aApparcServer.RegisterNonNativeApplicationL(TUid::Uid(KApplicationType), EDriveC, aRegistrationResourceFileWriter, NULL, NULL);
  1153 	aApparcServer.ForceCommitNonNativeApplicationsUpdatesL();
  1163 	aApparcServer.ForceCommitNonNativeApplicationsUpdatesL();
  1154 	CheckApplicationFailsToLaunchL(aApparcServer, aNextCommandLine, (TAny*)EAppA);//Since applist update has not yet completed
  1164 	CheckApplicationFailsToLaunchL(aApparcServer, aNextCommandLine, EAppA);//Since applist update has not yet completed
  1155 	
  1165 	
  1156 	//Register app B and RollbackNNAUpdates
  1166 	//Register app B and RollbackNNAUpdates
  1157 	INFO_PRINTF1(_L("..registering app 'B' using RegisterNonNativeApplicationL() "));
  1167 	INFO_PRINTF1(_L("..registering app 'B' using RegisterNonNativeApplicationL() "));
  1158 	aApparcServer.PrepareNonNativeApplicationsUpdatesL();
  1168 	aApparcServer.PrepareNonNativeApplicationsUpdatesL();
  1159 	aApparcServer.RegisterNonNativeApplicationL(TUid::Uid(KApplicationType), EDriveC, aRegistrationResourceFileWriterB, NULL, NULL);
  1169 	aApparcServer.RegisterNonNativeApplicationL(TUid::Uid(KApplicationType), EDriveC, aRegistrationResourceFileWriterB, NULL, NULL);
  1160 	aApparcServer.RollbackNonNativeApplicationsUpdates();
  1170 	aApparcServer.RollbackNonNativeApplicationsUpdates();
  1161 	
  1171 	
  1162 	//Wait for applist to be updated
  1172 	//Wait for applist to be updated
  1163 	WaitForApplistUpdate(aApparcServer);
  1173 	WaitForApplistUpdate(aApparcServer);
  1164 	CheckApplicationLaunchesOkayL(aApparcServer, aNextCommandLine, (TAny*)EAppA);//Check if app A launches
  1174 	CheckApplicationLaunchesOkayL(aApparcServer, aNextCommandLine, EAppA);//Check if app A launches
  1165 	//App B's registration was rolled back, so cannot launch it
  1175 	//App B's registration was rolled back, so cannot launch it
  1166 	CheckApplicationFailsToLaunchL(aApparcServer, aNextCommandLine, (TAny*)EAppB);
  1176 	CheckApplicationFailsToLaunchL(aApparcServer, aNextCommandLine, EAppB);
  1167 	
  1177 	
  1168 	//DeRegister app A and ForceCommitNNAUpdate
  1178 	//DeRegister app A and ForceCommitNNAUpdate
  1169 	INFO_PRINTF1(_L("..deregistering app 'A' using DeregisterNonNativeApplicationL() "));
  1179 	INFO_PRINTF1(_L("..deregistering app 'A' using DeregisterNonNativeApplicationL() "));
  1170 	aApparcServer.PrepareNonNativeApplicationsUpdatesL();
  1180 	aApparcServer.PrepareNonNativeApplicationsUpdatesL();
  1171 	aApparcServer.DeregisterNonNativeApplicationL(TUid::Uid(KApplicationA));
  1181 	aApparcServer.DeregisterNonNativeApplicationL(TUid::Uid(KApplicationA));
  1172 	aApparcServer.ForceCommitNonNativeApplicationsUpdatesL();
  1182 	aApparcServer.ForceCommitNonNativeApplicationsUpdatesL();
  1173 	//Since applist update has not yet completed, app A should launch
  1183 	//Since applist update has not yet completed, app A should launch
  1174 	CheckApplicationLaunchesOkayL(aApparcServer, aNextCommandLine, (TAny*)EAppA); 
  1184 	CheckApplicationLaunchesOkayL(aApparcServer, aNextCommandLine, EAppA); 
  1175 	
  1185 	
  1176 	//Wait for applist to be updated
  1186 	//Wait for applist to be updated
  1177 	WaitForApplistUpdate(aApparcServer);
  1187 	WaitForApplistUpdate(aApparcServer);
  1178 	//Both apps fail to launch
  1188 	//Both apps fail to launch
  1179 	CheckApplicationFailsToLaunchL(aApparcServer, aNextCommandLine, (TAny*)EAppA);
  1189 	CheckApplicationFailsToLaunchL(aApparcServer, aNextCommandLine, EAppA);
  1180 	CheckApplicationFailsToLaunchL(aApparcServer, aNextCommandLine, (TAny*)EAppB);
  1190 	CheckApplicationFailsToLaunchL(aApparcServer, aNextCommandLine, EAppB);
  1181 	
  1191 	
  1182 	INFO_PRINTF1(_L("..End Testing TestRollbackRegistrationL API..."));
  1192 	INFO_PRINTF1(_L("..End Testing TestRollbackRegistrationL API..."));
  1183 	}
  1193 	}
  1184  	
  1194  	
  1185   void CT_NonNativeAppsStep::TestRollbackDeregistrationL(RApaLsSession& aApparcServer, CApaRegistrationResourceFileWriter& aRegistrationResourceFileWriter, CApaRegistrationResourceFileWriter& aRegistrationResourceFileWriterB, CApaCommandLine& aNextCommandLine)
  1195   void CT_NonNativeAppsStep::TestRollbackDeregistrationL(RApaLsSession& aApparcServer, CApaRegistrationResourceFileWriter& aRegistrationResourceFileWriter, CApaRegistrationResourceFileWriter& aRegistrationResourceFileWriterB, CApaCommandLine& aNextCommandLine)
  1189  	//Register app A and ForceCommitNNAUpdate
  1199  	//Register app A and ForceCommitNNAUpdate
  1190 	INFO_PRINTF1(_L("..registering app 'A' using RegisterNonNativeApplicationL() "));
  1200 	INFO_PRINTF1(_L("..registering app 'A' using RegisterNonNativeApplicationL() "));
  1191 	aApparcServer.PrepareNonNativeApplicationsUpdatesL();
  1201 	aApparcServer.PrepareNonNativeApplicationsUpdatesL();
  1192 	aApparcServer.RegisterNonNativeApplicationL(TUid::Uid(KApplicationType), EDriveC, aRegistrationResourceFileWriter, NULL, NULL);
  1202 	aApparcServer.RegisterNonNativeApplicationL(TUid::Uid(KApplicationType), EDriveC, aRegistrationResourceFileWriter, NULL, NULL);
  1193 	aApparcServer.ForceCommitNonNativeApplicationsUpdatesL();
  1203 	aApparcServer.ForceCommitNonNativeApplicationsUpdatesL();
  1194 	CheckApplicationFailsToLaunchL(aApparcServer, aNextCommandLine, (TAny*)EAppA);//Since applist update has not yet completed
  1204 	CheckApplicationFailsToLaunchL(aApparcServer, aNextCommandLine, EAppA);//Since applist update has not yet completed
  1195 	
  1205 	
  1196 	//Register app B and ForceCommitNNAUpdate
  1206 	//Register app B and ForceCommitNNAUpdate
  1197 	INFO_PRINTF1(_L("..registering app 'B' using RegisterNonNativeApplicationL() "));
  1207 	INFO_PRINTF1(_L("..registering app 'B' using RegisterNonNativeApplicationL() "));
  1198 	aApparcServer.PrepareNonNativeApplicationsUpdatesL();
  1208 	aApparcServer.PrepareNonNativeApplicationsUpdatesL();
  1199 	aApparcServer.RegisterNonNativeApplicationL(TUid::Uid(KApplicationType), EDriveC, aRegistrationResourceFileWriterB, NULL, NULL);
  1209 	aApparcServer.RegisterNonNativeApplicationL(TUid::Uid(KApplicationType), EDriveC, aRegistrationResourceFileWriterB, NULL, NULL);
  1200 	aApparcServer.ForceCommitNonNativeApplicationsUpdatesL();
  1210 	aApparcServer.ForceCommitNonNativeApplicationsUpdatesL();
  1201 	CheckApplicationFailsToLaunchL(aApparcServer, aNextCommandLine, (TAny*)EAppB);
  1211 	CheckApplicationFailsToLaunchL(aApparcServer, aNextCommandLine, EAppB);
  1202 	
  1212 	
  1203 	//Wait for applist to be updated
  1213 	//Wait for applist to be updated
  1204 	WaitForApplistUpdate(aApparcServer);
  1214 	WaitForApplistUpdate(aApparcServer);
  1205 	//Check if both apps launches since applist update is complete now
  1215 	//Check if both apps launches since applist update is complete now
  1206 	CheckApplicationLaunchesOkayL(aApparcServer, aNextCommandLine, (TAny*)EAppA);
  1216 	CheckApplicationLaunchesOkayL(aApparcServer, aNextCommandLine, EAppA);
  1207 	CheckApplicationLaunchesOkayL(aApparcServer, aNextCommandLine, (TAny*)EAppB);
  1217 	CheckApplicationLaunchesOkayL(aApparcServer, aNextCommandLine, EAppB);
  1208 	
  1218 	
  1209 	//DeRegister app B and ForceCommitNNAUpdate
  1219 	//DeRegister app B and ForceCommitNNAUpdate
  1210 	INFO_PRINTF1(_L("..deregistering app 'B' using DeregisterNonNativeApplicationL() "));
  1220 	INFO_PRINTF1(_L("..deregistering app 'B' using DeregisterNonNativeApplicationL() "));
  1211 	aApparcServer.PrepareNonNativeApplicationsUpdatesL();
  1221 	aApparcServer.PrepareNonNativeApplicationsUpdatesL();
  1212 	aApparcServer.DeregisterNonNativeApplicationL(TUid::Uid(KApplicationB));
  1222 	aApparcServer.DeregisterNonNativeApplicationL(TUid::Uid(KApplicationB));
  1219 	aApparcServer.RollbackNonNativeApplicationsUpdates();
  1229 	aApparcServer.RollbackNonNativeApplicationsUpdates();
  1220 	
  1230 	
  1221 	//Wait for applist to be updated
  1231 	//Wait for applist to be updated
  1222 	WaitForApplistUpdate(aApparcServer);
  1232 	WaitForApplistUpdate(aApparcServer);
  1223 	//Since deregistration of app A was rolled back it still launches
  1233 	//Since deregistration of app A was rolled back it still launches
  1224 	CheckApplicationLaunchesOkayL(aApparcServer, aNextCommandLine, (TAny*)EAppA); 
  1234 	CheckApplicationLaunchesOkayL(aApparcServer, aNextCommandLine, EAppA); 
  1225 	CheckApplicationFailsToLaunchL(aApparcServer, aNextCommandLine, (TAny*)EAppB);
  1235 	CheckApplicationFailsToLaunchL(aApparcServer, aNextCommandLine, EAppB);
  1226 
  1236 
  1227 	INFO_PRINTF1(_L("..deregistering app 'A' using DeregisterNonNativeApplicationL() "));
  1237 	INFO_PRINTF1(_L("..deregistering app 'A' using DeregisterNonNativeApplicationL() "));
  1228 	aApparcServer.PrepareNonNativeApplicationsUpdatesL();
  1238 	aApparcServer.PrepareNonNativeApplicationsUpdatesL();
  1229 	aApparcServer.DeregisterNonNativeApplicationL(TUid::Uid(KApplicationA));
  1239 	aApparcServer.DeregisterNonNativeApplicationL(TUid::Uid(KApplicationA));
  1230 	aApparcServer.ForceCommitNonNativeApplicationsUpdatesL();
  1240 	aApparcServer.ForceCommitNonNativeApplicationsUpdatesL();
  1231 
  1241 
  1232 	//Wait for applist to be updated
  1242 	//Wait for applist to be updated
  1233 	WaitForApplistUpdate(aApparcServer);
  1243 	WaitForApplistUpdate(aApparcServer);
  1234 	//Both apps fail to launch
  1244 	//Both apps fail to launch
  1235 	CheckApplicationFailsToLaunchL(aApparcServer, aNextCommandLine, (TAny*)EAppA);
  1245 	CheckApplicationFailsToLaunchL(aApparcServer, aNextCommandLine, EAppA);
  1236 	CheckApplicationFailsToLaunchL(aApparcServer, aNextCommandLine, (TAny*)EAppB);
  1246 	CheckApplicationFailsToLaunchL(aApparcServer, aNextCommandLine, EAppB);
  1237 	
  1247 	
  1238 	INFO_PRINTF1(_L("..End Testing TestRollbackDeregistrationL API..."));
  1248 	INFO_PRINTF1(_L("..End Testing TestRollbackDeregistrationL API..."));
  1239  	}
  1249  	}
  1240  
  1250  
  1241 // CTestStep derived functions
  1251 // CTestStep derived functions
  1301 	CleanupStack::PopAndDestroy(3, &fileArray);
  1311 	CleanupStack::PopAndDestroy(3, &fileArray);
  1302 
  1312 
  1303 	INFO_PRINTF1(_L("....Test NonNativeApps completed!"));
  1313 	INFO_PRINTF1(_L("....Test NonNativeApps completed!"));
  1304 	return TestStepResult();
  1314 	return TestStepResult();
  1305 	}
  1315 	}
       
  1316 
       
  1317