Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1886)

Unified Diff: chrome/browser/chromeos/customization_document_unittest.cc

Issue 144363006: Expand VPD initial_locale to a list of locales. Use the expanded VPD initial_locale on the OOBE. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Unittests added. Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chromeos/customization_document_unittest.cc
diff --git a/chrome/browser/chromeos/customization_document_unittest.cc b/chrome/browser/chromeos/customization_document_unittest.cc
index 3e22f282df2fa41a79104dcde08991efc1ccbede..f92bb2d7c3e6e8b004b9b500bab4c08bb0ef26ea 100644
--- a/chrome/browser/chromeos/customization_document_unittest.cc
+++ b/chrome/browser/chromeos/customization_document_unittest.cc
@@ -47,6 +47,21 @@ const char kGoodStartupManifest[] =
" ],"
"}";
+const char kMultiLanguageStartupManifest[] =
+ "{\n"
+ " \"version\": \"1.0\",\n"
+ " \"initial_locale\" : \"en-US,de,fr,it\",\n"
+ " \"initial_timezone\" : \"Europe/Zurich\",\n"
+ " \"keyboard_layout\" : \"xkb:us::eng\",\n"
+ " \"registration_url\" : \"http://www.google.com\",\n"
+ " \"setup_content\" : {\n"
+ " \"default\" : {\n"
+ " \"help_page\" : \"file:///opt/oem/help/en-US/help.html\",\n"
+ " \"eula_page\" : \"file:///opt/oem/eula/en-US/eula.html\",\n"
+ " },\n"
+ " },"
+ "}";
+
const char kBadManifest[] = "{\"version\": \"1\"}";
const char kGoodServicesManifest[] =
@@ -157,6 +172,27 @@ TEST(ServicesCustomizationDocumentTest, Basic) {
EXPECT_EQ("http://mario/global", customization.GetSupportPage("ja"));
}
+#define EXPECT_LOCALE_ENTRY(i, value) \
+ if (customization.configured_locales().size() > i) \
+ EXPECT_EQ(value, customization.configured_locales()[i]) \
+ << "Bad locale value at index " << i
+
+TEST(ServicesCustomizationDocumentTest, MultiLanguage) {
+ system::MockStatisticsProvider mock_statistics_provider;
+ StartupCustomizationDocument customization(&mock_statistics_provider,
+ kMultiLanguageStartupManifest);
+ EXPECT_TRUE(customization.IsReady());
+
+ EXPECT_EQ("en-US,de,fr,it", customization.initial_locale());
+ EXPECT_EQ("en-US", customization.initial_locale_default());
+ EXPECT_EQ((size_t)4, customization.configured_locales().size());
Nikita (slow) 2014/01/31 15:47:20 nit: insert space after (size_t)
Alexander Alekseev 2014/01/31 17:21:00 Done.
+
+ EXPECT_LOCALE_ENTRY(0, "en-US");
+ EXPECT_LOCALE_ENTRY(1, "de");
+ EXPECT_LOCALE_ENTRY(2, "fr");
+ EXPECT_LOCALE_ENTRY(3, "it");
+}
+
TEST(ServicesCustomizationDocumentTest, BadManifest) {
ServicesCustomizationDocument customization(kBadManifest);
EXPECT_FALSE(customization.IsReady());

Powered by Google App Engine
This is Rietveld 408576698