Title: [105688] trunk/Source/WebKit2
Revision
105688
Author
[email protected]
Date
2012-01-23 20:40:30 -0800 (Mon, 23 Jan 2012)

Log Message

[GTK][WK2] Make the LoadTracking and WebView test fixtures more flexible
https://bugs.webkit.org/show_bug.cgi?id=76755

Reviewed by Alejandro G. Castro.

Always clear the loading events when loading new content in the load tracking
test. In the WebView test correctly handle loading HTML with a URL that isn't
"about:blank."

* UIProcess/API/gtk/tests/LoadTrackingTest.cpp:
(LoadTrackingTest::loadURI): Reset the class state when starting a new load.
(LoadTrackingTest::loadHtml): Ditto.
(LoadTrackingTest::loadPlainText): Ditto.
(LoadTrackingTest::loadRequest): Ditto.
* UIProcess/API/gtk/tests/LoadTrackingTest.h: Added new method definitions.
* UIProcess/API/gtk/tests/TestWebKitWebLoaderClient.cpp:
(assertNormalLoadHappened): No longer clear loading events. The fixture handles that now.
(testLoadHtml): Update to reflect new method name.
(testLoadPlainText): Ditto.
(testLoadRequest): Ditto.
(testWebViewReload): Ditto.
* UIProcess/API/gtk/tests/WebViewTest.cpp:
(WebViewTest::loadHtml): Properly interpret the baseURL parameter.
* UIProcess/API/gtk/tests/WebViewTest.h: Make loading methods virtual.

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (105687 => 105688)


--- trunk/Source/WebKit2/ChangeLog	2012-01-24 04:38:29 UTC (rev 105687)
+++ trunk/Source/WebKit2/ChangeLog	2012-01-24 04:40:30 UTC (rev 105688)
@@ -1,3 +1,30 @@
+2012-01-23  Martin Robinson  <[email protected]>
+
+        [GTK][WK2] Make the LoadTracking and WebView test fixtures more flexible
+        https://bugs.webkit.org/show_bug.cgi?id=76755
+
+        Reviewed by Alejandro G. Castro.
+
+        Always clear the loading events when loading new content in the load tracking
+        test. In the WebView test correctly handle loading HTML with a URL that isn't
+        "about:blank."
+
+        * UIProcess/API/gtk/tests/LoadTrackingTest.cpp:
+        (LoadTrackingTest::loadURI): Reset the class state when starting a new load.
+        (LoadTrackingTest::loadHtml): Ditto.
+        (LoadTrackingTest::loadPlainText): Ditto.
+        (LoadTrackingTest::loadRequest): Ditto.
+        * UIProcess/API/gtk/tests/LoadTrackingTest.h: Added new method definitions.
+        * UIProcess/API/gtk/tests/TestWebKitWebLoaderClient.cpp:
+        (assertNormalLoadHappened): No longer clear loading events. The fixture handles that now.
+        (testLoadHtml): Update to reflect new method name.
+        (testLoadPlainText): Ditto.
+        (testLoadRequest): Ditto.
+        (testWebViewReload): Ditto.
+        * UIProcess/API/gtk/tests/WebViewTest.cpp:
+        (WebViewTest::loadHtml): Properly interpret the baseURL parameter.
+        * UIProcess/API/gtk/tests/WebViewTest.h: Make loading methods virtual.
+
 2012-01-23  Alexander Færøy  <[email protected]>
 
         [Qt] Implement SSL error handling QML API.

Modified: trunk/Source/WebKit2/UIProcess/API/gtk/tests/LoadTrackingTest.cpp (105687 => 105688)


--- trunk/Source/WebKit2/UIProcess/API/gtk/tests/LoadTrackingTest.cpp	2012-01-24 04:38:29 UTC (rev 105687)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/tests/LoadTrackingTest.cpp	2012-01-24 04:40:30 UTC (rev 105688)
@@ -138,3 +138,30 @@
     m_estimatedProgress = progress;
 }
 
+void LoadTrackingTest::loadURI(const char* uri)
+{
+    m_loadEvents.clear();
+    m_estimatedProgress = 0;
+    WebViewTest::loadURI(uri);
+}
+
+void LoadTrackingTest::loadHtml(const char* html, const char* baseURI)
+{
+    m_loadEvents.clear();
+    m_estimatedProgress = 0;
+    WebViewTest::loadHtml(html, baseURI);
+}
+
+void LoadTrackingTest::loadPlainText(const char* plainText)
+{
+    m_loadEvents.clear();
+    m_estimatedProgress = 0;
+    WebViewTest::loadPlainText(plainText);
+}
+
+void LoadTrackingTest::loadRequest(WebKitURIRequest* request)
+{
+    m_loadEvents.clear();
+    m_estimatedProgress = 0;
+    WebViewTest::loadRequest(request);
+}

Modified: trunk/Source/WebKit2/UIProcess/API/gtk/tests/LoadTrackingTest.h (105687 => 105688)


--- trunk/Source/WebKit2/UIProcess/API/gtk/tests/LoadTrackingTest.h	2012-01-24 04:38:29 UTC (rev 105687)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/tests/LoadTrackingTest.h	2012-01-24 04:40:30 UTC (rev 105688)
@@ -39,6 +39,11 @@
     virtual void loadFailed(const char* failingURI, GError*);
     virtual void estimatedProgressChanged();
 
