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

Side by Side Diff: chrome/test/data/webui/settings/search_page_test.js

Issue 2617533003: MD Settings: change most checkboxes to toggles (leave dialogs alone) (Closed)
Patch Set: fix tests Created 3 years, 11 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 cr.define('settings_search_page', function() { 5 cr.define('settings_search_page', function() {
6 function generateSearchEngineInfo() { 6 function generateSearchEngineInfo() {
7 var searchEngines0 = settings_search.createSampleSearchEngine( 7 var searchEngines0 = settings_search.createSampleSearchEngine(
8 true, false, false); 8 true, false, false);
9 searchEngines0.default = true; 9 searchEngines0.default = true;
10 var searchEngines1 = settings_search.createSampleSearchEngine( 10 var searchEngines1 = settings_search.createSampleSearchEngine(
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 // Tests the UI when Hotword 'alwaysOn' is true. 102 // Tests the UI when Hotword 'alwaysOn' is true.
103 test('HotwordAlwaysOn', function() { 103 test('HotwordAlwaysOn', function() {
104 return browserProxy.whenCalled('getHotwordInfo').then(function() { 104 return browserProxy.whenCalled('getHotwordInfo').then(function() {
105 Polymer.dom.flush(); 105 Polymer.dom.flush();
106 assertTrue(page.hotwordInfo_.allowed); 106 assertTrue(page.hotwordInfo_.allowed);
107 assertTrue(page.hotwordInfo_.alwaysOn); 107 assertTrue(page.hotwordInfo_.alwaysOn);
108 assertFalse(page.hotwordInfo_.enabled); 108 assertFalse(page.hotwordInfo_.enabled);
109 assertFalse(browserProxy.hotwordSearchEnabled); 109 assertFalse(browserProxy.hotwordSearchEnabled);
110 assertFalse(page.hotwordSearchEnablePref_.value); 110 assertFalse(page.hotwordSearchEnablePref_.value);
111 111
112 var checkbox = page.$$('#hotwordSearchEnable'); 112 var control = page.$$('#hotwordSearchEnable');
113 assertTrue(!!checkbox); 113 assertTrue(!!control);
114 assertFalse(checkbox.disabled); 114 assertFalse(control.disabled);
115 assertFalse(checkbox.checked); 115 assertFalse(control.checked);
116 MockInteractions.tap(checkbox.$.checkbox); 116 MockInteractions.tap(control.$.control);
117 Polymer.dom.flush(); 117 Polymer.dom.flush();
118 return browserProxy.whenCalled('setHotwordSearchEnabled'); 118 return browserProxy.whenCalled('setHotwordSearchEnabled');
119 }).then(function() { 119 }).then(function() {
120 assertTrue(browserProxy.hotwordSearchEnabled); 120 assertTrue(browserProxy.hotwordSearchEnabled);
121 }); 121 });
122 }); 122 });
123 123
124 // Tests the UI when Hotword 'alwaysOn' is false. 124 // Tests the UI when Hotword 'alwaysOn' is false.
125 test('HotwordNotAlwaysOn', function() { 125 test('HotwordNotAlwaysOn', function() {
126 return browserProxy.whenCalled('getHotwordInfo').then(function() { 126 return browserProxy.whenCalled('getHotwordInfo').then(function() {
127 browserProxy.setHotwordInfo({ 127 browserProxy.setHotwordInfo({
128 allowed: true, 128 allowed: true,
129 enabled: false, 129 enabled: false,
130 alwaysOn: false, 130 alwaysOn: false,
131 errorMessage: '', 131 errorMessage: '',
132 userName: '', 132 userName: '',
133 historyEnabled: false, 133 historyEnabled: false,
134 }); 134 });
135 Polymer.dom.flush(); 135 Polymer.dom.flush();
136 assertTrue(page.hotwordInfo_.allowed); 136 assertTrue(page.hotwordInfo_.allowed);
137 assertFalse(page.hotwordInfo_.alwaysOn); 137 assertFalse(page.hotwordInfo_.alwaysOn);
138 assertFalse(page.hotwordInfo_.enabled); 138 assertFalse(page.hotwordInfo_.enabled);
139 139
140 var checkbox = page.$$('#hotwordSearchEnable'); 140 var control = page.$$('#hotwordSearchEnable');
141 assertTrue(!!checkbox); 141 assertTrue(!!control);
142 assertFalse(checkbox.disabled); 142 assertFalse(control.disabled);
143 assertFalse(checkbox.checked); 143 assertFalse(control.checked);
144 MockInteractions.tap(checkbox.$.checkbox); 144 MockInteractions.tap(control.$.control);
145 Polymer.dom.flush(); 145 Polymer.dom.flush();
146 return browserProxy.whenCalled('setHotwordSearchEnabled'); 146 return browserProxy.whenCalled('setHotwordSearchEnabled');
147 }).then(function() { 147 }).then(function() {
148 assertTrue(browserProxy.hotwordSearchEnabled); 148 assertTrue(browserProxy.hotwordSearchEnabled);
149 }); 149 });
150 }); 150 });
151 151
152 test('UpdateGoogleNowOnPrefChange', function() { 152 test('UpdateGoogleNowOnPrefChange', function() {
153 return browserProxy.whenCalled('getGoogleNowAvailability').then( 153 return browserProxy.whenCalled('getGoogleNowAvailability').then(
154 function() { 154 function() {
155 Polymer.dom.flush(); 155 Polymer.dom.flush();
156 assertTrue(page.googleNowAvailable_); 156 assertTrue(page.googleNowAvailable_);
157 157
158 var checkbox = page.$$('#googleNowEnable'); 158 var control = page.$$('#googleNowEnable');
159 assertTrue(!!checkbox); 159 assertTrue(!!control);
160 assertFalse(checkbox.disabled); 160 assertFalse(control.disabled);
161 assertFalse(checkbox.checked); 161 assertFalse(control.checked);
162 162
163 page.prefs = { 163 page.prefs = {
164 google_now_launcher: { 164 google_now_launcher: {
165 enabled: { 165 enabled: {
166 type: chrome.settingsPrivate.PrefType.BOOLEAN, 166 type: chrome.settingsPrivate.PrefType.BOOLEAN,
167 value: true, 167 value: true,
168 } 168 }
169 } 169 }
170 }; 170 };
171 Polymer.dom.flush(); 171 Polymer.dom.flush();
172 assertFalse(checkbox.disabled); 172 assertFalse(control.disabled);
173 assertTrue(checkbox.checked); 173 assertTrue(control.checked);
174 }); 174 });
175 }); 175 });
176 }); 176 });
177 } 177 }
178 178
179 return { 179 return {
180 registerTests: registerTests, 180 registerTests: registerTests,
181 }; 181 };
182 }); 182 });
OLDNEW
« no previous file with comments | « chrome/test/data/webui/settings/privacy_page_test.js ('k') | chrome/test/data/webui/settings/system_page_tests.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698