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

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

Issue 2206613003: Settings Router Refactor: Support dynamic parameters (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@223-settings-router-handle-random-urls-better
Patch Set: fix Created 4 years, 4 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 /** @fileoverview Runs the Polymer Settings tests. */ 5 /** @fileoverview Runs the Polymer Settings tests. */
6 6
7 /** @const {string} Path to source root. */ 7 /** @const {string} Path to source root. */
8 var ROOT_PATH = '../../../../../'; 8 var ROOT_PATH = '../../../../../';
9 9
10 // Polymer BrowserTest fixture. 10 // Polymer BrowserTest fixture.
(...skipping 664 matching lines...) Expand 10 before | Expand all | Expand 10 after
675 675
676 TEST_F('CrSettingsNonExistentRouteTest', 'All', function() { 676 TEST_F('CrSettingsNonExistentRouteTest', 'All', function() {
677 suite('NonExistentRoutes', function() { 677 suite('NonExistentRoutes', function() {
678 test('redirect to basic', function() { 678 test('redirect to basic', function() {
679 assertEquals(settings.Route.BASIC, settings.getCurrentRoute()); 679 assertEquals(settings.Route.BASIC, settings.getCurrentRoute());
680 assertEquals('/', location.pathname); 680 assertEquals('/', location.pathname);
681 }); 681 });
682 }); 682 });
683 mocha.run(); 683 mocha.run();
684 }); 684 });
685
686 /**
687 * @constructor
688 * @extends {SettingsPageBrowserTest}
689 */
690 function CrSettingsRouteDynamicParametersTest() {}
691
692 CrSettingsRouteDynamicParametersTest.prototype = {
693 __proto__: CrSettingsBrowserTest.prototype,
694
695 /** @override */
696 browsePreload: 'chrome://md-settings/internet?guid=a%2Fb&foo=42',
697 };
698
699 TEST_F('CrSettingsRouteDynamicParametersTest', 'All', function() {
700 suite('DynamicParameters', function() {
701 test('get parameters from URL and navigation', function(done) {
702 assertEquals(settings.Route.INTERNET, settings.getCurrentRoute());
703 assertDeepEquals({guid: 'a/b', foo: '42'}, settings.getQueryParameters());
704
705 settings.navigateTo(settings.Route.SYNC, {bar: 'b=z', biz: '3'});
706 assertEquals(settings.Route.SYNC, settings.getCurrentRoute());
707 assertDeepEquals({bar: 'b=z', biz: '3'}, settings.getQueryParameters());
708 assertEquals('?bar=b%3Dz&biz=3', window.location.search);
709
710 window.addEventListener('popstate', function(event) {
711 assertEquals('/internet', settings.getCurrentRoute().path);
712 assertEquals(settings.Route.INTERNET, settings.getCurrentRoute());
713 assertDeepEquals(
714 {guid: 'a/b', foo: '42'}, settings.getQueryParameters());
715 done();
716 });
717 window.history.back();
718 });
719 });
720 mocha.run();
721 });
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