Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(393)

Side by Side Diff: third_party/WebKit/LayoutTests/inspector/sources/debugger-ui/last-execution-context.html

Issue 2747863007: DevTools: clean up tests to not depend on NetworkProject.addFile method (Closed)
Patch Set: typo Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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> 4 <script>
5 5
6 function test() 6 function test()
7 { 7 {
8 var mockTargetId = 1;
9 function createMockTarget(name, capabilities, dontAttachToMain)
10 {
11 return SDK.targetManager.createTarget('mock-target-' + mockTargetId++, n ame, capabilities, params => new SDK.StubConnection(params), dontAttachToMain ? null : InspectorTest.mainTarget);
12 }
13
8 var context = new UI.Context(); 14 var context = new UI.Context();
9 context.addFlavorChangeListener(SDK.ExecutionContext, executionContextChange d, this); 15 context.addFlavorChangeListener(SDK.ExecutionContext, executionContextChange d, this);
10 context.addFlavorChangeListener(SDK.Target, targetChanged, this); 16 context.addFlavorChangeListener(SDK.Target, targetChanged, this);
11 new Main.ExecutionContextSelector(SDK.targetManager, context); 17 new Main.ExecutionContextSelector(SDK.targetManager, context);
12 18
13 function executionContextChanged(event) 19 function executionContextChanged(event)
14 { 20 {
15 var executionContext = event.data; 21 var executionContext = event.data;
16 InspectorTest.addResult("Execution context selected: " + (executionConte xt.isDefault ? executionContext.target().name() + ":" + executionContext.frameId : executionContext.name)); 22 InspectorTest.addResult("Execution context selected: " + (executionConte xt.isDefault ? executionContext.target().name() + ":" + executionContext.frameId : executionContext.name));
17 } 23 }
18 24
19 function targetChanged(event) 25 function targetChanged(event)
20 { 26 {
21 InspectorTest.addResult("Target selected: " + event.data.name()); 27 InspectorTest.addResult("Target selected: " + event.data.name());
22 } 28 }
23 29
24 InspectorTest.runtimeModel._executionContextsCleared(); 30 InspectorTest.runtimeModel._executionContextsCleared();
25 31
26 32
27 InspectorTest.addResult(""); 33 InspectorTest.addResult("");
28 InspectorTest.addResult("Adding page target"); 34 InspectorTest.addResult("Adding page target");
29 var pageTarget = InspectorTest.createMockTarget("page-target", SDK.Target.Ca pability.AllForTests, true /* dontAttachToMain */); 35 var pageTarget = createMockTarget("page-target", SDK.Target.Capability.AllFo rTests, true /* dontAttachToMain */);
30 SDK.ResourceTreeModel.fromTarget(pageTarget)._frameAttached('42', ''); 36 SDK.ResourceTreeModel.fromTarget(pageTarget)._frameAttached('42', '');
31 SDK.ResourceTreeModel.fromTarget(pageTarget)._frameNavigated({id: '42', pare ntId: '', loaderId: '', name: 'mock-frame', url: 'mock-url.com/frame.html', secu rityOrigin: 'mock-security-origin', mineType: 'mimeType'}); 37 SDK.ResourceTreeModel.fromTarget(pageTarget)._frameNavigated({id: '42', pare ntId: '', loaderId: '', name: 'mock-frame', url: 'mock-url.com/frame.html', secu rityOrigin: 'mock-security-origin', mineType: 'mimeType'});
32 pageTarget.runtimeModel._executionContextCreated({id: "cs1", auxData: { isDe fault: false, frameId: "42" }, origin: "origin", name: "contentScript1"}); 38 pageTarget.runtimeModel._executionContextCreated({id: "cs1", auxData: { isDe fault: false, frameId: "42" }, origin: "origin", name: "contentScript1"});
33 pageTarget.runtimeModel._executionContextCreated({id: "if1", auxData: { isDe fault: true, frameId: "iframe1" }, origin: "origin", name: "iframeContext1"}); 39 pageTarget.runtimeModel._executionContextCreated({id: "if1", auxData: { isDe fault: true, frameId: "iframe1" }, origin: "origin", name: "iframeContext1"});
34 pageTarget.runtimeModel._executionContextCreated({id: "p1", auxData: { isDef ault: true, frameId: "42" }, origin: "origin", name: "pageContext1Name"}); 40 pageTarget.runtimeModel._executionContextCreated({id: "p1", auxData: { isDef ault: true, frameId: "42" }, origin: "origin", name: "pageContext1Name"});
35 41
36 InspectorTest.addResult(""); 42 InspectorTest.addResult("");
37 InspectorTest.addResult("Adding sw target"); 43 InspectorTest.addResult("Adding sw target");
38 var swTarget = InspectorTest.createMockTarget("sw-target", SDK.Target.Capabi lity.Network | SDK.Target.Capability.Worker); 44 var swTarget = createMockTarget("sw-target", SDK.Target.Capability.Network | SDK.Target.Capability.Worker);
39 swTarget.runtimeModel._executionContextCreated({id: "sw1", auxData: { isDefa ult: true, frameId: "" }, origin: "origin", name: "swContext1Name"}); 45 swTarget.runtimeModel._executionContextCreated({id: "sw1", auxData: { isDefa ult: true, frameId: "" }, origin: "origin", name: "swContext1Name"});
40 46
41 InspectorTest.addResult(""); 47 InspectorTest.addResult("");
42 InspectorTest.addResult("Removing page main frame"); 48 InspectorTest.addResult("Removing page main frame");
43 pageTarget.runtimeModel._executionContextDestroyed("p1"); 49 pageTarget.runtimeModel._executionContextDestroyed("p1");
44 50
45 InspectorTest.addResult(""); 51 InspectorTest.addResult("");
46 InspectorTest.addResult("Readding page main frame"); 52 InspectorTest.addResult("Readding page main frame");
47 pageTarget.runtimeModel._executionContextCreated({id: "p2", auxData: { isDef ault: true, frameId: "42" }, origin: "origin", name: "pageContext1Name"}); 53 pageTarget.runtimeModel._executionContextCreated({id: "p2", auxData: { isDef ault: true, frameId: "42" }, origin: "origin", name: "pageContext1Name"});
48 54
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 </script> 102 </script>
97 </head> 103 </head>
98 104
99 <body onload="runTest()"> 105 <body onload="runTest()">
100 <p> 106 <p>
101 Tests how execution context and target are selected. 107 Tests how execution context and target are selected.
102 </p> 108 </p>
103 109
104 </body> 110 </body>
105 </html> 111 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698