[Qt][WK2] Move QQuickWebView::downloadRequested signal into experimental
authorjesus@webkit.org <jesus@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 23 Nov 2011 22:03:54 +0000 (22:03 +0000)
committerjesus@webkit.org <jesus@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 23 Nov 2011 22:03:54 +0000 (22:03 +0000)
https://bugs.webkit.org/show_bug.cgi?id=72914

Reviewed by Andreas Kling.

Make the signal downloadRequested an experimental API from QQuickWebView
and modify the qml test to use a WebView instead of a DesktopWebView.

* UIProcess/API/qt/qquickwebview_p.h:
* UIProcess/API/qt/tests/qmltests/WebView/tst_download.qml: Renamed from Source/WebKit2/UIProcess/API/qt/tests/qmltests/DesktopBehavior/tst_download.qml.
* UIProcess/API/qt/tests/qmltests/common/download.html: Removed.
* UIProcess/API/qt/tests/qmltests/qmltests.pro:
* UIProcess/qt/QtWebPageProxy.cpp:
(QtWebPageProxy::didReceiveDownloadResponse):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@101103 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebKit2/ChangeLog
Source/WebKit2/UIProcess/API/qt/qquickwebview_p.h
Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_download.qml [moved from Source/WebKit2/UIProcess/API/qt/tests/qmltests/DesktopBehavior/tst_download.qml with 68% similarity]
Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/download.html [deleted file]
Source/WebKit2/UIProcess/API/qt/tests/qmltests/qmltests.pro
Source/WebKit2/UIProcess/qt/QtWebPageProxy.cpp

index dac0611..e145534 100644 (file)
@@ -1,3 +1,20 @@
+2011-11-21  Jesus Sanchez-Palencia  <jesus.palencia@openbossa.org>
+
+        [Qt][WK2] Move QQuickWebView::downloadRequested signal into experimental
+        https://bugs.webkit.org/show_bug.cgi?id=72914
+
+        Reviewed by Andreas Kling.
+
+        Make the signal downloadRequested an experimental API from QQuickWebView
+        and modify the qml test to use a WebView instead of a DesktopWebView.
+
+        * UIProcess/API/qt/qquickwebview_p.h:
+        * UIProcess/API/qt/tests/qmltests/WebView/tst_download.qml: Renamed from Source/WebKit2/UIProcess/API/qt/tests/qmltests/DesktopBehavior/tst_download.qml.
+        * UIProcess/API/qt/tests/qmltests/common/download.html: Removed.
+        * UIProcess/API/qt/tests/qmltests/qmltests.pro:
+        * UIProcess/qt/QtWebPageProxy.cpp:
+        (QtWebPageProxy::didReceiveDownloadResponse):
+
 2011-11-22  Caio Marcelo de Oliveira Filho  <caio.oliveira@openbossa.org>
 
         [Qt] [WK2] Expose onNavigationRequested signal instead of expecting a slot be defined from QML
 2011-11-22  Caio Marcelo de Oliveira Filho  <caio.oliveira@openbossa.org>
 
         [Qt] [WK2] Expose onNavigationRequested signal instead of expecting a slot be defined from QML
index 1817d39..3291dff 100644 (file)
@@ -109,7 +109,6 @@ Q_SIGNALS:
     void loadProgressChanged(int progress);
     void urlChanged(const QUrl& url);
     void messageReceived(const QVariantMap& message);
     void loadProgressChanged(int progress);
     void urlChanged(const QUrl& url);
     void messageReceived(const QVariantMap& message);
-    void downloadRequested(QWebDownloadItem* downloadItem);
     void linkHovered(const QUrl& url, const QString& title);
     void viewModeChanged();
     void navigationStateChanged();
     void linkHovered(const QUrl& url, const QString& title);
     void viewModeChanged();
     void navigationStateChanged();
@@ -188,11 +187,14 @@ Q_SIGNALS:
     void alertDialogChanged();
     void confirmDialogChanged();
     void promptDialogChanged();
     void alertDialogChanged();
     void confirmDialogChanged();
     void promptDialogChanged();
+    void downloadRequested(QWebDownloadItem* downloadItem);
 
 private:
     QQuickWebView* q_ptr;
     QQuickWebViewPrivate* d_ptr;
 
 
 private:
     QQuickWebView* q_ptr;
     QQuickWebViewPrivate* d_ptr;
 
+    friend class QtWebPageProxy;
+
     Q_DECLARE_PRIVATE(QQuickWebView)
     Q_DECLARE_PUBLIC(QQuickWebView)
 };
     Q_DECLARE_PRIVATE(QQuickWebView)
     Q_DECLARE_PUBLIC(QQuickWebView)
 };
@@ -1,30 +1,24 @@
 import QtQuick 2.0
 import QtTest 1.0
 import QtWebKit 3.0
 import QtQuick 2.0
 import QtTest 1.0
 import QtWebKit 3.0
