OLD | NEW |
1 var initialize_BreakpointManagerTest = function() { | 1 var initialize_BreakpointManagerTest = function() { |
2 | 2 |
3 InspectorTest.createWorkspace = function() | 3 InspectorTest.createWorkspace = function() |
4 { | 4 { |
5 InspectorTest.testTargetManager = new SDK.TargetManager(); | 5 InspectorTest.testTargetManager = new SDK.TargetManager(); |
6 InspectorTest.testWorkspace = new Workspace.Workspace(); | 6 InspectorTest.testWorkspace = new Workspace.Workspace(); |
7 InspectorTest.testNetworkProjectManager = new Bindings.NetworkProjectManager
(InspectorTest.testTargetManager, InspectorTest.testWorkspace); | 7 InspectorTest.testNetworkProjectManager = new Bindings.NetworkProjectManager
(InspectorTest.testTargetManager, InspectorTest.testWorkspace); |
| 8 InspectorTest.testResourceBindingManager = new Bindings.ResourceBindingManag
er(InspectorTest.testTargetManager, InspectorTest.testWorkspace); |
8 InspectorTest.testDebuggerWorkspaceBinding = new Bindings.DebuggerWorkspaceB
inding(InspectorTest.testTargetManager, InspectorTest.testWorkspace); | 9 InspectorTest.testDebuggerWorkspaceBinding = new Bindings.DebuggerWorkspaceB
inding(InspectorTest.testTargetManager, InspectorTest.testWorkspace); |
| 10 // Override resourceBindingManager so that CSSWorkspaceBinding and DebuggerW
orkspaceBinding refer to the correct one. |
| 11 Bindings.resourceBindingManager = InspectorTest.testResourceBindingManager; |
| 12 } |
| 13 |
| 14 function resourceBindingForTarget(target) { |
| 15 var resourceTreeModel = target.model(SDK.ResourceTreeModel); |
| 16 var binding = resourceTreeModel ? InspectorTest.testResourceBindingManager._
modelToBinding.get(resourceTreeModel) : null; |
| 17 return binding; |
9 } | 18 } |
10 | 19 |
11 InspectorTest.createMockTarget = function(id) | 20 InspectorTest.createMockTarget = function(id) |
12 { | 21 { |
13 var capabilities = SDK.Target.Capability.AllForTests; | 22 var capabilities = SDK.Target.Capability.AllForTests; |
14 var target = InspectorTest.testTargetManager.createTarget("mock-target-id-"
+ id, "mock-target-" + id, capabilities & (~SDK.Target.Capability.JS), (params)
=> new SDK.StubConnection(params), null); | 23 var target = InspectorTest.testTargetManager.createTarget("mock-target-id-"
+ id, "mock-target-" + id, capabilities & (~SDK.Target.Capability.JS), (params)
=> new SDK.StubConnection(params), null); |
15 InspectorTest.testNetworkProject = Bindings.NetworkProject.forTarget(target)
; | 24 InspectorTest.testNetworkProject = Bindings.NetworkProject.forTarget(target)
; |
| 25 InspectorTest.testResourceBinding = resourceBindingForTarget(target); |
16 target._capabilitiesMask = capabilities; | 26 target._capabilitiesMask = capabilities; |
17 target._inspectedURL = InspectorTest.mainTarget.inspectedURL(); | 27 target._inspectedURL = InspectorTest.mainTarget.inspectedURL(); |
18 target.resourceTreeModel = target.model(SDK.ResourceTreeModel); | 28 target.resourceTreeModel = target.model(SDK.ResourceTreeModel); |
19 target.resourceTreeModel._cachedResourcesProcessed = true; | 29 target.resourceTreeModel._cachedResourcesProcessed = true; |
20 target.resourceTreeModel._frameAttached("42", 0); | 30 target.resourceTreeModel._frameAttached("42", 0); |
21 target.runtimeModel = /** @type {!SDK.RuntimeModel} */ (target.model(SDK.Run
timeModel)); | 31 target.runtimeModel = /** @type {!SDK.RuntimeModel} */ (target.model(SDK.Run
timeModel)); |
22 target.debuggerModel = new InspectorTest.DebuggerModelMock(target); | 32 target.debuggerModel = new InspectorTest.DebuggerModelMock(target); |
23 target._modelByConstructor.set(SDK.DebuggerModel, target.debuggerModel); | 33 target._modelByConstructor.set(SDK.DebuggerModel, target.debuggerModel); |
24 InspectorTest.testTargetManager.modelAdded(target, SDK.DebuggerModel, target
.debuggerModel); | 34 InspectorTest.testTargetManager.modelAdded(target, SDK.DebuggerModel, target
.debuggerModel); |
25 return target; | 35 return target; |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 } | 132 } |
123 | 133 |
124 createRawLocation(script, line, column) | 134 createRawLocation(script, line, column) |
125 { | 135 { |
126 return new SDK.DebuggerModel.Location(this, script.scriptId, line, colum
n); | 136 return new SDK.DebuggerModel.Location(this, script.scriptId, line, colum
n); |
127 } | 137 } |
128 | 138 |
129 createRawLocationByURL(url, line, column) | 139 createRawLocationByURL(url, line, column) |
130 { | 140 { |
131 var script = this._scriptForURL(url); | 141 var script = this._scriptForURL(url); |
| 142 if (!script) |
| 143 return null; |
132 return new SDK.DebuggerModel.Location(this, script.scriptId, line, colum
n); | 144 return new SDK.DebuggerModel.Location(this, script.scriptId, line, colum
n); |
133 } | 145 } |
134 | 146 |
135 setBreakpointByURL(url, lineNumber, columnNumber, condition, callback) | 147 setBreakpointByURL(url, lineNumber, columnNumber, condition, callback) |
136 { | 148 { |
137 InspectorTest.addResult(" debuggerModel.setBreakpoint(" + [url, lineN
umber, condition].join(":") + ")"); | 149 InspectorTest.addResult(" debuggerModel.setBreakpoint(" + [url, lineN
umber, condition].join(":") + ")"); |
138 | 150 |
139 var breakpointId = url + ":" + lineNumber; | 151 var breakpointId = url + ":" + lineNumber; |
140 if (this._breakpoints[breakpointId]) { | 152 if (this._breakpoints[breakpointId]) { |
141 this._scheduleSetBeakpointCallback(callback, null); | 153 this._scheduleSetBeakpointCallback(callback, null); |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
225 } | 237 } |
226 } | 238 } |
227 | 239 |
228 InspectorTest.addUISourceCode = function(target, breakpointManager, url, doNotSe
tSourceMapping, doNotAddScript) | 240 InspectorTest.addUISourceCode = function(target, breakpointManager, url, doNotSe
tSourceMapping, doNotAddScript) |
229 { | 241 { |
230 if (!doNotAddScript) | 242 if (!doNotAddScript) |
231 InspectorTest.addScript(target, breakpointManager, url); | 243 InspectorTest.addScript(target, breakpointManager, url); |
232 InspectorTest.addResult(" Adding UISourceCode: " + url); | 244 InspectorTest.addResult(" Adding UISourceCode: " + url); |
233 | 245 |
234 // Add resource to get UISourceCode. | 246 // Add resource to get UISourceCode. |
235 var uiSourceCode = InspectorTest.testWorkspace.uiSourceCodeForURL(url); | 247 var resourceBinding = resourceBindingForTarget(target); |
236 if (uiSourceCode) | 248 if (resourceBinding._resourceFiles.has(url)) { |
237 uiSourceCode.project().removeFile(url); | 249 resourceBinding._resourceFiles.get(url).dispose(); |
| 250 resourceBinding._resourceFiles.delete(url); |
| 251 } |
238 var resource = new SDK.Resource(target, null, url, url, '', '', Common.resou
rceTypes.Document, 'text/html', null, null); | 252 var resource = new SDK.Resource(target, null, url, url, '', '', Common.resou
rceTypes.Document, 'text/html', null, null); |
239 InspectorTest.testNetworkProject._addResource(resource); | 253 resourceBinding._resourceAdded({data: resource}); |
240 uiSourceCode = InspectorTest.testWorkspace.uiSourceCodeForURL(url); | 254 uiSourceCode = InspectorTest.testWorkspace.uiSourceCodeForURL(url); |
241 | 255 |
242 InspectorTest.uiSourceCodes[url] = uiSourceCode; | 256 InspectorTest.uiSourceCodes[url] = uiSourceCode; |
243 if (!doNotSetSourceMapping) { | 257 if (!doNotSetSourceMapping) { |
244 breakpointManager._debuggerWorkspaceBinding.updateLocations(target.debug
gerModel.scriptForId(url)); | 258 breakpointManager._debuggerWorkspaceBinding.updateLocations(target.debug
gerModel.scriptForId(url)); |
245 } | 259 } |
246 return uiSourceCode; | 260 return uiSourceCode; |
247 } | 261 } |
248 | 262 |
249 InspectorTest.createBreakpointManager = function(targetManager, debuggerWorkspac
eBinding, persistentBreakpoints) | 263 InspectorTest.createBreakpointManager = function(targetManager, debuggerWorkspac
eBinding, persistentBreakpoints) |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
397 } | 411 } |
398 | 412 |
399 function finish() | 413 function finish() |
400 { | 414 { |
401 InspectorTest.dumpBreakpointLocations(breakpointManager); | 415 InspectorTest.dumpBreakpointLocations(breakpointManager); |
402 next(); | 416 next(); |
403 } | 417 } |
404 } | 418 } |
405 | 419 |
406 } | 420 } |
OLD | NEW |