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

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

Issue 2141313002: Settings Router Refactor: Implement new Route class w/ test (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 months 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('routing', function() { 5 suite('routing', function() {
6 test('no duplicate routes', function() { 6 test('no duplicate routes', function() {
7 var urls = new Set(); 7 var urls = new Set();
8 document.createElement('settings-router').canonicalRoutes_.forEach( 8 document.createElement('settings-router').canonicalRoutes_.forEach(
9 function(route) { 9 function(route) {
10 assertFalse(urls.has(route.url), route.url); 10 assertFalse(urls.has(route.url), route.url);
11 urls.add(route.url); 11 urls.add(route.url);
12 }); 12 });
13 }); 13 });
14
15 test('new route tree structure', function() {
michaelpg 2016/07/13 05:53:40 these should be run separately, from a test that l
tommycli 2016/07/13 17:45:03 Done.
16 var BASIC = new settings.Route('/');
17 BASIC.page = 'basic';
18
19 var ADVANCED = new settings.Route('/advanced');
20 ADVANCED.page = 'advanced';
21
22 var PRIVACY = ADVANCED.createChild('/privacy');
23 PRIVACY.section = 'privacy';
24 assertEquals('advanced', PRIVACY.page);
25 assertFalse(PRIVACY.isDescendantOf(BASIC));
26 assertTrue(PRIVACY.isDescendantOf(ADVANCED));
27 assertFalse(PRIVACY.isDescendantOf(PRIVACY));
28
michaelpg 2016/07/13 05:53:39 assertFalse(ADVANCED.isDescendantOf(PRIVACY))?
tommycli 2016/07/13 17:45:03 Done.
29 var SITE_SETTINGS = PRIVACY.createChild('/siteSettings');
michaelpg 2016/07/13 05:53:40 we should test opt_subpageName. incidentally, site
tommycli 2016/07/13 17:45:03 Done. No it was just an oversight. In fact, testin
30 assertFalse(SITE_SETTINGS.dialog);
31 assertEquals('advanced', SITE_SETTINGS.page);
32 assertEquals('privacy', SITE_SETTINGS.section);
33 assertFalse(SITE_SETTINGS.isDescendantOf(BASIC));
34 assertTrue(SITE_SETTINGS.isDescendantOf(ADVANCED));
35 assertTrue(SITE_SETTINGS.isDescendantOf(PRIVACY));
36
37 var CLEAR_BROWSING_DATA = PRIVACY.createDialog('/clearBrowsingData');
38 assertTrue(CLEAR_BROWSING_DATA.dialog);
39 assertEquals('advanced', CLEAR_BROWSING_DATA.page);
40 assertEquals('privacy', CLEAR_BROWSING_DATA.section);
michaelpg 2016/07/13 05:53:40 may as well test isDescendantOf for dialogs too
tommycli 2016/07/13 17:45:04 Done.
41 });
14 }); 42 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698