os/ossrv/lowlevellibsandfws/pluginfw/Framework/SimpleTests/t_language.cpp
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
     1 // Copyright (c) 2002-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".
     7 //
     8 // Initial Contributors:
     9 // Nokia Corporation - initial contribution.
    10 //
    11 // Contributors:
    12 //
    13 // Description:
    14 //
    15 
    16 #include <ecom/ecom.h>
    17 #include "../EcomTestUtils/EcomTestUtils.h"
    18 
    19 #define UNUSED_VAR(a) a = a
    20 
    21 LOCAL_D RTest TEST(_L("ECom Language Plugin Test"));
    22 
    23 // Files to copy
    24 _LIT(KEComLangPluginDllOnC, "C:\\sys\\bin\\LanguagePlugin.dll");
    25 _LIT(KEComLangPluginDllOnZ, "Z:\\RAMOnly\\LanguagePlugin.dll");
    26 
    27 _LIT(KEComLangPluginRscOnC, "C:\\resource\\plugins\\LanguagePlugin.rsc");
    28 _LIT(KEComLangPluginRscOnZ, "Z:\\RAMOnly\\LanguagePlugin.rsc");
    29 
    30 _LIT(KEComLangPluginRsc1OnC, "C:\\resource\\plugins\\LanguagePlugin.r01");
    31 _LIT(KEComLangPluginRsc1OnZ, "Z:\\RAMOnly\\LanguagePlugin.r01");
    32 
    33 _LIT(KEComLangPluginRsc2OnC, "C:\\resource\\plugins\\LanguagePlugin.r02");
    34 _LIT(KEComLangPluginRsc2OnZ, "Z:\\RAMOnly\\LanguagePlugin.r02");
    35 
    36 _LIT(KEComLangPluginRsc3OnC, "C:\\resource\\plugins\\LanguagePlugin.r03");
    37 _LIT(KEComLangPluginRsc3OnZ, "Z:\\RAMOnly\\LanguagePlugin.r03");
    38 
    39 #ifndef SYMBIAN_DISTINCT_LOCALE_MODEL
    40     // Language files used for locale settings
    41     _LIT(KEComEnglishLocale, "elocl.01");
    42     _LIT(KEComFrenchLocale, "elocl.02");
    43     _LIT(KEComGermanLocale, "elocl.03");
    44     _LIT(KEComSpanishLocale, "elocl.04");
    45 #else
    46 // refer base/os/kernelhwsrv/kernel/eka/euser/locmapping.cpp
    47 // Language
    48     _LIT(KEComEnglishLang,"elocl_lan.001");
    49     _LIT(KEComFrenchLang,"elocl_lan.002");
    50     _LIT(KEComGermanLang,"elocl_lan.003");
    51     _LIT(KEComSpanishLang,"elocl_lan.004");
    52     // Region
    53     _LIT(KEComEnglishReg,"elocl_reg.826");
    54     _LIT(KEComFrenchReg,"elocl_reg.250");
    55     _LIT(KEComGermanReg,"elocl_reg.276");
    56     _LIT(KEComSpanishReg,"elocl_reg.724");
    57     // Collation
    58     _LIT(KEComEnglishColl,"elocl_col.001");
    59     _LIT(KEComFrenchColl,"elocl_col.002");
    60     _LIT(KEComGermanColl,"elocl_col.003");
    61     _LIT(KEComSpanishColl,"elocl_col.001");
    62 #endif
    63 
    64 // Result strings saved in opaque_data of each plugin
    65 _LIT8(KEComDefaultResult, "LANGUAGE_RSC");
    66 _LIT8(KEComEnglishResult, "LANGUAGE_01");
    67 _LIT8(KEComFrenchResult, "LANGUAGE_02");
    68 _LIT8(KEComGermanResult, "LANGUAGE_03");
    69 
    70 // Test data for data driven tests.
    71 #define MAX_LANGUAGE_TEST_FILES 5
    72 struct TLangTestEntry
    73 	{
    74 	// Source and destination to copy necessary plugins
    75 	struct FilesInfo
    76 		{
    77 		const TDesC* source;
    78 		const TDesC* dest;
    79 		};
    80 	FilesInfo files[MAX_LANGUAGE_TEST_FILES];
    81 #ifndef SYMBIAN_DISTINCT_LOCALE_MODEL
    82 	// Locale file to load
    83 	const TDesC* localeFile;
    84 #else
    85 	const TDesC* lang;
    86 	const TDesC* region;
    87 	const TDesC* collation;
    88 #endif
    89 	// Language downgrade path to set up
    90 	TLanguage downgradePathSetup[3];
    91 
    92 	// Expected result - opaque_data of retrieved plugin
    93 	const TDesC8* result;
    94 	};
    95 
    96 // Test Data
    97 LOCAL_D const TLangTestEntry LangTestData[] =
    98 	{
    99 		// Data Set 0
   100 		{
   101 			{
   102 				{&KEComLangPluginDllOnZ, &KEComLangPluginDllOnC},
   103 				{&KEComLangPluginRscOnZ, &KEComLangPluginRscOnC},
   104 				{&KEComLangPluginRsc1OnZ, &KEComLangPluginRsc1OnC},
   105 				{&KEComLangPluginRsc2OnZ, &KEComLangPluginRsc2OnC},
   106 				{&KEComLangPluginRsc3OnZ, &KEComLangPluginRsc3OnC}
   107 			},
   108             #ifndef SYMBIAN_DISTINCT_LOCALE_MODEL
   109 			&KEComEnglishLocale,
   110             #else
   111 			&KEComEnglishLang,
   112 			&KEComEnglishReg,
   113 			&KEComEnglishColl,
   114             #endif
   115 			{ELangEnglish, ELangFrench, ELangGerman},
   116 			&KEComEnglishResult
   117 		},
   118 		// Data Set 1
   119 		{
   120 			{
   121 				{&KEComLangPluginDllOnZ, &KEComLangPluginDllOnC},
   122 				{&KEComLangPluginRscOnZ, &KEComLangPluginRscOnC},
   123 				{&KEComLangPluginRsc1OnZ, &KEComLangPluginRsc1OnC},
   124 				{&KEComLangPluginRsc2OnZ, &KEComLangPluginRsc2OnC},
   125 				{&KEComLangPluginRsc3OnZ, &KEComLangPluginRsc3OnC}
   126 			},
   127             #ifndef SYMBIAN_DISTINCT_LOCALE_MODEL
   128             &KEComFrenchLocale,
   129             #else
   130             &KEComFrenchLang,
   131             &KEComFrenchReg,
   132             &KEComFrenchColl,
   133             #endif
   134 			{ELangFrench, ELangEnglish, ELangGerman},
   135 			&KEComFrenchResult
   136 		},
   137 		// Data Set 2
   138 		{
   139 			{
   140 				{&KEComLangPluginDllOnZ, &KEComLangPluginDllOnC},
   141 				{&KEComLangPluginRscOnZ, &KEComLangPluginRscOnC},
   142 				{&KEComLangPluginRsc1OnZ, &KEComLangPluginRsc1OnC},
   143 				{&KEComLangPluginRsc2OnZ, &KEComLangPluginRsc2OnC},
   144 				{&KEComLangPluginRsc3OnZ, &KEComLangPluginRsc3OnC}
   145 			},
   146             #ifndef SYMBIAN_DISTINCT_LOCALE_MODEL
   147             &KEComGermanLocale,
   148             #else
   149             &KEComGermanLang,
   150             &KEComGermanReg,
   151             &KEComGermanColl,
   152             #endif
   153 			{ELangGerman, ELangEnglish, ELangFrench},
   154 			&KEComGermanResult
   155 		},
   156 		// Data Set 3
   157 		{
   158 			{
   159 				{&KEComLangPluginDllOnZ, &KEComLangPluginDllOnC},
   160 				{&KEComLangPluginRscOnZ, &KEComLangPluginRscOnC},
   161 				{&KEComLangPluginRsc2OnZ, &KEComLangPluginRsc2OnC},
   162 				{&KEComLangPluginRsc3OnZ, &KEComLangPluginRsc3OnC}
   163 			},
   164             #ifndef SYMBIAN_DISTINCT_LOCALE_MODEL
   165             &KEComFrenchLocale,
   166             #else
   167             &KEComFrenchLang,
   168             &KEComFrenchReg,
   169             &KEComFrenchColl,
   170             #endif
   171 			{ELangEnglish, ELangFrench, ELangGerman},
   172 			&KEComFrenchResult
   173 		},
   174 		// Data Set 4
   175 		{
   176 			{
   177 				{&KEComLangPluginDllOnZ, &KEComLangPluginDllOnC},
   178 				{&KEComLangPluginRscOnZ, &KEComLangPluginRscOnC},
   179 				{&KEComLangPluginRsc3OnZ, &KEComLangPluginRsc3OnC}
   180 			},
   181             #ifndef SYMBIAN_DISTINCT_LOCALE_MODEL
   182             &KEComGermanLocale,
   183             #else
   184             &KEComGermanLang,
   185             &KEComGermanReg,
   186             &KEComGermanColl,
   187             #endif
   188 			{ELangEnglish, ELangFrench, ELangGerman},
   189 			&KEComGermanResult
   190 		},
   191 		// Data Set 5
   192 		{
   193 			{
   194 				{&KEComLangPluginDllOnZ, &KEComLangPluginDllOnC},
   195 				{&KEComLangPluginRscOnZ, &KEComLangPluginRscOnC},
   196 				{&KEComLangPluginRsc2OnZ, &KEComLangPluginRsc2OnC},
   197 				{&KEComLangPluginRsc3OnZ, &KEComLangPluginRsc3OnC}
   198 			},
   199             #ifndef SYMBIAN_DISTINCT_LOCALE_MODEL
   200             &KEComGermanLocale,
   201             #else
   202             &KEComGermanLang,
   203             &KEComGermanReg,
   204             &KEComGermanColl,
   205             #endif
   206 			{ELangSpanish, ELangItalian, ELangGerman},
   207 			&KEComGermanResult
   208 		},
   209 		// Data Set 6
   210 		{
   211 			{
   212 				{&KEComLangPluginDllOnZ, &KEComLangPluginDllOnC},
   213 				{&KEComLangPluginRscOnZ, &KEComLangPluginRscOnC},
   214 				{&KEComLangPluginRsc2OnZ, &KEComLangPluginRsc2OnC},
   215 				{&KEComLangPluginRsc3OnZ, &KEComLangPluginRsc3OnC}
   216 			},
   217             #ifndef SYMBIAN_DISTINCT_LOCALE_MODEL
   218             &KEComEnglishLocale,
   219             #else
   220             &KEComEnglishLang,
   221             &KEComEnglishReg,
   222             &KEComEnglishColl,
   223             #endif
   224 			{ELangSpanish, ELangItalian, ELangSwedish},
   225 			&KEComDefaultResult
   226 		},
   227 		// Data Set 7
   228 		{
   229 			{
   230 				{&KEComLangPluginDllOnZ, &KEComLangPluginDllOnC},
   231 				{&KEComLangPluginRscOnZ, &KEComLangPluginRscOnC},
   232 				{&KEComLangPluginRsc1OnZ, &KEComLangPluginRsc1OnC},
   233 			},
   234             #ifndef SYMBIAN_DISTINCT_LOCALE_MODEL
   235             &KEComEnglishLocale,
   236             #else
   237             &KEComEnglishLang,
   238             &KEComEnglishReg,
   239             &KEComEnglishColl,
   240             #endif
   241 			{ELangSpanish, ELangSwedish, ELangItalian},
   242 			&KEComEnglishResult
   243 		},
   244 		// Data Set 8
   245 		{
   246 			{
   247 				{&KEComLangPluginDllOnZ, &KEComLangPluginDllOnC},
   248 				{&KEComLangPluginRscOnZ, &KEComLangPluginRscOnC},
   249 			},
   250             #ifndef SYMBIAN_DISTINCT_LOCALE_MODEL
   251             &KEComEnglishLocale,
   252             #else
   253             &KEComEnglishLang,
   254             &KEComEnglishReg,
   255             &KEComEnglishColl,
   256             #endif
   257 			{ELangItalian, ELangSwedish, ELangSpanish},
   258 			&KEComDefaultResult
   259 		},
   260 	};
   261 
   262 struct TLangTestEntry2
   263 	{
   264 	// Locale file to load
   265     #ifndef SYMBIAN_DISTINCT_LOCALE_MODEL
   266         // Locale file to load
   267         const TDesC* localeFile;
   268     #else
   269         const TDesC* lang;
   270         const TDesC* region;
   271         const TDesC* collation;
   272     #endif
   273 	
   274 	// Language downgrade path to set up
   275 	TLanguage downgradePathSetup[3];
   276 
   277 	// Expected result - opaque_data of retrieved plugin
   278 	const TDesC8* result;
   279 	};
   280 
   281 LOCAL_D const TLangTestEntry2 LangTestData2[] =
   282 	{
   283 		//Data Set 0
   284 		{
   285             #ifndef SYMBIAN_DISTINCT_LOCALE_MODEL
   286             &KEComEnglishLocale,
   287             #else
   288             &KEComEnglishLang,
   289             &KEComEnglishReg,
   290             &KEComEnglishColl,
   291             #endif
   292 			{ELangEnglish, ELangFrench, ELangGerman},
   293 			&KEComEnglishResult
   294 
   295 		},
   296 
   297 		//Data Set 1
   298 		{
   299             #ifndef SYMBIAN_DISTINCT_LOCALE_MODEL
   300             &KEComFrenchLocale,
   301             #else
   302             &KEComFrenchLang,
   303             &KEComFrenchReg,
   304             &KEComFrenchColl,
   305             #endif
   306 			{ELangFrench, ELangEnglish, ELangGerman},
   307 			&KEComFrenchResult
   308 		},
   309 		//Data Set 2
   310 		{
   311             #ifndef SYMBIAN_DISTINCT_LOCALE_MODEL
   312             &KEComGermanLocale,
   313             #else
   314             &KEComGermanLang,
   315             &KEComGermanReg,
   316             &KEComGermanColl,
   317             #endif
   318 			{ELangGerman, ELangEnglish, ELangFrench},
   319 			&KEComGermanResult
   320 		},
   321 		//Data Set 3
   322 		{
   323             #ifndef SYMBIAN_DISTINCT_LOCALE_MODEL
   324             &KEComFrenchLocale,
   325             #else
   326             &KEComFrenchLang,
   327             &KEComFrenchReg,
   328             &KEComFrenchColl,
   329             #endif
   330 			{ELangEnglish, ELangFrench, ELangGerman},
   331 			&KEComFrenchResult
   332 		},
   333 		//Data Set 4
   334 		{
   335             #ifndef SYMBIAN_DISTINCT_LOCALE_MODEL
   336             &KEComGermanLocale,
   337             #else
   338             &KEComGermanLang,
   339             &KEComGermanReg,
   340             &KEComGermanColl,
   341             #endif
   342 			{ELangEnglish, ELangFrench, ELangGerman},
   343 			&KEComGermanResult
   344 		},
   345 		//Data Set 5
   346 		{
   347             #ifndef SYMBIAN_DISTINCT_LOCALE_MODEL
   348             &KEComGermanLocale,
   349             #else
   350             &KEComGermanLang,
   351             &KEComGermanReg,
   352             &KEComGermanColl,
   353             #endif
   354 			{ELangSpanish, ELangItalian, ELangGerman},
   355 			&KEComGermanResult
   356 		},
   357 		//Data Set 6
   358 		{
   359             #ifndef SYMBIAN_DISTINCT_LOCALE_MODEL
   360             &KEComEnglishLocale,
   361             #else
   362             &KEComEnglishLang,
   363             &KEComEnglishReg,
   364             &KEComEnglishColl,
   365             #endif
   366 			{ELangSpanish, ELangItalian, ELangSwedish},
   367 			&KEComEnglishResult
   368 
   369 		},
   370 		//Data Set 7
   371 		{
   372             #ifndef SYMBIAN_DISTINCT_LOCALE_MODEL
   373             &KEComSpanishLocale,
   374             #else
   375             &KEComSpanishLang,
   376             &KEComSpanishReg,
   377             &KEComSpanishColl,
   378             #endif
   379 			{ELangSpanish, ELangFrench, ELangEnglish},
   380 			&KEComFrenchResult
   381 
   382 		},
   383 		//Data Set 8
   384 		{
   385             #ifndef SYMBIAN_DISTINCT_LOCALE_MODEL
   386             &KEComSpanishLocale,
   387             #else
   388             &KEComSpanishLang,
   389             &KEComSpanishReg,
   390             &KEComSpanishColl,
   391             #endif
   392 			{ELangSpanish,ELangItalian, ELangSwedish},
   393 			&KEComDefaultResult
   394 		},
   395 
   396 		//Data Set 9
   397 		{
   398             #ifndef SYMBIAN_DISTINCT_LOCALE_MODEL
   399             &KEComSpanishLocale,
   400             #else
   401             &KEComSpanishLang,
   402             &KEComSpanishReg,
   403             &KEComSpanishColl,
   404             #endif
   405 			{ELangSpanish, ELangGerman, ELangItalian},
   406 			&KEComGermanResult
   407 		},
   408 
   409 		//Data Set 10
   410 		{
   411             #ifndef SYMBIAN_DISTINCT_LOCALE_MODEL
   412             &KEComSpanishLocale,
   413             #else
   414             &KEComSpanishLang,
   415             &KEComSpanishReg,
   416             &KEComSpanishColl,
   417             #endif
   418 			{ELangSpanish, ELangItalian, ELangNone},
   419 			&KEComDefaultResult
   420 		}
   421 	};
   422 
   423 class REComLanguagePluginTest
   424 	{
   425 public:
   426 	void StaticRunTestsL();
   427 	void DynamicRunTestsOnCL();
   428 	void DynamicRunTestsOnZL();
   429     #ifndef SYMBIAN_DISTINCT_LOCALE_MODEL	
   430         void SetLanguage(const TDesC& aLangFile,  const TLanguage aLang[3]);
   431     #else	
   432         void SetLanguage(const TDesC& aLanguage,const TDesC& aReg,const TDesC& aColl,const TLanguage aLang[3]);
   433     #endif
   434 	void CopyFiles(TInt aIndex);
   435 	static void DeleteFiles(TInt aIndex);
   436 	void DoCheckL(TInt testDataId, TUid &aInterfaceId, TDriveUnit aDriveUnit);
   437 	};
   438 
   439 /**
   440 Copies plugins.
   441 */
   442 void REComLanguagePluginTest::CopyFiles(TInt aIndex)
   443 	{
   444 	for (TInt i = 0; i < MAX_LANGUAGE_TEST_FILES && LangTestData[aIndex].files[i].source; i++)
   445 		{
   446 		TRAPD(err, EComTestUtils::FileManCopyFileL(	*(LangTestData[aIndex].files[i].source),
   447 													*(LangTestData[aIndex].files[i].dest)) );
   448  		TEST(err==KErrNone, __LINE__);
   449 		}
   450 	}
   451 
   452 /**
   453 Deletes plugins.
   454 */
   455 void REComLanguagePluginTest::DeleteFiles(TInt aIndex)
   456 	{
   457 		for (TInt i = 0; i < MAX_LANGUAGE_TEST_FILES && LangTestData[aIndex].files[i].source != NULL; i++)
   458 		{
   459 		TRAPD(err, EComTestUtils::FileManDeleteFileL(*(LangTestData[aIndex].files[i].dest)) );
   460 		UNUSED_VAR(err);
   461 		}
   462 	}
   463 #ifndef SYMBIAN_DISTINCT_LOCALE_MODEL
   464 /**
   465 Sets up the system-wide locale and language downgrade path.
   466 */
   467 void REComLanguagePluginTest::SetLanguage(const TDesC& aLangFile, const TLanguage aLang[3])
   468 	{
   469 	TLocale locale;
   470 	TInt loadval = 0;
   471 	TExtendedLocale extendedLocale;
   472 
   473 	extendedLocale.LoadSystemSettings();
   474 	loadval = extendedLocale.LoadLocale(aLangFile);
   475 	TEST(loadval==KErrNone, __LINE__);
   476 	extendedLocale.SaveSystemSettings();
   477 
   478 	locale.SetLanguageDowngrade(0, aLang[0]);
   479 	locale.SetLanguageDowngrade(1, aLang[1]);
   480 	locale.SetLanguageDowngrade(2, aLang[2]);
   481 	locale.Set();
   482 	}
   483 #else
   484 /**
   485 Sets up the system-wide locale and language downgrade path for the new locale model.
   486 */
   487 void REComLanguagePluginTest::SetLanguage(const TDesC& aLanguage,const TDesC& aReg,const TDesC& aColl,const TLanguage aLang[3])
   488     {
   489     TLocale locale;
   490     TExtendedLocale extendedLocale;
   491     TInt loadval = 0;
   492 
   493     extendedLocale.LoadSystemSettings();
   494     loadval = extendedLocale.LoadLocale(aLanguage,aReg,aColl);
   495     TEST(loadval==KErrNone, __LINE__);
   496     extendedLocale.SaveSystemSettings();
   497 
   498     locale.SetLanguageDowngrade(0, aLang[0]);
   499     locale.SetLanguageDowngrade(1, aLang[1]);
   500     locale.SetLanguageDowngrade(2, aLang[2]);
   501     locale.Set();
   502     }
   503 #endif
   504 
   505 void REComLanguagePluginTest::DoCheckL(TInt testDataId, TUid &aInterfaceId, TDriveUnit aDriveUnit)
   506 	{
   507 	RImplInfoPtrArray implArray;
   508 
   509 	REComSession::ListImplementationsL(aInterfaceId, implArray);
   510 
   511 	// Verify results
   512 	TBuf<100> buf;
   513 	RDebug::Print(_L("\tArray Count = %d\n"), implArray.Count());
   514 	buf.Copy(implArray[0]->OpaqueData());
   515 	RDebug::Print(_L("\tOpaque Data = %S\n"), &buf);
   516 	TInt drive = implArray[0]->Drive();
   517 	RDebug::Print(_L("\tDrive = %d\n"), drive);
   518 
   519 	TEST(implArray.Count() == 1);
   520 
   521 	if(aDriveUnit == EDriveZ)
   522 		{
   523 		TEST(implArray[0]->OpaqueData() == *(LangTestData2[testDataId].result));
   524 		}
   525 	else
   526 		{
   527 		TEST(implArray[0]->OpaqueData() == *(LangTestData[testDataId].result));
   528 		}
   529 
   530 	TEST(implArray[0]->Drive() == aDriveUnit);
   531 
   532 	// Post test clean up
   533 	REComSession::FinalClose();
   534 	implArray.ResetAndDestroy();
   535 	}
   536 
   537 /**
   538 Test case for DEF087773: ECOM ValidateRegistry checks for existence of RSC file only
   539 
   540 @SYMTestCaseID			SYSLIB-ECOM-CT-0655
   541 @SYMTestCaseDesc		Checks for existence of resource files for different downgrade paths
   542 @SYMTestPriority			high
   543 @SYMTestActions			Data driven tests.
   544 						Create different sets of language dependant resource file on "C"
   545 						Drive and verify the ECom discovery process
   546 @SYMTestExpectedResults The test must not fail.
   547 @SYMDEF					DEF087773
   548 */
   549 void REComLanguagePluginTest::StaticRunTestsL()
   550 	{
   551 	TEST.Next(_L(" @SYMTestCaseID:SYSLIB-ECOM-CT-0655 "));
   552 	TInt numberOfElements = sizeof(LangTestData)/sizeof(TLangTestEntry);
   553 
   554 	TUid ifUid={0x10009DB9};
   555 	for(TInt i = 0; i < numberOfElements; i++)
   556 		{
   557 		// kill ecom server so that language downgrade changes are picked up
   558 		ECOMTU_KILL_SERVER_L(TEST);
   559 
   560 		// Prepare test
   561         #ifndef SYMBIAN_DISTINCT_LOCALE_MODEL
   562 		SetLanguage(*(LangTestData[i].localeFile), LangTestData[i].downgradePathSetup);
   563         #else
   564 		SetLanguage(*(LangTestData[i].lang),*(LangTestData[i].region),*(LangTestData[i].collation),LangTestData[i].downgradePathSetup);
   565         #endif
   566 		
   567 		CopyFiles(i);
   568 
   569 		// 1st boot
   570 		TEST.Printf(_L("\tLanguage Plugin Test %d - 1st boot \n"), i);
   571 		DoCheckL(i,ifUid, EDriveC );
   572 
   573 		// kill ecom server for second boot
   574 		ECOMTU_KILL_SERVER_L(TEST);
   575 
   576 		// 2nd boot
   577 		TEST.Printf(_L("\tLanguage Plugin Test %d - 2nd boot \n"), i);
   578 		DoCheckL(i, ifUid, EDriveC);
   579 
   580 		DeleteFiles(i);
   581 		WAIT_FOR3s;
   582 		}
   583 	}
   584 
   585 /**
   586 Test case for CR0209: Enable Dynamic Language Switching in ECOM
   587 
   588 @SYMTestCaseID			SYSLIB-ECOM-CT-3169
   589 @SYMTestCaseDesc		Checks for picking up correct resource files for different downgrade paths in running time
   590 @SYMTestPriority		high
   591 @SYMTestActions			Data driven tests.
   592 						Start up Ecom server
   593 						Create different sets of language dependant resource file on "C" on running time.
   594 						Drive and verify the ECom discovery process
   595 @SYMTestExpectedResults The test must not fail.
   596 @SYMDEF					CR0209
   597 */
   598 void REComLanguagePluginTest::DynamicRunTestsOnCL()
   599 	{
   600 	TEST.Next(_L(" @SYMTestCaseID:SYSLIB-ECOM-CT-3169 "));
   601 	TInt numberOfElements = sizeof(LangTestData)/sizeof(TLangTestEntry);
   602 
   603 	RImplInfoPtrArray implArray;
   604 	TUid ifUid={0x10009DB9};
   605 
   606 	//start up ecom server
   607 	REComSession::ListImplementationsL(ifUid, implArray);
   608 
   609 	for(TInt i = 0; i < numberOfElements; i++)
   610 		{
   611 
   612 		// Prepare test
   613 		CopyFiles(i);
   614 
   615         #ifndef SYMBIAN_DISTINCT_LOCALE_MODEL
   616         SetLanguage(*(LangTestData[i].localeFile), LangTestData[i].downgradePathSetup);
   617         #else
   618         SetLanguage(*(LangTestData[i].lang),*(LangTestData[i].region),*(LangTestData[i].collation),LangTestData[i].downgradePathSetup);
   619         #endif
   620 		WAIT_FOR3s;
   621 
   622 		TEST.Printf(_L("\tLanguage Plugin Test %d - Dynamic switch on C \n"), i);
   623 		DoCheckL(i,ifUid, EDriveC);
   624 
   625 		DeleteFiles(i);
   626 		WAIT_FOR3s;
   627 		implArray.ResetAndDestroy();
   628 
   629 		}
   630 
   631 	// Post test clean up
   632 	REComSession::FinalClose();
   633 	implArray.ResetAndDestroy();
   634 
   635 	//kill ecomserver after finishing test
   636 	ECOMTU_KILL_SERVER_L(TEST);
   637 
   638 	}
   639 
   640 /**
   641 Test case for CR0209: Enable Dynamic Language Switching in ECOM on Z: drive
   642 
   643 @SYMTestCaseID			SYSLIB-ECOM-CT-3170
   644 @SYMTestCaseDesc		Checks for picking up correct resource files for different downgrade paths in running time.
   645 @SYMTestPriority		high
   646 @SYMTestActions			Data driven tests.
   647 						Start up Ecom server
   648 						Change languae downgrade path on running time.
   649 						Drive and verify the ECom discovery process.
   650 @SYMTestExpectedResults The test must not fail.
   651 @SYMDEF					CR0209
   652 */
   653 void REComLanguagePluginTest::DynamicRunTestsOnZL()
   654 	{
   655 	TEST.Next(_L(" @SYMTestCaseID:SYSLIB-ECOM-CT-3170 "));
   656 	TInt numberOfElements = sizeof(LangTestData2)/sizeof(TLangTestEntry2);
   657 
   658 	//Interface ID in a DLL existing on Z: Drive
   659 	TUid ifUid={0x10009DE1};
   660 
   661 	//start up ecom server
   662 	RImplInfoPtrArray implArray;
   663 	REComSession::ListImplementationsL(ifUid, implArray);
   664 	WAIT_FOR3s;
   665 
   666 	for(TInt i = 0; i < numberOfElements; i++)
   667 		{
   668 
   669 		// Prepare test
   670         #ifndef SYMBIAN_DISTINCT_LOCALE_MODEL
   671         SetLanguage(*(LangTestData2[i].localeFile), LangTestData2[i].downgradePathSetup);
   672         #else
   673         SetLanguage(*(LangTestData2[i].lang),*(LangTestData2[i].region),*(LangTestData2[i].collation),LangTestData2[i].downgradePathSetup);
   674         #endif
   675 		WAIT_FOR3s;
   676 
   677 		// Dynamic language downgrade path changing
   678 		TEST.Printf(_L("\tLanguage Plugin Test %d - Dynamic switch on Z \n"), i);
   679 		DoCheckL(i,ifUid, EDriveZ);
   680 		implArray.ResetAndDestroy();
   681 
   682 		}
   683 
   684 	// Post test clean up
   685 	REComSession::FinalClose();
   686 	implArray.ResetAndDestroy();
   687 
   688 	}
   689 
   690 LOCAL_C void RunTestL()
   691 	{
   692 	__UHEAP_MARK;
   693 	REComLanguagePluginTest testSuite;
   694 	testSuite.StaticRunTestsL();
   695 	testSuite.DynamicRunTestsOnCL();
   696 	testSuite.DynamicRunTestsOnZL();
   697 
   698 	__UHEAP_MARKEND;
   699 	}
   700 
   701 GLDEF_C TInt E32Main()
   702 	{
   703 	__UHEAP_MARK;
   704 
   705 	TEST.Title();
   706 	TEST.Start(_L("ECom Language Plugins tests."));
   707 
   708 	CTrapCleanup* cleanup = CTrapCleanup::New();
   709 	CActiveScheduler* scheduler = new(ELeave)CActiveScheduler;
   710 	CActiveScheduler::Install(scheduler);
   711 
   712 	TRAPD(err,RunTestL());
   713 
   714 	// tidy up in case of leave
   715 	if(err != KErrNone)
   716 		{
   717 		TInt numberOfElements = sizeof(LangTestData)/sizeof(TLangTestEntry);
   718 		for(TInt i = 0; i < numberOfElements; i++)
   719 			{
   720 			REComLanguagePluginTest::DeleteFiles(i);
   721 			}
   722 		}
   723 
   724 	TEST(err==KErrNone, __LINE__);
   725 
   726 	delete scheduler;
   727 	delete cleanup;
   728 
   729 	TEST.End();
   730 	TEST.Close();
   731 
   732 	__UHEAP_MARKEND;
   733 	return(0);
   734 	}