| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 /** @fileoverview Suite of tests for the Settings basic page. */ | 5 /** @fileoverview Suite of tests for the Settings basic page. */ |
| 6 | 6 |
| 7 GEN_INCLUDE(['settings_page_browsertest.js']); | 7 GEN_INCLUDE(['settings_page_browsertest.js']); |
| 8 | 8 |
| 9 /** | 9 /** |
| 10 * @constructor | 10 * @constructor |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 var section = self.getSection(page, sections[i]); | 49 var section = self.getSection(page, sections[i]); |
| 50 expectTrue(!!section); | 50 expectTrue(!!section); |
| 51 self.verifySubpagesHidden(section); | 51 self.verifySubpagesHidden(section); |
| 52 } | 52 } |
| 53 }); | 53 }); |
| 54 | 54 |
| 55 // This test checks for a regression that occurred with scrollToSection_ | 55 // This test checks for a regression that occurred with scrollToSection_ |
| 56 // failing to find its host element. | 56 // failing to find its host element. |
| 57 test('scroll to section', function() { | 57 test('scroll to section', function() { |
| 58 // Setting the page and section will cause a scrollToSection_. | 58 // Setting the page and section will cause a scrollToSection_. |
| 59 self.getPage('basic').currentRoute = { | 59 settings.navigateTo(settings.Route.ON_STARTUP); |
| 60 page: 'basic', | |
| 61 section: 'onStartup', | |
| 62 subpage: [], | |
| 63 }; | |
| 64 | 60 |
| 65 return new Promise(function(resolve, reject) { | 61 return new Promise(function(resolve, reject) { |
| 66 var intervalId = window.setInterval(function() { | 62 var intervalId = window.setInterval(function() { |
| 67 var page = self.getPage('basic'); | 63 var page = self.getPage('basic'); |
| 68 if (self.getSection(page, page.currentRoute.section)) { | 64 if (self.getSection(page, settings.getCurrentRoute().section)) { |
| 69 window.clearInterval(intervalId); | 65 window.clearInterval(intervalId); |
| 70 resolve(); | 66 resolve(); |
| 71 } | 67 } |
| 72 }, 55); | 68 }, 55); |
| 73 }.bind(self)); | 69 }.bind(self)); |
| 74 }); | 70 }); |
| 75 }); | 71 }); |
| 76 | 72 |
| 77 // Run all registered tests. | 73 // Run all registered tests. |
| 78 mocha.run(); | 74 mocha.run(); |
| 79 }); | 75 }); |
| OLD | NEW |