summaryrefslogtreecommitdiffstats
path: root/src/3rdparty/webkit/Source/WebKit/qt/tests
diff options
context:
space:
mode:
authorAdemar de Souza Reis Jr <ademar.reis@openbossa.org>2011-08-26 21:12:05 (GMT)
committerSergio Ahumada <sergio.ahumada@nokia.com>2011-08-26 21:26:31 (GMT)
commitfe2da7c82f52e16b87569fe8ef3561014bc8c854 (patch)
tree801c5c8664ec2d1be55d7c618b0abd9e18ce5294 /src/3rdparty/webkit/Source/WebKit/qt/tests
parentf801bd952c23e0d34c48f35d4d1b80d4bf355051 (diff)
downloadQt-fe2da7c82f52e16b87569fe8ef3561014bc8c854.zip
Qt-fe2da7c82f52e16b87569fe8ef3561014bc8c854.tar.gz
Qt-fe2da7c82f52e16b87569fe8ef3561014bc8c854.tar.bz2
Updated WebKit to dda59e50379214c098f365a39c4d64b39ced427e
Diffstat (limited to 'src/3rdparty/webkit/Source/WebKit/qt/tests')
-rw-r--r--src/3rdparty/webkit/Source/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp57
1 files changed, 14 insertions, 43 deletions
diff --git a/src/3rdparty/webkit/Source/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp b/src/3rdparty/webkit/Source/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp
index b423317..c9e862a 100644
--- a/src/3rdparty/webkit/Source/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp
+++ b/src/3rdparty/webkit/Source/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp
@@ -619,8 +619,7 @@ private slots:
void javaScriptWindowObjectCleared();
void javaScriptWindowObjectClearedOnEvaluate();
void setHtml();
- void setHtmlWithImageResource();
- void setHtmlWithStylesheetResource();
+ void setHtmlWithResource();
void setHtmlWithBaseURL();
void setHtmlWithJSAlert();
void ipv6HostEncoding();
@@ -650,7 +649,7 @@ private slots:
void setContent_data();
void setContent();
void setCacheLoadControlAttribute();
- //void setUrlWithPendingLoads();
+ void setUrlWithPendingLoads();
void setUrlWithFragment_data();
void setUrlWithFragment();
void setUrlToEmpty();
@@ -2500,37 +2499,24 @@ void tst_QWebFrame::setHtml()
QCOMPARE(spy.count(), 1);
}
-void tst_QWebFrame::setHtmlWithImageResource()
+void tst_QWebFrame::setHtmlWithResource()
{
- // By default, only security origins of local files can load local resources.
- // So we should specify baseUrl to be a local file in order to get a proper origin and load the local image.
+ QString html("<html><body><p>hello world</p><img src='qrc:/image.png'/></body></html>");
- QLatin1String html("<html><body><p>hello world</p><img src='qrc:/image.png'/></body></html>");
QWebPage page;
QWebFrame* frame = page.mainFrame();
- frame->setHtml(html, QUrl(QLatin1String("file:///path/to/file")));
+ // in few seconds, the image should be completey loaded
+ QSignalSpy spy(&page, SIGNAL(loadFinished(bool)));
+ frame->setHtml(html);
waitForSignal(frame, SIGNAL(loadFinished(bool)), 200);
+ QCOMPARE(spy.count(), 1);
QCOMPARE(frame->evaluateJavaScript("document.images.length").toInt(), 1);
QCOMPARE(frame->evaluateJavaScript("document.images[0].width").toInt(), 128);
QCOMPARE(frame->evaluateJavaScript("document.images[0].height").toInt(), 128);
- // Now we test the opposite: without a baseUrl as a local file, we cannot request local resources.
-
- frame->setHtml(html);
- waitForSignal(frame, SIGNAL(loadFinished(bool)), 200);
- QCOMPARE(frame->evaluateJavaScript("document.images.length").toInt(), 1);
- QCOMPARE(frame->evaluateJavaScript("document.images[0].width").toInt(), 0);
- QCOMPARE(frame->evaluateJavaScript("document.images[0].height").toInt(), 0);
-}
-
-void tst_QWebFrame::setHtmlWithStylesheetResource()
-{
- // By default, only security origins of local files can load local resources.
- // So we should specify baseUrl to be a local file in order to be able to download the local stylesheet.
-
- const char* htmlData =
+ QString html2 =
"<html>"
"<head>"
"<link rel='stylesheet' href='qrc:/style.css' type='text/css' />"
@@ -2539,29 +2525,18 @@ void tst_QWebFrame::setHtmlWithStylesheetResource()
"<p id='idP'>some text</p>"
"</body>"
"</html>";
- QLatin1String html(htmlData);
- QWebPage page;
- QWebFrame* frame = page.mainFrame();
- QWebElement webElement;
- frame->setHtml(html, QUrl(QLatin1String("qrc:///file")));
+ // in few seconds, the CSS should be completey loaded
+ frame->setHtml(html2);
waitForSignal(frame, SIGNAL(loadFinished(bool)), 200);
- webElement = frame->documentElement().findFirst("p");
- QCOMPARE(webElement.styleProperty("color", QWebElement::CascadedStyle), QLatin1String("red"));
+ QCOMPARE(spy.size(), 2);
- // Now we test the opposite: without a baseUrl as a local file, we cannot request local resources.
-
- frame->setHtml(html, QUrl(QLatin1String("http://www.example.com/")));
- waitForSignal(frame, SIGNAL(loadFinished(bool)), 200);
- webElement = frame->documentElement().findFirst("p");
- QCOMPARE(webElement.styleProperty("color", QWebElement::CascadedStyle), QString());
+ QWebElement p = frame->documentElement().findAll("p").at(0);
+ QCOMPARE(p.styleProperty("color", QWebElement::CascadedStyle), QLatin1String("red"));
}
void tst_QWebFrame::setHtmlWithBaseURL()
{
- // This tests if baseUrl is indeed affecting the relative paths from resources.
- // As we are using a local file as baseUrl, its security origin should be able to load local resources.
-
if (!QDir(TESTS_SOURCE_DIR).exists())
QSKIP(QString("This test requires access to resources found in '%1'").arg(TESTS_SOURCE_DIR).toLatin1().constData(), SkipAll);
@@ -3391,16 +3366,12 @@ void tst_QWebFrame::webElementSlotOnly()
QCOMPARE(evalJS("myWebElementSlotObject.tagName"), QString("BODY"));
}
-// [Qt] Fix tst_QWebFrame::setUrlWithPendingLoads() API test
-// https://bugs.webkit.org/show_bug.cgi?id=63237
-/*
void tst_QWebFrame::setUrlWithPendingLoads()
{
QWebPage page;
page.mainFrame()->setHtml("<img src='dummy:'/>");
page.mainFrame()->setUrl(QUrl("about:blank"));
}
-*/
void tst_QWebFrame::setUrlWithFragment_data()
{