Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(485)

Side by Side Diff: chrome/test/data/webui/settings/route_tests.js

Issue 2518763002: MD Settings: Allow trailing slashes in otherwise valid URLs. (Closed)
Patch Set: Beef up the regexp. Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 return whenPopState(function() { 150 return whenPopState(function() {
151 window.history.back(); 151 window.history.back();
152 }).then(function() { 152 }).then(function() {
153 assertEquals(settings.Route.BASIC, settings.getCurrentRoute()); 153 assertEquals(settings.Route.BASIC, settings.getCurrentRoute());
154 assertTrue(settings.lastRouteChangeWasPopstate()); 154 assertTrue(settings.lastRouteChangeWasPopstate());
155 155
156 settings.navigateTo(settings.Route.ADVANCED); 156 settings.navigateTo(settings.Route.ADVANCED);
157 assertFalse(settings.lastRouteChangeWasPopstate()); 157 assertFalse(settings.lastRouteChangeWasPopstate());
158 }); 158 });
159 }); 159 });
160
161 test('getRouteForPath trailing slashes', function() {
162 assertEquals(settings.Route.BASIC, settings.getRouteForPath('/'));
163 assertEquals(null, settings.getRouteForPath('//'));
164
165 // Simple path.
166 assertEquals(settings.Route.PEOPLE, settings.getRouteForPath('/people/'));
167 assertEquals(settings.Route.PEOPLE, settings.getRouteForPath('/people'));
168
169 // Path with a slash.
170 assertEquals(
171 settings.Route.SITE_SETTINGS_COOKIES,
172 settings.getRouteForPath('/content/cookies/'));
173
174 if (cr.isChromeOS) {
175 // Path with a dash.
176 assertEquals(
177 settings.Route.KEYBOARD,
178 settings.getRouteForPath('/keyboard-overlay/'));
179 }
180 });
160 }); 181 });
OLDNEW
« chrome/browser/resources/settings/route.js ('K') | « chrome/browser/resources/settings/route.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698