| 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 * A test version of SearchEnginesBrowserProxy. Provides helper methods | 7 * A test version of SearchEnginesBrowserProxy. Provides helper methods |
| 8 * for allowing tests to know when a method was called, as well as | 8 * for allowing tests to know when a method was called, as well as |
| 9 * specifying mock responses. | 9 * specifying mock responses. |
| 10 * | 10 * |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 document.body.appendChild(dialog); | 165 document.body.appendChild(dialog); |
| 166 }); | 166 }); |
| 167 | 167 |
| 168 teardown(function() { dialog.remove(); }); | 168 teardown(function() { dialog.remove(); }); |
| 169 | 169 |
| 170 // Tests that the dialog calls 'searchEngineEditStarted' and | 170 // Tests that the dialog calls 'searchEngineEditStarted' and |
| 171 // 'searchEngineEditCancelled' when closed from the 'x' button. | 171 // 'searchEngineEditCancelled' when closed from the 'x' button. |
| 172 test('DialogOpenAndClose', function() { | 172 test('DialogOpenAndClose', function() { |
| 173 return browserProxy.whenCalled('searchEngineEditStarted').then( | 173 return browserProxy.whenCalled('searchEngineEditStarted').then( |
| 174 function() { | 174 function() { |
| 175 MockInteractions.tap(dialog.$.close); | 175 MockInteractions.tap(dialog.$.dialog.getCloseButton()); |
| 176 return browserProxy.whenCalled('searchEngineEditCancelled'); | 176 return browserProxy.whenCalled('searchEngineEditCancelled'); |
| 177 }); | 177 }); |
| 178 }); | 178 }); |
| 179 | 179 |
| 180 // Tests that the dialog calls 'searchEngineEditStarted' and | 180 // Tests that the dialog calls 'searchEngineEditStarted' and |
| 181 // 'searchEngineEditCancelled' when closed from the 'cancel' button. | 181 // 'searchEngineEditCancelled' when closed from the 'cancel' button. |
| 182 test('DialogOpenAndCancel', function() { | 182 test('DialogOpenAndCancel', function() { |
| 183 return browserProxy.whenCalled('searchEngineEditStarted').then( | 183 return browserProxy.whenCalled('searchEngineEditStarted').then( |
| 184 function() { | 184 function() { |
| 185 MockInteractions.tap(dialog.$.cancel); | 185 MockInteractions.tap(dialog.$.cancel); |
| (...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 438 } | 438 } |
| 439 | 439 |
| 440 | 440 |
| 441 return { | 441 return { |
| 442 registerDialogTests: registerDialogTests, | 442 registerDialogTests: registerDialogTests, |
| 443 registerSearchEngineEntryTests: registerSearchEngineEntryTests, | 443 registerSearchEngineEntryTests: registerSearchEngineEntryTests, |
| 444 registerOmniboxExtensionEntryTests: registerOmniboxExtensionEntryTests, | 444 registerOmniboxExtensionEntryTests: registerOmniboxExtensionEntryTests, |
| 445 registerPageTests: registerPageTests, | 445 registerPageTests: registerPageTests, |
| 446 }; | 446 }; |
| 447 }); | 447 }); |
| OLD | NEW |