| <!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() { |
| let localResourceOverride = WI.LocalResourceOverride.create("http://127.0.0.1:8000/inspector/network/resources/override.js", WI.LocalResourceOverride.InterceptType.Request, { |
| requestURL: "http://127.0.0.1:8000/inspector/network/resources/intercept-request-overriden-script.js", |
| }); |
| WI.networkManager.addLocalResourceOverride(localResourceOverride); |
| |
| await Promise.all([ |
| InspectorTest.awaitEvent("OverrideContentDidLoad"), |
| InspectorTest.reloadPage({ignoreCache: false, revalidateAllResources: true}), |
| ]); |
| |
| WI.networkManager.removeLocalResourceOverride(localResourceOverride); |
| } |
| }); |
| |
| suite.runTestCasesAndFinish(); |
| } |
| </script> |
| </head> |
| <body onload="runTest()"> |
| <p>Test request interception intercepting the subresource load.</p> |
| <script src="resources/override.js"></script> |
| </body> |
| </html> |