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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
44 sections.push('defaultBrowser'); | 44 sections.push('defaultBrowser'); |
45 else | 45 else |
46 sections = sections.concat(['internet', 'device']); | 46 sections = sections.concat(['internet', 'device']); |
47 | 47 |
48 for (var i = 0; i < sections.length; i++) { | 48 for (var i = 0; i < sections.length; i++) { |
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 | |
55 // This test checks for a regression that occurred with scrollToSection_ | |
56 // failing to find its host element. | |
57 test('scroll to section', function() { | |
58 // Setting the page and section will cause a scrollToSection_. | |
59 self.getPage('basic').currentRoute = { | |
60 page: 'basic', | |
61 section: 'onStartup', | |
62 subpage: [], | |
63 }; | |
64 | |
65 return new Promise(function(resolve, reject) { | |
66 function pollForVisibility() { | |
67 var page = self.getPage('basic') | |
68 var section = self.getSection(page, page.currentRoute.section); | |
69 if (!section) | |
70 setTimeout(pollForVisibility, 55); | |
71 else | |
72 resolve(); | |
73 } | |
74 pollForVisibility(); | |
Dan Beam
2016/05/31 22:10:29
arguably:
var intervalId = window.setInterval(fun
dschuyler
2016/05/31 22:25:02
Done.
| |
75 }.bind(self)); | |
76 }); | |
54 }); | 77 }); |
55 | 78 |
56 // Run all registered tests. | 79 // Run all registered tests. |
57 mocha.run(); | 80 mocha.run(); |
58 }); | 81 }); |
OLD | NEW |