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

Unified Diff: third_party/WebKit/LayoutTests/http/tests/inspector-protocol/network/request-interception.html

Issue 2739323003: DevTools protocol interception, blocking & modification of requests (Closed)
Patch Set: Add a comment Created 3 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: third_party/WebKit/LayoutTests/http/tests/inspector-protocol/network/request-interception.html
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector-protocol/network/request-interception.html b/third_party/WebKit/LayoutTests/http/tests/inspector-protocol/network/request-interception.html
new file mode 100644
index 0000000000000000000000000000000000000000..65a33dde8a667ad000c481de631b6a39450f3317
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/http/tests/inspector-protocol/network/request-interception.html
@@ -0,0 +1,42 @@
+<html>
+<head>
+<script type="text/javascript" src="../inspector-protocol-test.js"></script>
+<script type="text/javascript" src="interception-test.js"></script>
+
+<script>
+function appendIframe()
+{
+ var iframe = document.createElement("iframe");
+ iframe.src = "resources/resource-iframe.html";
+ document.body.appendChild(iframe);
+}
+
+function test()
+{
+ var requestInterceptedDict = {
+ "resource-iframe.html": InspectorTest.allowRequest,
+ "i-dont-exist.css": function(event) {
+ InspectorTest.modifyRequest(event, {"url": "test.css"});
+ },
+ "script.js": function(event) {
+ InspectorTest.blockRequest(event, "ConnectionFailed");
+ },
+ "script2.js": function(event) {
+ var rawResponse =
+ "HTTP/1.1 200 OK\r\n" +
+ "Content-Type: application/javascript\r\n\r\n" +
+ "console.log('Hello from the mock resource');";
+ InspectorTest.mockResponse(event, rawResponse);
+ },
+ "post-echo.pl": InspectorTest.allowRequest,
+ };
+
+ InspectorTest.startInterceptionTest(requestInterceptedDict, 2);
+}
+</script>
+</head>
+<body onload="runTest();">
+<p>Tests interception blocking, modification of network fetches.</a>
+</p>
+</body>
+</html>

Powered by Google App Engine
This is Rietveld 408576698