From 97ddcf799ed307101cb1e4fcb0c11ed93d9fd770 Mon Sep 17 00:00:00 2001 From: "zeno.albisser@nokia.com" Date: Tue, 24 Jan 2012 12:28:31 +0000 Subject: [PATCH] [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: git-svn-id: http://svn.webkit.org/repository/webkit/trunk@105728 268f45cc-cd09-0410-ab3c-d52691b4dbfc --- Source/WebKit2/ChangeLog | 13 +++++ .../qmltests/WebView/tst_applicationScheme.qml | 61 +++++++++++++++++++++- 2 files changed, 73 insertions(+), 1 deletion(-) diff --git a/Source/WebKit2/ChangeLog b/Source/WebKit2/ChangeLog index 35f43de7..ed9cc86 100644 --- a/Source/WebKit2/ChangeLog +++ b/Source/WebKit2/ChangeLog @@ -1,3 +1,16 @@ +2012-01-24 Zeno Albisser + + [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 [GTK] Fix /webkit2/WebKitWebView/reload after r105688 diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_applicationScheme.qml b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_applicationScheme.qml index 29774e1..095ab30 100644 --- a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_applicationScheme.qml +++ b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_applicationScheme.qml @@ -16,6 +16,32 @@ WebView { reply.data = "Test Application SchemeA test page." reply.send() } + }, + UrlSchemeDelegate { + scheme: "scheme1" + onReceivedRequest: { + reply.data = "Scheme1 ReplyA test page." + reply.send() + } + }, + UrlSchemeDelegate { + scheme: "scheme2" + onReceivedRequest: { + reply.data = "Scheme2 ReplyA test page." + reply.send() + } + }, + UrlSchemeDelegate { + scheme: "scheme3" + onReceivedRequest: { + if (request.url == "scheme3://url1") + reply.data = "Scheme3 Reply1A test page." + else if (request.url == "scheme3://url2") + reply.data = "Scheme3 Reply2A test page." + else + reply.data = "Should not happenA test page." + 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) + } + } } -- 2.7.4