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

Side by Side 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, 10 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/chromeos/customization_document.h" 5 #include "chrome/browser/chromeos/customization_document.h"
6 6
7 #include "chromeos/system/mock_statistics_provider.h" 7 #include "chromeos/system/mock_statistics_provider.h"
8 #include "testing/gmock/include/gmock/gmock.h" 8 #include "testing/gmock/include/gmock/gmock.h"
9 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
10 10
(...skipping 29 matching lines...) Expand all
40 " }," 40 " },"
41 " {" 41 " {"
42 " \"hwid_mask\": \"Mario 1?3*\"," 42 " \"hwid_mask\": \"Mario 1?3*\","
43 " \"initial_locale\" : \"ru-RU\"," 43 " \"initial_locale\" : \"ru-RU\","
44 " \"initial_timezone\" : \"Europe/Moscow\"," 44 " \"initial_timezone\" : \"Europe/Moscow\","
45 " \"keyboard_layout\" : \"xkb:ru::rus\"," 45 " \"keyboard_layout\" : \"xkb:ru::rus\","
46 " }," 46 " },"
47 " ]," 47 " ],"
48 "}"; 48 "}";
49 49
50 const char kMultiLanguageStartupManifest[] =
51 "{\n"
52 " \"version\": \"1.0\",\n"
53 " \"initial_locale\" : \"en-US,de,fr,it\",\n"
54 " \"initial_timezone\" : \"Europe/Zurich\",\n"
55 " \"keyboard_layout\" : \"xkb:us::eng\",\n"
56 " \"registration_url\" : \"http://www.google.com\",\n"
57 " \"setup_content\" : {\n"
58 " \"default\" : {\n"
59 " \"help_page\" : \"file:///opt/oem/help/en-US/help.html\",\n"
60 " \"eula_page\" : \"file:///opt/oem/eula/en-US/eula.html\",\n"
61 " },\n"
62 " },"
63 "}";
64
50 const char kBadManifest[] = "{\"version\": \"1\"}"; 65 const char kBadManifest[] = "{\"version\": \"1\"}";
51 66
52 const char kGoodServicesManifest[] = 67 const char kGoodServicesManifest[] =
53 "{" 68 "{"
54 " \"version\": \"1.0\"," 69 " \"version\": \"1.0\","
55 " \"app_content\" : {" 70 " \"app_content\" : {"
56 " \"en-US\" : {" 71 " \"en-US\" : {"
57 " \"initial_start_page\": \"http://mario/promo\"," 72 " \"initial_start_page\": \"http://mario/promo\","
58 " \"support_page\": \"http://mario/us\"," 73 " \"support_page\": \"http://mario/us\","
59 " }," 74 " },"
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 EXPECT_EQ("http://mario/ru/promo", 165 EXPECT_EQ("http://mario/ru/promo",
151 customization.GetInitialStartPage("ru-RU")); 166 customization.GetInitialStartPage("ru-RU"));
152 EXPECT_EQ("http://mario/global/promo", 167 EXPECT_EQ("http://mario/global/promo",
153 customization.GetInitialStartPage("ja")); 168 customization.GetInitialStartPage("ja"));
154 169
155 EXPECT_EQ("http://mario/us", customization.GetSupportPage("en-US")); 170 EXPECT_EQ("http://mario/us", customization.GetSupportPage("en-US"));
156 EXPECT_EQ("http://mario/ru", customization.GetSupportPage("ru-RU")); 171 EXPECT_EQ("http://mario/ru", customization.GetSupportPage("ru-RU"));
157 EXPECT_EQ("http://mario/global", customization.GetSupportPage("ja")); 172 EXPECT_EQ("http://mario/global", customization.GetSupportPage("ja"));
158 } 173 }
159 174
175 #define EXPECT_LOCALE_ENTRY(i, value) \
176 if (customization.configured_locales().size() > i) \
177 EXPECT_EQ(value, customization.configured_locales()[i]) \
178 << "Bad locale value at index " << i
179
180 TEST(ServicesCustomizationDocumentTest, MultiLanguage) {
181 system::MockStatisticsProvider mock_statistics_provider;
182 StartupCustomizationDocument customization(&mock_statistics_provider,
183 kMultiLanguageStartupManifest);
184 EXPECT_TRUE(customization.IsReady());
185
186 EXPECT_EQ("en-US,de,fr,it", customization.initial_locale());
187 EXPECT_EQ("en-US", customization.initial_locale_default());
188 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.
189
190 EXPECT_LOCALE_ENTRY(0, "en-US");
191 EXPECT_LOCALE_ENTRY(1, "de");
192 EXPECT_LOCALE_ENTRY(2, "fr");
193 EXPECT_LOCALE_ENTRY(3, "it");
194 }
195
160 TEST(ServicesCustomizationDocumentTest, BadManifest) { 196 TEST(ServicesCustomizationDocumentTest, BadManifest) {
161 ServicesCustomizationDocument customization(kBadManifest); 197 ServicesCustomizationDocument customization(kBadManifest);
162 EXPECT_FALSE(customization.IsReady()); 198 EXPECT_FALSE(customization.IsReady());
163 } 199 }
164 200
165 } // namespace chromeos 201 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698