Title: [214784] releases/WebKitGTK/webkit-2.16/Tools
Revision
214784
Author
carlo...@webkit.org
Date
2017-04-03 06:06:15 -0700 (Mon, 03 Apr 2017)

Log Message

Merge r214347 - Unreviewed. Fix GTK+ test /webkit2/WebKitWebView/_javascript_-dialogs after r214277.

Since r214277 beforeunload events are not fired unless there's some user interaction, so we need to simulate it
in our unit tests to work.

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

Modified Paths

Diff

Modified: releases/WebKitGTK/webkit-2.16/Tools/ChangeLog (214783 => 214784)


--- releases/WebKitGTK/webkit-2.16/Tools/ChangeLog	2017-04-03 13:06:02 UTC (rev 214783)
+++ releases/WebKitGTK/webkit-2.16/Tools/ChangeLog	2017-04-03 13:06:15 UTC (rev 214784)
@@ -1,3 +1,13 @@
+2017-03-24  Carlos Garcia Campos  <cgar...@igalia.com>
+
+        Unreviewed. Fix GTK+ test /webkit2/WebKitWebView/_javascript_-dialogs after r214277.
+
+        Since r214277 beforeunload events are not fired unless there's some user interaction, so we need to simulate it
+        in our unit tests to work.
+
+        * TestWebKitAPI/Tests/WebKit2Gtk/TestUIClient.cpp:
+        (testWebViewJavaScriptDialogs):
+
 2017-03-15  Tim Horton  <timothy_hor...@apple.com>
 
         Null deref under callAfterNextPresentationUpdate

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


--- releases/WebKitGTK/webkit-2.16/Tools/TestWebKitAPI/Tests/WebKit2Gtk/TestUIClient.cpp	2017-04-03 13:06:02 UTC (rev 214783)
+++ releases/WebKitGTK/webkit-2.16/Tools/TestWebKitAPI/Tests/WebKit2Gtk/TestUIClient.cpp	2017-04-03 13:06:15 UTC (rev 214784)
@@ -298,6 +298,15 @@
         return m_mouseTargetHitTestResult.get();
     }
 
+    void simulateUserInterqaction()
+    {
+        mouseMoveTo(1, 1);
+        keyStroke(GDK_KEY_Down);
+        keyStroke(GDK_KEY_Up);
+        while (gtk_events_pending())
+            gtk_main_iteration();
+    }
+
     virtual GtkWidget* viewCreate(WebKitWebView* webView, WebKitNavigationAction* navigation)
     {
         g_assert(webView == m_webView);
@@ -519,6 +528,8 @@
 
 static void testWebViewJavaScriptDialogs(UIClientTest* test, gconstpointer)
 {
+    test->showInWindowAndWaitUntilMapped(GTK_WINDOW_TOPLEVEL);
+
     static const char* htmlOnLoadFormat = "<html><body _onLoad_=\"%s\"></body></html>";
     static const char* jsAlertFormat = "alert('%s')";
     static const char* jsConfirmFormat = "do { confirmed = confirm('%s'); } while (!confirmed); alert('confirmed');";
@@ -557,6 +568,7 @@
 
     // Reload should trigger onbeforeunload.
 #if 0
+    test->simulateUserInterqaction();
     // FIXME: reloading HTML data doesn't emit finished load event.
     // See https://bugs.webkit.org/show_bug.cgi?id=139089.
     test->m_scriptDialogConfirmed = false;
@@ -566,6 +578,7 @@
 #endif
 
     // Navigation should trigger onbeforeunload.
+    test->simulateUserInterqaction();
     test->m_scriptDialogConfirmed = false;
     test->loadHtml("<html></html>", nullptr);
     test->waitUntilLoadFinished();
@@ -575,6 +588,7 @@
     test->m_scriptDialogConfirmed = false;
     test->loadHtml(beforeUnloadDialogHTML.get(), nullptr);
     test->waitUntilLoadFinished();
+    test->simulateUserInterqaction();
     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