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 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 144 assertEquals('', settings.getQueryParameters().toString()); | 144 assertEquals('', settings.getQueryParameters().toString()); |
| 145 }); | 145 }); |
| 146 | 146 |
| 147 test('navigateTo ADVANCED forwards to BASIC', function() { | 147 test('navigateTo ADVANCED forwards to BASIC', function() { |
| 148 settings.navigateTo(settings.Route.ADVANCED); | 148 settings.navigateTo(settings.Route.ADVANCED); |
| 149 assertEquals(settings.Route.BASIC, settings.getCurrentRoute()); | 149 assertEquals(settings.Route.BASIC, settings.getCurrentRoute()); |
| 150 }); | 150 }); |
| 151 | 151 |
| 152 test('popstate flag works', function() { | 152 test('popstate flag works', function() { |
| 153 settings.navigateTo(settings.Route.BASIC); | 153 settings.navigateTo(settings.Route.BASIC); |
| 154 assertFalse(settings.lastRouteChangeWasPopstate()); | 154 assertFalse(settings.wasLastRouteChangePopstate()); |
|
dpapad
2017/05/27 01:29:51
This file should be reverted too, since this funct
dschuyler
2017/05/27 01:35:36
Thanks for catching this!
| |
| 155 | 155 |
| 156 settings.navigateTo(settings.Route.PEOPLE); | 156 settings.navigateTo(settings.Route.PEOPLE); |
| 157 assertFalse(settings.lastRouteChangeWasPopstate()); | 157 assertFalse(settings.wasLastRouteChangePopstate()); |
| 158 | 158 |
| 159 return whenPopState(function() { | 159 return whenPopState(function() { |
| 160 window.history.back(); | 160 window.history.back(); |
| 161 }).then(function() { | 161 }).then(function() { |
| 162 assertEquals(settings.Route.BASIC, settings.getCurrentRoute()); | 162 assertEquals(settings.Route.BASIC, settings.getCurrentRoute()); |
| 163 assertTrue(settings.lastRouteChangeWasPopstate()); | 163 assertTrue(settings.wasLastRouteChangePopstate()); |
| 164 | 164 |
| 165 settings.navigateTo(settings.Route.ADVANCED); | 165 settings.navigateTo(settings.Route.ADVANCED); |
| 166 assertFalse(settings.lastRouteChangeWasPopstate()); | 166 assertFalse(settings.wasLastRouteChangePopstate()); |
| 167 }); | 167 }); |
| 168 }); | 168 }); |
| 169 | 169 |
| 170 test('getRouteForPath trailing slashes', function() { | 170 test('getRouteForPath trailing slashes', function() { |
| 171 assertEquals(settings.Route.BASIC, settings.getRouteForPath('/')); | 171 assertEquals(settings.Route.BASIC, settings.getRouteForPath('/')); |
| 172 assertEquals(null, settings.getRouteForPath('//')); | 172 assertEquals(null, settings.getRouteForPath('//')); |
| 173 | 173 |
| 174 // Simple path. | 174 // Simple path. |
| 175 assertEquals(settings.Route.PEOPLE, settings.getRouteForPath('/people/')); | 175 assertEquals(settings.Route.PEOPLE, settings.getRouteForPath('/people/')); |
| 176 assertEquals(settings.Route.PEOPLE, settings.getRouteForPath('/people')); | 176 assertEquals(settings.Route.PEOPLE, settings.getRouteForPath('/people')); |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 198 assertTrue(settings.Route.CLEAR_BROWSER_DATA.isNavigableDialog); | 198 assertTrue(settings.Route.CLEAR_BROWSER_DATA.isNavigableDialog); |
| 199 assertTrue(settings.Route.IMPORT_DATA.isNavigableDialog); | 199 assertTrue(settings.Route.IMPORT_DATA.isNavigableDialog); |
| 200 assertTrue(settings.Route.RESET_DIALOG.isNavigableDialog); | 200 assertTrue(settings.Route.RESET_DIALOG.isNavigableDialog); |
| 201 assertTrue(settings.Route.SIGN_OUT.isNavigableDialog); | 201 assertTrue(settings.Route.SIGN_OUT.isNavigableDialog); |
| 202 assertTrue(settings.Route.TRIGGERED_RESET_DIALOG.isNavigableDialog); | 202 assertTrue(settings.Route.TRIGGERED_RESET_DIALOG.isNavigableDialog); |
| 203 | 203 |
| 204 assertFalse(settings.Route.PRIVACY.isNavigableDialog); | 204 assertFalse(settings.Route.PRIVACY.isNavigableDialog); |
| 205 assertFalse(settings.Route.DEFAULT_BROWSER.isNavigableDialog); | 205 assertFalse(settings.Route.DEFAULT_BROWSER.isNavigableDialog); |
| 206 }); | 206 }); |
| 207 }); | 207 }); |
| OLD | NEW |