| <!DOCTYPE html> |
| <html> |
| <head> |
| <meta charset="utf-8"> |
| <script src="../resources/inspector-test.js"></script> |
| <script> |
| function test() |
| { |
| let suite = InspectorTest.createAsyncSuite("LocalResourceOverride.MainResource"); |
| |
| suite.addTestCase({ |
| name: "LocalResourceOverride.MainResource", |
| description: "Main resource uses override content on next page load", |
| async test() { |
| WI.networkManager.addLocalResourceOverride(WI.LocalResourceOverride.create("http://127.0.0.1:8000/inspector/network/local-resource-override-main-resource.html", WI.LocalResourceOverride.InterceptType.Response, { |
| responseMIMEType: "text/html", |
| responseContent: `<!DOCTYPE html><html><head><script src="../resources/inspector-test.js"></`+`script></head><body><p>Overridden page content</p><script>alert("REPLACED HTML CONTENT"); TestPage.completeTest();</`+`script></body></html>`, |
| responseBase64Encoded: false, |
| responseStatusCode: 200, |
| responseStatusText: "OK", |
| responseHeaders: {}, |
| })); |
| |
| await InspectorTest.reloadPage({ignoreCache: false, revalidateAllResources: true}); |
| } |
| }); |
| |
| suite.runTestCasesAndFinish(); |
| } |
| </script> |
| </head> |
| <body onload="runTest()"> |
| <p>Test a LocalResourceOverride overriding a main resource load.</p> |
| <script>alert("ORIGINAL HTML CONTENT");</script> |
| </body> |
| </html> |