[Qt] QDesktopWebView missing loadProgress tests
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 20 Sep 2011 13:58:47 +0000 (13:58 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 20 Sep 2011 13:58:47 +0000 (13:58 +0000)
https://bugs.webkit.org/show_bug.cgi?id=68280

Patch by Gopal Raghavan <gopal.1.raghavan@nokia.com> on 2011-09-20
Reviewed by Andreas Kling.

Added test case to check load progress property and signal for QDesktopWebView

* UIProcess/API/qt/tests/qmltests/DesktopWebView/tst_loadProgress.qml: Added.
* UIProcess/API/qt/tests/qmltests/DesktopWebView/tst_loadProgressSignal.qml: Added.
* UIProcess/API/qt/tests/qmltests/qmltests.pro:

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

Source/WebKit2/ChangeLog
Source/WebKit2/UIProcess/API/qt/tests/qmltests/DesktopWebView/tst_loadProgress.qml [new file with mode: 0644]
Source/WebKit2/UIProcess/API/qt/tests/qmltests/DesktopWebView/tst_loadProgressSignal.qml [new file with mode: 0644]
Source/WebKit2/UIProcess/API/qt/tests/qmltests/qmltests.pro

index 4e80e5f..4091361 100644 (file)
@@ -1,3 +1,16 @@
+2011-09-20  Gopal Raghavan  <gopal.1.raghavan@nokia.com>
+
+        [Qt] QDesktopWebView missing loadProgress tests
+        https://bugs.webkit.org/show_bug.cgi?id=68280
+
+        Reviewed by Andreas Kling.
+
+        Added test case to check load progress property and signal for QDesktopWebView
+
+        * UIProcess/API/qt/tests/qmltests/DesktopWebView/tst_loadProgress.qml: Added.
+        * UIProcess/API/qt/tests/qmltests/DesktopWebView/tst_loadProgressSignal.qml: Added.
+        * UIProcess/API/qt/tests/qmltests/qmltests.pro:
+
 2011-09-20  Carlos Garcia Campos  <cgarcia@igalia.com>
 
         [GTK] WebProcess shouldn't use the GTK+ API
diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/DesktopWebView/tst_loadProgress.qml b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/DesktopWebView/tst_loadProgress.qml
new file mode 100644 (file)
index 0000000..03068db
--- /dev/null
@@ -0,0 +1,26 @@
+import QtQuick 2.0
+import QtTest 1.0
+import QtWebKit.experimental 5.0
+
+DesktopWebView {
+    id: webView
+
+    SignalSpy {
+        id: spy
+        target: webView
+        signalName: "loadSucceeded"
+    }
+
+    TestCase {
+        name: "DesktopWebViewLoadProgress"
+
+        function test_loadProgress() {
+            compare(spy.count, 0)
+            compare(webView.loadProgress, 0)
+            webView.load(Qt.resolvedUrl("../common/test1.html"))
+            compare(webView.loadProgress, 0)
+            spy.wait()
+            compare(webView.loadProgress, 100)
+        }
+    }
+}
diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/DesktopWebView/tst_loadProgressSignal.qml b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/DesktopWebView/tst_loadProgressSignal.qml
new file mode 100644 (file)
index 0000000..1c73ca9
--- /dev/null
@@ -0,0 +1,36 @@
+import QtQuick 2.0
+import QtTest 1.0
+import QtWebKit.experimental 5.0
+
+DesktopWebView {
+    id: webView
+
+    SignalSpy {
+        id: spy
+        target: webView
+        signalName: "loadSucceeded"
+    }
+
+    SignalSpy {
+        id: spyProgress
+        target: webView
+        signalName: "loadProgressChanged"
+    }
+
+    TestCase {
+        name: "DesktopWebViewLoadProgressSignal"
+
+        function test_loadProgressSignal() {
+            compare(spyProgress.count, 0)
+            compare(webView.loadProgress, 0)
+            webView.load(Qt.resolvedUrl("../common/test1.html"))
+            spyProgress.wait()
+            compare(true, webView.loadProgress > -1 && webView.loadProgress < 101)
+            if (webView.loadProgress > 0 && webView.loadProgress < 100) {
+                spy.wait()
+                spyProgress.wait()
+                compare(webView.loadProgress, 100)
+            }
+        }
+    }
+}
index c34a706..561e235 100644 (file)
@@ -11,6 +11,8 @@ DEFINES += QUICK_TEST_SOURCE_DIR=\"\\\"$$PWD\\\"\"
 OTHER_FILES += \
     DesktopWebView/tst_properties.qml \
     DesktopWebView/tst_navigationPolicyForUrl.qml \
+    DesktopWebView/tst_loadProgress.qml \
+    DesktopWebView/tst_loadProgressSignal.qml \
     TouchWebView/tst_properties.qml \
     TouchWebView/tst_loadZeroSizeView.qml \
     TouchWebView/tst_loadNegativeSizeView.qml \