Changeset 214347 in webkit


Ignore:
Timestamp:
Mar 24, 2017 7:55:59 AM (7 years ago)
Author:
Carlos Garcia Campos
Message:

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):

Location:
trunk/Tools
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Tools/ChangeLog

    r214338 r214347  
     12017-03-24  Carlos Garcia Campos  <cgarcia@igalia.com>
     2
     3        Unreviewed. Fix GTK+ test /webkit2/WebKitWebView/javascript-dialogs after r214277.
     4
     5        Since r214277 beforeunload events are not fired unless there's some user interaction, so we need to simulate it
     6        in our unit tests to work.
     7
     8        * TestWebKitAPI/Tests/WebKit2Gtk/TestUIClient.cpp:
     9        (testWebViewJavaScriptDialogs):
     10
    1112017-03-24  Carlos Garcia Campos  <cgarcia@igalia.com>
    212
  • trunk/Tools/TestWebKitAPI/Tests/WebKit2Gtk/TestUIClient.cpp

    r206302 r214347  
    299299    }
    300300
     301    void simulateUserInterqaction()
     302    {
     303        mouseMoveTo(1, 1);
     304        keyStroke(GDK_KEY_Down);
     305        keyStroke(GDK_KEY_Up);
     306        while (gtk_events_pending())
     307            gtk_main_iteration();
     308    }
     309
    301310    virtual GtkWidget* viewCreate(WebKitWebView* webView, WebKitNavigationAction* navigation)
    302311    {
     
    520529static void testWebViewJavaScriptDialogs(UIClientTest* test, gconstpointer)
    521530{
     531    test->showInWindowAndWaitUntilMapped(GTK_WINDOW_TOPLEVEL);
     532
    522533    static const char* htmlOnLoadFormat = "<html><body onLoad=\"%s\"></body></html>";
    523534    static const char* jsAlertFormat = "alert('%s')";
     
    558569    // Reload should trigger onbeforeunload.
    559570#if 0
     571    test->simulateUserInterqaction();
    560572    // FIXME: reloading HTML data doesn't emit finished load event.
    561573    // See https://bugs.webkit.org/show_bug.cgi?id=139089.
     
    567579
    568580    // Navigation should trigger onbeforeunload.
     581    test->simulateUserInterqaction();
    569582    test->m_scriptDialogConfirmed = false;
    570583    test->loadHtml("<html></html>", nullptr);
     
    576589    test->loadHtml(beforeUnloadDialogHTML.get(), nullptr);
    577590    test->waitUntilLoadFinished();
     591    test->simulateUserInterqaction();
    578592    test->tryCloseAndWaitUntilClosed();
    579593    g_assert(test->m_scriptDialogConfirmed);
Note: See TracChangeset for help on using the changeset viewer.