Title: [95545] trunk/Source/WebKit2
- Revision
- 95545
- Author
- [email protected]
- Date
- 2011-09-20 09:08:20 -0700 (Tue, 20 Sep 2011)
Log Message
[Qt][WK2] Export QNetworkReply in the QtWebKit QML module.
https://bugs.webkit.org/show_bug.cgi?id=68401
Reviewed by Simon Hausmann.
Add QNetworkReply in the QtWebKit module. We use the enum QNetworkReply::NetworkError
as the error code when the load fails. It is not used in the QtQuick module therefore
the QML team thinks it should belong here. Also added some auto-tests to cover the
loading errors.
* UIProcess/API/qt/qmlplugin/plugin.cpp:
(WebKit2QmlPlugin::registerTypes):
* UIProcess/API/qt/tests/qmltests/DesktopWebView/tst_loadFail.qml: Added.
* UIProcess/API/qt/tests/qmltests/TouchWebView/tst_loadFail.qml: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/Source/WebKit2/ChangeLog (95544 => 95545)
--- trunk/Source/WebKit2/ChangeLog 2011-09-20 15:46:29 UTC (rev 95544)
+++ trunk/Source/WebKit2/ChangeLog 2011-09-20 16:08:20 UTC (rev 95545)
@@ -1,3 +1,20 @@
+2011-09-20 Alexis Menard <[email protected]>
+
+ [Qt][WK2] Export QNetworkReply in the QtWebKit QML module.
+ https://bugs.webkit.org/show_bug.cgi?id=68401
+
+ Reviewed by Simon Hausmann.
+
+ Add QNetworkReply in the QtWebKit module. We use the enum QNetworkReply::NetworkError
+ as the error code when the load fails. It is not used in the QtQuick module therefore
+ the QML team thinks it should belong here. Also added some auto-tests to cover the
+ loading errors.
+
+ * UIProcess/API/qt/qmlplugin/plugin.cpp:
+ (WebKit2QmlPlugin::registerTypes):
+ * UIProcess/API/qt/tests/qmltests/DesktopWebView/tst_loadFail.qml: Added.
+ * UIProcess/API/qt/tests/qmltests/TouchWebView/tst_loadFail.qml: Added.
+
2011-09-20 Csaba Osztrogonác <[email protected]>
[Qt][Mac] Buildfix after r95513.
Modified: trunk/Source/WebKit2/UIProcess/API/qt/qmlplugin/plugin.cpp (95544 => 95545)
--- trunk/Source/WebKit2/UIProcess/API/qt/qmlplugin/plugin.cpp 2011-09-20 15:46:29 UTC (rev 95544)
+++ trunk/Source/WebKit2/UIProcess/API/qt/qmlplugin/plugin.cpp 2011-09-20 16:08:20 UTC (rev 95545)
@@ -24,6 +24,7 @@
#include <QtDeclarative/qdeclarative.h>
#include <QtDeclarative/qdeclarativeextensionplugin.h>
+#include <QtNetwork/qnetworkreply.h>
QT_BEGIN_NAMESPACE
@@ -37,6 +38,7 @@
qmlRegisterType<QTouchWebView>(uri, 5, 0, "TouchWebView");
qmlRegisterUncreatableType<QWebNavigationController>(uri, 5, 0, "NavigationController", QObject::tr("Cannot create separate instance of NavigationController"));
qmlRegisterUncreatableType<QTouchWebPage>(uri, 5, 0, "TouchWebPage", QObject::tr("Cannot create separate instance of TouchWebPage, use TouchWebView"));
+ qmlRegisterUncreatableType<QNetworkReply>(uri, 5, 0, "NetworkReply", QObject::tr("Cannot create separate instance of NetworkReply"));
}
};
Added: trunk/Source/WebKit2/UIProcess/API/qt/tests/qmltests/DesktopWebView/tst_loadFail.qml (0 => 95545)
--- trunk/Source/WebKit2/UIProcess/API/qt/tests/qmltests/DesktopWebView/tst_loadFail.qml (rev 0)
+++ trunk/Source/WebKit2/UIProcess/API/qt/tests/qmltests/DesktopWebView/tst_loadFail.qml 2011-09-20 16:08:20 UTC (rev 95545)
@@ -0,0 +1,33 @@
+import QtQuick 2.0
+import QtTest 1.0
+import QtWebKit.experimental 5.0
+
+DesktopWebView {
+ id: webView
+
+ property variant testUrl
+
+ SignalSpy {
+ id: spy
+ target: webView
+ signalName: "loadFailed"
+ }
+
+ TestCase {
+ id: test
+ name: "DesktopWebViewLoadFail"
+ function test_fail() {
+ compare(spy.count, 0)
+ testUrl = Qt.resolvedUrl("file_that_does_not_exist.html")
+ webView.load(testUrl)
+ spy.wait()
+ compare(spy.count, 1)
+ }
+ }
+
+ onLoadFailed: {
+ test.compare(url, testUrl)
+ test.compare(errorCode, NetworkReply.ContentNotFoundError)
+ test.compare(errorType, DesktopWebView.NetworkError)
+ }
+}
Added: trunk/Source/WebKit2/UIProcess/API/qt/tests/qmltests/TouchWebView/tst_loadFail.qml (0 => 95545)
--- trunk/Source/WebKit2/UIProcess/API/qt/tests/qmltests/TouchWebView/tst_loadFail.qml (rev 0)
+++ trunk/Source/WebKit2/UIProcess/API/qt/tests/qmltests/TouchWebView/tst_loadFail.qml 2011-09-20 16:08:20 UTC (rev 95545)
@@ -0,0 +1,37 @@
+import QtQuick 2.0
+import QtTest 1.0
+import QtWebKit.experimental 5.0
+
+TouchWebView {
+ id: webView
+
+ property variant testUrl
+
+ SignalSpy {
+ id: spy
+ target: webView.page
+ signalName: "loadFailed"
+ }
+
+ TestCase {
+ id: test
+ name: "TouchWebViewLoadFail"
+
+ function test_fail() {
+ skip("Fails due to https://bugreports.qt.nokia.com/browse/QTBUG-21537")
+ compare(spy.count, 0)
+ testUrl = Qt.resolvedUrl("file_that_does_not_exist.html")
+ webView.page.load(testUrl)
+ spy.wait()
+ compare(spy.count, 1)
+ }
+ }
+ Connections {
+ target: webView.page
+ onLoadFailed: {
+ test.compare(url, testUrl)
+ test.compare(errorCode, NetworkReply.ContentNotFoundError)
+ test.compare(errorType, TouchWebPage.NetworkError)
+ }
+ }
+}
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes