summaryrefslogtreecommitdiff
path: root/Source/WebKit2/UIProcess/API/gtk/tests
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@digia.com>2012-09-24 13:09:44 +0200
committerSimon Hausmann <simon.hausmann@digia.com>2012-09-24 13:09:44 +0200
commitdc6262b587c71c14e30d93e57ed812e36a79a33e (patch)
tree03ff986e7aa38bba0c0ef374f44fda52aff93f01 /Source/WebKit2/UIProcess/API/gtk/tests
parent02e1fbbefd49229b102ef107bd70ce974a2d85fb (diff)
downloadqtwebkit-dc6262b587c71c14e30d93e57ed812e36a79a33e.tar.gz
Imported WebKit commit 6339232fec7f5d9984a33388aecfd2cbc7832053 (http://svn.webkit.org/repository/webkit/trunk@129343)
New snapshot with build fixes for latest qtbase
Diffstat (limited to 'Source/WebKit2/UIProcess/API/gtk/tests')
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/tests/LoadTrackingTest.cpp6
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/tests/TestLoaderClient.cpp58
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/tests/TestWebKitWebView.cpp2
3 files changed, 65 insertions, 1 deletions
diff --git a/Source/WebKit2/UIProcess/API/gtk/tests/LoadTrackingTest.cpp b/Source/WebKit2/UIProcess/API/gtk/tests/LoadTrackingTest.cpp
index d370de938..b904111f4 100644
--- a/Source/WebKit2/UIProcess/API/gtk/tests/LoadTrackingTest.cpp
+++ b/Source/WebKit2/UIProcess/API/gtk/tests/LoadTrackingTest.cpp
@@ -26,16 +26,19 @@ static void loadChangedCallback(WebKitWebView* webView, WebKitLoadEvent loadEven
{
switch (loadEvent) {
case WEBKIT_LOAD_STARTED:
+ g_assert(webkit_web_view_is_loading(webView));
g_assert_cmpstr(test->m_activeURI.data(), ==, webkit_web_view_get_uri(webView));
test->provisionalLoadStarted();
break;
case WEBKIT_LOAD_REDIRECTED:
+ g_assert(webkit_web_view_is_loading(webView));
test->m_activeURI = webkit_web_view_get_uri(webView);
if (!test->m_redirectURI.isNull())
g_assert_cmpstr(test->m_redirectURI.data(), ==, test->m_activeURI.data());
test->provisionalLoadReceivedServerRedirect();
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));
// Check that on committed we always have a main resource with a response.
@@ -47,6 +50,7 @@ static void loadChangedCallback(WebKitWebView* webView, WebKitLoadEvent loadEven
break;
}
case WEBKIT_LOAD_FINISHED:
+ 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));
test->loadFinished();
@@ -62,11 +66,13 @@ static void loadFailedCallback(WebKitWebView* webView, WebKitLoadEvent loadEvent
switch (loadEvent) {
case WEBKIT_LOAD_STARTED:
+ 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);
diff --git a/Source/WebKit2/UIProcess/API/gtk/tests/TestLoaderClient.cpp b/Source/WebKit2/UIProcess/API/gtk/tests/TestLoaderClient.cpp
index dabf072e3..c3a14193d 100644
--- a/Source/WebKit2/UIProcess/API/gtk/tests/TestLoaderClient.cpp
+++ b/Source/WebKit2/UIProcess/API/gtk/tests/TestLoaderClient.cpp
@@ -226,6 +226,62 @@ static void testWebViewActiveURI(ViewURITrackingTest* test, gconstpointer)
test->waitUntilLoadFinished();
}
+class ViewIsLoadingTest: public LoadTrackingTest {
+public:
+ MAKE_GLIB_TEST_FIXTURE(ViewIsLoadingTest);
+
+ static void isLoadingChanged(GObject*, GParamSpec*, ViewIsLoadingTest* test)
+ {
+ if (webkit_web_view_is_loading(test->m_webView))
+ test->beginLoad();
+ else
+ test->endLoad();
+ }
+
+ ViewIsLoadingTest()
+ {
+ g_signal_connect(m_webView, "notify::is-loading", G_CALLBACK(isLoadingChanged), this);
+ }
+
+ void beginLoad()
+ {
+ // New load, load-started hasn't been emitted yet.
+ g_assert(m_loadEvents.isEmpty());
+ g_assert_cmpstr(webkit_web_view_get_uri(m_webView), ==, m_activeURI.data());
+ }
+
+ void endLoad()
+ {
+ // Load finish, load-finished and load-failed haven't been emitted yet.
+ g_assert(!m_loadEvents.isEmpty());
+ g_assert(!m_loadEvents.contains(LoadTrackingTest::LoadFinished));
+ g_assert(!m_loadEvents.contains(LoadTrackingTest::LoadFailed));
+ }
+};
+
+static void testWebViewIsLoading(ViewIsLoadingTest* test, gconstpointer)
+{
+ test->loadURI(kServer->getURIForPath("/normal").data());
+ test->waitUntilLoadFinished();
+
+ test->reload();
+ test->waitUntilLoadFinished();
+
+ test->loadURI(kServer->getURIForPath("/error").data());
+ test->waitUntilLoadFinished();
+
+ test->loadURI(kServer->getURIForPath("/normal").data());
+ test->waitUntilLoadFinished();
+ test->loadURI(kServer->getURIForPath("/normal2").data());
+ test->waitUntilLoadFinished();
+
+ test->goBack();
+ test->waitUntilLoadFinished();
+
+ test->goForward();
+ test->waitUntilLoadFinished();
+}
+
static void serverCallback(SoupServer* server, SoupMessage* message, const char* path, GHashTable*, SoupClientContext*, gpointer)
{
static const char* responseString = "<html><body>Testing!Testing!Testing!Testing!Testing!Testing!Testing!"
@@ -281,6 +337,8 @@ void beforeAll()
// This test checks that web view notify::uri signal is correctly emitted
// and the uri is already updated when loader client signals are emitted.
ViewURITrackingTest::add("WebKitWebView", "active-uri", testWebViewActiveURI);
+
+ ViewIsLoadingTest::add("WebKitWebView", "is-loading", testWebViewIsLoading);
}
void afterAll()
diff --git a/Source/WebKit2/UIProcess/API/gtk/tests/TestWebKitWebView.cpp b/Source/WebKit2/UIProcess/API/gtk/tests/TestWebKitWebView.cpp
index cc67c5d63..02e8138de 100644
--- a/Source/WebKit2/UIProcess/API/gtk/tests/TestWebKitWebView.cpp
+++ b/Source/WebKit2/UIProcess/API/gtk/tests/TestWebKitWebView.cpp
@@ -464,7 +464,7 @@ static void testWebViewWindowProperties(UIClientTest* test, gconstpointer)
static void testWebViewMouseTarget(UIClientTest* test, gconstpointer)
{
- test->showInWindowAndWaitUntilMapped();
+ test->showInWindowAndWaitUntilMapped(GTK_WINDOW_TOPLEVEL);
const char* linksHoveredHTML =
"<html><body>"