[Qt][WK2] Add test for application URL schemes.
authorzeno.albisser@nokia.com <zeno.albisser@nokia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 24 Jan 2012 12:28:31 +0000 (12:28 +0000)
committerzeno.albisser@nokia.com <zeno.albisser@nokia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 24 Jan 2012 12:28:31 +0000 (12:28 +0000)
https://bugs.webkit.org/show_bug.cgi?id=74933

Add a test that checks handling of url strings.
Add a test that verifies replies in case of multiple
available application url schemes.

Reviewed by Kenneth Rohde Christiansen.

* UIProcess/API/qt/tests/qmltests/WebView/tst_applicationScheme.qml:

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

Source/WebKit2/ChangeLog
Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_applicationScheme.qml

index 35f43de723c0a60a799d81a571421a46b75e9a00..ed9cc8619dd33d64504684d677979386c738076b 100644 (file)
@@ -1,3 +1,16 @@
+2012-01-24  Zeno Albisser  <zeno@webkit.org>
+
+        [Qt][WK2] Add test for application URL schemes.
+        https://bugs.webkit.org/show_bug.cgi?id=74933
+
+        Add a test that checks handling of url strings.
+        Add a test that verifies replies in case of multiple
+        available application url schemes.
+
+        Reviewed by Kenneth Rohde Christiansen.
+
+        * UIProcess/API/qt/tests/qmltests/WebView/tst_applicationScheme.qml:
+
 2012-01-24  Carlos Garcia Campos  <cgarcia@igalia.com>
 
         [GTK] Fix /webkit2/WebKitWebView/reload after r105688
index 29774e1179caf776a35ebad756540aeeda4b8c67..095ab30b314e1b4cc7fa3eaf75284726deee28de 100644 (file)
@@ -16,6 +16,32 @@ WebView {
                     reply.data = "<html><head><title>Test Application Scheme</title></head><body>A test page.</body></html>"
                     reply.send()
                 }
+            },
+            UrlSchemeDelegate {
+                scheme: "scheme1"
+                onReceivedRequest: {
+                    reply.data = "<html><head><title>Scheme1 Reply</title></head><body>A test page.</body></html>"
+                    reply.send()
+                }
+            },
+            UrlSchemeDelegate {
+                scheme: "scheme2"
+                onReceivedRequest: {
+                    reply.data = "<html><head><title>Scheme2 Reply</title></head><body>A test page.</body></html>"
+                    reply.send()
+                }
+            },
+            UrlSchemeDelegate {
+                scheme: "scheme3"
+                onReceivedRequest: {
+                    if (request.url == "scheme3://url1")
+                        reply.data = "<html><head><title>Scheme3 Reply1</title></head><body>A test page.</body></html>"
+                    else if (request.url == "scheme3://url2")
+                        reply.data = "<html><head><title>Scheme3 Reply2</title></head><body>A test page.</body></html>"
+                    else
+                        reply.data = "<html><head><title>Should not happen</title></head><body>A test page.</body></html>"
+                    reply.send()
+                }
             }
         ]
     }
@@ -30,12 +56,45 @@ WebView {
         name: "WebViewApplicationSchemes"
 
         function test_applicationScheme() {
+            spyTitle.clear()
             compare(spyTitle.count, 0)
             var testUrl = "applicationScheme://something"
             webView.load(testUrl)
             spyTitle.wait()
             compare(webView.title, "Test Application Scheme")
         }
-    }
 
+        function test_multipleSchemes() {
+            // Test if we receive the right reply when defining multiple schemes.
+            spyTitle.clear()
+            compare(spyTitle.count, 0)
+            var testUrl = "scheme2://some-url-string"
+            webView.load(testUrl)
+            spyTitle.wait()
+            compare(webView.title, "Scheme2 Reply")
+
+            testUrl = "scheme1://some-url-string"
+            webView.load(testUrl)
+            spyTitle.wait()
+            compare(webView.title, "Scheme1 Reply")
+
+            compare(spyTitle.count, 2)
+        }
+
+        function test_multipleUrlsForScheme() {
+            spyTitle.clear()
+            compare(spyTitle.count, 0)
+            var testUrl = "scheme3://url1"
+            webView.load(testUrl)
+            spyTitle.wait()
+            compare(webView.title, "Scheme3 Reply1")
+
+            testUrl = "scheme3://url2"
+            webView.load(testUrl)
+            spyTitle.wait()
+            compare(webView.title, "Scheme3 Reply2")
+
+            compare(spyTitle.count, 2)
+        }
+    }
 }