[ContentChangeObserver] LayoutTest/fast/content-observation/click-event-suppression...
authorzalan@apple.com <zalan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 14 Jun 2019 03:50:31 +0000 (03:50 +0000)
committerzalan@apple.com <zalan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 14 Jun 2019 03:50:31 +0000 (03:50 +0000)
https://bugs.webkit.org/show_bug.cgi?id=198848
<rdar://problem/51689630>

Reviewed by Dean Jackson.

1. Enable content observation for this test.
2. Add role attribute to trigger fast click-through -less flaky with the sleeps.
3. Use UIHelper functions.

* fast/content-observation/click-event-suppression-on-content-change.html: Removed.
* fast/events/touch/ios/content-observation/click-event-suppression-on-content-change-expected.txt: Renamed from LayoutTests/fast/content-observation/click-event-suppression-on-content-change-expected.txt.
* fast/events/touch/ios/content-observation/click-event-suppression-on-content-change.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@246426 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/fast/content-observation/click-event-suppression-on-content-change.html [deleted file]
LayoutTests/fast/events/touch/ios/content-observation/click-event-suppression-on-content-change-expected.txt [moved from LayoutTests/fast/content-observation/click-event-suppression-on-content-change-expected.txt with 100% similarity]
LayoutTests/fast/events/touch/ios/content-observation/click-event-suppression-on-content-change.html [new file with mode: 0644]

index f8d2e0a..8ed62f8 100644 (file)
@@ -1,3 +1,19 @@
+2019-06-13  Zalan Bujtas  <zalan@apple.com>
+
+        [ContentChangeObserver] LayoutTest/fast/content-observation/click-event-suppression-on-content-change.html is failing
+        https://bugs.webkit.org/show_bug.cgi?id=198848
+        <rdar://problem/51689630>
+
+        Reviewed by Dean Jackson.
+
+        1. Enable content observation for this test.
+        2. Add role attribute to trigger fast click-through -less flaky with the sleeps. 
+        3. Use UIHelper functions.
+
+        * fast/content-observation/click-event-suppression-on-content-change.html: Removed.
+        * fast/events/touch/ios/content-observation/click-event-suppression-on-content-change-expected.txt: Renamed from LayoutTests/fast/content-observation/click-event-suppression-on-content-change-expected.txt.
+        * fast/events/touch/ios/content-observation/click-event-suppression-on-content-change.html: Added.
+
 2019-06-13  Daniel Bates  <dabates@apple.com>
 
         [iOS] Normalize test result of fast/events/ios/keyboard-event-key-attribute.html to handle possible modifier dispatch
