Chromium Code Reviews| Index: chrome/test/data/webui/settings/search_page_test.js |
| diff --git a/chrome/test/data/webui/settings/search_page_test.js b/chrome/test/data/webui/settings/search_page_test.js |
| index 1e0b4a9917603c87c2964f4a369642256c500ad8..1b584bd38eb470a815a7790d5a37c3bf82fefa97 100644 |
| --- a/chrome/test/data/webui/settings/search_page_test.js |
| +++ b/chrome/test/data/webui/settings/search_page_test.js |
| @@ -73,6 +73,60 @@ cr.define('settings_search_page', function() { |
| }); |
| }); |
| }); |
| + |
| + // Tests the UI when Hotword 'alwaysOn' is true. |
| + test('HotwordAlwaysOn', function() { |
| + return browserProxy.whenCalled('getHotwordInfo').then(function() { |
| + Polymer.dom.flush(); |
| + assertTrue(page.hotwordInfo_.allowed); |
| + assertTrue(page.hotwordInfo_.alwaysOn); |
| + assertFalse(page.hotwordInfo_.enabled); |
| + assertFalse(browserProxy.hotwordSearchEnabled); |
| + assertFalse(page.hotwordSearchEnablePref_.value); |
| + |
| + var checkbox = page.$$('#hotwordSearchEnable'); |
| + assertTrue(!!checkbox); |
| + assertFalse(checkbox.checked); |
| + checkbox.checked = true; |
| + // TODO(stevenjb): Investigate why 'MockInteractions.tap(checkbox)' |
| + // does not fire a 'change' event. |
| + checkbox.dispatchEvent(new CustomEvent('change')); |
| + Polymer.dom.flush(); |
| + return browserProxy.whenCalled('setHotwordSearchEnabled'); |
| + }).then(function() { |
| + assertTrue(browserProxy.hotwordSearchEnabled); |
| + }); |
| + }); |
| + |
| + // Tests the UI when Hotword 'alwaysOn' is false. |
| + test('HotwordNotAlwaysOn', function() { |
| + return browserProxy.whenCalled('getHotwordInfo').then(function() { |
| + browserProxy.setHotwordInfo({ |
| + allowed: true, |
| + enabled: false, |
| + alwaysOn: false, |
| + errorMessage: '', |
| + userName: '', |
| + historyEnabled: false, |
| + }); |
| + Polymer.dom.flush(); |
| + assertTrue(page.hotwordInfo_.allowed); |
| + assertFalse(page.hotwordInfo_.alwaysOn); |
| + assertFalse(page.hotwordInfo_.enabled); |
| + |
| + var checkbox = page.$$('#hotwordSearchEnable'); |
| + assertTrue(!!checkbox); |
| + assertFalse(checkbox.checked); |
| + checkbox.checked = true; |
| + // TODO(stevenjb): Investigate why 'MockInteractions.tap(checkbox)' |
| + // does not fire a 'change' event. |
|
michaelpg
2016/11/27 22:25:37
o_O There are some mock events that fire async, bu
stevenjb
2016/11/28 20:53:37
Yes, the checkbox is enabled. I'm not sure how to
|
| + checkbox.dispatchEvent(new CustomEvent('change')); |
| + Polymer.dom.flush(); |
| + return browserProxy.whenCalled('setHotwordSearchEnabled'); |
| + }).then(function() { |
| + assertTrue(browserProxy.hotwordSearchEnabled); |
| + }); |
| + }); |
| }); |
| } |