Title: [289733] trunk/LayoutTests
Revision
289733
Author
grao...@webkit.org
Date
2022-02-14 06:06:38 -0800 (Mon, 14 Feb 2022)

Log Message

[model] refactor model document tests to use a shared testing function
https://bugs.webkit.org/show_bug.cgi?id=236578

Reviewed by Dean Jackson.

Add a new model_document_test function that both model document tests can use
to get the document loaded inside the iframe.

* http/tests/model/model-document-interactive-expected.txt:
* http/tests/model/model-document-interactive.html:
* http/tests/model/model-document.html:
* http/tests/model/resources/model-document.js: Added.
(const.model_document_test):

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (289732 => 289733)


--- trunk/LayoutTests/ChangeLog	2022-02-14 14:03:06 UTC (rev 289732)
+++ trunk/LayoutTests/ChangeLog	2022-02-14 14:06:38 UTC (rev 289733)
@@ -1,3 +1,19 @@
+2022-02-14  Antoine Quint  <grao...@webkit.org>
+
+        [model] refactor model document tests to use a shared testing function
+        https://bugs.webkit.org/show_bug.cgi?id=236578
+
+        Reviewed by Dean Jackson.
+
+        Add a new model_document_test function that both model document tests can use
+        to get the document loaded inside the iframe.
+
+        * http/tests/model/model-document-interactive-expected.txt:
+        * http/tests/model/model-document-interactive.html:
+        * http/tests/model/model-document.html:
+        * http/tests/model/resources/model-document.js: Added.
+        (const.model_document_test):
+
 2022-02-14  Martin Robinson  <mrobin...@webkit.org>
 
         Animation from "scale()" to "scale() translate()" does not yield the expected result

Modified: trunk/LayoutTests/http/tests/model/model-document-interactive-expected.txt (289732 => 289733)


--- trunk/LayoutTests/http/tests/model/model-document-interactive-expected.txt	2022-02-14 14:03:06 UTC (rev 289732)
+++ trunk/LayoutTests/http/tests/model/model-document-interactive-expected.txt	2022-02-14 14:06:38 UTC (rev 289733)
@@ -1,4 +1,3 @@
 
-
 PASS <model> in standalone document is interactive.
 

Modified: trunk/LayoutTests/http/tests/model/model-document-interactive.html (289732 => 289733)


--- trunk/LayoutTests/http/tests/model/model-document-interactive.html	2022-02-14 14:03:06 UTC (rev 289732)
+++ trunk/LayoutTests/http/tests/model/model-document-interactive.html	2022-02-14 14:06:38 UTC (rev 289733)
@@ -3,16 +3,11 @@
 <body>
 <script src=""
 <script src=""
+<script src=""
 <script>
 
-promise_test(async test => {
-    const frame = document.createElement("iframe");
-    frame.src = ""
-    document.body.appendChild(frame);
-
-    await new Promise(resolve => frame.addEventListener("load", resolve, { once: true }));
-
-    const model = frame.contentDocument.querySelector("model");
+model_document_test(async modelDocument => {
+    const model = modelDocument.querySelector("model");
     assert_true(model.interactive);
 }, "<model> in standalone document is interactive.");
 

Modified: trunk/LayoutTests/http/tests/model/model-document.html (289732 => 289733)


--- trunk/LayoutTests/http/tests/model/model-document.html	2022-02-14 14:03:06 UTC (rev 289732)
+++ trunk/LayoutTests/http/tests/model/model-document.html	2022-02-14 14:06:38 UTC (rev 289733)
@@ -3,17 +3,12 @@
 <body>
 <script src=""
 <script src=""
+<script src=""
 <script>
 
-promise_test(async test => {
-    const frame = document.createElement("iframe");
-    frame.src = ""
-    document.body.appendChild(frame);
-
-    await new Promise(resolve => frame.addEventListener("load", resolve, { once: true }));
-
-    assert_true(!!frame.contentDocument.querySelector("model"), "The frame contains a <model> element");
-    assert_true(!!frame.contentDocument.querySelector("model source"), "The <model> element contains a <source> element");
+model_document_test(async modelDocument => {
+    assert_true(!!modelDocument.querySelector("model"), "The frame contains a <model> element");
+    assert_true(!!modelDocument.querySelector("model source"), "The <model> element contains a <source> element");
 }, "Loading a standalone model resource creates a standalone <model> document.");
 
 </script>

Added: trunk/LayoutTests/http/tests/model/resources/model-document.js (0 => 289733)


--- trunk/LayoutTests/http/tests/model/resources/model-document.js	                        (rev 0)
+++ trunk/LayoutTests/http/tests/model/resources/model-document.js	2022-02-14 14:06:38 UTC (rev 289733)
@@ -0,0 +1,14 @@
+
+const model_document_test = (callback, description) => {
+    return promise_test(async test => {
+        const frame = document.createElement("iframe");
+        frame.src = ""
+        document.body.appendChild(frame);
+
+        test.add_cleanup(() => frame.remove());
+
+        await new Promise(resolve => frame.addEventListener("load", resolve, { once: true }));
+
+        await callback(frame.contentDocument);
+    }, description);
+};
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to