Index: chrome/test/data/webui/md_history/history_routing_test.js |
diff --git a/chrome/test/data/webui/md_history/history_routing_test.js b/chrome/test/data/webui/md_history/history_routing_test.js |
new file mode 100644 |
index 0000000000000000000000000000000000000000..e8aa984451d5bdb2515d84a25b6b72e2c673e86f |
--- /dev/null |
+++ b/chrome/test/data/webui/md_history/history_routing_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('md_history.history_routing_test', function() { |
+ function registerTests() { |
+ suite('routing-test', function() { |
+ var app; |
+ var list; |
+ |
+ suiteSetup(function() { |
+ app = $('history-app'); |
+ sidebar = app.$['side-bar'] |
+ }); |
+ |
+ test('changing route changes active view', function() { |
+ assertEquals('history', app.$.content.selected); |
+ app.set('routeData_.page', 'syncedTabs'); |
+ return flush().then(function() { |
+ assertEquals('syncedTabs', app.$.content.selected); |
+ assertEquals('chrome://history/syncedTabs', window.location.href); |
+ }); |
+ }); |
+ |
+ test('route updates from sidebar', function() { |
+ var menu = sidebar.$.menu; |
+ assertEquals('', app.routeData_.page); |
+ assertEquals('chrome://history/', window.location.href); |
+ |
+ MockInteractions.tap(menu.children[1]); |
+ assertEquals('syncedTabs', app.routeData_.page); |
+ assertEquals('chrome://history/syncedTabs', window.location.href); |
+ |
+ MockInteractions.tap(menu.children[0]); |
+ assertEquals('', app.routeData_.page); |
+ assertEquals('chrome://history/', window.location.href); |
+ }); |
+ |
+ teardown(function() { |
+ app.set('routeData_.page', ''); |
+ }); |
+ }); |
+ } |
+ return { |
+ registerTests: registerTests |
+ }; |
+}); |