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="breakpoint-manager.js"></script> | 5 <script src="breakpoint-manager.js"></script> |
5 | 6 |
6 <script> | 7 <script> |
7 | 8 |
9 | |
8 function test() | 10 function test() |
9 { | 11 { |
10 InspectorTest.dumpTargetIds = true; | 12 InspectorTest.dumpTargetIds = true; |
11 InspectorTest.setupLiveLocationSniffers(); | 13 InspectorTest.setupLiveLocationSniffers(); |
12 | 14 |
13 | 15 |
14 InspectorTest.runTestSuite([ | 16 InspectorTest.runTestSuite([ |
15 | 17 |
16 function testResolvedBreakpointInBothTarget(next) | 18 function testResolvedBreakpointInBothTarget(next) |
17 { | 19 { |
18 var targetManager = new WebInspector.TargetManager(); | 20 InspectorTest.createWorkspace(true); |
19 var target1 = InspectorTest.createMockTarget(targetManager, 1); | 21 var breakpointManager = InspectorTest.createBreakpointManager(Inspec torTest.testTargetManager, InspectorTest.testDebuggerWorkspaceBinding); |
20 targetManager._targets.push(target1); | 22 var target1 = InspectorTest.createMockTarget(1); |
21 var breakpointManager = InspectorTest.createBreakpointManager(target Manager); | 23 InspectorTest.testTargetManager.addTarget(target1); |
22 var uiSourceCode = InspectorTest.addUISourceCode(target1, breakpoint Manager, "a.js"); | 24 var uiSourceCode = InspectorTest.addUISourceCode(target1, breakpoint Manager, "a.js"); |
23 var target2; | 25 var target2; |
24 InspectorTest.setBreakpoint(breakpointManager, uiSourceCode, 30, 0, "", true, step1); | 26 InspectorTest.setBreakpoint(breakpointManager, uiSourceCode, 30, 0, "", true, step1); |
25 | 27 |
26 function step1() | 28 function step1() |
27 { | 29 { |
28 target1.debuggerModel._breakpointResolved("a.js:30", new WebInsp ector.DebuggerModel.Location(target1, "a.js", 131, 5)); | 30 target1.debuggerModel._breakpointResolved("a.js:30", new WebInsp ector.DebuggerModel.Location(target1, "a.js", 131, 0)); |
29 InspectorTest.dumpBreakpointLocations(breakpointManager); | 31 InspectorTest.dumpBreakpointLocations(breakpointManager); |
30 InspectorTest.addResult(" Second target added"); | 32 InspectorTest.addResult(" Second target added"); |
31 target2 = InspectorTest.createMockTarget(targetManager, 2); | 33 target2 = InspectorTest.createMockTarget(2); |
32 new InspectorTest.DebuggerModelMock(target2, target2.defaultMapp ing); | 34 InspectorTest.testTargetManager.addTarget(target2); |
33 targetManager.addTarget(target2); | |
34 target2.debuggerModel._addScript("a.js", "a.js"); | 35 target2.debuggerModel._addScript("a.js", "a.js"); |
35 uiSourceCode.setSourceMappingForTarget(target2, target2.defaultM apping); | 36 uiSourceCode.setSourceMappingForTarget(target2, target2.defaultM apping); |
36 window.setBreakpointCallback = step2; | 37 window.setBreakpointCallback = step2; |
37 } | 38 } |
38 | 39 |
39 function step2() | 40 function step2() |
40 { | 41 { |
41 target2.debuggerModel._breakpointResolved("a.js:30", new WebInsp ector.DebuggerModel.Location(target2, "a.js", 30, 5)); | 42 target2.debuggerModel._breakpointResolved("a.js:30", new WebInsp ector.DebuggerModel.Location(target2, "a.js", 30, 0)); |
42 InspectorTest.dumpBreakpointLocations(breakpointManager); | 43 InspectorTest.dumpBreakpointLocations(breakpointManager); |
43 InspectorTest.addResult(" First target removed") | 44 InspectorTest.addResult(" First target removed"); |
44 targetManager.removeTarget(target1); | 45 target1.detached = true; |
46 InspectorTest.testTargetManager.removeTarget(target1); | |
45 InspectorTest.dumpBreakpointLocations(breakpointManager); | 47 InspectorTest.dumpBreakpointLocations(breakpointManager); |
46 InspectorTest.addResult(" Second target removed") | 48 InspectorTest.addResult(" Second target removed"); |
47 targetManager.removeTarget(target2); | 49 target2.detached = true; |
vsevik
2014/08/04 09:05:15
Move into testTargetManager.removeTarget() ?
apavlov
2014/08/04 10:04:34
This is a method on TargetManager, so extracted in
| |
48 InspectorTest.finishBreakpointTest(breakpointManager, next) | 50 InspectorTest.testTargetManager.removeTarget(target2); |
51 InspectorTest.finishBreakpointTest(breakpointManager, next); | |
49 } | 52 } |
50 | 53 |
51 }, | 54 }, |
52 | 55 |
53 function testResolvedBreakpointInOneTarget(next) | 56 function testResolvedBreakpointInOneTarget(next) |
54 { | 57 { |
55 var targetManager = new WebInspector.TargetManager(); | 58 InspectorTest.createWorkspace(true); |
56 var target1 = InspectorTest.createMockTarget(targetManager, 1); | 59 var target1 = InspectorTest.createMockTarget(1); |
57 var target2 = InspectorTest.createMockTarget(targetManager, 2); | 60 var target2 = InspectorTest.createMockTarget(2); |
58 | 61 |
59 targetManager._targets.push(target1); | 62 InspectorTest.testTargetManager.addTarget(target1); |
60 targetManager._targets.push(target2); | 63 InspectorTest.testTargetManager.addTarget(target2); |
61 var breakpointManager = InspectorTest.createBreakpointManager(target Manager); | 64 var breakpointManager = InspectorTest.createBreakpointManager(Inspec torTest.testTargetManager, InspectorTest.testDebuggerWorkspaceBinding); |
62 var uiSourceCode = InspectorTest.addUISourceCode(target1, breakpoint Manager, "a.js"); | 65 var uiSourceCode = InspectorTest.addUISourceCode(target1, breakpoint Manager, "a.js"); |
63 InspectorTest.setBreakpoint(breakpointManager, uiSourceCode, 30, 0, "", true, step1); | 66 InspectorTest.setBreakpoint(breakpointManager, uiSourceCode, 30, 0, "", true, step1); |
64 | 67 |
65 function step1() | 68 function step1() |
66 { | 69 { |
67 window.setBreakpointCallback = step2; | 70 window.setBreakpointCallback = step2; |
68 } | 71 } |
69 | 72 |
70 function step2() | 73 function step2() |
71 { | 74 { |
72 InspectorTest.addResult(" First target removed!") | 75 InspectorTest.addResult(" First target removed!") |
73 targetManager.removeTarget(target1); | 76 target1.detached = true; |
77 InspectorTest.testTargetManager.removeTarget(target1); | |
74 InspectorTest.dumpBreakpointLocations(breakpointManager); | 78 InspectorTest.dumpBreakpointLocations(breakpointManager); |
75 InspectorTest.finishBreakpointTest(breakpointManager, next); | 79 InspectorTest.finishBreakpointTest(breakpointManager, next); |
76 } | 80 } |
77 }, | 81 }, |
78 | 82 |
79 ]); | 83 ]); |
80 }; | 84 }; |
81 | |
82 </script> | 85 </script> |
83 | 86 |
84 </head> | 87 </head> |
85 | 88 |
86 <body onload="runTest()"> | 89 <body onload="runTest()"> |
87 <p>Tests BreakpointManager class.</p> | 90 <p>Tests BreakpointManager class.</p> |
88 | 91 |
89 </body> | 92 </body> |
90 </html> | 93 </html> |
OLD | NEW |