Title: [99570] trunk/Source/WebKit2
Revision
99570
Author
caio.olive...@openbossa.org
Date
2011-11-08 08:21:26 -0800 (Tue, 08 Nov 2011)

Log Message

[Qt] Workaround some problems in QML API tests
https://bugs.webkit.org/show_bug.cgi?id=71818

Reviewed by Tor Arne Vestbø.

This commit workaround the issue of QML's QtTest crashing when we run tests after
"windowShown". We delay to the next run of the mainloop. This workaround is not
pretty but shouldn't affect the semantics of the tests. And we benefit more from
having working tests right now.

This patch also improves Download to: wait for the load before emitting click, and
properly identifying the "succeeded" signal of the downloadItem object.

* UIProcess/API/qt/tests/qmltests/DesktopWebView/tst_download.qml:
* UIProcess/API/qt/tests/qmltests/DesktopWebView/tst_linkHovered.qml:
* UIProcess/API/qt/tests/qmltests/DesktopWebView/tst_navigationPolicyForUrl.qml:

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (99569 => 99570)


--- trunk/Source/WebKit2/ChangeLog	2011-11-08 15:40:33 UTC (rev 99569)
+++ trunk/Source/WebKit2/ChangeLog	2011-11-08 16:21:26 UTC (rev 99570)
@@ -1,3 +1,22 @@
+2011-11-08  Caio Marcelo de Oliveira Filho  <caio.olive...@openbossa.org>
+
+        [Qt] Workaround some problems in QML API tests
+        https://bugs.webkit.org/show_bug.cgi?id=71818
+
+        Reviewed by Tor Arne Vestbø.
+
+        This commit workaround the issue of QML's QtTest crashing when we run tests after
+        "windowShown". We delay to the next run of the mainloop. This workaround is not
+        pretty but shouldn't affect the semantics of the tests. And we benefit more from
+        having working tests right now.
+
+        This patch also improves Download to: wait for the load before emitting click, and
+        properly identifying the "succeeded" signal of the downloadItem object.
+
+        * UIProcess/API/qt/tests/qmltests/DesktopWebView/tst_download.qml:
+        * UIProcess/API/qt/tests/qmltests/DesktopWebView/tst_linkHovered.qml:
+        * UIProcess/API/qt/tests/qmltests/DesktopWebView/tst_navigationPolicyForUrl.qml:
+
 2011-11-08  Kenneth Rohde Christiansen  <kenn...@webkit.org>
 
         Clean up QtViewportInteractionEngine

Modified: trunk/Source/WebKit2/UIProcess/API/qt/tests/qmltests/DesktopWebView/tst_download.qml (99569 => 99570)


--- trunk/Source/WebKit2/UIProcess/API/qt/tests/qmltests/DesktopWebView/tst_download.qml	2011-11-08 15:40:33 UTC (rev 99569)
+++ trunk/Source/WebKit2/UIProcess/API/qt/tests/qmltests/DesktopWebView/tst_download.qml	2011-11-08 16:21:26 UTC (rev 99570)
@@ -7,10 +7,17 @@
     width: 200
     height: 400
 
