| 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_startup_urls_page', function() { | 5 cr.define('settings_startup_urls_page', function() { |
| 6 /** | 6 /** |
| 7 * @constructor | 7 * @constructor |
| 8 * @implements {settings.StartupUrlsPageBrowserProxy} | 8 * @implements {settings.StartupUrlsPageBrowserProxy} |
| 9 * @extends {settings.TestBrowserProxy} | 9 * @extends {settings.TestBrowserProxy} |
| 10 */ | 10 */ |
| (...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 222 Polymer.dom.flush(); | 222 Polymer.dom.flush(); |
| 223 assertTrue(!!page.$$('settings-startup-url-dialog')); | 223 assertTrue(!!page.$$('settings-startup-url-dialog')); |
| 224 }); | 224 }); |
| 225 | 225 |
| 226 test('EditPage_OpensDialog', function() { | 226 test('EditPage_OpensDialog', function() { |
| 227 assertFalse(!!page.$$('settings-startup-url-dialog')); | 227 assertFalse(!!page.$$('settings-startup-url-dialog')); |
| 228 page.fire(settings.EDIT_STARTUP_URL_EVENT, createSampleUrlEntry()); | 228 page.fire(settings.EDIT_STARTUP_URL_EVENT, createSampleUrlEntry()); |
| 229 Polymer.dom.flush(); | 229 Polymer.dom.flush(); |
| 230 assertTrue(!!page.$$('settings-startup-url-dialog')); | 230 assertTrue(!!page.$$('settings-startup-url-dialog')); |
| 231 }); | 231 }); |
| 232 |
| 233 test('StartupPagesChanges_CloseOpenEditDialog', function() { |
| 234 var entry1 = { |
| 235 modelIndex: 2, |
| 236 title: 'Test page 1', |
| 237 tooltip: 'test tooltip', |
| 238 url: 'chrome://bar', |
| 239 }; |
| 240 |
| 241 var entry2 = { |
| 242 modelIndex: 2, |
| 243 title: 'Test page 2', |
| 244 tooltip: 'test tooltip', |
| 245 url: 'chrome://foo', |
| 246 }; |
| 247 |
| 248 cr.webUIListenerCallback('update-startup-pages', [entry1, entry2]); |
| 249 page.fire(settings.EDIT_STARTUP_URL_EVENT, entry2); |
| 250 Polymer.dom.flush(); |
| 251 |
| 252 assertTrue(!!page.$$('settings-startup-url-dialog')); |
| 253 cr.webUIListenerCallback('update-startup-pages', [entry1]); |
| 254 Polymer.dom.flush(); |
| 255 |
| 256 assertFalse(!!page.$$('settings-startup-url-dialog')); |
| 257 }); |
| 232 }); | 258 }); |
| 233 | 259 |
| 234 /** @return {!StartupPageInfo} */ | 260 /** @return {!StartupPageInfo} */ |
| 235 function createSampleUrlEntry() { | 261 function createSampleUrlEntry() { |
| 236 return { | 262 return { |
| 237 modelIndex: 2, | 263 modelIndex: 2, |
| 238 title: 'Test page', | 264 title: 'Test page', |
| 239 tooltip: 'test tooltip', | 265 tooltip: 'test tooltip', |
| 240 url: 'chrome://foo', | 266 url: 'chrome://foo', |
| 241 }; | 267 }; |
| (...skipping 25 matching lines...) Expand all Loading... |
| 267 test('MenuOptions_Remove', function() { | 293 test('MenuOptions_Remove', function() { |
| 268 var removeButton = element.shadowRoot.querySelector('#remove') | 294 var removeButton = element.shadowRoot.querySelector('#remove') |
| 269 MockInteractions.tap(removeButton); | 295 MockInteractions.tap(removeButton); |
| 270 return browserProxy.whenCalled('removeStartupPage').then( | 296 return browserProxy.whenCalled('removeStartupPage').then( |
| 271 function(modelIndex) { | 297 function(modelIndex) { |
| 272 assertEquals(element.model.modelIndex, modelIndex); | 298 assertEquals(element.model.modelIndex, modelIndex); |
| 273 }); | 299 }); |
| 274 }); | 300 }); |
| 275 }); | 301 }); |
| 276 }); | 302 }); |
| OLD | NEW |