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

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

Issue 2257703002: MD History: Improve test helpers, update synced tabs tests to use them (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Revulcanize 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_synced_tabs_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 0deeb3b54425f502e464344745c051eaf7ac753a..3d8ea2e36ce67ee07eda6b5b8ad8e4ef7d5f096e 100644
--- a/chrome/test/data/webui/md_history/test_util.js
+++ b/chrome/test/data/webui/md_history/test_util.js
@@ -16,6 +16,32 @@ function flush() {
}
/**
+ * Replace the current primary element of the test with a new element. Useful
+ * as an alternative to PolymerTest.clearBody() which preserves styling.
+ * @param {Element} element
+ */
+function replaceBody(element) {
+ var body = document.body;
+ var currentBody =
+ body.querySelector('history-app') || body.querySelector('.test-body');
+ body.removeChild(currentBody);
+
+ element.classList.add('test-body');
+ body.appendChild(element);
+}
+
+/**
+ * Replace the document body with a new instance of <history-app>.
+ * @return {HistoryAppElement} The app which was created.
+ */
+function replaceApp() {
+ var app = document.createElement('history-app');
+ app.id = 'history-app';
+ replaceBody(app);
+ return app;
+}
+
+/**
* Create a fake history result with the given timestamp.
* @param {number|string} timestamp Timestamp of the entry, as a number in ms or
* a string which can be parsed by Date.parse().
« no previous file with comments | « chrome/test/data/webui/md_history/history_synced_tabs_test.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698