OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "base/message_loop/message_loop.h" | 5 #include "base/message_loop/message_loop.h" |
6 #include "base/prefs/pref_service.h" | 6 #include "base/prefs/pref_service.h" |
7 #include "base/strings/stringprintf.h" | 7 #include "base/strings/stringprintf.h" |
8 #include "base/task_runner.h" | 8 #include "base/task_runner.h" |
9 #include "chrome/browser/browser_process.h" | 9 #include "chrome/browser/browser_process.h" |
10 #include "chrome/browser/chrome_notification_types.h" | 10 #include "chrome/browser/chrome_notification_types.h" |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 | 69 |
70 } // namespace | 70 } // namespace |
71 | 71 |
72 struct LocalizationTestParams { | 72 struct LocalizationTestParams { |
73 const char* initial_locale; | 73 const char* initial_locale; |
74 const char* keyboard_layout; | 74 const char* keyboard_layout; |
75 const char* expected_locale; | 75 const char* expected_locale; |
76 const char* expected_keyboard_layout; | 76 const char* expected_keyboard_layout; |
77 const char* expected_keyboard_select_control; | 77 const char* expected_keyboard_select_control; |
78 } const oobe_localization_test_parameters[] = { | 78 } const oobe_localization_test_parameters[] = { |
79 // ------------------ Non-Latin setup | 79 // ------------------ Non-Latin setup |
80 // For a non-Latin keyboard layout like Russian, we expect to see the US | 80 // For a non-Latin keyboard layout like Russian, we expect to see the US |
81 // keyboard. | 81 // keyboard. |
82 {"ru", "xkb:ru::rus", "ru", kUSLayout, "xkb:us::eng"}, | 82 {"ru", "xkb:ru::rus", "ru", kUSLayout, "xkb:us::eng"}, |
83 {"ru", "xkb:us::eng,xkb:ru::rus", "ru", kUSLayout, "xkb:us::eng"}, | 83 {"ru", "xkb:us::eng,xkb:ru::rus", "ru", kUSLayout, "xkb:us::eng"}, |
84 | 84 |
85 // IMEs do not load at OOBE, so we just expect to see the (Latin) Japanese | 85 // IMEs do not load at OOBE, so we just expect to see the (Latin) Japanese |
86 // keyboard. | 86 // keyboard. |
87 {"ja", "xkb:jp::jpn", "ja", "xkb:jp::jpn", "xkb:jp::jpn,[xkb:us::eng]"}, | 87 {"ja", "xkb:jp::jpn", "ja", "xkb:jp::jpn", "xkb:jp::jpn,[xkb:us::eng]"}, |
88 | 88 |
89 // We don't use the Icelandic locale but the Icelandic keyboard layout | 89 // We don't use the Icelandic locale but the Icelandic keyboard layout |
90 // should still be selected when specified as the default. | 90 // should still be selected when specified as the default. |
91 {"en-US", | 91 {"en-US", "xkb:is::ice", "en-US", "xkb:is::ice", |
92 "xkb:is::ice", | 92 "xkb:is::ice,[xkb:us::eng,xkb:us:intl:eng,xkb:us:altgr-intl:eng," |
93 "en-US", | 93 "xkb:us:dvorak:eng,xkb:us:dvp:eng,xkb:us:colemak:eng," |
94 "xkb:is::ice", | 94 "xkb:us:workman:eng,xkb:us:workman-intl:eng]"}, |
95 "xkb:is::ice,[xkb:us::eng,xkb:us:intl:eng,xkb:us:altgr-intl:eng," | 95 // ------------------ Full Latin setup |
96 "xkb:us:dvorak:eng,xkb:us:dvp:eng,xkb:us:colemak:eng]"}, | 96 // French Swiss keyboard. |
97 // ------------------ Full Latin setup | 97 {"fr", "xkb:ch:fr:fra", "fr", "xkb:ch:fr:fra", |
98 // French Swiss keyboard. | 98 "xkb:ch:fr:fra,[xkb:fr::fra,xkb:be::fra,xkb:ca::fra," |
99 {"fr", | 99 "xkb:ca:multix:fra,xkb:us::eng]"}, |
100 "xkb:ch:fr:fra", | |
101 "fr", | |
102 "xkb:ch:fr:fra", | |
103 "xkb:ch:fr:fra,[xkb:fr::fra,xkb:be::fra,xkb:ca::fra," | |
104 "xkb:ca:multix:fra,xkb:us::eng]"}, | |
105 | 100 |
106 // German Swiss keyboard. | 101 // German Swiss keyboard. |
107 {"de", | 102 {"de", "xkb:ch::ger", "de", "xkb:ch::ger", |
108 "xkb:ch::ger", | 103 "xkb:ch::ger,[xkb:de::ger,xkb:de:neo:ger,xkb:be::ger,xkb:us::eng]"}, |
109 "de", | |
110 "xkb:ch::ger", | |
111 "xkb:ch::ger,[xkb:de::ger,xkb:de:neo:ger,xkb:be::ger,xkb:us::eng]"}, | |
112 | 104 |
113 // NetworkScreenMultipleLocales | 105 // NetworkScreenMultipleLocales |
114 {"es,en-US,nl", | 106 {"es,en-US,nl", "xkb:be::nld", "es,en-US,nl", "xkb:be::nld", |
115 "xkb:be::nld", | 107 "xkb:be::nld,[xkb:es::spa,xkb:latam::spa,xkb:us::eng]"}, |
116 "es,en-US,nl", | |
117 "xkb:be::nld", | |
118 "xkb:be::nld,[xkb:es::spa,xkb:latam::spa,xkb:us::eng]"}, | |
119 | 108 |
120 {"ru,de", "xkb:ru::rus", "ru,de", kUSLayout, "xkb:us::eng"}, | 109 {"ru,de", "xkb:ru::rus", "ru,de", kUSLayout, "xkb:us::eng"}, |
121 | 110 |
122 // TODO(alemate/michaelpg): Figure out why these tests are failing | 111 // TODO(alemate/michaelpg): Figure out why these tests are failing |
123 // and re-enable them. crbug.com/422702. | 112 // and re-enable them. crbug.com/422702. |
124 // ------------------ Regional Locales | 113 // ------------------ Regional Locales |
125 // Syntetic example to test correct merging of different locales. | 114 // Syntetic example to test correct merging of different locales. |
126 // {"fr-CH,it-CH,de-CH", | 115 // {"fr-CH,it-CH,de-CH", |
127 // "xkb:fr::fra,xkb:it::ita,xkb:de::ger", | 116 // "xkb:fr::fra,xkb:it::ita,xkb:de::ger", |
128 // "fr-CH,it-CH,de-CH", | 117 // "fr-CH,it-CH,de-CH", |
129 // "xkb:fr::fra", | 118 // "xkb:fr::fra", |
130 // "xkb:fr::fra,xkb:it::ita,xkb:de::ger,[xkb:be::fra,xkb:ca::fra," | 119 // "xkb:fr::fra,xkb:it::ita,xkb:de::ger,[xkb:be::fra,xkb:ca::fra," |
131 // "xkb:ch:fr:fra,xkb:ca:multix:fra,xkb:us::eng]"}, | 120 // "xkb:ch:fr:fra,xkb:ca:multix:fra,xkb:us::eng]"}, |
132 | 121 |
133 // Another syntetic example. Check that british keyboard is available. | 122 // Another syntetic example. Check that british keyboard is available. |
134 // {"en-AU", | 123 // {"en-AU", |
135 // "xkb:us::eng", | 124 // "xkb:us::eng", |
136 // "en-AU", | 125 // "en-AU", |
137 // "xkb:us::eng", | 126 // "xkb:us::eng", |
138 // "xkb:us::eng,[xkb:gb:extd:eng,xkb:gb:dvorak:eng]"}, | 127 // "xkb:us::eng,[xkb:gb:extd:eng,xkb:gb:dvorak:eng]"}, |
139 }; | 128 }; |
140 | 129 |
141 class OobeLocalizationTest | 130 class OobeLocalizationTest |
142 : public LoginManagerTest, | 131 : public LoginManagerTest, |
143 public testing::WithParamInterface<const LocalizationTestParams*> { | 132 public testing::WithParamInterface<const LocalizationTestParams*> { |
144 public: | 133 public: |
145 OobeLocalizationTest(); | 134 OobeLocalizationTest(); |
146 | 135 |
147 // Verifies that the comma-separated |values| corresponds with the first | 136 // Verifies that the comma-separated |values| corresponds with the first |
148 // values in |select_id|, optionally checking for an options group label after | 137 // values in |select_id|, optionally checking for an options group label after |
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
382 RunLocalizationTest(); | 371 RunLocalizationTest(); |
383 } | 372 } |
384 | 373 |
385 INSTANTIATE_TEST_CASE_P( | 374 INSTANTIATE_TEST_CASE_P( |
386 StructSequence, | 375 StructSequence, |
387 OobeLocalizationTest, | 376 OobeLocalizationTest, |
388 testing::Range(&oobe_localization_test_parameters[0], | 377 testing::Range(&oobe_localization_test_parameters[0], |
389 &oobe_localization_test_parameters[arraysize( | 378 &oobe_localization_test_parameters[arraysize( |
390 oobe_localization_test_parameters)])); | 379 oobe_localization_test_parameters)])); |
391 } // namespace chromeos | 380 } // namespace chromeos |
OLD | NEW |