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

Side by Side Diff: chrome/test/data/webui/settings/route_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: merge 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
« no previous file with comments | « chrome/test/data/webui/settings/cr_settings_browsertest.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
(Empty)
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
3 // found in the LICENSE file.
4
5 suite('route', function() {
6 test('tree structure', function() {
7 // Set up root page routes.
8 var BASIC = new settings.Route('/');
9 BASIC.page = 'basic';
10 var ADVANCED = new settings.Route('/advanced');
11 ADVANCED.page = 'advanced';
12 assertDeepEquals([], ADVANCED.subpage);
13
14 // Test a section route.
15 var PRIVACY = ADVANCED.createChild('/privacy');
16 PRIVACY.section = 'privacy';
17 assertEquals('advanced', PRIVACY.page);
18 assertDeepEquals([], PRIVACY.subpage);
19 assertFalse(PRIVACY.isDescendantOf(BASIC));
20 assertTrue(PRIVACY.isDescendantOf(ADVANCED));
21 assertFalse(PRIVACY.isDescendantOf(PRIVACY));
22 assertFalse(ADVANCED.isDescendantOf(PRIVACY));
23
24 // Test a subpage route.
25 var SITE_SETTINGS = PRIVACY.createChild('/siteSettings', 'site-settings');
26 assertFalse(SITE_SETTINGS.dialog);
27 assertDeepEquals(['site-settings'], SITE_SETTINGS.subpage);
28 assertEquals('advanced', SITE_SETTINGS.page);
29 assertEquals('privacy', SITE_SETTINGS.section);
30 assertFalse(SITE_SETTINGS.isDescendantOf(BASIC));
31 assertTrue(SITE_SETTINGS.isDescendantOf(ADVANCED));
32 assertTrue(SITE_SETTINGS.isDescendantOf(PRIVACY));
33
34 // Test a sub-subpage route.
35 var SITE_SETTINGS_ALL =
36 SITE_SETTINGS.createChild('/siteSettings/all', 'all-sites');
37 assertDeepEquals(['site-settings', 'all-sites'], SITE_SETTINGS_ALL.subpage);
38
39 // Test a dialog route.
40 var CLEAR_BROWSING_DATA = PRIVACY.createDialog('/clearBrowsingData');
41 assertTrue(CLEAR_BROWSING_DATA.dialog);
42 assertEquals('privacy', CLEAR_BROWSING_DATA.section);
43 assertEquals('advanced', CLEAR_BROWSING_DATA.page);
44 assertEquals('privacy', CLEAR_BROWSING_DATA.section);
45 assertFalse(CLEAR_BROWSING_DATA.isDescendantOf(BASIC));
46 assertTrue(CLEAR_BROWSING_DATA.isDescendantOf(ADVANCED));
47 assertTrue(CLEAR_BROWSING_DATA.isDescendantOf(PRIVACY));
48 });
49 });
OLDNEW
« no previous file with comments | « chrome/test/data/webui/settings/cr_settings_browsertest.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698