| OLD | NEW |
| 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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 | 101 |
| 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('getSearchEnginesList').then(function() { |
| 105 return browserProxy.whenCalled('getHotwordInfo'); |
| 106 }).then(function() { |
| 105 Polymer.dom.flush(); | 107 Polymer.dom.flush(); |
| 106 assertTrue(page.hotwordInfo_.allowed); | 108 assertTrue(page.hotwordInfo_.allowed); |
| 107 assertTrue(page.hotwordInfo_.alwaysOn); | 109 assertTrue(page.hotwordInfo_.alwaysOn); |
| 108 assertFalse(page.hotwordInfo_.enabled); | 110 assertFalse(page.hotwordInfo_.enabled); |
| 109 assertFalse(browserProxy.hotwordSearchEnabled); | 111 assertFalse(browserProxy.hotwordSearchEnabled); |
| 110 assertFalse(page.hotwordSearchEnablePref_.value); | 112 assertFalse(page.hotwordSearchEnablePref_.value); |
| 111 | 113 |
| 112 var control = page.$$('#hotwordSearchEnable'); | 114 var control = page.$$('#hotwordSearchEnable'); |
| 113 assertTrue(!!control); | 115 assertTrue(!!control); |
| 114 assertFalse(control.disabled); | 116 assertFalse(control.disabled); |
| 115 assertFalse(control.checked); | 117 assertFalse(control.checked); |
| 116 MockInteractions.tap(control.$.control); | 118 MockInteractions.tap(control.$.control); |
| 117 Polymer.dom.flush(); | 119 Polymer.dom.flush(); |
| 118 return browserProxy.whenCalled('setHotwordSearchEnabled'); | 120 return browserProxy.whenCalled('setHotwordSearchEnabled'); |
| 119 }).then(function() { | 121 }).then(function() { |
| 120 assertTrue(browserProxy.hotwordSearchEnabled); | 122 assertTrue(browserProxy.hotwordSearchEnabled); |
| 121 }); | 123 }); |
| 122 }); | 124 }); |
| 123 | 125 |
| 124 // Tests the UI when Hotword 'alwaysOn' is false. | 126 // Tests the UI when Hotword 'alwaysOn' is false. |
| 125 test('HotwordNotAlwaysOn', function() { | 127 test('HotwordNotAlwaysOn', function() { |
| 126 return browserProxy.whenCalled('getHotwordInfo').then(function() { | 128 return browserProxy.whenCalled('getSearchEnginesList').then(function() { |
| 129 return browserProxy.whenCalled('getHotwordInfo'); |
| 130 }).then(function() { |
| 127 browserProxy.setHotwordInfo({ | 131 browserProxy.setHotwordInfo({ |
| 128 allowed: true, | 132 allowed: true, |
| 129 enabled: false, | 133 enabled: false, |
| 130 alwaysOn: false, | 134 alwaysOn: false, |
| 131 errorMessage: '', | 135 errorMessage: '', |
| 132 userName: '', | 136 userName: '', |
| 133 historyEnabled: false, | 137 historyEnabled: false, |
| 134 }); | 138 }); |
| 135 Polymer.dom.flush(); | 139 Polymer.dom.flush(); |
| 136 assertTrue(page.hotwordInfo_.allowed); | 140 assertTrue(page.hotwordInfo_.allowed); |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 assertTrue(control.checked); | 177 assertTrue(control.checked); |
| 174 }); | 178 }); |
| 175 }); | 179 }); |
| 176 }); | 180 }); |
| 177 } | 181 } |
| 178 | 182 |
| 179 return { | 183 return { |
| 180 registerTests: registerTests, | 184 registerTests: registerTests, |
| 181 }; | 185 }; |
| 182 }); | 186 }); |
| OLD | NEW |