| OLD | NEW |
| 1 <html> | 1 <html> |
| 2 <head> | 2 <head> |
| 3 <script src="../../../http/tests/inspector/inspector-test.js"></script> | 3 <script src="../../../http/tests/inspector/inspector-test.js"></script> |
| 4 <script src="../../../http/tests/inspector/workspace-test.js"></script> | 4 <script src="../../../http/tests/inspector/workspace-test.js"></script> |
| 5 <script> | 5 <script> |
| 6 | 6 |
| 7 function test() | 7 function test() |
| 8 { | 8 { |
| 9 InspectorTest.createWorkspace(true); | 9 InspectorTest.createWorkspace(true); |
| 10 var context = new WebInspector.Context(); | 10 var context = new WebInspector.Context(); |
| 11 context.addFlavorChangeListener(WebInspector.ExecutionContext, executionCont
extChanged, this); | 11 context.addFlavorChangeListener(WebInspector.ExecutionContext, executionCont
extChanged, this); |
| 12 context.addFlavorChangeListener(WebInspector.Target, targetChanged, this); | 12 context.addFlavorChangeListener(WebInspector.Target, targetChanged, this); |
| 13 new WebInspector.ExecutionContextSelector(InspectorTest.testTargetManager, c
ontext); | 13 new WebInspector.ExecutionContextSelector(InspectorTest.testTargetManager, c
ontext); |
| 14 | 14 |
| 15 function executionContextChanged(event) | 15 function executionContextChanged(event) |
| 16 { | 16 { |
| 17 var executionContext = event.data; | 17 var executionContext = event.data; |
| 18 InspectorTest.addResult("Execution context selected: " + (executionConte
xt.isDefault ? executionContext.target().name() + ":" + executionContext.frameId
: executionContext.name)); | 18 InspectorTest.addResult("Execution context selected: " + (executionConte
xt.isDefault ? executionContext.target().name() + ":" + executionContext.frameId
: executionContext.name)); |
| 19 } | 19 } |
| 20 | 20 |
| 21 function targetChanged(event) | 21 function targetChanged(event) |
| 22 { | 22 { |
| 23 InspectorTest.addResult("Target selected: " + event.data.name()); | 23 InspectorTest.addResult("Target selected: " + event.data.name()); |
| 24 } | 24 } |
| 25 | 25 |
| 26 | 26 |
| 27 InspectorTest.addResult(""); | 27 InspectorTest.addResult(""); |
| 28 InspectorTest.addResult("Adding page target"); | 28 InspectorTest.addResult("Adding page target"); |
| 29 var pageTarget = InspectorTest.createMockTarget("page-target"); | 29 var pageTarget = InspectorTest.createMockTarget("page-target"); |
| 30 pageTarget.runtimeModel._executionContextCreated({id: "cs1", isDefault: fals
e, origin: "origin", name: "contentScript1", frameId: "42"}); | 30 pageTarget.runtimeModel._executionContextCreated({id: "cs1", auxData: { isDe
fault: false, frameId: "42" }, origin: "origin", name: "contentScript1"}); |
| 31 pageTarget.runtimeModel._executionContextCreated({id: "if1", isDefault: true
, origin: "origin", name: "iframeContext1", frameId: "iframe1"}); | 31 pageTarget.runtimeModel._executionContextCreated({id: "if1", auxData: { isDe
fault: true, frameId: "iframe1" }, origin: "origin", name: "iframeContext1"}); |
| 32 pageTarget.runtimeModel._executionContextCreated({id: "p1", isDefault: true,
origin: "origin", name: "pageContext1Name", frameId: "42"}); | 32 pageTarget.runtimeModel._executionContextCreated({id: "p1", auxData: { isDef
ault: true, frameId: "42" }, origin: "origin", name: "pageContext1Name"}); |
| 33 | 33 |
| 34 InspectorTest.addResult(""); | 34 InspectorTest.addResult(""); |
| 35 InspectorTest.addResult("Adding sw target"); | 35 InspectorTest.addResult("Adding sw target"); |
| 36 var swTarget = InspectorTest.createMockTarget("sw-target", null, WebInspecto
r.Target.Capability.Network | WebInspector.Target.Capability.Worker); | 36 var swTarget = InspectorTest.createMockTarget("sw-target", null, WebInspecto
r.Target.Capability.Network | WebInspector.Target.Capability.Worker); |
| 37 swTarget.runtimeModel._executionContextCreated({id: "sw1", isDefault: true,
origin: "origin", name: "swContext1Name", frameId: ""}); | 37 swTarget.runtimeModel._executionContextCreated({id: "sw1", auxData: { isDefa
ult: true, frameId: "" }, origin: "origin", name: "swContext1Name"}); |
| 38 | 38 |
| 39 InspectorTest.addResult(""); | 39 InspectorTest.addResult(""); |
| 40 InspectorTest.addResult("Removing page main frame"); | 40 InspectorTest.addResult("Removing page main frame"); |
| 41 pageTarget.runtimeModel._executionContextDestroyed("p1"); | 41 pageTarget.runtimeModel._executionContextDestroyed("p1"); |
| 42 | 42 |
| 43 InspectorTest.addResult(""); | 43 InspectorTest.addResult(""); |
| 44 InspectorTest.addResult("Readding page main frame"); | 44 InspectorTest.addResult("Readding page main frame"); |
| 45 pageTarget.runtimeModel._executionContextCreated({id: "p2", isDefault: true,
origin: "origin", name: "pageContext1Name", frameId: "42"}); | 45 pageTarget.runtimeModel._executionContextCreated({id: "p2", auxData: { isDef
ault: true, frameId: "42" }, origin: "origin", name: "pageContext1Name"}); |
| 46 | 46 |
| 47 InspectorTest.addResult(""); | 47 InspectorTest.addResult(""); |
| 48 InspectorTest.addResult("Switching to sw target"); | 48 InspectorTest.addResult("Switching to sw target"); |
| 49 context.setFlavor(WebInspector.Target, swTarget); | 49 context.setFlavor(WebInspector.Target, swTarget); |
| 50 | 50 |
| 51 InspectorTest.addResult(""); | 51 InspectorTest.addResult(""); |
| 52 InspectorTest.addResult("Switching to page target"); | 52 InspectorTest.addResult("Switching to page target"); |
| 53 context.setFlavor(WebInspector.Target, pageTarget); | 53 context.setFlavor(WebInspector.Target, pageTarget); |
| 54 | 54 |
| 55 InspectorTest.addResult(""); | 55 InspectorTest.addResult(""); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 79 InspectorTest.addResult(""); | 79 InspectorTest.addResult(""); |
| 80 InspectorTest.addResult("Switching to sw target"); | 80 InspectorTest.addResult("Switching to sw target"); |
| 81 context.setFlavor(WebInspector.Target, swTarget); | 81 context.setFlavor(WebInspector.Target, swTarget); |
| 82 | 82 |
| 83 InspectorTest.addResult(""); | 83 InspectorTest.addResult(""); |
| 84 InspectorTest.addResult("Removing page main frame"); | 84 InspectorTest.addResult("Removing page main frame"); |
| 85 pageTarget.runtimeModel._executionContextDestroyed("p2"); | 85 pageTarget.runtimeModel._executionContextDestroyed("p2"); |
| 86 | 86 |
| 87 InspectorTest.addResult(""); | 87 InspectorTest.addResult(""); |
| 88 InspectorTest.addResult("Readding page main frame"); | 88 InspectorTest.addResult("Readding page main frame"); |
| 89 pageTarget.runtimeModel._executionContextCreated({id: "p3", isDefault: true,
origin: "origin", name: "pageContext1Name", frameId: "42"}); | 89 pageTarget.runtimeModel._executionContextCreated({id: "p3", auxData: { isDef
ault: true, frameId: "42" }, origin: "origin", name: "pageContext1Name"}); |
| 90 | 90 |
| 91 InspectorTest.completeTest(); | 91 InspectorTest.completeTest(); |
| 92 } | 92 } |
| 93 | 93 |
| 94 </script> | 94 </script> |
| 95 </head> | 95 </head> |
| 96 | 96 |
| 97 <body onload="runTest()"> | 97 <body onload="runTest()"> |
| 98 <p> | 98 <p> |
| 99 Tests how execution context and target are selected. | 99 Tests how execution context and target are selected. |
| 100 </p> | 100 </p> |
| 101 | 101 |
| 102 </body> | 102 </body> |
| 103 </html> | 103 </html> |
| OLD | NEW |