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

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

Issue 2207323002: [MD History] Factor out a common HistoryListBehavior. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix nits 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/md_history/history_list_test.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/md_history/test_util.js
diff --git a/chrome/test/data/webui/md_history/test_util.js b/chrome/test/data/webui/md_history/test_util.js
index d4f44ea367b34e203deb87f11badefcbd61c5697..7ec8a6d7df545120647fac087afc04d05caec28f 100644
--- a/chrome/test/data/webui/md_history/test_util.js
+++ b/chrome/test/data/webui/md_history/test_util.js
@@ -75,3 +75,37 @@ function createHistoryInfo(searchTerm) {
term: searchTerm || ''
};
}
+
+/**
+ * @param {Element} element
+ * @param {string} selector
+ * @return {Element}
+ */
+function polymerSelectAll(element, selector) {
+ return Polymer.dom(element.root).querySelectorAll(selector);
+}
+
+/**
+ * Returns a promise which is resolved when |eventName| is fired on |element|
+ * and |predicate| is true.
+ * @param {HTMLElement} element
+ * @param {string} eventName
+ * @param {function(Event): boolean} predicate
+ * @return {Promise}
+ */
+function waitForEvent(element, eventName, predicate) {
+ if (!predicate)
+ predicate = function() { return true; };
+
+ return new Promise(function(resolve) {
+ var listener = function(e) {
+ if (!predicate(e))
+ return;
+
+ resolve();
+ element.removeEventListener(eventName, listener);
+ }
+
+ element.addEventListener(eventName, listener);
+ });
+}
« no previous file with comments | « chrome/test/data/webui/md_history/history_list_test.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698