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

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

Issue 2068613002: [MD History] Add URL parameter for search. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@routing
Patch Set: rebase 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/md_history_browsertest.js
diff --git a/chrome/test/data/webui/md_history/md_history_browsertest.js b/chrome/test/data/webui/md_history/md_history_browsertest.js
index 6de0d2a1b4936d21bdb2bdb307d7945a97f488e9..0ae71fe1985eb32954548e57b471ab539e504f00 100644
--- a/chrome/test/data/webui/md_history/md_history_browsertest.js
+++ b/chrome/test/data/webui/md_history/md_history_browsertest.js
@@ -109,3 +109,46 @@ TEST_F('MaterialHistoryDeletionDisabledTest', 'HistorySupervisedUserTest',
md_history.history_supervised_user_test.registerTests();
mocha.run();
});
+
+function MaterialHistoryWithQueryParamTest() {}
+
+MaterialHistoryWithQueryParamTest.prototype = {
+ __proto__: MaterialHistoryBrowserTest.prototype,
+
+ browsePreload: 'chrome://history?q=query',
+
+ /** @override */
+ setUp: function() {
+ PolymerTest.prototype.setUp.call(this);
+
+ suiteSetup(function() {
+ var upgraded = false;
+
+ // This message handler needs to be registered before the test since the
+ // query can happen immediately after the element is upgraded. However,
+ // since there may be a delay as well, the test might check the global var
+ // too early as well. In this case we send a message to the test to keep
+ // things going.
tsergeant 2016/07/19 03:32:20 oh BOY I -think- you can simplify this a bit by h
calamity 2016/07/19 04:35:33 That does seem to work! I tested by strategically
+ registerMessageCallback('queryHistory', this, function (info) {
+ console.log(info);
tsergeant 2016/07/19 03:32:20 Delete this log
calamity 2016/07/19 04:35:33 Done.
+ if (upgraded) {
+ chrome.send('historyQueried', info);
+ return;
+ }
+
+ window.historyQueryInfo = info;
+ });
+
+ // Wait for the top-level app element to be upgraded.
+ return waitForUpgrade($('history-app')).then(function() {
+ upgraded = true;
+ });
+ });
+ },
+};
+
+TEST_F('MaterialHistoryWithQueryParamTest', 'RoutingTestWithQueryParam',
+ function() {
+ md_history.history_routing_test_with_query_param.registerTests();
+ mocha.run();
+});

Powered by Google App Engine
This is Rietveld 408576698