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

Unified Diff: chrome/test/data/webui/md_history/history_routing_test.js

Issue 2068613002: [MD History] Add URL parameter for search. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@routing
Patch Set: remove_var 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/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
index e8aa984451d5bdb2515d84a25b6b72e2c673e86f..4cd5585dd43a0087b5c1c4e36cc2a85b47cab456 100644
--- a/chrome/test/data/webui/md_history/history_routing_test.js
+++ b/chrome/test/data/webui/md_history/history_routing_test.js
@@ -7,10 +7,12 @@ cr.define('md_history.history_routing_test', function() {
suite('routing-test', function() {
var app;
var list;
+ var toolbar;
suiteSetup(function() {
app = $('history-app');
sidebar = app.$['side-bar']
+ toolbar = app.$['toolbar'];
});
test('changing route changes active view', function() {
@@ -36,8 +38,81 @@ cr.define('md_history.history_routing_test', function() {
assertEquals('chrome://history/', window.location.href);
});
+ test('route updates from search', function() {
+ var searchTerm = 'McCree';
+ assertEquals('', app.routeData_.page);
+ toolbar.setSearchTerm(searchTerm);
+ assertEquals(searchTerm, app.queryParams_.q);
+ });
+
+ test('search updates from route', function() {
+ var searchTerm = 'Mei';
+ assertEquals('history', app.$.content.selected);
+ app.set('queryParams_.q', searchTerm);
+ assertEquals(searchTerm, toolbar.searchTerm);
+ });
+
+ test('search preserved across menu items', function() {
+ var searchTerm = 'Soldier 76';
+ var menu = sidebar.$.menu;
+ assertEquals('', app.routeData_.page);
+ assertEquals('history', app.$.content.selected);
+ app.set('queryParams_.q', searchTerm);
+
+ MockInteractions.tap(menu.children[1]);
+ assertEquals('syncedTabs', app.routeData_.page);
+ assertEquals(searchTerm, app.queryParams_.q);
+ assertEquals(searchTerm, toolbar.searchTerm);
+
+ MockInteractions.tap(menu.children[0]);
+ assertEquals('', app.routeData_.page);
+ assertEquals(searchTerm, app.queryParams_.q);
+ assertEquals(searchTerm, toolbar.searchTerm);
+ });
+
teardown(function() {
app.set('routeData_.page', '');
+ app.set('queryParams_.q', null);
+ });
+ });
+ }
+ return {
+ registerTests: registerTests
+ };
+});
+
+cr.define('md_history.history_routing_test_with_query_param', function() {
+ function registerTests() {
+ suite('routing-with-query-param', function() {
+ var app;
+ var list;
+ var toolbar;
+ var expectedQuery;
+
+ suiteSetup(function() {
+ app = $('history-app');
+ sidebar = app.$['side-bar']
+ toolbar = app.$['toolbar'];
+ expectedQuery = 'query';
+ });
+
+ test('search initiated on load', function(done) {
+ var verifyFunction = function(info) {
+ assertEquals(expectedQuery, info[0]);
+ flush().then(function() {
+ assertEquals(
+ expectedQuery,
+ toolbar.$['main-toolbar'].getSearchField().getValue());
+ done();
+ });
+ };
+
+ if (window.historyQueryInfo) {
+ verifyFunction(window.historyQueryInfo);
+ return;
+ }
+
+ registerMessageCallback('queryHistory', this, verifyFunction);
});
});
}
« no previous file with comments | « chrome/test/data/webui/md_history/history_list_test.js ('k') | chrome/test/data/webui/md_history/history_synced_tabs_test.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698