Chromium Code Reviews| Index: third_party/WebKit/LayoutTests/inspector-protocol/page/ensureIsolatedWorld.html | 
| diff --git a/third_party/WebKit/LayoutTests/inspector-protocol/page/ensureIsolatedWorld.html b/third_party/WebKit/LayoutTests/inspector-protocol/page/ensureIsolatedWorld.html | 
| new file mode 100644 | 
| index 0000000000000000000000000000000000000000..44d429fa8af00eabfcd2abc674c7337db6d7e602 | 
| --- /dev/null | 
| +++ b/third_party/WebKit/LayoutTests/inspector-protocol/page/ensureIsolatedWorld.html | 
| @@ -0,0 +1,52 @@ | 
| +<html> | 
| +<head> | 
| +<script type="text/javascript" src="../../http/tests/inspector-protocol/inspector-protocol-test.js"></script> | 
| +<script> | 
| + | 
| +function test() | 
| +{ | 
| + var mainFrameId = ""; | 
| + InspectorTest.eventHandler["Runtime.executionContextCreated"] = | 
| + function(message) { | 
| + if (message.params.context.auxData.frameId !== mainFrameId) | 
| + return; | 
| + if (message.params.context.auxData.isDefault === false) { | 
| + InspectorTest.log("PASS - isolated world created."); | 
| + } else { | 
| + InspectorTest.log("fail - main world created."); | 
| + } | 
| + InspectorTest.completeTest(); | 
| + }; | 
| + | 
| + InspectorTest.sendCommandOrDie("Runtime.enable", {}, runtimeAgentEnabled); | 
| + | 
| + function runtimeAgentEnabled() { | 
| + InspectorTest.log("Runtime enabled"); | 
| + | 
| + InspectorTest.sendCommandOrDie("Page.enable", {}, pageAgentEnabled); | 
| + } | 
| + | 
| + function pageAgentEnabled() { | 
| + InspectorTest.log("Page enabled"); | 
| + InspectorTest.sendCommandOrDie( | 
| + "Page.getResourceTree", {}, resourceTreeLoaded); | 
| + } | 
| + | 
| + function resourceTreeLoaded(payload) { | 
| + mainFrameId = payload.frameTree.frame.id; | 
| + onMainFrameId(mainFrameId); | 
| + } | 
| + | 
| + function onMainFrameId(mainFrameId) | 
| + { | 
| 
 
Sami
2017/04/28 10:12:57
nit: move brace to previous line
 
 | 
| + InspectorTest.log("Main Frame obtained"); | 
| + InspectorTest.sendCommandOrDie("Page.ensureIsolatedWorld", { | 
| + frameId: mainFrameId, worldId:1}); | 
| + } | 
| +} | 
| + | 
| +</script> | 
| +</head> | 
| +<body onload="runTest()"> | 
| +</body> | 
| +</html> |