blob: af5879c179e2d30f9f8cfd266d3985688ad6874a [file] [log] [blame]
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<script src="../resources/inspector-test.js"></script>
<script>
function test()
{
let suite = InspectorTest.createAsyncSuite("Network.interceptRequest");
suite.addTestCase({
name: "Network.interceptRequest.Subresource",
description: "Subresource uses request interception",
async test() {
await NetworkAgent.addInterception.invoke({
url: "http://127.0.0.1:8000/inspector/network/resources/override.js",
stage: InspectorBackend.Enum.Network.NetworkStage.Request,
});
WI.networkManager.singleFireEventListener(WI.NetworkManager.Event.RequestIntercepted, (event) => {
let {target, requestId, request} = event.data;
NetworkAgent.interceptWithRequest.invoke({
url: "http://127.0.0.1:8000/inspector/network/resources/intercept-request-overriden-script.js",
requestId,
});
});
await InspectorTest.reloadPage({ignoreCache: false, revalidateAllResources: true});
await InspectorTest.awaitEvent("OverrideContentDidLoad");
}
});
suite.runTestCasesAndFinish();
}
</script>
</head>
<body onload="runTest()">
<p>Test request interception intercepting the subresource load.</p>
<script src="resources/override.js"></script>
</body>
</html>