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

Unified Diff: chrome/test/data/webui/settings/settings_subpage_test.js

Issue 2234093002: Settings Router Refactor: Update subpage-back button to use history back sometimes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix closure compile using typecast 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 side-by-side diff with in-line comments
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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/data/webui/settings/settings_subpage_test.js
diff --git a/chrome/test/data/webui/settings/settings_subpage_test.js b/chrome/test/data/webui/settings/settings_subpage_test.js
new file mode 100644
index 0000000000000000000000000000000000000000..ceb88fd39ae613ad841ca9ad32f82466143c262b
--- /dev/null
+++ b/chrome/test/data/webui/settings/settings_subpage_test.js
@@ -0,0 +1,47 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+cr.define('settings_subpage', function() {
+ function registerTests() {
+ suite('SettingsSubpage', function() {
+ test('can navigate to parent', function() {
+ PolymerTest.clearBody();
+
+ // Choose CERTIFICATES since it is not a descendant of BASIC.
+ settings.navigateTo(settings.Route.CERTIFICATES);
+ assertEquals(settings.Route.CERTIFICATES, settings.getCurrentRoute());
+
+ var subpage = document.createElement('settings-subpage');
+ document.body.appendChild(subpage);
+
+ MockInteractions.tap(subpage.$$('paper-icon-button'));
+ assertEquals(settings.Route.PRIVACY, settings.getCurrentRoute());
+ });
+
+ test('can navigate to grandparent using window.back()', function(done) {
+ PolymerTest.clearBody();
+
+ settings.navigateTo(settings.Route.BASIC);
+ settings.navigateTo(settings.Route.SYNC);
+ assertEquals(settings.Route.SYNC, settings.getCurrentRoute());
+
+ var subpage = document.createElement('settings-subpage');
+ document.body.appendChild(subpage);
+
+ MockInteractions.tap(subpage.$$('paper-icon-button'));
+
+ // Since the previous history entry is an ancestor, we expect
+ // window.history.back() to be called and a popstate event to be fired.
+ window.addEventListener('popstate', function(event) {
+ assertEquals(settings.Route.BASIC, settings.getCurrentRoute());
+ done();
+ });
+ });
+ });
+ }
+
+ return {
+ registerTests: registerTests,
+ };
+});
« 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