diff --git a/LayoutTests/fast/content-observation/click-event-suppression-on-content-change.html b/LayoutTests/fast/content-observation/click-event-suppression-on-content-change.html
deleted file mode 100644 (file)
index dd88b18..0000000
+++ /dev/null
@@ -1,85 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
-<style>
-#neutral { position:absolute; top:0px; left:100px; width:100px; height:100px; border:2px solid blue; }
-#test { position:absolute; top:100px; left:100px; width:100px; height:100px; border:2px solid blue; }
-#test div { border: 2px solid red; width: 10px; height: 10px; }
-</style>
-<script>
-if (window.testRunner) {
-    testRunner.dumpAsText();
-    testRunner.waitUntilDone();
-}
-
-var outputText = "";
-
-function output(text) {
-    outputText += text + '<br>';
-}
-
-var mutateOnMouseOver = false;
-
-function mouseOver() {
-    if (mutateOnMouseOver) {
-        let newContent = document.createElement("div");
-        newContent.addEventListener("click", function( event ) {
-            console.log("clicked");
-        }, false);
-        document.querySelector('#test').appendChild(newContent);
-    }
-    output('mouseover');
-}
-function mouseOut() {
-    output('mouseout');
-}
-function mouseClick() {
-    output('mouseclick');
-}
-
-function getTapUIScript(x, y)
-{
-    return `
-    (function() {
-        uiController.singleTapAtPoint(${x}, ${y}, function() {
-            uiController.uiScriptComplete("Done");
-        });
-    })();`
-}
-
-function test() {
-    if (!window.testRunner || !window.testRunner.runUIScript)
-        return;
-    // Test tapping in a div.
-    output("Tapping once");
-    testRunner.runUIScript(getTapUIScript(150, 150), function(result) {
-        output("Tapping again");
-        testRunner.runUIScript(getTapUIScript(150, 150), function(result) {
-            output("Tapping out");
-            testRunner.runUIScript(getTapUIScript(150, 50), function(result) {
-                output("Enabling mutation on mouseover");
-                mutateOnMouseOver = true;
-                output("Tapping once");
-                testRunner.runUIScript(getTapUIScript(150, 150), function(result) {
-                    output("Tapping again");
-                    testRunner.runUIScript(getTapUIScript(150, 150), function(result) {
-                        document.querySelector('#output').innerHTML += outputText;
-                        testRunner.notifyDone();
-                    });
-                });
-            });
-        });
-    });
-}
-
-</script>
-</head>
-<body onload="test()">
-    <div>Test that if document is visibly mutated in mouseover handler then synthetic click is not generated until the next tap.</div>
-    <div id='neutral' onmouseover='' onmouseout='' onclick=''>
-    </div>
-    <div id='test' onmouseover='mouseOver()' onmouseout='mouseOut()' onclick='mouseClick()'>
-    </div>
-    <div id='output'></div>
-</body>
-</html>
diff --git a/LayoutTests/fast/events/touch/ios/content-observation/click-event-suppression-on-content-change.html b/LayoutTests/fast/events/touch/ios/content-observation/click-event-suppression-on-content-change.html
new file mode 100644 (file)
index 0000000..53fb8f2
--- /dev/null
@@ -0,0 +1,84 @@
+<!DOCTYPE html><!-- webkit-test-runner [ useFlexibleViewport=true ] -->
+<html>
+<head>
+<meta name="viewport" content="width=device-width initial-scale=1 user-scalable=no">
+<script src="../../../../../resources/ui-helper.js"></script>
+<style>
+#neutral { position:absolute; top:0px; left:100px; width:100px; height:100px; border:2px solid blue; }
+#testDiv { position:absolute; top:100px; left:100px; width:100px; height:100px; border:2px solid blue; }
+#testDiv div { border: 2px solid red; width: 10px; height: 10px; }
+</style>
+<script>
+if (window.testRunner) {
+    testRunner.dumpAsText();
+    testRunner.waitUntilDone();
+}
+if (window.internals)
+    internals.settings.setContentChangeObserverEnabled(true);
+
+var outputText = "";
+
+function output(text) {
+    outputText += text + '<br>';
+}
+
+var mutateOnMouseOver = false;
+
+function mouseOver() {
+    if (mutateOnMouseOver) {
+        let newContent = document.createElement("div");
+        newContent.addEventListener("click", function( event ) {
+        }, false);
+        document.querySelector('#testDiv').appendChild(newContent);
+    }
+    output('mouseover');
+}
+function mouseOut() {
+    output('mouseout');
+}
+function mouseClick() {
+    output('mouseclick');
+}
+
+async function test() {
+    if (!window.testRunner || !window.testRunner.runUIScript)
+        return;
+    // Test tapping in a div.
+    output("Tapping once");
+    await UIHelper.tapAt(150, 150);
+    await UIHelper.delayFor(50);
+
+    output("Tapping again");
+    await UIHelper.tapAt(150, 150);
+    await UIHelper.delayFor(50);
+
+    output("Tapping out");
+    await UIHelper.tapAt(150, 50);
+    await UIHelper.delayFor(50);
+
+    output("Enabling mutation on mouseover");
+    testDiv.removeAttribute("role"); 
+    mutateOnMouseOver = true;
+    output("Tapping once");
+    await UIHelper.tapAt(150, 150);
+    await UIHelper.delayFor(50);
+
+    output("Tapping again");
+    await UIHelper.tapAt(150, 150);
+    await UIHelper.delayFor(50);
+
+    document.querySelector('#output').innerHTML += outputText;
+    testRunner.notifyDone();
+}
+
+</script>
+</head>
+<body onload="test()">
+    <div>Test that if document is visibly mutated in mouseover handler then synthetic click is not generated until the next tap.</div>
+    <div id='neutral' onmouseover='' onmouseout='' onclick=''>
+    </div>
+    <div role="checkbox" id='testDiv' onmouseover='mouseOver()' onmouseout='mouseOut()' onclick='mouseClick()'>
+    </div>
+    <div id='output'></div>
+</body>
+</html>