| 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> | |
| 5 <script> | 4 <script> |
| 6 | 5 |
| 7 function test() | 6 function test() |
| 8 { | 7 { |
| 9 InspectorTest.createWorkspace(true); | |
| 10 var context = new UI.Context(); | 8 var context = new UI.Context(); |
| 11 context.addFlavorChangeListener(SDK.ExecutionContext, executionContextChange
d, this); | 9 context.addFlavorChangeListener(SDK.ExecutionContext, executionContextChange
d, this); |
| 12 context.addFlavorChangeListener(SDK.Target, targetChanged, this); | 10 context.addFlavorChangeListener(SDK.Target, targetChanged, this); |
| 13 new Components.ExecutionContextSelector(InspectorTest.testTargetManager, con
text); | 11 new Components.ExecutionContextSelector(SDK.targetManager, context); |
| 14 | 12 |
| 15 function executionContextChanged(event) | 13 function executionContextChanged(event) |
| 16 { | 14 { |
| 17 var executionContext = event.data; | 15 var executionContext = event.data; |
| 18 InspectorTest.addResult("Execution context selected: " + (executionConte
xt.isDefault ? executionContext.target().name() + ":" + executionContext.frameId
: executionContext.name)); | 16 InspectorTest.addResult("Execution context selected: " + (executionConte
xt.isDefault ? executionContext.target().name() + ":" + executionContext.frameId
: executionContext.name)); |
| 19 } | 17 } |
| 20 | 18 |
| 21 function targetChanged(event) | 19 function targetChanged(event) |
| 22 { | 20 { |
| 23 InspectorTest.addResult("Target selected: " + event.data.name()); | 21 InspectorTest.addResult("Target selected: " + event.data.name()); |
| 24 } | 22 } |
| 25 | 23 |
| 24 InspectorTest.runtimeModel._executionContextsCleared(); |
| 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 SDK.ResourceTreeModel.fromTarget(pageTarget)._cachedResourcesProcessed = tru
e; |
| 31 SDK.ResourceTreeModel.fromTarget(pageTarget)._frameAttached("42", 0); |
| 30 pageTarget.runtimeModel._executionContextCreated({id: "cs1", auxData: { isDe
fault: false, frameId: "42" }, origin: "origin", name: "contentScript1"}); | 32 pageTarget.runtimeModel._executionContextCreated({id: "cs1", auxData: { isDe
fault: false, frameId: "42" }, origin: "origin", name: "contentScript1"}); |
| 31 pageTarget.runtimeModel._executionContextCreated({id: "if1", auxData: { isDe
fault: true, frameId: "iframe1" }, origin: "origin", name: "iframeContext1"}); | 33 pageTarget.runtimeModel._executionContextCreated({id: "if1", auxData: { isDe
fault: true, frameId: "iframe1" }, origin: "origin", name: "iframeContext1"}); |
| 32 pageTarget.runtimeModel._executionContextCreated({id: "p1", auxData: { isDef
ault: true, frameId: "42" }, origin: "origin", name: "pageContext1Name"}); | 34 pageTarget.runtimeModel._executionContextCreated({id: "p1", auxData: { isDef
ault: true, frameId: "42" }, origin: "origin", name: "pageContext1Name"}); |
| 33 | 35 |
| 34 InspectorTest.addResult(""); | 36 InspectorTest.addResult(""); |
| 35 InspectorTest.addResult("Adding sw target"); | 37 InspectorTest.addResult("Adding sw target"); |
| 36 var swTarget = InspectorTest.createMockTarget("sw-target", null, SDK.Target.
Capability.Network | SDK.Target.Capability.Worker); | 38 var swTarget = InspectorTest.createMockTarget("sw-target", SDK.Target.Capabi
lity.Network | SDK.Target.Capability.Worker); |
| 37 swTarget.runtimeModel._executionContextCreated({id: "sw1", auxData: { isDefa
ult: true, frameId: "" }, origin: "origin", name: "swContext1Name"}); | 39 swTarget.runtimeModel._executionContextCreated({id: "sw1", auxData: { isDefa
ult: true, frameId: "" }, origin: "origin", name: "swContext1Name"}); |
| 38 | 40 |
| 39 InspectorTest.addResult(""); | 41 InspectorTest.addResult(""); |
| 40 InspectorTest.addResult("Removing page main frame"); | 42 InspectorTest.addResult("Removing page main frame"); |
| 41 pageTarget.runtimeModel._executionContextDestroyed("p1"); | 43 pageTarget.runtimeModel._executionContextDestroyed("p1"); |
| 42 | 44 |
| 43 InspectorTest.addResult(""); | 45 InspectorTest.addResult(""); |
| 44 InspectorTest.addResult("Readding page main frame"); | 46 InspectorTest.addResult("Readding page main frame"); |
| 45 pageTarget.runtimeModel._executionContextCreated({id: "p2", auxData: { isDef
ault: true, frameId: "42" }, origin: "origin", name: "pageContext1Name"}); | 47 pageTarget.runtimeModel._executionContextCreated({id: "p2", auxData: { isDef
ault: true, frameId: "42" }, origin: "origin", name: "pageContext1Name"}); |
| 46 | 48 |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 </script> | 96 </script> |
| 95 </head> | 97 </head> |
| 96 | 98 |
| 97 <body onload="runTest()"> | 99 <body onload="runTest()"> |
| 98 <p> | 100 <p> |
| 99 Tests how execution context and target are selected. | 101 Tests how execution context and target are selected. |
| 100 </p> | 102 </p> |
| 101 | 103 |
| 102 </body> | 104 </body> |
| 103 </html> | 105 </html> |
| OLD | NEW |