localisation/apparchitecture/tef/T_RecUpgrade.cpp
branchSymbian3
changeset 57 b8d18c84f71c
parent 6 c108117318cb
equal deleted inserted replaced
56:aa99f2208aad 57:b8d18c84f71c
     1 // Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
     1 // Copyright (c) 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 // This test case is used to verify that a recognizer plugin can be upgraded and  used 
    14 // This test case is used to verify that a recognizer plugin can be upgraded and  used 
    15 // without reboot.
    15 // without reboot.
    16 // 
    16 //
       
    17 // t_recupgrade.cpp
    17 //
    18 //
    18 
    19 
    19 
    20 
    20 
    21 
    21 /**
    22 /**
    22  @file
    23  @file t_recupgrade.cpp
    23  @internalComponent - Internal Symbian test code
    24  @internalComponent - Internal Symbian test code
    24 */
    25 */
    25 
    26 
    26 #include "testableapalssession.h"
    27 #include "testableapalssession.h"
    27 #include "T_RecUpgrade.h"
    28 #include "T_RecUpgrade.h"
    28 #include "appfwk_test_utils.h"
    29 #include "TRecUpgrade/upgconstants.h"
    29 #include "trecupgrade/upgconstants.h"
    30 
    30 
    31 //
    31 /////////////////////////////////////////////////
       
    32 
    32 
    33 // Should be enough for CApaEComMonitor to detect new plugin
    33 // Should be enough for CApaEComMonitor to detect new plugin
    34 const TInt KOneSecondDelay = 1000000;
    34 const TInt KOneSecondDelay = 1000000;
    35 
    35 
    36 /////////////////////////////////////////////////
    36 //
    37 
    37 
    38 CT_RecUpgradeStep::CT_RecUpgradeStep()
    38 CT_RecUpgradeStep::CT_RecUpgradeStep()
    39 	{
    39 	{
    40 	// Call base class method to set up the human readable name for logging
    40 	// Call base class method to set up the human readable name for logging
    41 	SetTestStepName(KT_RecUpgradeStep);
    41 	SetTestStepName(KT_RecUpgradeStep);
    42 	}
    42 	}
    43 
    43 
    44 CT_RecUpgradeStep::~CT_RecUpgradeStep()
    44 CT_RecUpgradeStep::~CT_RecUpgradeStep()
    45 	{
    45 	{
       
    46 	}
       
    47 
       
    48 
       
    49 TInt CT_RecUpgradeStep::DeleteFileL(const TDesC &aFileName, RSmlTestUtils &fs)
       
    50 	{
       
    51 	TInt fileExists = EFalse;
       
    52 	TInt err;
       
    53 	fs.IsFilePresent(aFileName, fileExists);
       
    54 	if (fileExists)
       
    55 		{
       
    56 		fs.ChangeFilePermissionL(aFileName); // clear readonly attribute inherited from z:
       
    57 		err = fs.DeleteFileL(aFileName);
       
    58 		return(err);
       
    59 		}
       
    60 	return(KErrNotFound);
    46 	}
    61 	}
    47 
    62 
    48 /**
    63 /**
    49 Check that the test plugin file has not been left in the filesystem from a previous run.
    64 Check that the test plugin file has not been left in the filesystem from a previous run.
    50 */
    65 */
    70 	{
    85 	{
    71 	RSmlTestUtils fs;
    86 	RSmlTestUtils fs;
    72 	CleanupClosePushL(fs);
    87 	CleanupClosePushL(fs);
    73 	User::LeaveIfError(fs.Connect());
    88 	User::LeaveIfError(fs.Connect());
    74 
    89 
    75 	TBool fileExists = EFalse;
    90 	TInt err = CT_RecUpgradeStep::DeleteFileL(KUpgRscTargetPath,fs);
    76 	fs.IsFilePresent(KUpgRscTargetPath, fileExists);
    91 	if(err == KErrNone || err == KErrNotFound) 
    77 	if(fileExists)
    92 		INFO_PRINTF1(_L("Removed temporary file recupgrade.rsc or not found"));
    78 		{
    93 	else 
    79 		fs.ChangeFilePermissionL(KUpgRscTargetPath); // clear readonly attribute inherited from z:
    94 		INFO_PRINTF1(_L("Failed to remove temporary file recupgrade.rsc"));	
    80 		const TInt err = fs.DeleteFileL(KUpgRscTargetPath);
    95 	
    81 		if(err == KErrNone) 
    96 	err = CT_RecUpgradeStep::DeleteFileL(KUpgDllTargetPath,fs);
    82 			INFO_PRINTF1(_L("Removed temporary file recupgrade.rsc"));
    97 	if(err == KErrNone || err == KErrNotFound) 
    83 		else 
    98 		INFO_PRINTF1(_L("Removed temporary file recupgrade.dll or not found"));
    84 			INFO_PRINTF1(_L("Failed to remove temporary file recupgrade.rsc"));	
    99 	else 
    85 		}
   100 		INFO_PRINTF1(_L("Failed to remove temporary file recupgrade.dll"));	
    86 		
   101 
    87 	CleanupStack::PopAndDestroy(&fs);
   102 	CleanupStack::PopAndDestroy(&fs);
    88 	return TestStepResult();
   103 	return TestStepResult();
    89 	}
   104 	}
    90 	
   105 	
    91 /*
   106 /*
    94 TVerdict CT_RecUpgradeStep::doTestStepL()
   109 TVerdict CT_RecUpgradeStep::doTestStepL()
    95 	{
   110 	{
    96 	RTestableApaLsSession apparcServer;
   111 	RTestableApaLsSession apparcServer;
    97 	CleanupClosePushL(apparcServer);
   112 	CleanupClosePushL(apparcServer);
    98 	User::LeaveIfError(apparcServer.Connect());
   113 	User::LeaveIfError(apparcServer.Connect());
    99 	//DONT_CHECK skips the heap check at server side. This heap imbalance happens due to copying recupgrade.dll to c:\sys\bin
   114 	HEAP_TEST_LS_SESSION(apparcServer, 0, 0, TestUpgradeRecognizerL(apparcServer), apparcServer.FlushRecognitionCache());
   100 	//and failed to delete it in cleanup (Windows OS don’t allow to delete any file which are in use).
   115 	HEAP_TEST_LS_SESSION(apparcServer, 0, 0, TestUpgradeRecognizer2L(apparcServer), apparcServer.FlushRecognitionCache());	
   101  	HEAP_TEST_LS_SESSION(apparcServer, 0, DONT_CHECK, TestUpgradeRecognizerL(apparcServer), NO_CLEANUP);
       
   102 
   116 
   103 	CleanupStack::PopAndDestroy(&apparcServer);
   117 	CleanupStack::PopAndDestroy(&apparcServer);
   104 	
   118 	
   105 	return TestStepResult();
   119 	return TestStepResult();
   106 	}
   120 	}
   117 @SYMTestStatus Implemented
   131 @SYMTestStatus Implemented
   118 
   132 
   119 @SYMTestActions:
   133 @SYMTestActions:
   120 	
   134 	
   121 	1. Try to recognize .upg file with version 1 of recupgrade ECOM plugin but if shuld not be able to recognize as it is implemented like that
   135 	1. Try to recognize .upg file with version 1 of recupgrade ECOM plugin but if shuld not be able to recognize as it is implemented like that
   122 	2. Install version 2 of recupgrade plugin (copy recupgrade_winscw/armv5_rec.dll and recupgrade_1.rsc from z:\system\data to c:\sys\bin and c:\resource\plugin respectively)
   136 	2. Install version 2 of recupgrade plugin (copy recupgrade_armv5_rel.dll and recupgrade.rsc from z:\system\data to c:\sys\bin and c:\resource\plugin respectively)
   123 
       
   124 	3. Because of installation Apparc will be notified and it will reload all recognizers plugin
   137 	3. Because of installation Apparc will be notified and it will reload all recognizers plugin
   125 	4. Now try to recognize .upg file . it shuld be able to recognize as vertion 2 is implemented like that
   138 	4. Now try to recognize .upg file . it shuld be able to recognize as vertion 2 is implemented like that
   126 
   139 
   127 @SYMTestExpectedResults Test should complete without any leave, panic or error.
   140 @SYMTestExpectedResults Test should complete without any leave, panic or error.
   128  */
   141  */
   145 	RSmlTestUtils fs;
   158 	RSmlTestUtils fs;
   146 	CleanupClosePushL(fs);
   159 	CleanupClosePushL(fs);
   147 	User::LeaveIfError(fs.Connect());
   160 	User::LeaveIfError(fs.Connect());
   148 	
   161 	
   149 	// Ensure c:\\resource\\plugins is created, otherwise leave from this teststep
   162 	// Ensure c:\\resource\\plugins is created, otherwise leave from this teststep
   150 	
       
   151 	TInt err = fs.CreateDirectoryL(KUpgRscTargetDir);
   163 	TInt err = fs.CreateDirectoryL(KUpgRscTargetDir);
   152 	TESTEL((err == KErrNone || err == KErrAlreadyExists), err);
   164 	TESTEL((err == KErrNone || err == KErrAlreadyExists), err);
   153 	INFO_PRINTF1(_L("c:\\resource\\plugins is created successfully or already exists"));
   165 	INFO_PRINTF1(_L("c:\\resource\\plugins is created successfully or already exists"));
   154 	
   166 	
   155 	// Ensure c:\\sys\\bin is created, otherwise leave from this teststep
   167 	// Ensure c:\\sys\\bin is created, otherwise leave from this teststep
   156 	
       
   157 	err = fs.CreateDirectoryL(KUpgDllTargetDir);
   168 	err = fs.CreateDirectoryL(KUpgDllTargetDir);
   158 	TESTEL((err == KErrNone || err == KErrAlreadyExists), err);
   169 	TESTEL((err == KErrNone || err == KErrAlreadyExists), err);
   159 	INFO_PRINTF1(_L("c:\\sys\\bin is created successfully or already exists"));
   170 	INFO_PRINTF1(_L("c:\\sys\\bin is created successfully or already exists"));
   160 
   171 
   161 	// Copy recupgrade.rsc from z:\\ to c:\\resource\\plugins, to trigger the rescan for plugins.
   172 	// Copy recupgrade.rsc from z:\\ to c:\\resource\\plugins, to trigger the rescan for plugins.
   162 	
       
   163 	err = fs.CopyFileL(KUpgRscSourcePath, KUpgRscTargetPath);
   173 	err = fs.CopyFileL(KUpgRscSourcePath, KUpgRscTargetPath);
   164 	TEST(err == KErrNone);
   174 	TEST(err == KErrNone);
   165 	INFO_PRINTF1(_L("Successfully copied recupgrade.rsc from Z:\\system\\data to c\\resource\\plugins"));
   175 	INFO_PRINTF1(_L("Successfully copied recupgrade.rsc from Z:\\system\\data to c\\resource\\plugins"));
       
   176 
   166 	// Copy recupgrade_*.dll from z:\\ to c:\\sys\\bin.
   177 	// Copy recupgrade_*.dll from z:\\ to c:\\sys\\bin.
   167 	#ifdef __WINS__ 
   178 	err = fs.CopyFileL(KUpgDllSourcePathArmv5, KUpgDllTargetPath);
   168 		err = fs.CopyFileL(KUpgDllSourcePathWinscw, KUpgDllTargetPath);
   179 	
   169 	#else
       
   170 		err = fs.CopyFileL(KUpgDllSourcePathArmv5, KUpgDllTargetPath);
       
   171 	#endif
       
   172 	TEST(err == KErrNone);
   180 	TEST(err == KErrNone);
   173 	INFO_PRINTF1(_L("Successfully copied recupgrade_*.dll from Z:\\system\\data to c:\\sys\\bin"));
   181 	INFO_PRINTF1(_L("Successfully copied recupgrade_*.dll from Z:\\system\\data to c:\\sys\\bin"));
   174 
   182 
   175 	INFO_PRINTF2(_L("Waits %d seconds for new mime/upg recognizer with EPossible confidence to be installed."), (4 * KOneSecondDelay)/1000000);	
   183 	INFO_PRINTF2(_L("Waits %d seconds for new mime/upg recognizer with ECertain confidence to be installed."), (5 * KOneSecondDelay)/1000000);	
   176 	User::After(4 * KOneSecondDelay);
   184 	User::After(5 * KOneSecondDelay);
   177 	
   185 	
   178 	// Without fix for INC127312: Apparc server will not reload all upgraded MIME type recognition hence new version of existing will not used for recognization 
   186 	// Test whether newly installed (or copied) plugin to c: drive is loaded by framework and recognizes file with .upg extension.  
   179 	INFO_PRINTF1(_L("MIME type recognition cache is flushed when a new recogizer is installed"));
   187 	INFO_PRINTF1(_L("MIME type recognition cache is flushed when a new recogizer is installed"));
   180 	recogResult.Reset();
   188 	recogResult.Reset();
   181 	TEST(aApparcServer.RecognizeData(KUpgDocPath, buffer, recogResult)==KErrNone);
   189 	TEST(aApparcServer.RecognizeData(KUpgDocPath, buffer, recogResult)==KErrNone);
   182 	TEST(recogResult.iDataType.Des8().CompareF(KMimeUpgType) == 0);
   190 	TEST(recogResult.iDataType.Des8().CompareF(KMimeUpgType) == 0);
   183 	TEST(recogResult.iConfidence == CApaDataRecognizerType::EPossible);
   191 	TEST(recogResult.iConfidence == CApaDataRecognizerType::ECertain);		
   184 		
   192 	
   185 	
   193 	// Delete the plugin resource file of the recognizer with ECertain confidence which was installed during the test from z:.
   186 // Delete the plugin resource file of the recognizer with EPossible confidence which was installed during the test from z:.
   194 	err=CT_RecUpgradeStep::DeleteFileL(KUpgRscTargetPath,fs);
   187 	
   195 	if(err == KErrNone) 
   188 	TInt fileExists = EFalse;
   196 		INFO_PRINTF1(_L("Removed file recupgrade.rsc"));
   189 	fs.IsFilePresent(KUpgRscTargetPath, fileExists);
   197 	else 
   190 	if (fileExists)
   198 		INFO_PRINTF1(_L("Failed to remove recupgrade.rsc"));	
   191 		{
   199 
   192 		fs.ChangeFilePermissionL(KUpgRscTargetPath); // clear readonly attribute inherited from z:
   200 	err=CT_RecUpgradeStep::DeleteFileL(KUpgDllTargetPath,fs);
   193 		err = fs.DeleteFileL(KUpgRscTargetPath);
   201 	if(err == KErrNone) 
   194 		if(err == KErrNone) 
   202 		INFO_PRINTF1(_L("Removed file recupgrade.dll"));
   195 			INFO_PRINTF1(_L("Removed file recupgrade.rsc"));
   203 	else 
   196 		else 
   204 		INFO_PRINTF1(_L("Failed to remove recupgrade.dll"));
   197 			INFO_PRINTF1(_L("Failed to remove recupgrade.rsc"));	
   205 
   198 		}
       
   199 
       
   200 	fileExists = EFalse;
       
   201 	fs.IsFilePresent(KUpgDllTargetPath, fileExists);
       
   202 	if (fileExists)
       
   203 		{
       
   204 		fs.ChangeFilePermissionL(KUpgDllTargetPath); // clear readonly attribute inherited from z:
       
   205 		err = fs.DeleteFileL(KUpgDllTargetPath);
       
   206 		if(err == KErrNone) 
       
   207 			INFO_PRINTF1(_L("Removed recupgrade.dll"));
       
   208 		else 
       
   209 			INFO_PRINTF1(_L("Failed to remove recupgrade.dll"));	
       
   210 		}
       
   211 
   206 
   212 	INFO_PRINTF2(_L("Waits %d seconds for the data recognizer list maintained by EMIME to be updated"), (10 * KOneSecondDelay)/1000000);	
   207 	INFO_PRINTF2(_L("Waits %d seconds for the data recognizer list maintained by EMIME to be updated"), (10 * KOneSecondDelay)/1000000);	
   213  	User::After(10 * KOneSecondDelay);
   208  	User::After(10 * KOneSecondDelay);
   214 	
   209 	
   215 	// Since "mime/upg" recognizer version 2 is uninstalled, mime/upg mime type is not recognized. 
   210 	// Since "mime/upg" recognizer version 2 is uninstalled, mime/upg mime type is not recognized. 
   217 	recogResult.Reset();
   212 	recogResult.Reset();
   218 	TEST(aApparcServer.RecognizeData(KUpgDocPath, buffer, recogResult)==KErrNone);
   213 	TEST(aApparcServer.RecognizeData(KUpgDocPath, buffer, recogResult)==KErrNone);
   219 	TEST(recogResult.iConfidence == CApaDataRecognizerType::ENotRecognized);
   214 	TEST(recogResult.iConfidence == CApaDataRecognizerType::ENotRecognized);
   220 	
   215 	
   221 	CleanupStack::PopAndDestroy(&fs);
   216 	CleanupStack::PopAndDestroy(&fs);
   222 	
   217 	}
   223 	}
   218 
       
   219 
       
   220 /**
       
   221 @SYMTestCaseID APPFWK-APPARC-0101
       
   222 
       
   223 @SYMDEF INC127312
       
   224 
       
   225 @SYMTestCaseDesc This test verify that apparc can dynamically upgrade a plugin if the new plugin replaces existing plugin (i.e new plugin is installed to same drive where the old plugin resides).
       
   226 
       
   227 @SYMTestPriority High
       
   228 
       
   229 @SYMTestStatus Implemented
       
   230 
       
   231 @SYMTestActions:
       
   232 	
       
   233 	1. Try to recognize .upg file with version 1 of recupgrade ECOM plugin but if shuld not be able to recognize as it is implemented like that
       
   234 	2. Install version 2 of recupgrade plugin (copy recupgrade_armv5_rel.dll and recupgrade.rsc from z:\system\data to c:\sys\bin and c:\resource\plugin respectively)
       
   235 	3. Because of installation Apparc will be notified and it will reload all recognizers plugin
       
   236 	4. Now try to recognize .upg file . it shuld be able to recognize as vertion 2 is implemented like that
       
   237 	5. Delete the version 2 plugin files and copy version 3 plugin files to c: drive (copy recupgrade2_armv5_rel.dll and recupgrade2.rsc from z:\system\data to c:\sys\bin and c:\resource\plugin respectively)
       
   238 	6. Now try to recognize .upr file . it shuld be able to recognize as vertion 3 is implemented like that
       
   239 
       
   240 @SYMTestExpectedResults Test should complete without any leave, panic or error.
       
   241  */
       
   242 
       
   243 
       
   244 void CT_RecUpgradeStep::TestUpgradeRecognizer2L(RApaLsSession& aApparcServer)
       
   245 	{
       
   246 
       
   247 	TDataRecognitionResult recogResult;
       
   248 	TBuf8<255> buffer;
       
   249 	buffer.FillZ(255);
       
   250 	recogResult.Reset();
       
   251 		
       
   252 	// Since recognizer for "mime\upg" mime type is installed but it will return CApaDataRecognizerType::ENotRecognized as implemented : call to RecognizeData()
       
   253 	// returns CApaDataRecognizerType::ENotRecognized.
       
   254 	INFO_PRINTF1(_L("MIME type recognition cache is not used..."));
       
   255 	TEST(aApparcServer.RecognizeData(KUpgDocPath, buffer, recogResult)==KErrNone);
       
   256 	TEST(recogResult.iConfidence == CApaDataRecognizerType::ENotRecognized);
       
   257 
       
   258 	//Check the loaded plugin recognizes "mime/upr" data. Version 1 of the plugin should not recognize this data.
       
   259 	TEST(aApparcServer.RecognizeData(KUprDocPath, buffer, recogResult)==KErrNone);
       
   260 	TEST(recogResult.iConfidence == CApaDataRecognizerType::ENotRecognized);
       
   261 
       
   262 	INFO_PRINTF1(_L("Installs upgrade of  mime/upg recognizer plugin file "));
       
   263 	RSmlTestUtils fs;
       
   264 	CleanupClosePushL(fs);
       
   265 	User::LeaveIfError(fs.Connect());
       
   266 	
       
   267 	// Ensure c:\\resource\\plugins is created, otherwise leave from this teststep
       
   268 	TInt err = fs.CreateDirectoryL(KUpgRscTargetDir);
       
   269 	TESTEL((err == KErrNone || err == KErrAlreadyExists), err);
       
   270 	INFO_PRINTF1(_L("c:\\resource\\plugins is created successfully or already exists"));
       
   271 	
       
   272 	// Ensure c:\\sys\\bin is created, otherwise leave from this teststep
       
   273 	err = fs.CreateDirectoryL(KUpgDllTargetDir);
       
   274 	TESTEL((err == KErrNone || err == KErrAlreadyExists), err);
       
   275 	INFO_PRINTF1(_L("c:\\sys\\bin is created successfully or already exists"));
       
   276 
       
   277 	// Copy recupgrade.rsc from z:\\ to c:\\resource\\plugins, to trigger the rescan for plugins.
       
   278 	err = fs.CopyFileL(KUpgRscSourcePath, KUpgRscTargetPath);
       
   279 	TEST(err == KErrNone);
       
   280 	INFO_PRINTF1(_L("Successfully copied recupgrade.rsc from Z:\\system\\data to c\\resource\\plugins"));
       
   281 
       
   282 	// Copy recupgrade_*.dll from z:\\ to c:\\sys\\bin.
       
   283 	err = fs.CopyFileL(KUpgDllSourcePathArmv5, KUpgDllTargetPath);
       
   284 	
       
   285 	TEST(err == KErrNone);
       
   286 	INFO_PRINTF1(_L("Successfully copied recupgrade_*.dll from Z:\\system\\data to c:\\sys\\bin"));
       
   287 
       
   288 	INFO_PRINTF2(_L("Waits %d seconds for new mime/upg recognizer with ECertain confidence to be installed."), (5 * KOneSecondDelay)/1000000);	
       
   289 	User::After(5 * KOneSecondDelay);
       
   290 	
       
   291 	// Test whether newly installed (or copied) plugin to c: drive is loaded by framework and recognizes file with .upg extension.	INFO_PRINTF1(_L("MIME type recognition cache is flushed when a new recogizer is installed"));
       
   292 	recogResult.Reset();
       
   293 	TEST(aApparcServer.RecognizeData(KUpgDocPath, buffer, recogResult)==KErrNone);
       
   294 	TEST(recogResult.iDataType.Des8().CompareF(KMimeUpgType) == 0);
       
   295 	TEST(recogResult.iConfidence == CApaDataRecognizerType::ECertain);
       
   296 	
       
   297 	// Test whether newly installed (or copied) plugin does not recognize a file with .upr extension.
       
   298 	recogResult.Reset();
       
   299 	TEST(aApparcServer.RecognizeData(KUprDocPath, buffer, recogResult)==KErrNone);
       
   300 	TEST(recogResult.iConfidence == CApaDataRecognizerType::ENotRecognized);
       
   301 	
       
   302 	// Delete the plugin resource file of the recognizer with ECertain confidence which was installed during the test from z:.
       
   303 	err=CT_RecUpgradeStep::DeleteFileL(KUpgRscTargetPath,fs);
       
   304 	if(err == KErrNone) 
       
   305 		INFO_PRINTF1(_L("Removed file recupgrade.rsc"));
       
   306 	else 
       
   307 		INFO_PRINTF1(_L("Failed to remove recupgrade.rsc"));	
       
   308 
       
   309 	err=CT_RecUpgradeStep::DeleteFileL(KUpgDllTargetPath,fs);
       
   310 	if(err == KErrNone) 
       
   311 		INFO_PRINTF1(_L("Removed file recupgrade.dll"));
       
   312 	else 
       
   313 		INFO_PRINTF1(_L("Failed to remove recupgrade.dll"));
       
   314 
       
   315 	User::After(1 * KOneSecondDelay);	
       
   316 
       
   317 	// Copy recupgrade2.rsc from z:\\ to c:\\resource\\plugins, to trigger the rescan for plugins.
       
   318 	err = fs.CopyFileL(KUprRscSourcePath, KUpgRscTargetPath);
       
   319 	TEST(err == KErrNone);
       
   320 	INFO_PRINTF1(_L("Successfully copied recupgrade2.rsc from Z:\\system\\data to c:\\resource\\plugins"));
       
   321 
       
   322 	
       
   323 	// Copy recupgrade_*.dll from z:\\ to c:\\sys\\bin.
       
   324 	err = fs.CopyFileL(KUprDllSourcePathArmv5, KUpgDllTargetPath);
       
   325 	
       
   326 	TEST(err == KErrNone);
       
   327 	INFO_PRINTF1(_L("Successfully copied recupgrade2_*.dll from Z:\\system\\data to c:\\sys\\bin"));
       
   328 
       
   329 	
       
   330 	INFO_PRINTF2(_L("Waits %d seconds for new mime/upg recognizer with ECertain confidence to be installed."), (5 * KOneSecondDelay)/1000000);	
       
   331 	User::After(5 * KOneSecondDelay);
       
   332 	
       
   333 	// Test whether the plugin which replaces old plugin in c: drive is loaded by framework and recognizes file with .upr extension.
       
   334 	INFO_PRINTF1(_L("MIME type recognition cache is flushed when a new recogizer is installed"));
       
   335 	recogResult.Reset();
       
   336 	TEST(aApparcServer.RecognizeData(KUprDocPath, buffer, recogResult)==KErrNone);
       
   337 	TEST(recogResult.iDataType.Des8().CompareF(KMimeUprType) == 0);
       
   338 	TEST(recogResult.iConfidence == CApaDataRecognizerType::ECertain);
       
   339 
       
   340 	// Test whether the plugin which replaces old plugin in c: drive does not recognize a file with .upg extension.
       
   341 	recogResult.Reset();
       
   342 	TEST(aApparcServer.RecognizeData(KUpgDocPath, buffer, recogResult)==KErrNone);
       
   343 	TEST(recogResult.iConfidence == CApaDataRecognizerType::ENotRecognized);
       
   344 
       
   345 	
       
   346 	// Delete the plugin resource file of the recognizer with ECertain confidence which was installed during the test from z:.
       
   347 	err=CT_RecUpgradeStep::DeleteFileL(KUpgRscTargetPath,fs);
       
   348 	if(err == KErrNone) 
       
   349 		INFO_PRINTF1(_L("Removed file recupgrade.rsc"));
       
   350 	else 
       
   351 		INFO_PRINTF1(_L("Failed to remove recupgrade.rsc"));	
       
   352 
       
   353 	err=CT_RecUpgradeStep::DeleteFileL(KUpgDllTargetPath,fs);
       
   354 	if(err == KErrNone) 
       
   355 		INFO_PRINTF1(_L("Removed file recupgrade.dll"));
       
   356 	else 
       
   357 		INFO_PRINTF1(_L("Failed to remove recupgrade.dll"));
       
   358 
       
   359 	INFO_PRINTF2(_L("Waits %d seconds for the data recognizer list maintained by EMIME to be updated"), (10 * KOneSecondDelay)/1000000);	
       
   360  	User::After(10 * KOneSecondDelay);
       
   361 	
       
   362 	// Since "mime/upr" recognizer version 3 is uninstalled, mime/upr mime type is not recognized. 
       
   363 	INFO_PRINTF1(_L("MIME type recognition cache is flushed when a existing recogizer is uninstalled"));
       
   364 	recogResult.Reset();
       
   365 	TEST(aApparcServer.RecognizeData(KUprDocPath, buffer, recogResult)==KErrNone);
       
   366 	TEST(recogResult.iConfidence == CApaDataRecognizerType::ENotRecognized);
       
   367 
       
   368 	CleanupStack::PopAndDestroy(&fs);
       
   369 	}
       
   370