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

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

Issue 2919343005: Remove tests for deprecated Options UI (Closed)
Patch Set: and more Created 3 years, 6 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
(Empty)
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
3 // found in the LICENSE file.
4
5 GEN_INCLUDE(['options_browsertest_base.js']);
6
7 /**
8 * TestFixture for testing messages of dictionary download progress in language
9 * options WebUI.
10 * @extends {testing.Test}
11 * @constructor
12 */
13 function LanguagesOptionsDictionaryDownloadWebUITest() {}
14
15 LanguagesOptionsDictionaryDownloadWebUITest.prototype = {
16 __proto__: OptionsBrowsertestBase.prototype,
17
18 /**
19 * Browse to languages options.
20 */
21 browsePreload: 'chrome://settings-frame/languages',
22
23 /**
24 * Register a mock dictionary handler.
25 */
26 preLoad: function() {
27 this.makeAndRegisterMockHandler(['retryDictionaryDownload']);
28 this.mockHandler.stubs().retryDictionaryDownload().
29 will(callFunction(function() {
30 options.LanguageOptions.onDictionaryDownloadBegin('en-US');
31 }));
32 },
33
34 /** @override */
35 setUp: function() {
36 OptionsBrowsertestBase.prototype.setUp.call(this);
37
38 // Enable when failure is resolved.
39 // AX_ARIA_10: http://crbug.com/570554
40 this.accessibilityAuditConfig.ignoreSelectors(
41 'unsupportedAriaAttribute',
42 '#language-options-list');
43
44 // Enable when failure is resolved.
45 // AX_TEXT_04: http://crbug.com/570553
46 this.accessibilityAuditConfig.ignoreSelectors(
47 'linkWithUnclearPurpose',
48 '#languagePage > .content-area > .language-options-header > A');
49 },
50 };
51
52 // Verify that dictionary download success does not show, "This language can't
53 // be used for spellchecking." or "Download failed."
54 // Disabled due to flakiness (crbug.com/616550).
55 TEST_F('LanguagesOptionsDictionaryDownloadWebUITest',
56 'DISABLED_testdictionaryDownloadSuccess',
57 function() {
58 options.LanguageOptions.onDictionaryDownloadSuccess('en-US');
59 expectTrue($('spellcheck-language-message').hidden);
60 expectTrue($('language-options-dictionary-downloading-message').hidden);
61 expectTrue($('language-options-dictionary-download-failed-message').hidden);
62 expectTrue(
63 $('language-options-dictionary-download-fail-help-message').hidden);
64 });
65
66 // Verify that dictionary download in progress shows 'Downloading spell check
67 // language' message.
68 // Disabled due to flakiness (crbug.com/616550).
69 TEST_F('LanguagesOptionsDictionaryDownloadWebUITest',
70 'DISABLED_testdictionaryDownloadProgress',
71 function() {
72 options.LanguageOptions.onDictionaryDownloadBegin('en-US');
73 expectTrue($('spellcheck-language-message').hidden);
74 expectFalse($('language-options-dictionary-downloading-message').hidden);
75 expectTrue($('language-options-dictionary-download-failed-message').hidden);
76 expectTrue(
77 $('language-options-dictionary-download-fail-help-message').hidden);
78 });
79
80 // Verify that failure in dictionary download shows 'Dictionary download failed'
81 // message.
82 TEST_F('LanguagesOptionsDictionaryDownloadWebUITest',
83 'testdictionaryDownloadFailed',
84 function() {
85 // Clear the failure counter:
86 options.LanguageOptions.onDictionaryDownloadSuccess('en-US');
87
88 // First failure shows a short error message.
89 options.LanguageOptions.onDictionaryDownloadFailure('en-US');
90 expectTrue($('spellcheck-language-message').hidden);
91 expectTrue($('language-options-dictionary-downloading-message').hidden);
92 expectFalse($('language-options-dictionary-download-failed-message').hidden);
93 expectTrue(
94 $('language-options-dictionary-download-fail-help-message').hidden);
95
96 // Second and all following failures show a longer error message.
97 options.LanguageOptions.onDictionaryDownloadFailure('en-US');
98 expectTrue($('spellcheck-language-message').hidden);
99 expectTrue($('language-options-dictionary-downloading-message').hidden);
100 expectFalse($('language-options-dictionary-download-failed-message').hidden);
101 expectFalse(
102 $('language-options-dictionary-download-fail-help-message').hidden);
103
104 options.LanguageOptions.onDictionaryDownloadFailure('en-US');
105 expectTrue($('spellcheck-language-message').hidden);
106 expectTrue($('language-options-dictionary-downloading-message').hidden);
107 expectFalse($('language-options-dictionary-download-failed-message').hidden);
108 expectFalse(
109 $('language-options-dictionary-download-fail-help-message').hidden);
110 });
111
112 // Verify that clicking the retry button calls the handler.
113 // This test is flaky on Windows. https://crbug.com/616791
114 GEN('#if defined(OS_WIN)');
115 GEN('#define MAYBE_testdictionaryDownloadRetry ' +
116 'DISABLED_testdictionaryDownloadRetry');
117 GEN('#else');
118 GEN('#define MAYBE_testdictionaryDownloadRetry testdictionaryDownloadRetry');
119 GEN('#endif // defined(OS_WIN)');
120 TEST_F('LanguagesOptionsDictionaryDownloadWebUITest',
121 'MAYBE_testdictionaryDownloadRetry',
122 function() {
123 this.mockHandler.expects(once()).retryDictionaryDownload('en-US').
124 will(callFunction(function() {
125 options.LanguageOptions.onDictionaryDownloadBegin('en-US');
126 }));
127 options.LanguageOptions.onDictionaryDownloadFailure('en-US');
128 $('dictionary-download-retry-button').click();
129 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698