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 suite('route', function() { | 5 suite('route', function() { |
6 /** | 6 /** |
7 * Returns a new promise that resolves after a window 'popstate' event. | 7 * Returns a new promise that resolves after a window 'popstate' event. |
8 * @return {!Promise} | 8 * @return {!Promise} |
9 */ | 9 */ |
10 function whenPopState(causeEvent) { | 10 function whenPopState(causeEvent) { |
11 var promise = new Promise(function(resolve) { | 11 var promise = new Promise(function(resolve) { |
12 window.addEventListener('popstate', function callback() { | 12 window.addEventListener('popstate', function callback() { |
13 window.removeEventListener('popstate', callback); | 13 window.removeEventListener('popstate', callback); |
14 resolve(); | 14 resolve(); |
15 }); | 15 }); |
16 }); | 16 }); |
17 | 17 |
18 causeEvent(); | 18 causeEvent(); |
19 return promise; | 19 return promise; |
20 } | 20 } |
21 | 21 |
| 22 teardown(function() { |
| 23 PolymerTest.clearBody(); |
| 24 }); |
| 25 |
22 /** | 26 /** |
23 * Tests a specific navigation situation. | 27 * Tests a specific navigation situation. |
24 * @param {!settings.Route} previousRoute | 28 * @param {!settings.Route} previousRoute |
25 * @param {!settings.Route} currentRoute | 29 * @param {!settings.Route} currentRoute |
26 * @param {!settings.Route} expectedNavigatePreviousResult | 30 * @param {!settings.Route} expectedNavigatePreviousResult |
27 * @return {!Promise} | 31 * @return {!Promise} |
28 */ | 32 */ |
29 function testNavigateBackUsesHistory(previousRoute, currentRoute, | 33 function testNavigateBackUsesHistory(previousRoute, currentRoute, |
30 expectedNavigatePreviousResult) { | 34 expectedNavigatePreviousResult) { |
31 settings.navigateTo(previousRoute); | 35 settings.navigateTo(previousRoute); |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 if (cr.isChromeOS) { | 181 if (cr.isChromeOS) { |
178 // Path with a dash. | 182 // Path with a dash. |
179 assertEquals( | 183 assertEquals( |
180 settings.Route.KEYBOARD, | 184 settings.Route.KEYBOARD, |
181 settings.getRouteForPath('/keyboard-overlay')); | 185 settings.getRouteForPath('/keyboard-overlay')); |
182 assertEquals( | 186 assertEquals( |
183 settings.Route.KEYBOARD, | 187 settings.Route.KEYBOARD, |
184 settings.getRouteForPath('/keyboard-overlay/')); | 188 settings.getRouteForPath('/keyboard-overlay/')); |
185 } | 189 } |
186 }); | 190 }); |
| 191 |
| 192 test('isNavigableDialog', function() { |
| 193 assertTrue(settings.Route.CLEAR_BROWSER_DATA.isNavigableDialog); |
| 194 assertTrue(settings.Route.IMPORT_DATA.isNavigableDialog); |
| 195 assertTrue(settings.Route.RESET_DIALOG.isNavigableDialog); |
| 196 assertTrue(settings.Route.SIGN_OUT.isNavigableDialog); |
| 197 assertTrue(settings.Route.TRIGGERED_RESET_DIALOG.isNavigableDialog); |
| 198 |
| 199 assertFalse(settings.Route.PRIVACY.isNavigableDialog); |
| 200 assertFalse(settings.Route.DEFAULT_BROWSER.isNavigableDialog); |
| 201 }); |
187 }); | 202 }); |
OLD | NEW |