OLD | NEW |
1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 print("Test for Debugger.getPossibleBreakpoints"); | 5 print("Test for Debugger.getPossibleBreakpoints"); |
6 | 6 |
7 Protocol.Runtime.enable(); | 7 Protocol.Runtime.enable(); |
8 Protocol.Debugger.enable(); | 8 Protocol.Debugger.enable(); |
9 | 9 |
10 InspectorTest.runTestSuite([ | 10 InspectorTest.runTestSuite([ |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 // TODO(kozyatinskiy): lineNumber for return position should be only 19, n
ot 20. | 156 // TODO(kozyatinskiy): lineNumber for return position should be only 19, n
ot 20. |
157 .then(() => waitForPossibleBreakpoints("() => { return 239 }", { lineNumbe
r: 0, columnNumber: 0 })) | 157 .then(() => waitForPossibleBreakpoints("() => { return 239 }", { lineNumbe
r: 0, columnNumber: 0 })) |
158 .then(InspectorTest.logMessage) | 158 .then(InspectorTest.logMessage) |
159 .then(next) | 159 .then(next) |
160 } | 160 } |
161 ]); | 161 ]); |
162 | 162 |
163 function compileScript(source, origin) { | 163 function compileScript(source, origin) { |
164 var promise = Protocol.Debugger.onceScriptParsed().then(message => message.par
ams.scriptId); | 164 var promise = Protocol.Debugger.onceScriptParsed().then(message => message.par
ams.scriptId); |
165 if (!origin) origin = { name: "", line_offset: 0, column_offset: 0 }; | 165 if (!origin) origin = { name: "", line_offset: 0, column_offset: 0 }; |
166 compileAndRunWithOrigin(source, origin.name, origin.line_offset, origin.column
_offset); | 166 compileAndRunWithOrigin(source, origin.name, origin.line_offset, origin.column
_offset, false); |
167 return promise; | 167 return promise; |
168 } | 168 } |
169 | 169 |
170 function waitForPossibleBreakpoints(source, start, end, origin) { | 170 function waitForPossibleBreakpoints(source, start, end, origin) { |
171 return compileScript(source, origin) | 171 return compileScript(source, origin) |
172 .then(scriptId => { (start || {}).scriptId = scriptId; (end || {}).scriptId
= scriptId }) | 172 .then(scriptId => { (start || {}).scriptId = scriptId; (end || {}).scriptId
= scriptId }) |
173 .then(() => Protocol.Debugger.getPossibleBreakpoints({ start: start, end: en
d })); | 173 .then(() => Protocol.Debugger.getPossibleBreakpoints({ start: start, end: en
d })); |
174 } | 174 } |
175 | 175 |
176 function waitForPossibleBreakpointsOnPause(source, start, end, next) { | 176 function waitForPossibleBreakpointsOnPause(source, start, end, next) { |
(...skipping 17 matching lines...) Expand all Loading... |
194 InspectorTest.logMessage(message); | 194 InspectorTest.logMessage(message); |
195 return; | 195 return; |
196 } | 196 } |
197 var id_data = message.result.breakpointId.split(":"); | 197 var id_data = message.result.breakpointId.split(":"); |
198 if (parseInt(id_data[1]) !== message.result.actualLocation.lineNumber || parse
Int(id_data[2]) !== message.result.actualLocation.columnNumber) { | 198 if (parseInt(id_data[1]) !== message.result.actualLocation.lineNumber || parse
Int(id_data[2]) !== message.result.actualLocation.columnNumber) { |
199 InspectorTest.log("FAIL: possible breakpoint was resolved in another locatio
n"); | 199 InspectorTest.log("FAIL: possible breakpoint was resolved in another locatio
n"); |
200 InspectorTest.logMessage(message); | 200 InspectorTest.logMessage(message); |
201 } | 201 } |
202 InspectorTest.logMessage(message); | 202 InspectorTest.logMessage(message); |
203 } | 203 } |
OLD | NEW |