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

Unified Diff: LayoutTests/http/tests/inspector/network/network-blocked-reason.html

Issue 1315043008: [DevTools] Show blocked requests in Network panel. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: rebased Created 5 years, 3 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/http/tests/inspector/network/network-blocked-reason-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: LayoutTests/http/tests/inspector/network/network-blocked-reason.html
diff --git a/LayoutTests/http/tests/inspector/network/network-blocked-reason.html b/LayoutTests/http/tests/inspector/network/network-blocked-reason.html
new file mode 100644
index 0000000000000000000000000000000000000000..b01997652ada931e3080618414c268b3363b9f71
--- /dev/null
+++ b/LayoutTests/http/tests/inspector/network/network-blocked-reason.html
@@ -0,0 +1,75 @@
+<html>
+<head>
+<meta http-equiv="Content-Security-Policy" content="script-src 'self' 'unsafe-inline'">
+<script src="/inspector/inspector-test.js"></script>
+<script>
+
+function sendCSPRequest()
+{
+ var script = document.createElement("script");
+ script.src = "https://www.example.com/csp.js";
+ document.head.appendChild(script);
+}
+
+function addBlockedScript()
+{
+ var script = document.createElement("script");
+ script.src = "resources/silent_script.js";
+ document.head.appendChild(script);
+}
+
+function test()
+{
+ var requestName;
+ var nextStep;
+ var blockedSetting = WebInspector.settingForTest("blockedURLs");
+
+ function onRequest(event)
+ {
+ var request = event.data;
+ if (request.name() !== requestName)
+ return;
+ requestName = undefined;
+ InspectorTest.addResult("");
+ InspectorTest.addResult("Request: " + request.name());
+ InspectorTest.addResult("BlockedReason: " + request.blockedReason());
+ nextStep();
+ }
+
+ InspectorTest.networkManager.addEventListener(WebInspector.NetworkManager.EventTypes.RequestFinished, onRequest);
+
+ InspectorTest.runTestSuite([
+ function testCSP(next)
+ {
+ requestName = "csp.js";
+ nextStep = next;
+ InspectorTest.evaluateInPage("sendCSPRequest()");
+ },
+
+ function testDevTools(next)
+ {
+ blockedSetting.set(["http://some.strange.origin/script.js", "resources/silent_script.js"]);
+ nextStep = removeBlock;
+ InspectorTest.runAfterPendingDispatches(addScript);
+
+ function removeBlock()
+ {
+ blockedSetting.set(["http://some.strange.origin/script.js"]);
+ nextStep = next;
+ InspectorTest.runAfterPendingDispatches(addScript);
+ }
+
+ function addScript()
+ {
+ requestName = "silent_script.js";
+ InspectorTest.evaluateInPage("addBlockedScript()");
+ }
+ }
+ ]);
+}
+</script>
+</head>
+<body onload="runTest()">
+<p>Tests that blocked reason is recognized correctly.</p>
+</body>
+</html>
« no previous file with comments | « no previous file | LayoutTests/http/tests/inspector/network/network-blocked-reason-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698