blob: 2dc1aa86fb832621195dca10840c23fc3f2e5f3e [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("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({
url: "http://127.0.0.1:8000/inspector/network/local-resource-override-main-resource.html",
mimeType: "text/html",
content: `<!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>`,
base64Encoded: false,
statusCode: 200,
statusText: "OK",
headers: {},
}));
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>