Commit 61fac4c6 authored by mrobinson@webkit.org's avatar mrobinson@webkit.org

[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.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@105688 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 78f5eb75
2012-01-23 Martin Robinson <mrobinson@igalia.com>
[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 <alexander.faeroy@nokia.com>
[Qt] Implement SSL error handling QML API.
......@@ -138,3 +138,30 @@ void LoadTrackingTest::estimatedProgressChanged()
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);
}
......@@ -39,6 +39,11 @@ public:
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 {
......
......@@ -55,27 +55,26 @@ static void testLoadingError(LoadTrackingTest* test, gconstpointer)
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 @@ static void testLoadRequest(LoadTrackingTest* test, gconstpointer)
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 @@ static void testWebViewReload(LoadTrackingTest* test, gconstpointer)
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)
......
......@@ -48,7 +48,10 @@ void WebViewTest::loadURI(const char* uri)
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);
}
......
......@@ -31,10 +31,10 @@ public:
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();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment