Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / inspector / sources / debugger-ui / last-execution-context.html
blob12ff43ddcd204b034dbaff443b39391353c8fda8
1 <html>
2 <head>
3 <script src="../../../http/tests/inspector/inspector-test.js"></script>
4 <script src="../../../http/tests/inspector/workspace-test.js"></script>
5 <script>
7 function test()
9 InspectorTest.createWorkspace(true);
10 var context = new WebInspector.Context();
11 context.addFlavorChangeListener(WebInspector.ExecutionContext, executionContextChanged, this);
12 context.addFlavorChangeListener(WebInspector.Target, targetChanged, this);
13 new WebInspector.ExecutionContextSelector(InspectorTest.testTargetManager, context);
15 function executionContextChanged(event)
17 var executionContext = event.data;
18 InspectorTest.addResult("Execution context selected: " + (executionContext.isMainWorldContext ? executionContext.target().name() + ":" + executionContext.frameId : ""));
21 function targetChanged(event)
23 InspectorTest.addResult("Target selected: " + event.data.name());
27 InspectorTest.addResult("Adding page target:");
28 var pageTarget = InspectorTest.createMockTarget("page-target");
29 pageTarget.runtimeModel._executionContextCreated({id: "p1", name: "pageContext1", origin: "origin", name: "pageContext1Name", frameId: "pageFrame1"});
30 InspectorTest.addResult("");
32 InspectorTest.addResult("Adding sw target:");
33 var swTarget = InspectorTest.createMockTarget("sw-target");
34 swTarget.runtimeModel._executionContextCreated({id: "sw1", name: "swContext1", origin: "origin", name: "swContext1Name", frameId: ""});
36 InspectorTest.addResult("");
37 InspectorTest.addResult("Removing page target:");
38 pageTarget.runtimeModel._executionContextDestroyed("p1");
40 InspectorTest.addResult("");
41 InspectorTest.addResult("Readding page target:");
42 pageTarget.runtimeModel._executionContextCreated({id: "p2", name: "", origin: "", name: "", frameId: "pageFrame1"});
44 InspectorTest.completeTest();
47 </script>
48 </head>
50 <body onload="runTest()">
51 <p>
52 Tests that re-adding a removed target restores the last selected execution context.
53 </p>
55 </body>
56 </html>