| 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_engines_page', function() { | 5 cr.define('settings_search_engines_page', function() { |
| 6 /** | 6 /** |
| 7 * @param {boolean} canBeDefault | 7 * @param {boolean} canBeDefault |
| 8 * @param {boolean} canBeEdited | 8 * @param {boolean} canBeEdited |
| 9 * @param {boolean} canBeRemoved | 9 * @param {boolean} canBeRemoved |
| 10 * @return {!SearchEngine} | 10 * @return {!SearchEngine} |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 assertTrue(!!deleteButton); | 180 assertTrue(!!deleteButton); |
| 181 assertFalse(deleteButton.hidden); | 181 assertFalse(deleteButton.hidden); |
| 182 MockInteractions.tap(deleteButton); | 182 MockInteractions.tap(deleteButton); |
| 183 return browserProxy.whenCalled('removeSearchEngine').then( | 183 return browserProxy.whenCalled('removeSearchEngine').then( |
| 184 function(modelIndex) { | 184 function(modelIndex) { |
| 185 assertEquals(entry.engine.modelIndex, modelIndex); | 185 assertEquals(entry.engine.modelIndex, modelIndex); |
| 186 }); | 186 }); |
| 187 }); | 187 }); |
| 188 | 188 |
| 189 test('MakeDefault_Enabled', function() { | 189 test('MakeDefault_Enabled', function() { |
| 190 // Open action menu. |
| 191 MockInteractions.tap(entry.$$('paper-icon-button')); |
| 192 |
| 190 var makeDefaultButton = entry.$.makeDefault; | 193 var makeDefaultButton = entry.$.makeDefault; |
| 191 assertTrue(!!makeDefaultButton); | 194 assertTrue(!!makeDefaultButton); |
| 192 MockInteractions.tap(makeDefaultButton); | 195 MockInteractions.tap(makeDefaultButton); |
| 193 return browserProxy.whenCalled('setDefaultSearchEngine').then( | 196 return browserProxy.whenCalled('setDefaultSearchEngine').then( |
| 194 function(modelIndex) { | 197 function(modelIndex) { |
| 195 assertEquals(entry.engine.modelIndex, modelIndex); | 198 assertEquals(entry.engine.modelIndex, modelIndex); |
| 196 }); | 199 }); |
| 197 }); | 200 }); |
| 198 | 201 |
| 199 // Test that clicking the "edit" button brings up a dialog. | 202 // Test that clicking the "edit" button brings up a dialog. |
| 200 test('Edit_Enabled', function() { | 203 test('Edit_Enabled', function() { |
| 204 // Open action menu. |
| 205 MockInteractions.tap(entry.$$('paper-icon-button')); |
| 206 |
| 201 var engine = entry.engine; | 207 var engine = entry.engine; |
| 202 var editButton = entry.$.edit; | 208 var editButton = entry.$.edit; |
| 203 assertTrue(!!editButton); | 209 assertTrue(!!editButton); |
| 204 assertFalse(editButton.hidden); | 210 assertFalse(editButton.hidden); |
| 205 MockInteractions.tap(editButton); | 211 MockInteractions.tap(editButton); |
| 206 return browserProxy.whenCalled('searchEngineEditStarted').then( | 212 return browserProxy.whenCalled('searchEngineEditStarted').then( |
| 207 function(modelIndex) { | 213 function(modelIndex) { |
| 208 assertEquals(engine.modelIndex, modelIndex); | 214 assertEquals(engine.modelIndex, modelIndex); |
| 209 var dialog = entry.$$('settings-search-engine-dialog'); | 215 var dialog = entry.$$('settings-search-engine-dialog'); |
| 210 assertTrue(!!dialog); | 216 assertTrue(!!dialog); |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 358 | 364 |
| 359 return { | 365 return { |
| 360 registerTests: function() { | 366 registerTests: function() { |
| 361 registerDialogTests(); | 367 registerDialogTests(); |
| 362 registerSearchEngineEntryTests(); | 368 registerSearchEngineEntryTests(); |
| 363 registerOmniboxExtensionEntryTests(); | 369 registerOmniboxExtensionEntryTests(); |
| 364 registerPageTests(); | 370 registerPageTests(); |
| 365 }, | 371 }, |
| 366 }; | 372 }; |
| 367 }); | 373 }); |
| OLD | NEW |