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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: chrome/test/data/webui/settings/router_tests.js
diff --git a/chrome/test/data/webui/settings/router_tests.js b/chrome/test/data/webui/settings/router_tests.js
index d9529251c6222a46a20507e5ad6511725667f18f..b6c1f22ff6918517121985f9ca96161ab969a1c2 100644
--- a/chrome/test/data/webui/settings/router_tests.js
+++ b/chrome/test/data/webui/settings/router_tests.js
@@ -11,4 +11,32 @@ suite('routing', function() {
urls.add(route.url);
});
});
+
+ 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.
+ var BASIC = new settings.Route('/');
+ BASIC.page = 'basic';
+
+ var ADVANCED = new settings.Route('/advanced');
+ ADVANCED.page = 'advanced';
+
+ var PRIVACY = ADVANCED.createChild('/privacy');
+ PRIVACY.section = 'privacy';
+ assertEquals('advanced', PRIVACY.page);
+ assertFalse(PRIVACY.isDescendantOf(BASIC));
+ assertTrue(PRIVACY.isDescendantOf(ADVANCED));
+ assertFalse(PRIVACY.isDescendantOf(PRIVACY));
+
michaelpg 2016/07/13 05:53:39 assertFalse(ADVANCED.isDescendantOf(PRIVACY))?
tommycli 2016/07/13 17:45:03 Done.
+ 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
+ assertFalse(SITE_SETTINGS.dialog);
+ assertEquals('advanced', SITE_SETTINGS.page);
+ assertEquals('privacy', SITE_SETTINGS.section);
+ assertFalse(SITE_SETTINGS.isDescendantOf(BASIC));
+ assertTrue(SITE_SETTINGS.isDescendantOf(ADVANCED));
+ assertTrue(SITE_SETTINGS.isDescendantOf(PRIVACY));
+
+ var CLEAR_BROWSING_DATA = PRIVACY.createDialog('/clearBrowsingData');
+ assertTrue(CLEAR_BROWSING_DATA.dialog);
+ assertEquals('advanced', CLEAR_BROWSING_DATA.page);
+ 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.
+ });
});

Powered by Google App Engine
This is Rietveld 408576698