Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | |
|
please use gerrit instead
2015/06/16 00:31:17
2015
Julius
2015/06/17 00:59:53
Done.
| |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 GEN('#include "chrome/browser/ui/webui/options/multilanguage_options_webui_brows ertest.h"'); | |
| 6 | |
| 7 /** | |
| 8 * Test C++ fixture for downloads WebUI testing. | |
| 9 * @constructor | |
| 10 * @extends {testing.Test} | |
| 11 */ | |
| 12 function MultilanguageOptionsWebUIBrowserTest() {} | |
|
please use gerrit instead
2015/06/16 00:31:17
Is this necessary?
Julius
2015/06/17 00:59:53
I renamed BaseMultilanguageOptionsWebUIBrowserTest
| |
| 13 | |
| 14 /** | |
| 15 * Base fixture for Downloads WebUI testing. | |
|
please use gerrit instead
2015/06/16 00:31:17
This comment is wrong.
Julius
2015/06/17 00:59:53
Done.
| |
| 16 * @extends {testing.Test} | |
| 17 * @constructor | |
| 18 */ | |
| 19 function BaseMultilanguageOptionsWebUIBrowserTest() {} | |
|
please use gerrit instead
2015/06/16 00:31:17
Will it work to call this MultilanguageOptionsWebU
Julius
2015/06/17 00:59:53
That generates compiler errors. The typedefCppFixt
| |
| 20 | |
| 21 BaseMultilanguageOptionsWebUIBrowserTest.prototype = { | |
| 22 __proto__: testing.Test.prototype, | |
| 23 | |
| 24 /** | |
| 25 * Browse to the downloads page & call our preLoad(). | |
|
please use gerrit instead
2015/06/16 00:31:17
That's not the "downloads" page. Please update the
Julius
2015/06/17 00:59:53
Done.
| |
| 26 */ | |
| 27 browsePreload: 'chrome://settings-frame/languages/', | |
| 28 | |
| 29 /** @override */ | |
| 30 typedefCppFixture: 'MultilanguageOptionsWebUIBrowserTest', | |
| 31 | |
| 32 /** @override */ | |
| 33 runAccessibilityChecks: true, | |
| 34 | |
| 35 /** @override */ | |
| 36 accessibilityIssuesAreErrors: true, | |
| 37 }; | |
| 38 | |
| 39 // Test opening language options has correct location. | |
| 40 TEST_F('BaseMultilanguageOptionsWebUIBrowserTest', | |
| 41 'testOpenLanguageOptions', | |
| 42 function() { | |
| 43 expectEquals(this.browsePreload, document.location.href); | |
|
please use gerrit instead
2015/06/16 00:31:17
It's best to use literal expected values in tests,
Julius
2015/06/17 00:59:53
Done.
| |
| 44 }); | |
| 45 | |
| 46 // Test that only certain languages can be selected and used for spellchecking. | |
|
please use gerrit instead
2015/06/16 00:31:17
Specify the value of prefs::kLanguagePreferredLang
Julius
2015/06/17 00:59:53
Done.
| |
| 47 TEST_F('BaseMultilanguageOptionsWebUIBrowserTest', | |
| 48 'languageOptions', | |
| 49 function() { | |
| 50 expectTrue(loadTimeData.getBoolean('enableMultilingualSpellChecker')); | |
| 51 if (!cr.isMac) { | |
|
please use gerrit instead
2015/06/16 00:31:17
I agree with Dan that you should assert(!cr.isMac)
Julius
2015/06/17 00:59:53
Done.
| |
| 52 expectTrue($('spellcheck-language-button').hidden); | |
| 53 var langOps = LanguageOptions.getInstance(); | |
| 54 // Make sure the only language currently selected is 'en-US'. | |
| 55 expectEquals('en-US', loadTimeData.getString('currentUiLanguageCode')); | |
|
please use gerrit instead
2015/06/16 00:31:17
I don't think you can rely on the UI locale being
Julius
2015/06/17 00:59:53
Done.
| |
| 56 expectTrue(langOps.spellCheckDictionaries_.hasOwnProperty('en-US')); | |
| 57 expectTrue($('language-options-list').selectLanguageByCode('en-US')); | |
| 58 expectTrue($('spellcheck-language-checkbox').checked); | |
| 59 | |
| 60 // Click 'es' and ensure that its checkbox gets checked, 'en-US' stays, | |
| 61 // checked, and those are the only languages being used for spellchecking. | |
| 62 expectTrue($('language-options-list').selectLanguageByCode('es')); | |
| 63 LanguageOptions.updateSpellCheckLanguageControls('es'); | |
| 64 expectFalse($('spellcheck-language-checkbox').checked, 'es'); | |
| 65 $('spellcheck-language-checkbox').click(); | |
| 66 expectTrue(langOps.spellCheckDictionaries_.hasOwnProperty('es')); | |
| 67 expectTrue($('spellcheck-language-checkbox').checked, 'es'); | |
| 68 $('language-options-list').selectLanguageByCode('en-US'); | |
| 69 LanguageOptions.updateSpellCheckLanguageControls('en-US'); | |
| 70 expectTrue($('spellcheck-language-checkbox').checked); | |
| 71 expectTrue(langOps.spellCheckDictionaries_.hasOwnProperty('en-US')); | |
| 72 expectTrue(langOps.spellCheckDictionaries_.hasOwnProperty('es')); | |
| 73 | |
| 74 // Check that 'am' cannot be selected as a language and make sure the other | |
| 75 // languages stay selected. | |
| 76 expectFalse($('language-options-list').selectLanguageByCode('am')); | |
| 77 $('language-options-list').selectLanguageByCode('en-US'); | |
| 78 expectTrue($('spellcheck-language-checkbox').checked); | |
| 79 $('language-options-list').selectLanguageByCode('es'); | |
| 80 expectTrue($('spellcheck-language-checkbox').checked, 'es'); | |
| 81 expectTrue(langOps.spellCheckDictionaries_.hasOwnProperty('en-US')); | |
| 82 expectTrue(langOps.spellCheckDictionaries_.hasOwnProperty('es')); | |
| 83 expectFalse(langOps.spellCheckDictionaries_.hasOwnProperty('am')); | |
| 84 | |
| 85 // Click 'en-US' and ensure that its checkbox gets unchecked, 'es' stays, | |
| 86 // checked, and that is the only language being used for spellchecking. | |
| 87 $('language-options-list').selectLanguageByCode('en-US'); | |
| 88 LanguageOptions.updateSpellCheckLanguageControls('en-US'); | |
| 89 expectTrue($('spellcheck-language-checkbox').checked); | |
| 90 $('spellcheck-language-checkbox').click(); | |
| 91 expectFalse(langOps.spellCheckDictionaries_.hasOwnProperty('en-US')); | |
| 92 expectFalse($('spellcheck-language-checkbox').checked); | |
| 93 $('language-options-list').selectLanguageByCode('es'); | |
| 94 LanguageOptions.updateSpellCheckLanguageControls('es'); | |
| 95 expectTrue($('spellcheck-language-checkbox').checked, 'es'); | |
| 96 expectTrue(langOps.spellCheckDictionaries_.hasOwnProperty('es')); | |
| 97 | |
| 98 // Make sure 'en' cannot be used as a spellchecking language. | |
| 99 $('language-options-list').selectLanguageByCode('en'); | |
| 100 LanguageOptions.updateSpellCheckLanguageControls('en'); | |
| 101 expectTrue($('spellcheck-language-checkbox-container').hidden); | |
| 102 expectFalse($('spellcheck-language-checkbox').checked); | |
| 103 expectFalse(langOps.spellCheckDictionaries_.hasOwnProperty('en')); | |
| 104 } | |
| 105 }); | |
| OLD | NEW |