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

Side by Side 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, 10 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 <html>
jochen (gone - plz use gerrit) 2014/01/28 13:13:23 <!DOCTYPE html>
2 <body>
3 <p>This test makes sure that navigator.isProtocolHandlerRegistered throws the pr oper exceptions and returns the default state of handler.</p>
4 <pre id="console"></pre>
5 <script>
6 if (window.testRunner)
7 testRunner.dumpAsText();
8
9 function debug(str)
10 {
11 var c = document.getElementById('console')
12 c.appendChild(document.createTextNode(str + '\n'));
13 }
14
15 if (window.navigator.isProtocolHandlerRegistered)
16 debug('Pass: window.navigator.isProtocolHandlerRegistered is defined.');
17 else
18 debug('Fail: window.navigator.isProtocolHandlerRegistered is not defined.');
19
20 var invalidUrl = "%S";
21 var succeeded = false;
22 try {
23 window.navigator.isProtocolHandlerRegistered(protocol, invalidUrl);
24 succeeded = false;
25 } catch (e) {
26 succeeded = true;
27 }
28 if (succeeded)
29 debug('Pass: Invalid url "' + invalidUrl + '" threw SyntaxError exception.') ;
30 else
31 debug('Fail: Invalid url "' + invalidUrl + '" allowed.');
32
33 // FIXME: Need to check if this function can return 'registered' and 'declined' states as well.
34 try {
35 var state = window.navigator.isProtocolHandlerRegistered("bitcoin", "valid p rotocol %s");
36 if (state == "new")
37 debug('Pass: window.navigator.isProtocolHandlerRegistered returns "new" state');
38 else
39 debug("Fail: window.navigator.isProtocolHandlerRegistered doesn't return the default state.");
40 } catch (e) {
41 debug('Fail: window.navigator.isProtocolHandlerRegistered call is failed: "' + e.message + '".');
42 }
43 </script>
44 </body>
45 </html>
OLDNEW
« 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