Chromium Code Reviews| 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) { |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 99 return testNavigateBackUsesHistory( | 99 return testNavigateBackUsesHistory( |
| 100 settings.Route.BASIC, | 100 settings.Route.BASIC, |
| 101 settings.Route.PEOPLE, | 101 settings.Route.PEOPLE, |
| 102 settings.Route.BASIC); | 102 settings.Route.BASIC); |
| 103 }); | 103 }); |
| 104 | 104 |
| 105 test('navigate back to non-ancestor shallower route', function() { | 105 test('navigate back to non-ancestor shallower route', function() { |
| 106 return testNavigateBackUsesHistory( | 106 return testNavigateBackUsesHistory( |
| 107 settings.Route.ADVANCED, | 107 settings.Route.ADVANCED, |
| 108 settings.Route.PEOPLE, | 108 settings.Route.PEOPLE, |
| 109 settings.Route.ADVANCED); | 109 settings.Route.BASIC); |
|
dpapad
2017/03/22 20:18:11
I had to update this test too, since it assumed th
| |
| 110 }); | 110 }); |
| 111 | 111 |
| 112 test('navigate back to sibling route', function() { | 112 test('navigate back to sibling route', function() { |
| 113 return testNavigateBackUsesHistory( | 113 return testNavigateBackUsesHistory( |
| 114 settings.Route.APPEARANCE, | 114 settings.Route.APPEARANCE, |
| 115 settings.Route.PEOPLE, | 115 settings.Route.PEOPLE, |
| 116 settings.Route.APPEARANCE); | 116 settings.Route.APPEARANCE); |
| 117 }); | 117 }); |
| 118 | 118 |
| 119 test('navigate back to parent when previous route is deeper', function() { | 119 test('navigate back to parent when previous route is deeper', function() { |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 137 | 137 |
| 138 settings.navigateTo( | 138 settings.navigateTo( |
| 139 settings.Route.SITE_SETTINGS, null, /* removeSearch */ false); | 139 settings.Route.SITE_SETTINGS, null, /* removeSearch */ false); |
| 140 assertEquals(params.toString(), settings.getQueryParameters().toString()); | 140 assertEquals(params.toString(), settings.getQueryParameters().toString()); |
| 141 | 141 |
| 142 settings.navigateTo( | 142 settings.navigateTo( |
| 143 settings.Route.SEARCH_ENGINES, null, /* removeSearch */ true); | 143 settings.Route.SEARCH_ENGINES, null, /* removeSearch */ true); |
| 144 assertEquals('', settings.getQueryParameters().toString()); | 144 assertEquals('', settings.getQueryParameters().toString()); |
| 145 }); | 145 }); |
| 146 | 146 |
| 147 test('navigateTo ADVANCED forwards to BASIC', function() { | |
| 148 settings.navigateTo(settings.Route.ADVANCED); | |
| 149 assertEquals(settings.Route.BASIC, settings.getCurrentRoute()); | |
| 150 }); | |
| 151 | |
| 147 test('popstate flag works', function() { | 152 test('popstate flag works', function() { |
| 148 settings.navigateTo(settings.Route.BASIC); | 153 settings.navigateTo(settings.Route.BASIC); |
| 149 assertFalse(settings.lastRouteChangeWasPopstate()); | 154 assertFalse(settings.lastRouteChangeWasPopstate()); |
| 150 | 155 |
| 151 settings.navigateTo(settings.Route.PEOPLE); | 156 settings.navigateTo(settings.Route.PEOPLE); |
| 152 assertFalse(settings.lastRouteChangeWasPopstate()); | 157 assertFalse(settings.lastRouteChangeWasPopstate()); |
| 153 | 158 |
| 154 return whenPopState(function() { | 159 return whenPopState(function() { |
| 155 window.history.back(); | 160 window.history.back(); |
| 156 }).then(function() { | 161 }).then(function() { |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 193 assertTrue(settings.Route.CLEAR_BROWSER_DATA.isNavigableDialog); | 198 assertTrue(settings.Route.CLEAR_BROWSER_DATA.isNavigableDialog); |
| 194 assertTrue(settings.Route.IMPORT_DATA.isNavigableDialog); | 199 assertTrue(settings.Route.IMPORT_DATA.isNavigableDialog); |
| 195 assertTrue(settings.Route.RESET_DIALOG.isNavigableDialog); | 200 assertTrue(settings.Route.RESET_DIALOG.isNavigableDialog); |
| 196 assertTrue(settings.Route.SIGN_OUT.isNavigableDialog); | 201 assertTrue(settings.Route.SIGN_OUT.isNavigableDialog); |
| 197 assertTrue(settings.Route.TRIGGERED_RESET_DIALOG.isNavigableDialog); | 202 assertTrue(settings.Route.TRIGGERED_RESET_DIALOG.isNavigableDialog); |
| 198 | 203 |
| 199 assertFalse(settings.Route.PRIVACY.isNavigableDialog); | 204 assertFalse(settings.Route.PRIVACY.isNavigableDialog); |
| 200 assertFalse(settings.Route.DEFAULT_BROWSER.isNavigableDialog); | 205 assertFalse(settings.Route.DEFAULT_BROWSER.isNavigableDialog); |
| 201 }); | 206 }); |
| 202 }); | 207 }); |
| OLD | NEW |