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

Side by Side 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2017 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 print('Checks protocol methods related to breakpoints');
6
7 InspectorTest.addScript(`
8 function foo() {
9 return 42;
10 }
11 //# sourceURL=test.js`, 7, 26);
12
13 InspectorTest.setupScriptMap();
14 Protocol.Debugger.onPaused(message => {
15 InspectorTest.logCallFrames(message.params.callFrames);
16 delete message.params.callFrames;
17 InspectorTest.logMessage(message);
18 Protocol.Debugger.resume();
19 });
20
21 Protocol.Debugger.enable();
22 InspectorTest.runTestSuite([
23 function oneBreakpointTwoScripts(next) {
24 var source = `
25 var arr = arr || [];
26 arr.push(function foo() {
27 return 42;
28 });
29 //# sourceURL=oneBreakpointTwoScripts.js`;
30
31 Protocol.Debugger.onBreakpointResolved(InspectorTest.logMessage);
32 var breakpointId;
33 Protocol.Debugger.setBreakpointByUrl({ lineNumber: 3, url: 'oneBreakpointTwo Scripts.js'})
34 .then(message => breakpointId = message.result.breakpointId)
35 .then(() => Protocol.Runtime.evaluate({ expression: source }))
36 .then(() => Protocol.Runtime.evaluate({ expression: source }))
37 .then(() => Protocol.Runtime.evaluate({ expression: 'arr.map(f => f())'}))
38 .then(() => Protocol.Debugger.removeBreakpoint({ breakpointId: breakpointI d }))
39 .then(() => Protocol.Runtime.evaluate({ expression: 'arr.map(f => f())'}))
40 .then(() => Protocol.Debugger.onBreakpointResolved(undefined))
41 .then(next);
42 },
43
44 function debugCommandAndRegularBreakpoint(next) {
45 Protocol.Debugger.onBreakpointResolved(InspectorTest.logMessage);
46 var breakpointId;
47 Protocol.Runtime.evaluate({ expression: 'debug(foo); monitor(foo);', include CommandLineAPI: true })
48 .then(() => Protocol.Debugger.setBreakpointByUrl({ lineNumber: 8, columnNu mber: 12, url: 'test.js' }))
49 .then(message => breakpointId = message.result.breakpointId)
50 .then(() => Protocol.Runtime.evaluate({ expression: 'foo()' }))
51 .then(() => Protocol.Runtime.evaluate({ expression: 'undebug(foo); unmonit or(foo);', includeCommandLineAPI: true }))
52 .then(() => Protocol.Runtime.evaluate({ expression: 'foo()' }))
53 .then(() => Protocol.Debugger.removeBreakpoint({ breakpointId: breakpointI d }))
54 .then(() => Protocol.Runtime.evaluate({ expression: 'foo()' }))
55 .then(() => Protocol.Debugger.onBreakpointResolved(undefined))
56 .then(next);
57 },
58
59 function setBreakpointByRawLocation(next) {
60 var scriptId;
61 var breakpointId;
62 Protocol.Debugger.onceScriptParsed()
63 .then(message => scriptId = message.params.scriptId)
64 .then(() => Protocol.Debugger.setBreakpoint({ location: { scriptId: script Id, lineNumber: 2 } }))
65 .then(message => breakpointId = message.result.breakpointId)
66 .then(() => Protocol.Runtime.evaluate({ expression: 'boo()' }))
67 .then(() => Protocol.Debugger.setBreakpoint({ location: { scriptId: script Id, lineNumber: 2 } }))
68 .then(InspectorTest.logMessage)
69 .then(() => Protocol.Debugger.removeBreakpoint({ breakpointId: breakpointI d }))
70 .then(() => Protocol.Runtime.evaluate({ expression: 'boo()' }))
71 .then(() => Protocol.Debugger.setBreakpoint({ location: { scriptId: script Id, lineNumber: 42 } }))
72 .then(InspectorTest.logMessage)
73 .then(next);
74
75 var source = `
76 function boo() {
77 return 42;
78 }
79 //# sourceURL=setBreakpointByRawLocation.js`;
80 Protocol.Runtime.evaluate({ expression: source });
81 },
82
83 function setBreakpointArgumentsChecks(next) {
84 Protocol.Debugger.setBreakpointByUrl({ lineNumber: 42 })
85 .then(InspectorTest.logMessage)
86 .then(() => Protocol.Debugger.setBreakpointByUrl({ lineNumber: 42, url: 'r andom.url' }))
87 .then(() => Protocol.Debugger.setBreakpointByUrl({ lineNumber: 42, url: 'r andom.url' }))
88 .then(InspectorTest.logMessage)
89 .then(next);
90 },
91
92 function setBreakpointByRegex(next) {
93 var source = `
94 var arr = arr || [];
95 arr.push(function foo() {
96 return 42;
97 });`;
98
99 Protocol.Debugger.onBreakpointResolved(InspectorTest.logMessage);
100 var breakpointId;
101 Protocol.Debugger.setBreakpointByUrl({ lineNumber: 3, urlRegex: 'setBreakpoi ntByRegex-[0-9]\\.js'})
102 .then(message => breakpointId = message.result.breakpointId)
103 .then(() => Protocol.Runtime.evaluate({ expression: source + '//# sourceUR L=setBreakpointByRegex-1.js'}))
104 .then(() => Protocol.Runtime.evaluate({ expression: source + '//# sourceUR L=setBreakpointByRegex-2.js'}))
105 .then(() => Protocol.Runtime.evaluate({ expression: 'arr.map(f => f())'}))
106 .then(() => Protocol.Debugger.removeBreakpoint({ breakpointId: breakpointI d }))
107 .then(() => Protocol.Runtime.evaluate({ expression: 'arr.map(f => f())'}))
108 .then(() => Protocol.Debugger.onBreakpointResolved(undefined))
109 .then(next);
110 }
111 ]);
OLDNEW
« 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