Index: third_party/WebKit/LayoutTests/custom-elements/spec/resources/custom-elements-helpers.js |
diff --git a/third_party/WebKit/LayoutTests/custom-elements/spec/resources/custom-elements-helpers.js b/third_party/WebKit/LayoutTests/custom-elements/spec/resources/custom-elements-helpers.js |
new file mode 100644 |
index 0000000000000000000000000000000000000000..885677d54cd183c6226c7dd07a57753aaf3ec9f1 |
--- /dev/null |
+++ b/third_party/WebKit/LayoutTests/custom-elements/spec/resources/custom-elements-helpers.js |
@@ -0,0 +1,22 @@ |
+function create_window_in_test(t) { |
+ let p = new Promise((resolve) => { |
+ let f = document.createElement('iframe'); |
+ f.srcdoc = ''; |
+ f.onload = (event) => { |
+ let w = f.contentWindow; |
+ t.add_cleanup(() => f.remove()); |
+ resolve(w); |
+ }; |
+ document.body.appendChild(f); |
+ }); |
+ return p; |
+} |
+ |
+function test_with_window(f, name) { |
+ promise_test((t) => { |
+ return create_window_in_test(t) |
+ .then((w) => { |
+ f(w); |
+ }); |
+ }, name); |
+} |