-    property int expectedLength : 0
-    property int totalBytes : 0
+    property int expectedLength: 0
+    property bool downloadFinished: false
+    property int totalBytes: 0
 
     SignalSpy {
+        id: loadSpy
+        target: webView
+        signalName: "loadSucceeded"
+    }
+
+    SignalSpy {
         id: spy
         target: webView
         signalName: "downloadRequested"
@@ -26,32 +33,45 @@
     Connections {
         id: download
         ignoreUnknownSignals: true
-        onSucceeded: { totalBytes = download.target.totalBytesReceived }
+        onSucceeded: {
+            downloadFinished = true
+            totalBytes = download.target.totalBytesReceived
+        }
     }
 
-    SignalSpy {
-        id: otherSpy
-        target: download
-        signalName: "succeeded"
-    }
-
     TestCase {
         name: "DesktopWebViewDownload"
-        when: windowShown
 
+        // Delayed windowShown to workaround problems with Qt5 in debug mode.
+        when: false
+        Timer {
+            running: parent.windowShown
+            repeat: false
+            interval: 1
+            onTriggered: parent.when = true
+        }
+
+        function init() {
+            spy.clear()
+            loadSpy.clear()
+            expectedLength = 0
+            downloadFinished = false
+            totalBytes = 0
+        }
+
         function test_downloadRequest() {
-            spy.clear()
             compare(spy.count, 0)
             webView.load(Qt.resolvedUrl("../common/download.html"))
+            loadSpy.wait()
             mouseClick(webView, 100, 100, Qt.LeftButton)
             spy.wait()
             compare(spy.count, 1)
         }
 
         function test_expectedLength() {
-            spy.clear()
             compare(spy.count, 0)
             webView.load(Qt.resolvedUrl("../common/download.html"))
+            loadSpy.wait()
             mouseClick(webView, 100, 100, Qt.LeftButton)
             spy.wait()
             compare(spy.count, 1)
@@ -59,16 +79,13 @@
         }
 
         function test_succeeded() {
-            spy.clear()
             compare(spy.count, 0)
-            otherSpy.clear()
-            compare(otherSpy.count, 0)
             webView.load(Qt.resolvedUrl("../common/download.html"))
+            loadSpy.wait()
             mouseClick(webView, 100, 100, Qt.LeftButton)
             spy.wait()
             compare(spy.count, 1)
-            otherSpy.wait()
-            compare(otherSpy.count, 1)
+            verify(downloadFinished)
             compare(totalBytes, expectedLength)
         }
     }

Modified: trunk/Source/WebKit2/UIProcess/API/qt/tests/qmltests/DesktopWebView/tst_linkHovered.qml (99569 => 99570)


--- trunk/Source/WebKit2/UIProcess/API/qt/tests/qmltests/DesktopWebView/tst_linkHovered.qml	2011-11-08 15:40:33 UTC (rev 99569)
+++ trunk/Source/WebKit2/UIProcess/API/qt/tests/qmltests/DesktopWebView/tst_linkHovered.qml	2011-11-08 16:21:26 UTC (rev 99570)
@@ -29,8 +29,16 @@
 
     TestCase {
         name: "DesktopWebViewLinkHovered"
-        when: windowShown
 
+        // Delayed windowShown to workaround problems with Qt5 in debug mode.
+        when: false
+        Timer {
+            running: parent.windowShown
+            repeat: false
+            interval: 1
+            onTriggered: parent.when = true
+        }
+
         function init() {
             webView.lastUrl = ""
             webView.lastTitle = ""

Modified: trunk/Source/WebKit2/UIProcess/API/qt/tests/qmltests/DesktopWebView/tst_navigationPolicyForUrl.qml (99569 => 99570)


--- trunk/Source/WebKit2/UIProcess/API/qt/tests/qmltests/DesktopWebView/tst_navigationPolicyForUrl.qml	2011-11-08 15:40:33 UTC (rev 99569)
+++ trunk/Source/WebKit2/UIProcess/API/qt/tests/qmltests/DesktopWebView/tst_navigationPolicyForUrl.qml	2011-11-08 16:21:26 UTC (rev 99570)
@@ -34,8 +34,16 @@
 
     TestCase {
         name: "DesktopWebViewNavigationPolicyForUrl"
-        when: windowShown
 
+        // Delayed windowShown to workaround problems with Qt5 in debug mode.
+        when: false
+        Timer {
+            running: parent.windowShown
+            repeat: false
+            interval: 1
+            onTriggered: parent.when = true
+        }
+
         function test_usePolicy() {
             webView.load(Qt.resolvedUrl("../common/test2.html"))
             spy.wait()
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to