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

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

Issue 293403002: Introduce mock test system for navigator content utils (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 7 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
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
index dab41fb86d021d898ebae7ad6fe3a3c5f40bdc9f..8c0fff732d8b43684f0a5a184341a12f716222dc 100644
--- a/LayoutTests/fast/dom/navigatorcontentutils/is-protocol-handler-registered.html
+++ b/LayoutTests/fast/dom/navigatorcontentutils/is-protocol-handler-registered.html
@@ -10,6 +10,9 @@
if (window.testRunner)
testRunner.dumpAsText();
+if (window.internals)
+ internals.setNavigatorContentUtilsClientMock(document);
+
if (window.navigator.isProtocolHandlerRegistered)
debug('PASS window.navigator.isProtocolHandlerRegistered is defined.');
else
@@ -43,16 +46,24 @@ invalid_schemes.forEach(function (scheme) {
debug('FAIL Invalid scheme "' + scheme + '" allowed.');
});
-// FIXME: Need to check if this function can return 'registered' and 'declined' states as well.
+debug("\nCheck if isProtocolHandlerRegistered() works correctly. If isProtocolHandlerRegistered() returns 'new' state, it works well.");
+debug("'bitcoin' protocol will be registered, and then checks if the 'bitcoin' protocol is registered by isProtocolHandlerRegistered().\n");
try {
+ // Register 'bitcoin' protocol for testing.
+ window.navigator.registerProtocolHandler('bitcoin', 'invalid scheme uri=%s', 'title');
+
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.");
+ if (state == "registered")
+ debug("PASS window.navigator.isProtocolHandlerRegistered returns 'registered' state. isProtocolHandlerRegistered() works correctly.");
+ else if (state == "new")
+ debug("FAIL window.navigator.isProtocolHandlerRegistered returns 'new' state.");
+ else if (state == "declined")
+ debug("FAIL window.navigator.isProtocolHandlerRegistered returns 'declined' state.");
} catch (e) {
debug('FAIL window.navigator.isProtocolHandlerRegistered call is failed: "' + e.message + '".');
}
+debug("\n");
+
</script>
</body>
</html>

Powered by Google App Engine
This is Rietveld 408576698