diff options
author | Lorry Tar Creator <lorry-tar-importer@lorry> | 2016-04-10 09:28:39 +0000 |
---|---|---|
committer | Lorry Tar Creator <lorry-tar-importer@lorry> | 2016-04-10 09:28:39 +0000 |
commit | 32761a6cee1d0dee366b885b7b9c777e67885688 (patch) | |
tree | d6bec92bebfb216f4126356e55518842c2f476a1 /Tools/TestWebKitAPI/gtk/WebKit2Gtk/LoadTrackingTest.cpp | |
parent | a4e969f4965059196ca948db781e52f7cfebf19e (diff) | |
download | WebKitGtk-tarball-32761a6cee1d0dee366b885b7b9c777e67885688.tar.gz |
webkitgtk-2.4.11webkitgtk-2.4.11
Diffstat (limited to 'Tools/TestWebKitAPI/gtk/WebKit2Gtk/LoadTrackingTest.cpp')
-rw-r--r-- | Tools/TestWebKitAPI/gtk/WebKit2Gtk/LoadTrackingTest.cpp | 81 |
1 files changed, 26 insertions, 55 deletions
diff --git a/Tools/TestWebKitAPI/gtk/WebKit2Gtk/LoadTrackingTest.cpp b/Tools/TestWebKitAPI/gtk/WebKit2Gtk/LoadTrackingTest.cpp index e78ce45ee..211fa8b82 100644 --- a/Tools/TestWebKitAPI/gtk/WebKit2Gtk/LoadTrackingTest.cpp +++ b/Tools/TestWebKitAPI/gtk/WebKit2Gtk/LoadTrackingTest.cpp @@ -50,15 +50,9 @@ static void loadChangedCallback(WebKitWebView* webView, WebKitLoadEvent loadEven break; } case WEBKIT_LOAD_FINISHED: - if (!test->m_loadFailed) { - g_assert(!webkit_web_view_is_loading(webView)); + g_assert(!webkit_web_view_is_loading(webView)); + if (!test->m_loadFailed) g_assert_cmpstr(test->m_activeURI.data(), ==, webkit_web_view_get_uri(webView)); - } else if (!g_error_matches(test->m_error.get(), WEBKIT_NETWORK_ERROR, WEBKIT_NETWORK_ERROR_CANCELLED)) { - // When a new load is started before the previous one has finished, we receive the load-finished signal - // of the ongoing load while we already have a provisional URL for the new load. This is the only case - // where isloading is true when the load has finished. - g_assert(!webkit_web_view_is_loading(webView)); - } test->loadFinished(); break; default: @@ -69,24 +63,19 @@ static void loadChangedCallback(WebKitWebView* webView, WebKitLoadEvent loadEven static void loadFailedCallback(WebKitWebView* webView, WebKitLoadEvent loadEvent, const char* failingURI, GError* error, LoadTrackingTest* test) { test->m_loadFailed = true; - - g_assert(error); test->m_error.reset(g_error_copy(error)); - if (!g_error_matches(error, WEBKIT_NETWORK_ERROR, WEBKIT_NETWORK_ERROR_CANCELLED)) { - // When a new load is started before the previous one has finished, we receive the load-failed signal - // of the ongoing load while we already have a provisional URL for the new load. This is the only case - // where is-loading is true when the load has failed. - g_assert(!webkit_web_view_is_loading(webView)); - } - switch (loadEvent) { case WEBKIT_LOAD_STARTED: - g_assert_cmpstr(test->m_activeURI.data(), ==, failingURI); + g_assert(!webkit_web_view_is_loading(webView)); + g_assert_cmpstr(test->m_activeURI.data(), ==, webkit_web_view_get_uri(webView)); + g_assert(error); test->provisionalLoadFailed(failingURI, error); break; case WEBKIT_LOAD_COMMITTED: + g_assert(!webkit_web_view_is_loading(webView)); g_assert_cmpstr(test->m_activeURI.data(), ==, webkit_web_view_get_uri(webView)); + g_assert(error); test->loadFailed(failingURI, error); break; default: @@ -94,16 +83,6 @@ static void loadFailedCallback(WebKitWebView* webView, WebKitLoadEvent loadEvent } } -static gboolean loadFailedWithTLSErrorsCallback(WebKitWebView* webView, const char* failingURI, GTlsCertificate* certificate, GTlsCertificateFlags tlsErrors, LoadTrackingTest* test) -{ - test->m_loadFailed = true; - g_assert(!webkit_web_view_is_loading(webView)); - g_assert_cmpstr(test->m_activeURI.data(), ==, failingURI); - g_assert(G_IS_TLS_CERTIFICATE(certificate)); - g_assert(tlsErrors); - return test->loadFailedWithTLSErrors(failingURI, certificate, tlsErrors); -} - static void estimatedProgressChangedCallback(GObject*, GParamSpec*, LoadTrackingTest* test) { test->estimatedProgressChanged(); @@ -115,7 +94,6 @@ LoadTrackingTest::LoadTrackingTest() { g_signal_connect(m_webView, "load-changed", G_CALLBACK(loadChangedCallback), this); g_signal_connect(m_webView, "load-failed", G_CALLBACK(loadFailedCallback), this); - g_signal_connect(m_webView, "load-failed-with-tls-errors", G_CALLBACK(loadFailedWithTLSErrorsCallback), this); g_signal_connect(m_webView, "notify::estimated-load-progress", G_CALLBACK(estimatedProgressChangedCallback), this); g_assert(!webkit_web_view_get_uri(m_webView)); @@ -165,12 +143,6 @@ void LoadTrackingTest::loadFailed(const gchar* failingURI, GError* error) m_loadEvents.append(LoadFailed); } -bool LoadTrackingTest::loadFailedWithTLSErrors(const gchar* /*failingURI*/, GTlsCertificate*, GTlsCertificateFlags) -{ - m_loadEvents.append(LoadFailedWithTLSErrors); - return false; -} - void LoadTrackingTest::estimatedProgressChanged() { double progress = webkit_web_view_get_estimated_load_progress(m_webView); @@ -180,57 +152,56 @@ void LoadTrackingTest::estimatedProgressChanged() void LoadTrackingTest::loadURI(const char* uri) { - reset(); + m_loadEvents.clear(); + m_estimatedProgress = 0; + m_error.reset(); WebViewTest::loadURI(uri); } void LoadTrackingTest::loadHtml(const char* html, const char* baseURI) { - reset(); + m_loadEvents.clear(); + m_estimatedProgress = 0; + m_error.reset(); WebViewTest::loadHtml(html, baseURI); } void LoadTrackingTest::loadPlainText(const char* plainText) { - reset(); + m_loadEvents.clear(); + m_estimatedProgress = 0; + m_error.reset(); WebViewTest::loadPlainText(plainText); } -void LoadTrackingTest::loadBytes(GBytes* bytes, const char* mimeType, const char* encoding, const char* baseURI) -{ - reset(); - WebViewTest::loadBytes(bytes, mimeType, encoding, baseURI); -} - void LoadTrackingTest::loadRequest(WebKitURIRequest* request) { - reset(); + m_loadEvents.clear(); + m_estimatedProgress = 0; + m_error.reset(); WebViewTest::loadRequest(request); } void LoadTrackingTest::reload() { - reset(); + m_loadEvents.clear(); + m_estimatedProgress = 0; + m_error.reset(); webkit_web_view_reload(m_webView); } void LoadTrackingTest::goBack() { - reset(); + m_loadEvents.clear(); + m_estimatedProgress = 0; + m_error.reset(); WebViewTest::goBack(); } void LoadTrackingTest::goForward() { - reset(); - WebViewTest::goForward(); -} - -void LoadTrackingTest::reset() -{ - m_runLoadUntilCompletion = false; - m_loadFailed = false; m_loadEvents.clear(); m_estimatedProgress = 0; m_error.reset(); + WebViewTest::goForward(); } |