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

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: Don't use Internet as test route. That's CrOS only. 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
« 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 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/people?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.PEOPLE, settings.getCurrentRoute());
703 assertEquals('a/b', settings.getQueryParameters().get('guid'));
704 assertEquals('42', settings.getQueryParameters().get('foo'));
705
706 var params = new URLSearchParams();
707 params.set('bar', 'b=z');
708 params.set('biz', '3');
709 settings.navigateTo(settings.Route.SYNC, params);
710 assertEquals(settings.Route.SYNC, settings.getCurrentRoute());
711 assertEquals('b=z', settings.getQueryParameters().get('bar'));
712 assertEquals('3', settings.getQueryParameters().get('biz'));
713 assertEquals('?bar=b%3Dz&biz=3', window.location.search);
714
715 window.addEventListener('popstate', function(event) {
716 assertEquals('/people', settings.getCurrentRoute().path);
717 assertEquals(settings.Route.PEOPLE, settings.getCurrentRoute());
718 assertEquals('a/b', settings.getQueryParameters().get('guid'));
719 assertEquals('42', settings.getQueryParameters().get('foo'));
720 done();
721 });
722 window.history.back();
723 });
724 });
725 mocha.run();
726 });
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