+    void loadURI(const char* uri);
+    void loadHtml(const char* html, const char* baseURI);
+    void loadPlainText(const char* plainText);
+    void loadRequest(WebKitURIRequest*);
+
     void setRedirectURI(const char* uri) { m_redirectURI = uri; }
 
     enum LoadEvents {

Modified: trunk/Source/WebKit2/UIProcess/API/gtk/tests/TestWebKitWebLoaderClient.cpp (105687 => 105688)


--- trunk/Source/WebKit2/UIProcess/API/gtk/tests/TestWebKitWebLoaderClient.cpp	2012-01-24 04:38:29 UTC (rev 105687)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/tests/TestWebKitWebLoaderClient.cpp	2012-01-24 04:40:30 UTC (rev 105688)
@@ -55,27 +55,26 @@
     g_assert_cmpint(events[2], ==, LoadTrackingTest::LoadFinished);
 }
 
-static void assertNormalLoadHappenedAndClearEvents(Vector<LoadTrackingTest::LoadEvents>& events)
+static void assertNormalLoadHappened(Vector<LoadTrackingTest::LoadEvents>& events)
 {
     g_assert_cmpint(events.size(), ==, 3);
     g_assert_cmpint(events[0], ==, LoadTrackingTest::ProvisionalLoadStarted);
     g_assert_cmpint(events[1], ==, LoadTrackingTest::LoadCommitted);
     g_assert_cmpint(events[2], ==, LoadTrackingTest::LoadFinished);
-    events.clear();
 }
 
 static void testLoadHtml(LoadTrackingTest* test, gconstpointer)
 {
     test->loadHtml("<html><body>Hello WebKit-GTK+</body></html>", 0);
     test->waitUntilLoadFinished();
-    assertNormalLoadHappenedAndClearEvents(test->m_loadEvents);
+    assertNormalLoadHappened(test->m_loadEvents);
 }
 
 static void testLoadPlainText(LoadTrackingTest* test, gconstpointer)
 {
     test->loadPlainText("Hello WebKit-GTK+");
     test->waitUntilLoadFinished();
-    assertNormalLoadHappenedAndClearEvents(test->m_loadEvents);
+    assertNormalLoadHappened(test->m_loadEvents);
 }
 
 static void testLoadRequest(LoadTrackingTest* test, gconstpointer)
@@ -83,7 +82,7 @@
     GRefPtr<WebKitURIRequest> request(webkit_uri_request_new(kServer->getURIForPath("/normal").data()));
     test->loadRequest(request.get());
     test->waitUntilLoadFinished();
-    assertNormalLoadHappenedAndClearEvents(test->m_loadEvents);
+    assertNormalLoadHappened(test->m_loadEvents);
 }
 
 class LoadStopTrackingTest : public LoadTrackingTest {
@@ -131,11 +130,11 @@
 
     test->loadURI(kServer->getURIForPath("/normal").data());
     test->waitUntilLoadFinished();
-    assertNormalLoadHappenedAndClearEvents(test->m_loadEvents);
+    assertNormalLoadHappened(test->m_loadEvents);
 
     webkit_web_view_reload(test->m_webView);
     test->waitUntilLoadFinished();
-    assertNormalLoadHappenedAndClearEvents(test->m_loadEvents);
+    assertNormalLoadHappened(test->m_loadEvents);
 }
 
 static void testLoadProgress(LoadTrackingTest* test, gconstpointer)

Modified: trunk/Source/WebKit2/UIProcess/API/gtk/tests/WebViewTest.cpp (105687 => 105688)


--- trunk/Source/WebKit2/UIProcess/API/gtk/tests/WebViewTest.cpp	2012-01-24 04:38:29 UTC (rev 105687)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/tests/WebViewTest.cpp	2012-01-24 04:40:30 UTC (rev 105688)
@@ -48,7 +48,10 @@
 
 void WebViewTest::loadHtml(const char* html, const char* baseURI)
 {
-    m_activeURI = "about:blank";
+    if (!baseURI)
+        m_activeURI = "about:blank";
+    else
+        m_activeURI = baseURI;
     webkit_web_view_load_html(m_webView, html, baseURI);
 }
 

Modified: trunk/Source/WebKit2/UIProcess/API/gtk/tests/WebViewTest.h (105687 => 105688)


--- trunk/Source/WebKit2/UIProcess/API/gtk/tests/WebViewTest.h	2012-01-24 04:38:29 UTC (rev 105687)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/tests/WebViewTest.h	2012-01-24 04:40:30 UTC (rev 105688)
@@ -31,10 +31,10 @@
     WebViewTest();
     virtual ~WebViewTest();
 
-    void loadURI(const char* uri);
-    void loadHtml(const char* html, const char* baseURI);
-    void loadPlainText(const char* plainText);
-    void loadRequest(WebKitURIRequest*);
+    virtual void loadURI(const char* uri);
+    virtual void loadHtml(const char* html, const char* baseURI);
+    virtual void loadPlainText(const char* plainText);
+    virtual void loadRequest(WebKitURIRequest*);
     void replaceContent(const char* html, const char* contentURI, const char* baseURI);
     void goBack();
     void goForward();
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to