Beispiel #1
0
static void load_wentback_status_changed_cb(GObject* object, GParamSpec* pspec, WebLoadingFixture* fixture)
{
    WebKitLoadStatus status = webkit_web_view_get_load_status(WEBKIT_WEB_VIEW(object));
    char* uri_string;
    char* uri_string2;

    uri_string = get_uri_for_path("/test_loading_status");
    uri_string2 = get_uri_for_path("/test_loading_status2");

    switch(status) {
    case WEBKIT_LOAD_PROVISIONAL:
        g_assert_cmpstr(webkit_web_view_get_uri(fixture->webView), ==, uri_string2);
        break;
    case WEBKIT_LOAD_COMMITTED:
        g_assert_cmpstr(webkit_web_view_get_uri(fixture->webView), ==, uri_string);
        break;
    case WEBKIT_LOAD_FAILED:
        g_assert_not_reached();
        break;
    case WEBKIT_LOAD_FINISHED:
        g_assert_cmpstr(webkit_web_view_get_uri(fixture->webView), ==, uri_string);
        g_main_loop_quit(fixture->loop);
        break;
    default:
        break;
    }

    g_free(uri_string);
    g_free(uri_string2);
}
Beispiel #2
0
static void test_loading_goback(WebLoadingFixture* fixture, gconstpointer data)
{
    char* uri_string;

    g_signal_connect(fixture->webView, "notify::load-status", G_CALLBACK(load_goback_status_changed_cb), fixture);

    g_signal_connect(fixture->webView, "load-error", G_CALLBACK(load_error_test), fixture);

    uri_string = get_uri_for_path("/test_loading_status");
    webkit_web_view_load_uri(fixture->webView, uri_string);
    g_free(uri_string);

    g_main_loop_run(fixture->loop);

    fixture->has_been_provisional = FALSE;
    fixture->has_been_committed = FALSE;
    fixture->has_been_first_visually_non_empty_layout = FALSE;
    fixture->has_been_finished = FALSE;
    fixture->has_been_failed = FALSE;
    fixture->has_been_load_error = FALSE;

    uri_string = get_uri_for_path("/test_loading_status2");
    webkit_web_view_load_uri(fixture->webView, uri_string);
    g_free(uri_string);

    g_main_loop_run(fixture->loop);

    g_signal_handlers_disconnect_by_func(fixture->webView, load_goback_status_changed_cb, fixture);

    fixture->has_been_provisional = FALSE;
    fixture->has_been_committed = FALSE;
    fixture->has_been_first_visually_non_empty_layout = FALSE;
    fixture->has_been_finished = FALSE;
    fixture->has_been_failed = FALSE;
    fixture->has_been_load_error = FALSE;

    g_signal_connect(fixture->webView, "notify::load-status", G_CALLBACK(load_wentback_status_changed_cb), fixture);
    webkit_web_view_go_back(fixture->webView);

    g_main_loop_run(fixture->loop);

    g_signal_handlers_disconnect_by_func(fixture->webView, load_wentback_status_changed_cb, fixture);
}
Beispiel #3
0
static void test_loading_cancelled(WebLoadingFixture* fixture, gconstpointer data)
{
    char* uri_string;

    g_test_bug("29644");

    g_signal_connect(fixture->webView, "load-error", G_CALLBACK(load_cancelled_cb), fixture);
    g_signal_connect(fixture->webView, "notify::load-status", G_CALLBACK(load_cancelled_status_changed_cb), fixture);

    uri_string = get_uri_for_path("/test_loading_cancelled");
    webkit_web_view_load_uri(fixture->webView, uri_string);
    g_free(uri_string);

    g_main_loop_run(fixture->loop);
}
Beispiel #4
0
static void
fixture_setup (Fixture *fixture, gconstpointer data)
{
  char *tmp_filename;
  char *dest_file;

  tmp_filename = ephy_file_tmp_filename ("ephy-download-XXXXXX", NULL);
  dest_file = g_build_filename (ephy_file_tmp_dir (), tmp_filename, NULL);

  fixture->source = get_uri_for_path ("/default");
  fixture->download = ephy_download_new_for_uri (fixture->source);
  fixture->destination = g_filename_to_uri (dest_file, NULL, NULL);
  fixture->loop = g_main_loop_new (NULL, TRUE);

  ephy_download_set_destination_uri (fixture->download, fixture->destination);

  g_free (tmp_filename);
  g_free (dest_file);
}
Beispiel #5
0
static void test_loading_error(WebLoadingFixture* fixture, gconstpointer data)
{
    char* uri_string;

    g_test_bug("28842");

    g_signal_connect(fixture->webView, "load-error", G_CALLBACK(load_error_cb), fixture);
    g_signal_connect(fixture->webView, "notify::load-status", G_CALLBACK(load_error_status_changed_cb), fixture);

    uri_string = get_uri_for_path("/test_load_error");
    webkit_web_view_load_uri(fixture->webView, uri_string);
    g_free(uri_string);

    g_main_loop_run(fixture->loop);

    g_assert(fixture->has_been_provisional);
    g_assert(!fixture->has_been_committed);
    g_assert(fixture->has_been_load_error);
    g_assert(fixture->has_been_failed);
    g_assert(!fixture->has_been_finished);
}
Beispiel #6
0
static void test_loading_status(WebLoadingFixture* fixture, gconstpointer data)
{
    char* uri_string;

    g_assert_cmpint(webkit_web_view_get_load_status(fixture->webView), ==, WEBKIT_LOAD_PROVISIONAL);

    g_object_connect(G_OBJECT(fixture->webView),
                     "signal::notify::load-status", G_CALLBACK(status_changed_cb), fixture,
                     "signal::load-finished", G_CALLBACK(load_finished_cb), fixture,
                     NULL);

    uri_string = get_uri_for_path("/test_loading_status");

    /* load_uri will trigger the navigation-policy-decision-requested
     * signal emission;
     */
    webkit_web_view_load_uri(fixture->webView, uri_string);
    g_free(uri_string);

    g_main_loop_run(fixture->loop);
}