Title: [216424] releases/WebKitGTK/webkit-2.16/Tools
Revision
216424
Author
carlo...@webkit.org
Date
2017-05-08 09:42:39 -0700 (Mon, 08 May 2017)

Log Message

Merge r216423 - Unreviewed. Fix GTK+ test /webkit2/WebKitWebView/_javascript_-dialogs after r215404.

Sending down+up keys is no longer enough to simulate a real user interaction after r215404, the key events now
should be handled by the web process to be considered a user interaction. So, add an input to the HTML and send
characters to the input. Also fix typo in the function name.

* TestWebKitAPI/Tests/WebKit2Gtk/TestUIClient.cpp:
(testWebViewJavaScriptDialogs):

Modified Paths

Diff

Modified: releases/WebKitGTK/webkit-2.16/Tools/ChangeLog (216423 => 216424)


--- releases/WebKitGTK/webkit-2.16/Tools/ChangeLog	2017-05-08 16:40:44 UTC (rev 216423)
+++ releases/WebKitGTK/webkit-2.16/Tools/ChangeLog	2017-05-08 16:42:39 UTC (rev 216424)
@@ -1,3 +1,14 @@
+2017-05-08  Carlos Garcia Campos  <cgar...@igalia.com>
+
+        Unreviewed. Fix GTK+ test /webkit2/WebKitWebView/_javascript_-dialogs after r215404.
+
+        Sending down+up keys is no longer enough to simulate a real user interaction after r215404, the key events now
+        should be handled by the web process to be considered a user interaction. So, add an input to the HTML and send
+        characters to the input. Also fix typo in the function name.
+
+        * TestWebKitAPI/Tests/WebKit2Gtk/TestUIClient.cpp:
+        (testWebViewJavaScriptDialogs):
+
 2017-05-04  Mark Lam  <mark....@apple.com>
 
         DRT's setAudioResultCallback() and IDBRequest::setResult() need to acquire the JSLock.

Modified: releases/WebKitGTK/webkit-2.16/Tools/TestWebKitAPI/Tests/WebKit2Gtk/TestUIClient.cpp (216423 => 216424)


--- releases/WebKitGTK/webkit-2.16/Tools/TestWebKitAPI/Tests/WebKit2Gtk/TestUIClient.cpp	2017-05-08 16:40:44 UTC (rev 216423)
+++ releases/WebKitGTK/webkit-2.16/Tools/TestWebKitAPI/Tests/WebKit2Gtk/TestUIClient.cpp	2017-05-08 16:42:39 UTC (rev 216424)
@@ -298,11 +298,11 @@
         return m_mouseTargetHitTestResult.get();
     }
 
-    void simulateUserInterqaction()
+    void simulateUserInteraction()
     {
-        mouseMoveTo(1, 1);
-        keyStroke(GDK_KEY_Down);
-        keyStroke(GDK_KEY_Up);
+        runJavaScriptAndWaitUntilFinished("document.getElementById('testInput').focus()", nullptr);
+        keyStroke(GDK_KEY_a);
+        keyStroke(GDK_KEY_b);
         while (gtk_events_pending())
             gtk_main_iteration();
     }
@@ -535,7 +535,7 @@
     static const char* jsConfirmFormat = "do { confirmed = confirm('%s'); } while (!confirmed); alert('confirmed');";
     static const char* jsPromptFormat = "alert(prompt('%s', 'default'));";
     static const char* htmlOnBeforeUnloadFormat =
-        "<html><body _onbeforeunload_=\"return beforeUnloadHandler();\"><script>function beforeUnloadHandler() { return \"%s\"; }</script></body></html>";
+        "<html><body _onbeforeunload_=\"return beforeUnloadHandler();\"><input id=\"testInput\" type=\"text\"></input><script>function beforeUnloadHandler() { return \"%s\"; }</script></body></html>";
 
     test->m_scriptDialogType = WEBKIT_SCRIPT_DIALOG_ALERT;
     GUniquePtr<char> alertDialogMessage(g_strdup_printf(jsAlertFormat, kAlertDialogMessage));
@@ -568,7 +568,7 @@
 
     // Reload should trigger onbeforeunload.
 #if 0
-    test->simulateUserInterqaction();
+    test->simulateUserInteraction();
     // FIXME: reloading HTML data doesn't emit finished load event.
     // See https://bugs.webkit.org/show_bug.cgi?id=139089.
     test->m_scriptDialogConfirmed = false;
@@ -578,7 +578,7 @@
 #endif
 
     // Navigation should trigger onbeforeunload.
-    test->simulateUserInterqaction();
+    test->simulateUserInteraction();
     test->m_scriptDialogConfirmed = false;
     test->loadHtml("<html></html>", nullptr);
     test->waitUntilLoadFinished();
@@ -588,7 +588,7 @@
     test->m_scriptDialogConfirmed = false;
     test->loadHtml(beforeUnloadDialogHTML.get(), nullptr);
     test->waitUntilLoadFinished();
-    test->simulateUserInterqaction();
+    test->simulateUserInteraction();
     test->tryCloseAndWaitUntilClosed();
     g_assert(test->m_scriptDialogConfirmed);
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to