Index: chrome/test/data/webui/polymer_browser_test_base.js |
diff --git a/chrome/test/data/webui/polymer_browser_test_base.js b/chrome/test/data/webui/polymer_browser_test_base.js |
index b63110cd36f562c154c2028349724d90f5e5038f..40bd809b0d621122a52d9e91972aae14328477cb 100644 |
--- a/chrome/test/data/webui/polymer_browser_test_base.js |
+++ b/chrome/test/data/webui/polymer_browser_test_base.js |
@@ -188,10 +188,24 @@ PolymerTest.loadScript = function(src) { |
}; |
/** |
- * Removes all content from the body. |
+ * Removes all content from the body, save for the global <style> elements |
+ * used by a vulcanized build. |
*/ |
PolymerTest.clearBody = function() { |
- document.body.innerHTML = ''; |
+ var vulcanizeDiv = document.querySelector('body > div[hidden][by-vulcanize]'); |
dpapad
2017/04/24 18:35:15
Would it be simpler to do the following?
var toRe
dpapad
2017/04/25 01:11:09
Or maybe even better to use the following selector
|
+ document.body.innerHTML=''; |
+ if (!vulcanizeDiv) |
+ return; |
+ |
+ if (!vulcanizeDiv.hasAttribute('processed-by-test')) { |
dpapad
2017/04/24 18:35:15
What is "processed-by-test"?
|
+ for (var child of vulcanizeDiv.children) { |
+ if (child.tagName != 'STYLE') |
+ child.remove(); |
+ } |
+ vulcanizeDiv.setAttribute('processed-by-test', ''); |
+ } |
+ |
+ document.body.appendChild(vulcanizeDiv); |
}; |
/** |