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

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: Nit per Tommy's comment. 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
« no previous file with comments | « chrome/browser/resources/settings/route.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 assertEquals(
174 settings.Route.SITE_SETTINGS_COOKIES,
175 settings.getRouteForPath('/content/cookies/'));
176
177 if (cr.isChromeOS) {
178 // Path with a dash.
179 assertEquals(
180 settings.Route.KEYBOARD,
181 settings.getRouteForPath('/keyboard-overlay'));
182 assertEquals(
183 settings.Route.KEYBOARD,
184 settings.getRouteForPath('/keyboard-overlay/'));
185 }
186 });
160 }); 187 });
OLDNEW
« no previous file with comments | « chrome/browser/resources/settings/route.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698