-import QtWebKitTest 1.0
+import QtWebKit.experimental 3.0
 
 
-DesktopWebView {
+WebView {
     id: webView
     width: 200
     id: webView
     width: 200
-    height: 400
+    height: 200
 
     property int expectedLength: 0
     property bool downloadFinished: false
     property int totalBytes: 0
 
     SignalSpy {
 
     property int expectedLength: 0
     property bool downloadFinished: false
     property int totalBytes: 0
 
     SignalSpy {
-        id: loadSpy
-        target: webView
-        signalName: "loadSucceeded"
-    }
-
-    SignalSpy {
         id: spy
         id: spy
-        target: webView
+        target: experimental
         signalName: "downloadRequested"
     }
 
         signalName: "downloadRequested"
     }
 
-    onDownloadRequested: {
+    experimental.onDownloadRequested: {
         download.target = downloadItem
         expectedLength = downloadItem.expectedContentLength
         downloadItem.destinationPath = downloadItem.suggestedFilename
         download.target = downloadItem
         expectedLength = downloadItem.expectedContentLength
         downloadItem.destinationPath = downloadItem.suggestedFilename
@@ -41,7 +35,7 @@ DesktopWebView {
     }
 
     TestCase {
     }
 
     TestCase {
-        name: "DesktopWebViewDownload"
+        name: "WebViewDownload"
 
         // Delayed windowShown to workaround problems with Qt5 in debug mode.
         when: false
 
         // Delayed windowShown to workaround problems with Qt5 in debug mode.
         when: false
@@ -54,26 +48,20 @@ DesktopWebView {
 
         function init() {
             spy.clear()
 
         function init() {
             spy.clear()
-            loadSpy.clear()
             expectedLength = 0
             downloadFinished = false
             expectedLength = 0
             downloadFinished = false
-            totalBytes = 0
         }
 
         function test_downloadRequest() {
             compare(spy.count, 0)
         }
 
         function test_downloadRequest() {
             compare(spy.count, 0)
-            webView.load(Qt.resolvedUrl("../common/download.html"))
-            loadSpy.wait()
-            mouseClick(webView, 100, 100, Qt.LeftButton)
+            webView.load(Qt.resolvedUrl("../common/download.zip"))
             spy.wait()
             compare(spy.count, 1)
         }
 
         function test_expectedLength() {
             compare(spy.count, 0)
             spy.wait()
             compare(spy.count, 1)
         }
 
         function test_expectedLength() {
             compare(spy.count, 0)
-            webView.load(Qt.resolvedUrl("../common/download.html"))
-            loadSpy.wait()
-            mouseClick(webView, 100, 100, Qt.LeftButton)
+            webView.load(Qt.resolvedUrl("../common/download.zip"))
             spy.wait()
             compare(spy.count, 1)
             compare(expectedLength, 325)
             spy.wait()
             compare(spy.count, 1)
             compare(expectedLength, 325)
@@ -81,9 +69,7 @@ DesktopWebView {
 
         function test_succeeded() {
             compare(spy.count, 0)
 
         function test_succeeded() {
             compare(spy.count, 0)
-            webView.load(Qt.resolvedUrl("../common/download.html"))
-            loadSpy.wait()
-            mouseClick(webView, 100, 100, Qt.LeftButton)
+            webView.load(Qt.resolvedUrl("../common/download.zip"))
             spy.wait()
             compare(spy.count, 1)
             verify(downloadFinished)
             spy.wait()
             compare(spy.count, 1)
             verify(downloadFinished)
diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/download.html b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/download.html
deleted file mode 100644 (file)
index 606fa4c..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-<html>
-<head><title>Download Test page with huge link area</title></head>
-<body>
-<a title="Zip file" href="download.zip"><img width=200 height=200></a>
-</body>
-</html>
index 71b8549..ea0dff0 100644 (file)
@@ -24,8 +24,8 @@ OTHER_FILES += \
     WebView/tst_loadZeroSizeView.qml \
     WebView/tst_preferences.qml \
     WebView/tst_loadHtml.qml \
     WebView/tst_loadZeroSizeView.qml \
     WebView/tst_preferences.qml \
     WebView/tst_loadHtml.qml \
+    WebView/tst_download.qml \
     DesktopBehavior/tst_linkHovered.qml \
     DesktopBehavior/tst_messaging.qml \
     DesktopBehavior/tst_linkHovered.qml \
     DesktopBehavior/tst_messaging.qml \
-    DesktopBehavior/tst_download.qml \
     DesktopBehavior/tst_navigationRequested.qml \
     DesktopBehavior/tst_loadHtml.qml
     DesktopBehavior/tst_navigationRequested.qml \
     DesktopBehavior/tst_loadHtml.qml
index d2a6d1c..a5bb1cd 100644 (file)
@@ -834,7 +834,7 @@ void QtWebPageProxy::didReceiveDownloadResponse(QWebDownloadItem* downloadItem)
         return;
 
     QDeclarativeEngine::setObjectOwnership(downloadItem, QDeclarativeEngine::JavaScriptOwnership);
         return;
 
     QDeclarativeEngine::setObjectOwnership(downloadItem, QDeclarativeEngine::JavaScriptOwnership);
-    emit m_qmlWebView->downloadRequested(downloadItem);
+    emit m_qmlWebView->experimental()->downloadRequested(downloadItem);
 }
 
 PassOwnPtr<DrawingAreaProxy> QtWebPageProxy::createDrawingAreaProxy()
 }
 
 PassOwnPtr<DrawingAreaProxy> QtWebPageProxy::createDrawingAreaProxy()