| 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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 Polymer.dom.flush(); | 66 Polymer.dom.flush(); |
| 67 assertEquals(2, selectElement.selectedIndex); | 67 assertEquals(2, selectElement.selectedIndex); |
| 68 | 68 |
| 69 browserProxy.whenCalled('setDefaultSearchEngine').then(function() { | 69 browserProxy.whenCalled('setDefaultSearchEngine').then(function() { |
| 70 // Since the change happened in a different tab, there should be no | 70 // Since the change happened in a different tab, there should be no |
| 71 // new call to |setDefaultSearchEngine|. | 71 // new call to |setDefaultSearchEngine|. |
| 72 assertNotReached('Should not call setDefaultSearchEngine again'); | 72 assertNotReached('Should not call setDefaultSearchEngine again'); |
| 73 }); | 73 }); |
| 74 }); | 74 }); |
| 75 }); | 75 }); |
| 76 |
| 77 test('ControlledByExtension', function() { |
| 78 return browserProxy.whenCalled('getSearchEnginesList').then(function() { |
| 79 var selectElement = page.$$('select'); |
| 80 assertFalse(selectElement.disabled); |
| 81 assertFalse(!!page.$$('extension-controlled-indicator')); |
| 82 |
| 83 page.prefs = { |
| 84 default_search_provider: { |
| 85 enabled: { |
| 86 controlledBy: chrome.settingsPrivate.ControlledBy.EXTENSION, |
| 87 controlledByName: 'fake extension name', |
| 88 enforcement: chrome.settingsPrivate.Enforcement.ENFORCED, |
| 89 extensionId: 'fake extension id', |
| 90 extensionCanBeDisabled: true, |
| 91 value: true, |
| 92 }, |
| 93 }, |
| 94 }; |
| 95 Polymer.dom.flush(); |
| 96 |
| 97 assertTrue(selectElement.disabled); |
| 98 assertTrue(!!page.$$('extension-controlled-indicator')); |
| 99 }); |
| 100 }); |
| 76 }); | 101 }); |
| 77 } | 102 } |
| 78 | 103 |
| 79 return { | 104 return { |
| 80 registerTests: registerTests, | 105 registerTests: registerTests, |
| 81 }; | 106 }; |
| 82 }); | 107 }); |
| OLD | NEW |