Changeset 109720 in webkit


Ignore:
Timestamp:
Mar 5, 2012 12:35:15 AM (12 years ago)
Author:
Martin Robinson
Message:

[GTK] "Console: undefined @0: ReferenceError: Can't find variable: WebInspector" during testwebinspector
https://bugs.webkit.org/show_bug.cgi?id=80235

Reviewed by Philippe Normand.

Source/WebKit/gtk:

Wait to inspect the WebView until the page has finished loading. Also
clean up some minor style errors.

  • tests/testwebinspector.c:

(closeInspector): Small style fixes.
(showInspector): Ditto.
(loadFinished): Ditto.
(test_webkit_web_inspector_close_and_inspect): Wait to inspect until the page has loaded.
(test_webkit_web_inspector_destroy_inspected_web_view): Ditto.
(main): Small style fixes.

Tools:

  • Scripts/run-gtk-tests:

(TestRunner.run): Use the WEBKIT_INSPECTOR_PATH environment variable so that
inspector resources path determination is shared by all tests.

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/gtk/ChangeLog

    r109719 r109720  
     12012-03-04  Martin Robinson  <mrobinson@igalia.com>
     2
     3        [GTK] "Console: undefined @0: ReferenceError: Can't find variable: WebInspector" during testwebinspector
     4        https://bugs.webkit.org/show_bug.cgi?id=80235
     5
     6        Reviewed by Philippe Normand.
     7
     8        Wait to inspect the WebView until the page has finished loading. Also
     9        clean up some minor style errors.
     10
     11        * tests/testwebinspector.c:
     12        (closeInspector): Small style fixes.
     13        (showInspector): Ditto.
     14        (loadFinished): Ditto.
     15        (test_webkit_web_inspector_close_and_inspect): Wait to inspect until the page has loaded.
     16        (test_webkit_web_inspector_destroy_inspected_web_view): Ditto.
     17        (main): Small style fixes.
     18
    1192012-03-04  Martin Robinson  <mrobinson@igalia.com>
    220
  • trunk/Source/WebKit/gtk/tests/testwebinspector.c

    r106851 r109720  
    6363}
    6464
    65 static gboolean closeInspector (WebKitWebInspector *inspector, int *timesClosed)
     65static gboolean closeInspector(WebKitWebInspector *inspector, int *timesClosed)
    6666{
    6767    *timesClosed = *timesClosed + 1;
     
    7171}
    7272
    73 static gboolean showInspector (WebKitWebInspector *inspector, gpointer data)
     73static gboolean showInspector(WebKitWebInspector *inspector, gpointer data)
    7474{
    7575    g_idle_add(quitLoop, NULL);
     
    7777}
    7878
     79static void loadFinished(WebKitWebView *webView, WebKitWebFrame *frame, gboolean *isLoadFinished)
     80{
     81    *isLoadFinished = TRUE;
     82    if (g_main_loop_is_running(loop))
     83        g_main_loop_quit(loop);
     84}
     85
    7986static void test_webkit_web_inspector_close_and_inspect()
    8087{
    8188    WebKitWebView *webView = WEBKIT_WEB_VIEW(webkit_web_view_new());
     89    loop = g_main_loop_new(NULL, TRUE);
    8290
    83     WebKitWebSettings *settings = webkit_web_view_get_settings(webView);
    84     g_object_set(settings, "enable-developer-extras", TRUE, NULL);
     91    gboolean isLoadFinished = FALSE;
     92    g_signal_connect(webView, "load-finished", G_CALLBACK(loadFinished), &isLoadFinished);
     93    webkit_web_view_load_string(webView,
     94                                "<html><body><p>woohoo</p></body></html>",
     95                                "text/html", "UTF-8", "file://");
     96    if (!isLoadFinished)
     97        g_main_loop_run(loop);
    8598
    86     webkit_web_view_load_string (webView,
    87                                  "<html><body><p>woohoo</p></body></html>",
    88                                  "text/html", "UTF-8", "file://");
    89 
     99    g_object_set(webkit_web_view_get_settings(webView), "enable-developer-extras", TRUE, NULL);
    90100    WebKitWebInspector *inspector = webkit_web_view_get_inspector(webView);
    91101
     
    101111    g_assert_cmpint(timesElementInspected, ==, 1);
    102112
    103     loop = g_main_loop_new(NULL, TRUE);
    104113    g_main_loop_run(loop);
    105114
     
    121130{
    122131    WebKitWebView *webView = WEBKIT_WEB_VIEW(webkit_web_view_new());
     132    loop = g_main_loop_new(NULL, TRUE);
    123133
    124     WebKitWebSettings *settings = webkit_web_view_get_settings(webView);
    125     g_object_set(settings, "enable-developer-extras", TRUE, NULL);
     134    gboolean isLoadFinished = FALSE;
     135    g_signal_connect(webView, "load-finished", G_CALLBACK(loadFinished), &isLoadFinished);
     136    webkit_web_view_load_string(webView,
     137                                "<html><body><p>woohoo</p></body></html>",
     138                                "text/html", "UTF-8", "file://");
     139    if (!isLoadFinished)
     140        g_main_loop_run(loop);
    126141
    127     webkit_web_view_load_string (webView,
    128                                  "<html><body><p>woohoo</p></body></html>",
    129                                  "text/html", "UTF-8", "file://");
    130 
     142    g_object_set(webkit_web_view_get_settings(webView), "enable-developer-extras", TRUE, NULL);
    131143    WebKitWebInspector *inspector = webkit_web_view_get_inspector(webView);
    132144
     
    142154    g_assert_cmpint(timesElementInspected, ==, 1);
    143155
    144     loop = g_main_loop_new(NULL, TRUE);
    145156    g_main_loop_run(loop);
    146157
     
    155166    gtk_test_init(&argc, &argv, NULL);
    156167
    157     testutils_relative_chdir("Programs/resources/inspector/inspector.html", argv[0]);
    158 
    159     char *currentDir = g_get_current_dir();
    160     g_setenv("WEBKIT_INSPECTOR_PATH", currentDir, TRUE);
    161     g_free(currentDir);
    162 
    163168    g_test_bug_base("https://bugs.webkit.org/");
    164169    g_test_add_func("/webkit/webinspector/destroy-inspected-web-view", test_webkit_web_inspector_destroy_inspected_web_view);
    165170    g_test_add_func("/webkit/webinspector/close-and-inspect", test_webkit_web_inspector_close_and_inspect);
    166171
    167     return g_test_run ();
     172    return g_test_run();
    168173}
    169174
  • trunk/Tools/ChangeLog

    r109719 r109720  
     12012-03-04  Martin Robinson  <mrobinson@igalia.com>
     2
     3        [GTK] "Console: undefined @0: ReferenceError: Can't find variable: WebInspector" during testwebinspector
     4        https://bugs.webkit.org/show_bug.cgi?id=80235
     5
     6        Reviewed by Philippe Normand.
     7
     8        * Scripts/run-gtk-tests:
     9        (TestRunner.run): Use the WEBKIT_INSPECTOR_PATH environment variable so that
     10        inspector resources path determination is shared by all tests.
     11
    1122012-03-04  Martin Robinson  <mrobinson@igalia.com>
    213
  • trunk/Tools/Scripts/run-gtk-tests

    r105736 r109720  
    9090        test_env = os.environ
    9191        test_env["DISPLAY"] = ":55"
     92        test_env["WEBKIT_INSPECTOR_PATH"] = os.path.abspath(os.path.join(self._programs_path, 'resources', 'inspector'))
    9293
    9394        exit_status = [0]
Note: See TracChangeset for help on using the changeset viewer.