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

Side by Side Diff: chrome/browser/ui/webui/options/language_options_dictionary_download_browsertest.js

Issue 1156473007: Enables the user to select multiple languages for spellchecking (UI) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed nits and presubmit warnings. Created 5 years, 5 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 /** 5 /**
6 * TestFixture for testing messages of dictionary download progress in language 6 * TestFixture for testing messages of dictionary download progress in language
7 * options WebUI. 7 * options WebUI.
8 * @extends {testing.Test} 8 * @extends {testing.Test}
9 * @constructor 9 * @constructor
10 */ 10 */
(...skipping 18 matching lines...) Expand all
29 })); 29 }));
30 }, 30 },
31 }; 31 };
32 32
33 // Verify that dictionary download success shows 'This language is used for 33 // Verify that dictionary download success shows 'This language is used for
34 // spellchecking' message. 34 // spellchecking' message.
35 TEST_F('LanguagesOptionsDictionaryDownloadWebUITest', 35 TEST_F('LanguagesOptionsDictionaryDownloadWebUITest',
36 'testdictionaryDownloadSuccess', 36 'testdictionaryDownloadSuccess',
37 function() { 37 function() {
38 options.LanguageOptions.onDictionaryDownloadSuccess('en-US'); 38 options.LanguageOptions.onDictionaryDownloadSuccess('en-US');
39 expectFalse($('language-options-spell-check-language-message').hidden); 39 expectFalse($('spellcheck-language-message').hidden);
40 expectTrue($('language-options-dictionary-downloading-message').hidden); 40 expectTrue($('language-options-dictionary-downloading-message').hidden);
41 expectTrue($('language-options-dictionary-download-failed-message').hidden); 41 expectTrue($('language-options-dictionary-download-failed-message').hidden);
42 expectTrue( 42 expectTrue(
43 $('language-options-dictionary-download-fail-help-message').hidden); 43 $('language-options-dictionary-download-fail-help-message').hidden);
44 }); 44 });
45 45
46 // Verify that dictionary download in progress shows 'Downloading spell check 46 // Verify that dictionary download in progress shows 'Downloading spell check
47 // language' message. 47 // language' message.
48 TEST_F('LanguagesOptionsDictionaryDownloadWebUITest', 48 TEST_F('LanguagesOptionsDictionaryDownloadWebUITest',
49 'testdictionaryDownloadProgress', 49 'testdictionaryDownloadProgress',
50 function() { 50 function() {
51 options.LanguageOptions.onDictionaryDownloadBegin('en-US'); 51 options.LanguageOptions.onDictionaryDownloadBegin('en-US');
52 expectTrue($('language-options-spell-check-language-message').hidden); 52 expectTrue($('spellcheck-language-message').hidden);
53 expectFalse($('language-options-dictionary-downloading-message').hidden); 53 expectFalse($('language-options-dictionary-downloading-message').hidden);
54 expectTrue($('language-options-dictionary-download-failed-message').hidden); 54 expectTrue($('language-options-dictionary-download-failed-message').hidden);
55 expectTrue( 55 expectTrue(
56 $('language-options-dictionary-download-fail-help-message').hidden); 56 $('language-options-dictionary-download-fail-help-message').hidden);
57 }); 57 });
58 58
59 // Verify that failure in dictionary download shows 'Dictionary download failed' 59 // Verify that failure in dictionary download shows 'Dictionary download failed'
60 // message. 60 // message.
61 TEST_F('LanguagesOptionsDictionaryDownloadWebUITest', 61 TEST_F('LanguagesOptionsDictionaryDownloadWebUITest',
62 'testdictionaryDownloadFailed', 62 'testdictionaryDownloadFailed',
63 function() { 63 function() {
64 // Clear the failure counter: 64 // Clear the failure counter:
65 options.LanguageOptions.onDictionaryDownloadSuccess('en-US'); 65 options.LanguageOptions.onDictionaryDownloadSuccess('en-US');
66 66
67 // First failure shows a short error message. 67 // First failure shows a short error message.
68 options.LanguageOptions.onDictionaryDownloadFailure('en-US'); 68 options.LanguageOptions.onDictionaryDownloadFailure('en-US');
69 expectTrue($('language-options-spell-check-language-message').hidden); 69 expectTrue($('spellcheck-language-message').hidden);
70 expectTrue($('language-options-dictionary-downloading-message').hidden); 70 expectTrue($('language-options-dictionary-downloading-message').hidden);
71 expectFalse($('language-options-dictionary-download-failed-message').hidden); 71 expectFalse($('language-options-dictionary-download-failed-message').hidden);
72 expectTrue( 72 expectTrue(
73 $('language-options-dictionary-download-fail-help-message').hidden); 73 $('language-options-dictionary-download-fail-help-message').hidden);
74 74
75 // Second and all following failures show a longer error message. 75 // Second and all following failures show a longer error message.
76 options.LanguageOptions.onDictionaryDownloadFailure('en-US'); 76 options.LanguageOptions.onDictionaryDownloadFailure('en-US');
77 expectTrue($('language-options-spell-check-language-message').hidden); 77 expectTrue($('spellcheck-language-message').hidden);
78 expectTrue($('language-options-dictionary-downloading-message').hidden); 78 expectTrue($('language-options-dictionary-downloading-message').hidden);
79 expectFalse($('language-options-dictionary-download-failed-message').hidden); 79 expectFalse($('language-options-dictionary-download-failed-message').hidden);
80 expectFalse( 80 expectFalse(
81 $('language-options-dictionary-download-fail-help-message').hidden); 81 $('language-options-dictionary-download-fail-help-message').hidden);
82 82
83 options.LanguageOptions.onDictionaryDownloadFailure('en-US'); 83 options.LanguageOptions.onDictionaryDownloadFailure('en-US');
84 expectTrue($('language-options-spell-check-language-message').hidden); 84 expectTrue($('spellcheck-language-message').hidden);
85 expectTrue($('language-options-dictionary-downloading-message').hidden); 85 expectTrue($('language-options-dictionary-downloading-message').hidden);
86 expectFalse($('language-options-dictionary-download-failed-message').hidden); 86 expectFalse($('language-options-dictionary-download-failed-message').hidden);
87 expectFalse( 87 expectFalse(
88 $('language-options-dictionary-download-fail-help-message').hidden); 88 $('language-options-dictionary-download-fail-help-message').hidden);
89 }); 89 });
90 90
91 // Verify that clicking the retry button calls the handler. 91 // Verify that clicking the retry button calls the handler.
92 TEST_F('LanguagesOptionsDictionaryDownloadWebUITest', 92 TEST_F('LanguagesOptionsDictionaryDownloadWebUITest',
93 'testdictionaryDownloadRetry', 93 'testdictionaryDownloadRetry',
94 function() { 94 function() {
95 this.mockHandler.expects(once()).retryDictionaryDownload(). 95 this.mockHandler.expects(once()).retryDictionaryDownload().
96 will(callFunction(function() { 96 will(callFunction(function() {
97 options.LanguageOptions.onDictionaryDownloadBegin('en-US'); 97 options.LanguageOptions.onDictionaryDownloadBegin('en-US');
98 })); 98 }));
99 options.LanguageOptions.onDictionaryDownloadFailure('en-US'); 99 options.LanguageOptions.onDictionaryDownloadFailure('en-US');
100 $('dictionary-download-retry-button').click(); 100 $('dictionary-download-retry-button').click();
101 }); 101 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698