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

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

Issue 2507363002: MD Settings: Add Hotword (OK Google) section to search_page (Closed)
Patch Set: Nit Created 4 years 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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 value: true, 91 value: true,
92 }, 92 },
93 }, 93 },
94 }; 94 };
95 Polymer.dom.flush(); 95 Polymer.dom.flush();
96 96
97 assertTrue(selectElement.disabled); 97 assertTrue(selectElement.disabled);
98 assertTrue(!!page.$$('extension-controlled-indicator')); 98 assertTrue(!!page.$$('extension-controlled-indicator'));
99 }); 99 });
100 }); 100 });
101
102 // Tests the UI when Hotword 'alwaysOn' is true.
103 test('HotwordAlwaysOn', function() {
104 return browserProxy.whenCalled('getHotwordInfo').then(function() {
105 Polymer.dom.flush();
106 assertTrue(page.hotwordInfo_.allowed);
107 assertTrue(page.hotwordInfo_.alwaysOn);
108 assertFalse(page.hotwordInfo_.enabled);
109 assertFalse(browserProxy.hotwordSearchEnabled);
110 assertFalse(page.hotwordSearchEnablePref_.value);
111
112 var checkbox = page.$$('#hotwordSearchEnable');
113 assertTrue(!!checkbox);
114 assertFalse(checkbox.disabled);
115 assertFalse(checkbox.checked);
116 MockInteractions.tap(checkbox.$.checkbox);
117 Polymer.dom.flush();
118 return browserProxy.whenCalled('setHotwordSearchEnabled');
119 }).then(function() {
120 assertTrue(browserProxy.hotwordSearchEnabled);
121 });
122 });
123
124 // Tests the UI when Hotword 'alwaysOn' is false.
125 test('HotwordNotAlwaysOn', function() {
126 return browserProxy.whenCalled('getHotwordInfo').then(function() {
127 browserProxy.setHotwordInfo({
128 allowed: true,
129 enabled: false,
130 alwaysOn: false,
131 errorMessage: '',
132 userName: '',
133 historyEnabled: false,
134 });
135 Polymer.dom.flush();
136 assertTrue(page.hotwordInfo_.allowed);
137 assertFalse(page.hotwordInfo_.alwaysOn);
138 assertFalse(page.hotwordInfo_.enabled);
139
140 var checkbox = page.$$('#hotwordSearchEnable');
141 assertTrue(!!checkbox);
142 assertFalse(checkbox.disabled);
143 assertFalse(checkbox.checked);
144 MockInteractions.tap(checkbox.$.checkbox);
145 Polymer.dom.flush();
146 return browserProxy.whenCalled('setHotwordSearchEnabled');
147 }).then(function() {
148 assertTrue(browserProxy.hotwordSearchEnabled);
149 });
150 });
101 }); 151 });
102 } 152 }
103 153
104 return { 154 return {
105 registerTests: registerTests, 155 registerTests: registerTests,
106 }; 156 };
107 }); 157 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698