Add a test case for navigator.isProtocolHandlerRegistered
authorgyuyoung.kim@samsung.com <gyuyoung.kim@samsung.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 7 Feb 2014 03:12:06 +0000 (03:12 +0000)
committergyuyoung.kim@samsung.com <gyuyoung.kim@samsung.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 7 Feb 2014 03:12:06 +0000 (03:12 +0000)
https://bugs.webkit.org/show_bug.cgi?id=128302

Reviewed by Anders Carlsson.

Add a test case for navigator.isProtocolHandlerRegistered. This new test will
check if "navigator.isProtocolHandlerRegistered" throws the proper exceptions
and returns a proper state of handler.

Currently, this function is only supported by EFL WK1 port.

* fast/dom/is-protocol-handler-registered-expected.txt: Added.
* fast/dom/is-protocol-handler-registered.html: Added.
* platform/efl-wk2/TestExpectations: Skip this test.
* platform/gtk/TestExpectations: ditto.
* platform/mac/TestExpectations: ditto.

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

LayoutTests/ChangeLog
LayoutTests/fast/dom/is-protocol-handler-registered-expected.txt [new file with mode: 0644]
LayoutTests/fast/dom/is-protocol-handler-registered.html [new file with mode: 0644]
LayoutTests/platform/efl-wk2/TestExpectations
LayoutTests/platform/gtk/TestExpectations
LayoutTests/platform/mac/TestExpectations

index d170e28..9a8e1e0 100644 (file)
@@ -1,3 +1,22 @@
+2014-02-06  Gyuyoung Kim  <gyuyoung.kim@samsung.com>
+
+        Add a test case for navigator.isProtocolHandlerRegistered
+        https://bugs.webkit.org/show_bug.cgi?id=128302
+
+        Reviewed by Anders Carlsson.
+
+        Add a test case for navigator.isProtocolHandlerRegistered. This new test will
+        check if "navigator.isProtocolHandlerRegistered" throws the proper exceptions
+        and returns a proper state of handler.
+
+        Currently, this function is only supported by EFL WK1 port.
+
+        * fast/dom/is-protocol-handler-registered-expected.txt: Added.
+        * fast/dom/is-protocol-handler-registered.html: Added.
+        * platform/efl-wk2/TestExpectations: Skip this test.
+        * platform/gtk/TestExpectations: ditto.
+        * platform/mac/TestExpectations: ditto.
+
 2014-02-06  Jeffrey Pfau  <jpfau@apple.com>
 
         loadSubframe can return null in SubframeLoader::loadOrRedirectSubframe
diff --git a/LayoutTests/fast/dom/is-protocol-handler-registered-expected.txt b/LayoutTests/fast/dom/is-protocol-handler-registered-expected.txt
new file mode 100644 (file)
index 0000000..8e87080
--- /dev/null
@@ -0,0 +1,6 @@
+This test makes sure that navigator.isProtocolHandlerRegistered throws the proper exceptions and returns the default state of handler.
+
+PASS window.navigator.isProtocolHandlerRegistered is defined.
+PASS Invalid url "%S" threw SyntaxError exception.
+PASS window.navigator.isProtocolHandlerRegistered returns "registered" state
+
diff --git a/LayoutTests/fast/dom/is-protocol-handler-registered.html b/LayoutTests/fast/dom/is-protocol-handler-registered.html
new file mode 100644 (file)
index 0000000..387b8da
--- /dev/null
@@ -0,0 +1,42 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src="../../resources/js-test-pre.js"></script>
+</head>
+<body>
+<p>This test makes sure that navigator.isProtocolHandlerRegistered throws the proper exceptions and returns the default state of handler.</p>
+<pre id="console"></pre>
+<script>
+if (window.testRunner)
+    testRunner.dumpAsText();
+
+if (window.navigator.isProtocolHandlerRegistered)
+    debug('PASS window.navigator.isProtocolHandlerRegistered is defined.');
+else
+    debug('FAIL window.navigator.isProtocolHandlerRegistered is not defined.');
+
+var invalidUrl = "%S";
+var succeeded = false;
+try {
+    window.navigator.isProtocolHandlerRegistered(protocol, invalidUrl);
+    succeeded = false;
+} catch (e) {
+    succeeded = true;
+}
+if (succeeded)
+    debug('PASS Invalid url "' + invalidUrl + '" threw SyntaxError exception.');
+else
+    debug('FAIL Invalid url "' + invalidUrl + '" allowed.');
+
+try {
+    var state = window.navigator.isProtocolHandlerRegistered("bitcoin", "valid protocol %s");
+    if (state == "registered")
+        debug('PASS window.navigator.isProtocolHandlerRegistered returns "registered" state');
+    else
+        debug("FAIL window.navigator.isProtocolHandlerRegistered doesn't return the default state.");
+} catch (e) {
+    debug('FAIL window.navigator.isProtocolHandlerRegistered call is failed: "' + e.message + '".');
+}
+</script>
+</body>
+</html>
index 2784892..b1375e3 100644 (file)
@@ -287,6 +287,9 @@ svg/webarchive [ Skip ]
 svg/custom/image-with-prefix-in-webarchive.svg [ Skip ]
 http/tests/webarchive [ Skip ]
 
+# isProtocolHandlerRegistered() isn't supported by WK2 yet.
+webkit.org/b/92749 fast/dom/is-protocol-handler-registered.html [ Skip ]
+
 # WebKitTestRunner needs an implementation for testRunner.titleTextDirection
 webkit.org/b/93470 fast/dom/title-directionality-removeChild.html [ Failure ]
 webkit.org/b/93470 fast/dom/title-directionality.html [ Failure ]
index 0e40a64..ffbb1c7 100644 (file)
@@ -231,6 +231,9 @@ webkit.org/b/61661 editing/pasteboard/drag-drop-list.html [ Failure ]
 webkit.org/b/117039 media/track/audio-track.html [ Skip ]
 webkit.org/b/117039 media/track/video-track.html [ Skip ]
 
+# isProtocolHandlerRegistered() isn't supported yet.
+webkit.org/b/92749 fast/dom/is-protocol-handler-registered.html [ Skip ]
+
 # Tests for MediaSource API. Feature is not totally functional.
 webkit.org/b/99065 http/tests/media/media-source/mediasource-addsourcebuffer.html [ Failure Timeout ]
 webkit.org/b/99065 http/tests/media/media-source/mediasource-append-buffer.html [ Crash Timeout ]
index 499d9a7..45549a1 100644 (file)
@@ -1086,6 +1086,9 @@ webkit.org/b/121331 http/tests/misc/submit-post-keygen.html [ Pass Failure Timeo
 # Feature not implemented
 webkit.org/b/91611 media/media-higher-prio-audio-stream.html [ Skip ]
 
+# isProtocolHandlerRegistered() isn't supported yet.
+webkit.org/b/92749 fast/dom/is-protocol-handler-registered.html [ Skip ]
+
 # Snapshotted plugins not enabled on WK1
 plugins/snapshotting [ Skip ]