Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(332)

Unified Diff: LayoutTests/fast/dom/navigatorcontentutils/is-protocol-handler-registered.html

Issue 147083008: Add a test case for navigator.isProtocolHandlerRegistered (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | LayoutTests/fast/dom/navigatorcontentutils/is-protocol-handler-registered-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: LayoutTests/fast/dom/navigatorcontentutils/is-protocol-handler-registered.html
diff --git a/LayoutTests/fast/dom/navigatorcontentutils/is-protocol-handler-registered.html b/LayoutTests/fast/dom/navigatorcontentutils/is-protocol-handler-registered.html
new file mode 100644
index 0000000000000000000000000000000000000000..07ecb78114aa27f74323ff06bb083a69beb917bd
--- /dev/null
+++ b/LayoutTests/fast/dom/navigatorcontentutils/is-protocol-handler-registered.html
@@ -0,0 +1,45 @@
+<html>
jochen (gone - plz use gerrit) 2014/01/28 13:13:23 <!DOCTYPE html>
+<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();
+
+function debug(str)
+{
+ var c = document.getElementById('console')
+ c.appendChild(document.createTextNode(str + '\n'));
+}
+
+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.');
+
+// FIXME: Need to check if this function can return 'registered' and 'declined' states as well.
+try {
+ var state = window.navigator.isProtocolHandlerRegistered("bitcoin", "valid protocol %s");
+ if (state == "new")
+ debug('Pass: window.navigator.isProtocolHandlerRegistered returns "new" 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>
« no previous file with comments | « no previous file | LayoutTests/fast/dom/navigatorcontentutils/is-protocol-handler-registered-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698