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.testDebuggerWorkspaceBinding = new Bindings.DebuggerWorkspaceB
inding(InspectorTest.testTargetManager, InspectorTest.testWorkspace); | 8 InspectorTest.testDebuggerWorkspaceBinding = new Bindings.DebuggerWorkspaceB
inding(InspectorTest.testTargetManager, InspectorTest.testWorkspace); |
9 } | 9 } |
10 | 10 |
11 InspectorTest.createMockTarget = function(id) | 11 InspectorTest.createMockTarget = function(id) |
12 { | 12 { |
13 var capabilities = SDK.Target.Capability.AllForTests; | 13 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); | 14 var dispatcher = new Protocol.Dispatcher((params) => new SDK.StubConnection(
params)); |
| 15 var target = InspectorTest.testTargetManager.createTarget("mock-target-id-"
+ id, "mock-target-" + id, capabilities & (~SDK.Target.Capability.JS), dispatche
r, null); |
15 InspectorTest.testNetworkProject = Bindings.NetworkProject.forTarget(target)
; | 16 InspectorTest.testNetworkProject = Bindings.NetworkProject.forTarget(target)
; |
16 target._capabilitiesMask = capabilities; | 17 target._capabilitiesMask = capabilities; |
17 target._inspectedURL = InspectorTest.mainTarget.inspectedURL(); | 18 target._inspectedURL = InspectorTest.mainTarget.inspectedURL(); |
18 target.resourceTreeModel = target.model(SDK.ResourceTreeModel); | 19 target.resourceTreeModel = target.model(SDK.ResourceTreeModel); |
19 target.resourceTreeModel._cachedResourcesProcessed = true; | 20 target.resourceTreeModel._cachedResourcesProcessed = true; |
20 target.resourceTreeModel._frameAttached("42", 0); | 21 target.resourceTreeModel._frameAttached("42", 0); |
21 target.runtimeModel = /** @type {!SDK.RuntimeModel} */ (target.model(SDK.Run
timeModel)); | 22 target.runtimeModel = /** @type {!SDK.RuntimeModel} */ (target.model(SDK.Run
timeModel)); |
22 target.debuggerModel = new InspectorTest.DebuggerModelMock(target); | 23 target.debuggerModel = new InspectorTest.DebuggerModelMock(target, target._d
ispatcher); |
23 target._modelByConstructor.set(SDK.DebuggerModel, target.debuggerModel); | 24 target._modelByConstructor.set(SDK.DebuggerModel, target.debuggerModel); |
24 InspectorTest.testTargetManager.modelAdded(target, SDK.DebuggerModel, target
.debuggerModel); | 25 InspectorTest.testTargetManager.modelAdded(target, SDK.DebuggerModel, target
.debuggerModel); |
25 return target; | 26 return target; |
26 } | 27 } |
27 | 28 |
28 InspectorTest.uiSourceCodes = {}; | 29 InspectorTest.uiSourceCodes = {}; |
29 | 30 |
30 InspectorTest.initializeDefaultMappingOnTarget = function(target) | 31 InspectorTest.initializeDefaultMappingOnTarget = function(target) |
31 { | 32 { |
32 var defaultMapping = { | 33 var defaultMapping = { |
(...skipping 15 matching lines...) Expand all Loading... |
48 } | 49 } |
49 }; | 50 }; |
50 target.defaultMapping = defaultMapping; | 51 target.defaultMapping = defaultMapping; |
51 } | 52 } |
52 | 53 |
53 InspectorTest.DebuggerModelMock = class extends SDK.SDKModel { | 54 InspectorTest.DebuggerModelMock = class extends SDK.SDKModel { |
54 sourceMapManager() { | 55 sourceMapManager() { |
55 return this._sourceMapManager; | 56 return this._sourceMapManager; |
56 } | 57 } |
57 | 58 |
58 constructor(target) | 59 constructor(target, dispatcher) |
59 { | 60 { |
60 super(target); | 61 super(target, dispatcher); |
61 this._sourceMapManager = new SDK.SourceMapManager(); | 62 this._sourceMapManager = new SDK.SourceMapManager(); |
62 this._target = target; | 63 this._target = target; |
| 64 this._agent = dispatcher.debuggerAgent(); |
63 this._breakpointResolvedEventTarget = new Common.Object(); | 65 this._breakpointResolvedEventTarget = new Common.Object(); |
64 this._scripts = {}; | 66 this._scripts = {}; |
65 this._breakpoints = {}; | 67 this._breakpoints = {}; |
66 this._debuggerWorkspaceBinding = InspectorTest.testDebuggerWorkspaceBind
ing; | 68 this._debuggerWorkspaceBinding = InspectorTest.testDebuggerWorkspaceBind
ing; |
67 } | 69 } |
68 | 70 |
69 target() | 71 target() |
70 { | 72 { |
71 return this._target; | 73 return this._target; |
72 } | 74 } |
(...skipping 11 matching lines...) Expand all Loading... |
84 } | 86 } |
85 | 87 |
86 scriptsForSourceURL(url) | 88 scriptsForSourceURL(url) |
87 { | 89 { |
88 var script = this._scriptForURL(url); | 90 var script = this._scriptForURL(url); |
89 return script ? [script] : []; | 91 return script ? [script] : []; |
90 } | 92 } |
91 | 93 |
92 _addScript(scriptId, url) | 94 _addScript(scriptId, url) |
93 { | 95 { |
94 var script = new SDK.Script(this, scriptId, url); | 96 var script = new SDK.Script(this, this._agent, scriptId, url); |
95 this._scripts[scriptId] = script; | 97 this._scripts[scriptId] = script; |
96 this._debuggerWorkspaceBinding._debuggerModelToData.get(this)._parsedScr
iptSource({data: script}); | 98 this._debuggerWorkspaceBinding._debuggerModelToData.get(this)._parsedScr
iptSource({data: script}); |
97 } | 99 } |
98 | 100 |
99 _scriptForURL(url) | 101 _scriptForURL(url) |
100 { | 102 { |
101 for (var scriptId in this._scripts) { | 103 for (var scriptId in this._scripts) { |
102 var script = this._scripts[scriptId]; | 104 var script = this._scripts[scriptId]; |
103 if (script.sourceURL === url) | 105 if (script.sourceURL === url) |
104 return script; | 106 return script; |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
238 InspectorTest.addUISourceCode = function(target, breakpointManager, url, doNotSe
tSourceMapping, doNotAddScript) | 240 InspectorTest.addUISourceCode = function(target, breakpointManager, url, doNotSe
tSourceMapping, doNotAddScript) |
239 { | 241 { |
240 if (!doNotAddScript) | 242 if (!doNotAddScript) |
241 InspectorTest.addScript(target, breakpointManager, url); | 243 InspectorTest.addScript(target, breakpointManager, url); |
242 InspectorTest.addResult(" Adding UISourceCode: " + url); | 244 InspectorTest.addResult(" Adding UISourceCode: " + url); |
243 | 245 |
244 // Add resource to get UISourceCode. | 246 // Add resource to get UISourceCode. |
245 var uiSourceCode = InspectorTest.testWorkspace.uiSourceCodeForURL(url); | 247 var uiSourceCode = InspectorTest.testWorkspace.uiSourceCodeForURL(url); |
246 if (uiSourceCode) | 248 if (uiSourceCode) |
247 uiSourceCode.project().removeFile(url); | 249 uiSourceCode.project().removeFile(url); |
248 var resource = new SDK.Resource(target, null, url, url, '', '', Common.resou
rceTypes.Document, 'text/html', null, null); | 250 var resource = new SDK.Resource(target.model(SDK.ResourceTreeModel), target.
_dispatcher.pageAgent(), null, url, url, '', '', Common.resourceTypes.Document,
'text/html', null, null); |
249 InspectorTest.testNetworkProject._addResource(resource); | 251 InspectorTest.testNetworkProject._addResource(resource); |
250 uiSourceCode = InspectorTest.testWorkspace.uiSourceCodeForURL(url); | 252 uiSourceCode = InspectorTest.testWorkspace.uiSourceCodeForURL(url); |
251 | 253 |
252 //var contentProvider = Common.StaticContentProvider.fromString(url, Common.
resourceTypes.Script, ""); | 254 //var contentProvider = Common.StaticContentProvider.fromString(url, Common.
resourceTypes.Script, ""); |
253 //var uiSourceCode = InspectorTest.testNetworkProject.addFile(contentProvide
r, null); | 255 //var uiSourceCode = InspectorTest.testNetworkProject.addFile(contentProvide
r, null); |
254 InspectorTest.uiSourceCodes[url] = uiSourceCode; | 256 InspectorTest.uiSourceCodes[url] = uiSourceCode; |
255 if (!doNotSetSourceMapping) { | 257 if (!doNotSetSourceMapping) { |
256 breakpointManager._debuggerWorkspaceBinding.setSourceMapping(target.debu
ggerModel, uiSourceCode, breakpointManager.defaultMapping); | 258 breakpointManager._debuggerWorkspaceBinding.setSourceMapping(target.debu
ggerModel, uiSourceCode, breakpointManager.defaultMapping); |
257 breakpointManager._debuggerWorkspaceBinding.updateLocations(target.debug
gerModel.scriptForId(url)); | 259 breakpointManager._debuggerWorkspaceBinding.updateLocations(target.debug
gerModel.scriptForId(url)); |
258 } | 260 } |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
410 } | 412 } |
411 | 413 |
412 function finish() | 414 function finish() |
413 { | 415 { |
414 InspectorTest.dumpBreakpointLocations(breakpointManager); | 416 InspectorTest.dumpBreakpointLocations(breakpointManager); |
415 next(); | 417 next(); |
416 } | 418 } |
417 } | 419 } |
418 | 420 |
419 } | 421 } |
OLD | NEW |