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

Side by Side Diff: test/inspector/debugger/framework-break.js

Issue 2633803002: [inspector] implemented blackboxing inside v8 (Closed)
Patch Set: rebased Created 3 years, 11 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
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 that breaks in framework code correctly processed.');
6
7 InspectorTest.addScript(`
8 function frameworkAssert() {
9 console.assert(false);
10 }
11
12 function throwCaughtError() {
13 try {
14 throw new Error();
15 } catch (e) {
16 }
17 }
18
19 function throwUncaughtError() {
20 throw new Error();
21 }
22
23 function breakpoint() {
24 return 239;
25 }
26
27 function debuggerStatement() {
28 debugger;
29 }
30
31 function syncDOMBreakpoint() {
32 breakProgram('DOM', JSON.stringify({a: 42}));
33 }
34
35 function asyncDOMBreakpoint() {
36 return 42;
37 }
38
39 function throwCaughtSyntaxError() {
40 try {
41 eval('}');
42 } catch (e) {
43 }
44 }
45
46 function throwFromJSONParse() {
47 try {
48 JSON.parse('ping');
49 } catch (e) {
50 }
51 }
52
53 //# sourceURL=framework.js`, 7, 26);
54
55 InspectorTest.setupScriptMap();
56 Protocol.Debugger.onPaused(message => {
57 InspectorTest.logCallFrames(message.params.callFrames);
58 InspectorTest.log('');
59 Protocol.Debugger.resume();
60 });
61
62 Protocol.Debugger.enable();
63 Protocol.Debugger.setBlackboxPatterns({ patterns: [ "framework\.js" ] });
64
65 InspectorTest.runTestSuite([
66 function testConsoleAssert(next) {
67 Protocol.Debugger.setPauseOnExceptions({ state: 'all' })
68 .then(() => InspectorTest.log('> all frames in framework:'))
69 .then(() => Protocol.Runtime.evaluate({
70 expression: 'frameworkAssert()//# sourceURL=framework.js'}))
71 .then(() => InspectorTest.log('> mixed, top frame in framework:'))
72 .then(() => Protocol.Runtime.evaluate({
73 expression: 'frameworkAssert()//# sourceURL=user.js'}))
74 .then(() => Protocol.Debugger.setPauseOnExceptions({ state: 'none' }))
75 .then(next);
76 },
77
78 function testCaughtException(next) {
79 Protocol.Debugger.setPauseOnExceptions({ state: 'all' })
80 .then(() => InspectorTest.log('> all frames in framework:'))
81 .then(() => Protocol.Runtime.evaluate({
82 expression: 'throwCaughtError()//# sourceURL=framework.js'}))
83 .then(() => InspectorTest.log('> mixed, top frame in framework:'))
84 .then(() => Protocol.Runtime.evaluate({
85 expression: 'throwCaughtError()//# sourceURL=user.js'}))
86 .then(() => Protocol.Debugger.setPauseOnExceptions({ state: 'none' }))
87 .then(next);
88 },
89
90 function testUncaughtException(next) {
91 Protocol.Debugger.setPauseOnExceptions({ state: 'all' })
92 .then(() => InspectorTest.log('> all frames in framework:'))
93 .then(() => Protocol.Runtime.evaluate({
94 expression: 'throwUncaughtError()//# sourceURL=framework.js'}))
95 .then(() => InspectorTest.log('> mixed, top frame in framework:'))
96 .then(() => Protocol.Runtime.evaluate({
97 expression: 'throwUncaughtError()//# sourceURL=user.js'}))
98 .then(() => Protocol.Debugger.setPauseOnExceptions({ state: 'none' }))
99 .then(next);
100 },
101
102 function testBreakpoint(next) {
103 Protocol.Debugger.setBreakpointByUrl({ lineNumber: 24, url: 'framework.js'})
104 .then(() => InspectorTest.log('> all frames in framework:'))
105 .then(() => Protocol.Runtime.evaluate({
106 expression: 'breakpoint()//# sourceURL=framework.js'}))
107 .then(() => InspectorTest.log('> mixed, top frame in framework:'))
108 .then(() => Protocol.Runtime.evaluate({
109 expression: 'breakpoint()//# sourceURL=user.js'}))
110 .then(next);
111 },
112
113 function testDebuggerStatement(next) {
114 InspectorTest.log('> all frames in framework:');
115 Protocol.Runtime.evaluate({
116 expression: 'debuggerStatement()//# sourceURL=framework.js'})
117 .then(() => InspectorTest.log('> mixed, top frame in framework:'))
118 .then(() => Protocol.Runtime.evaluate({
119 expression: 'debuggerStatement()//# sourceURL=user.js'}))
120 .then(next);
121 },
122
123 function testSyncDOMBreakpoint(next) {
124 InspectorTest.log('> all frames in framework:');
125 Protocol.Runtime.evaluate({
126 expression: 'syncDOMBreakpoint()//# sourceURL=framework.js'})
127 .then(() => InspectorTest.log('> mixed, top frame in framework:'))
128 .then(() => Protocol.Runtime.evaluate({
129 expression: 'syncDOMBreakpoint()//# sourceURL=user.js'}))
130 .then(next);
131 },
132
133 function testAsyncDOMBreakpoint(next) {
134 schedulePauseOnNextStatement('DOM', JSON.stringify({a: 42}));
135 InspectorTest.log('> all frames in framework:');
136 Protocol.Runtime.evaluate({
137 expression: 'asyncDOMBreakpoint()//# sourceURL=framework.js'})
138 .then(() => cancelPauseOnNextStatement())
139 .then(() => Protocol.Runtime.evaluate({
140 expression: '42//# sourceURL=user.js'}))
141 .then(() => schedulePauseOnNextStatement('DOM', JSON.stringify({a: 42})))
142 .then(() => Protocol.Runtime.evaluate({
143 expression: 'asyncDOMBreakpoint()//# sourceURL=user.js' }))
144 .then(next);
145 },
146
147 function testCaughtSyntaxError(next) {
148 Protocol.Debugger.setPauseOnExceptions({ state: 'all' })
149 .then(() => InspectorTest.log('> all frames in framework:'))
150 .then(() => Protocol.Runtime.evaluate({
151 expression: 'throwCaughtSyntaxError()//# sourceURL=framework.js'}))
152 .then(() => InspectorTest.log('> mixed, top frame in framework:'))
153 .then(() => Protocol.Runtime.evaluate({
154 expression: 'throwCaughtSyntaxError()//# sourceURL=user.js'}))
155 .then(() => Protocol.Debugger.setPauseOnExceptions({ state: 'none' }))
156 .then(next);
157 },
158
159 function testCaughtJSONParseError(next) {
160 Protocol.Debugger.setPauseOnExceptions({ state: 'all' })
161 .then(() => InspectorTest.log('> all frames in framework:'))
162 .then(() => Protocol.Runtime.evaluate({
163 expression: 'throwFromJSONParse()//# sourceURL=framework.js'}))
164 .then(() => InspectorTest.log('> mixed, top frame in framework:'))
165 .then(() => Protocol.Runtime.evaluate({
166 expression: 'throwFromJSONParse()//# sourceURL=user.js'}))
167 .then(() => Protocol.Debugger.setPauseOnExceptions({ state: 'none' }))
168 .then(next);
169 }
170 ]);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698