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

Unified Diff: chrome/test/data/safe_browsing/malware_websocket.html

Issue 2952583002: SafeBrowsing support for WebSocket (post-network-servicification) (Closed)
Patch Set: Fix header files for move of service lookup Created 3 years, 6 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: chrome/test/data/safe_browsing/malware_websocket.html
diff --git a/chrome/test/data/safe_browsing/malware_websocket.html b/chrome/test/data/safe_browsing/malware_websocket.html
new file mode 100644
index 0000000000000000000000000000000000000000..df66c39c641cb4957d10dbe85f674a6a9c4918d7
--- /dev/null
+++ b/chrome/test/data/safe_browsing/malware_websocket.html
@@ -0,0 +1,12 @@
+<title>Test whether a WebSocket connection triggers a SafeBrowsing interstitial</title>
+<script>
+// Construct the WebSocket URL from the page URL. The server should not be
+// configured to accept a WebSocket handshake at this endpoint, or the "not
+// blocked" test will fail. A 404 error is perfect.
+const wsUrl = new URL('/safe_browsing/malware-ws', document.location.href);
+wsUrl.protocol = 'ws';
+const ws = new WebSocket(wsUrl.href);
+// The "not blocked" test looks for this title change to verify that the request
+// has not been blocked.
+ws.onerror = () => { document.title = 'COMPLETED'; };
+</script>

Powered by Google App Engine
This is Rietveld 408576698