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

Unified Diff: test/inspector/debugger/set-breakpoint.js

Issue 2685163006: [inspector] migrate set/remove BreakPoint to debug-interface.h (Closed)
Patch Set: added comment about inlined jsframe index Created 3 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/wasm/wasm-objects.cc ('k') | test/inspector/debugger/set-breakpoint-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/inspector/debugger/set-breakpoint.js
diff --git a/test/inspector/debugger/set-breakpoint.js b/test/inspector/debugger/set-breakpoint.js
new file mode 100644
index 0000000000000000000000000000000000000000..60762b5a540e3932edbfad07e5d62cb9c17a5f8f
--- /dev/null
+++ b/test/inspector/debugger/set-breakpoint.js
@@ -0,0 +1,111 @@
+// Copyright 2017 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+print('Checks protocol methods related to breakpoints');
+
+InspectorTest.addScript(`
+function foo() {
+ return 42;
+}
+//# sourceURL=test.js`, 7, 26);
+
+InspectorTest.setupScriptMap();
+Protocol.Debugger.onPaused(message => {
+ InspectorTest.logCallFrames(message.params.callFrames);
+ delete message.params.callFrames;
+ InspectorTest.logMessage(message);
+ Protocol.Debugger.resume();
+});
+
+Protocol.Debugger.enable();
+InspectorTest.runTestSuite([
+ function oneBreakpointTwoScripts(next) {
+ var source = `
+ var arr = arr || [];
+ arr.push(function foo() {
+ return 42;
+ });
+ //# sourceURL=oneBreakpointTwoScripts.js`;
+
+ Protocol.Debugger.onBreakpointResolved(InspectorTest.logMessage);
+ var breakpointId;
+ Protocol.Debugger.setBreakpointByUrl({ lineNumber: 3, url: 'oneBreakpointTwoScripts.js'})
+ .then(message => breakpointId = message.result.breakpointId)
+ .then(() => Protocol.Runtime.evaluate({ expression: source }))
+ .then(() => Protocol.Runtime.evaluate({ expression: source }))
+ .then(() => Protocol.Runtime.evaluate({ expression: 'arr.map(f => f())'}))
+ .then(() => Protocol.Debugger.removeBreakpoint({ breakpointId: breakpointId }))
+ .then(() => Protocol.Runtime.evaluate({ expression: 'arr.map(f => f())'}))
+ .then(() => Protocol.Debugger.onBreakpointResolved(undefined))
+ .then(next);
+ },
+
+ function debugCommandAndRegularBreakpoint(next) {
+ Protocol.Debugger.onBreakpointResolved(InspectorTest.logMessage);
+ var breakpointId;
+ Protocol.Runtime.evaluate({ expression: 'debug(foo); monitor(foo);', includeCommandLineAPI: true })
+ .then(() => Protocol.Debugger.setBreakpointByUrl({ lineNumber: 8, columnNumber: 12, url: 'test.js' }))
+ .then(message => breakpointId = message.result.breakpointId)
+ .then(() => Protocol.Runtime.evaluate({ expression: 'foo()' }))
+ .then(() => Protocol.Runtime.evaluate({ expression: 'undebug(foo); unmonitor(foo);', includeCommandLineAPI: true }))
+ .then(() => Protocol.Runtime.evaluate({ expression: 'foo()' }))
+ .then(() => Protocol.Debugger.removeBreakpoint({ breakpointId: breakpointId }))
+ .then(() => Protocol.Runtime.evaluate({ expression: 'foo()' }))
+ .then(() => Protocol.Debugger.onBreakpointResolved(undefined))
+ .then(next);
+ },
+
+ function setBreakpointByRawLocation(next) {
+ var scriptId;
+ var breakpointId;
+ Protocol.Debugger.onceScriptParsed()
+ .then(message => scriptId = message.params.scriptId)
+ .then(() => Protocol.Debugger.setBreakpoint({ location: { scriptId: scriptId, lineNumber: 2 } }))
+ .then(message => breakpointId = message.result.breakpointId)
+ .then(() => Protocol.Runtime.evaluate({ expression: 'boo()' }))
+ .then(() => Protocol.Debugger.setBreakpoint({ location: { scriptId: scriptId, lineNumber: 2 } }))
+ .then(InspectorTest.logMessage)
+ .then(() => Protocol.Debugger.removeBreakpoint({ breakpointId: breakpointId }))
+ .then(() => Protocol.Runtime.evaluate({ expression: 'boo()' }))
+ .then(() => Protocol.Debugger.setBreakpoint({ location: { scriptId: scriptId, lineNumber: 42 } }))
+ .then(InspectorTest.logMessage)
+ .then(next);
+
+ var source = `
+ function boo() {
+ return 42;
+ }
+ //# sourceURL=setBreakpointByRawLocation.js`;
+ Protocol.Runtime.evaluate({ expression: source });
+ },
+
+ function setBreakpointArgumentsChecks(next) {
+ Protocol.Debugger.setBreakpointByUrl({ lineNumber: 42 })
+ .then(InspectorTest.logMessage)
+ .then(() => Protocol.Debugger.setBreakpointByUrl({ lineNumber: 42, url: 'random.url' }))
+ .then(() => Protocol.Debugger.setBreakpointByUrl({ lineNumber: 42, url: 'random.url' }))
+ .then(InspectorTest.logMessage)
+ .then(next);
+ },
+
+ function setBreakpointByRegex(next) {
+ var source = `
+ var arr = arr || [];
+ arr.push(function foo() {
+ return 42;
+ });`;
+
+ Protocol.Debugger.onBreakpointResolved(InspectorTest.logMessage);
+ var breakpointId;
+ Protocol.Debugger.setBreakpointByUrl({ lineNumber: 3, urlRegex: 'setBreakpointByRegex-[0-9]\\.js'})
+ .then(message => breakpointId = message.result.breakpointId)
+ .then(() => Protocol.Runtime.evaluate({ expression: source + '//# sourceURL=setBreakpointByRegex-1.js'}))
+ .then(() => Protocol.Runtime.evaluate({ expression: source + '//# sourceURL=setBreakpointByRegex-2.js'}))
+ .then(() => Protocol.Runtime.evaluate({ expression: 'arr.map(f => f())'}))
+ .then(() => Protocol.Debugger.removeBreakpoint({ breakpointId: breakpointId }))
+ .then(() => Protocol.Runtime.evaluate({ expression: 'arr.map(f => f())'}))
+ .then(() => Protocol.Debugger.onBreakpointResolved(undefined))
+ .then(next);
+ }
+]);
« no previous file with comments | « src/wasm/wasm-objects.cc ('k') | test/inspector/debugger/set-breakpoint-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698