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 GEN_INCLUDE(['options_browsertest_base.js']); | |
6 | |
7 /** | 5 /** |
8 * TestFixture for language options WebUI testing. | 6 * TestFixture for language options WebUI testing. |
9 * @extends {testing.Test} | 7 * @extends {testing.Test} |
10 * @constructor | 8 * @constructor |
11 */ | 9 */ |
12 function LanguageOptionsWebUITest() {} | 10 function LanguageOptionsWebUITest() {} |
13 | 11 |
14 LanguageOptionsWebUITest.prototype = { | 12 LanguageOptionsWebUITest.prototype = { |
15 __proto__: OptionsBrowsertestBase.prototype, | 13 __proto__: testing.Test.prototype, |
16 | 14 |
17 /** @override */ | 15 /** @override */ |
18 browsePreload: 'chrome://settings-frame/languages', | 16 browsePreload: 'chrome://settings-frame/languages', |
19 }; | 17 }; |
20 | 18 |
21 // Test opening language options has correct location. | 19 // Test opening language options has correct location. |
22 TEST_F('LanguageOptionsWebUITest', 'testOpenLanguageOptions', function() { | 20 TEST_F('LanguageOptionsWebUITest', 'testOpenLanguageOptions', function() { |
23 assertEquals(this.browsePreload, document.location.href); | 21 assertEquals(this.browsePreload, document.location.href); |
24 }); | 22 }); |
25 | 23 |
26 GEN('#if defined(OS_WIN) || defined(OS_CHROMEOS)'); | 24 GEN('#if defined(OS_WIN) || defined(OS_CHROMEOS)'); |
27 // Test reselecting the same language as the current UI locale. This should show | 25 // Test reselecting the same language as the current UI locale. This should show |
28 // a "Chrome is displayed in this language" message rather than a restart banner | 26 // a "Chrome is displayed in this language" message rather than a restart banner |
29 // or a [ Display Chrome in this language ] button. | 27 // or a [ Display Chrome in this language ] button. |
30 TEST_F('LanguageOptionsWebUITest', 'reselectUILocale', function() { | 28 TEST_F('LanguageOptionsWebUITest', 'reselectUILocale', function() { |
31 var currentLang = loadTimeData.getString('currentUiLanguageCode'); | 29 var currentLang = loadTimeData.getString('currentUiLanguageCode'); |
32 $('language-options-list').selectLanguageByCode(currentLang); | 30 $('language-options-list').selectLanguageByCode(currentLang); |
33 LanguageOptions.uiLanguageSaved(currentLang); | 31 LanguageOptions.uiLanguageSaved(currentLang); |
34 | 32 |
35 expectTrue($('language-options-ui-language-button').hidden); | 33 expectTrue($('language-options-ui-language-button').hidden); |
36 expectFalse($('language-options-ui-language-message').hidden); | 34 expectFalse($('language-options-ui-language-message').hidden); |
37 expectTrue($('language-options-ui-notification-bar').hidden); | 35 expectTrue($('language-options-ui-notification-bar').hidden); |
38 }); | 36 }); |
39 GEN('#endif'); // defined(OS_WIN) || defined(OS_CHROMEOS) | 37 GEN('#endif'); // defined(OS_WIN) || defined(OS_CHROMEOS) |
OLD | NEW |