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

Unified Diff: test/inspector/debugger/framework-break.js

Issue 2633803002: [inspector] implemented blackboxing inside v8 (Closed)
Patch Set: addressed comments 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/objects-inl.h ('k') | test/inspector/debugger/framework-break-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/inspector/debugger/framework-break.js
diff --git a/test/inspector/debugger/framework-break.js b/test/inspector/debugger/framework-break.js
new file mode 100644
index 0000000000000000000000000000000000000000..44ae680a68d5c73a4feda52a75c788d56b56a48b
--- /dev/null
+++ b/test/inspector/debugger/framework-break.js
@@ -0,0 +1,189 @@
+// 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 that breaks in framework code correctly processed.');
+
+InspectorTest.addScript(
+ `
+function frameworkAssert() {
+ console.assert(false);
+}
+
+function throwCaughtError() {
+ try {
+ throw new Error();
+ } catch (e) {
+ }
+}
+
+function throwUncaughtError() {
+ throw new Error();
+}
+
+function breakpoint() {
+ return 239;
+}
+
+function debuggerStatement() {
+ debugger;
+}
+
+function syncDOMBreakpoint() {
+ breakProgram('', '');
+}
+
+function asyncDOMBreakpoint() {
+ return 42;
+}
+
+function throwCaughtSyntaxError() {
+ try {
+ eval('}');
+ } catch (e) {
+ }
+}
+
+function throwFromJSONParse() {
+ try {
+ JSON.parse('ping');
+ } catch (e) {
+ }
+}
+
+//# sourceURL=framework.js`,
+ 7, 26);
+
+InspectorTest.setupScriptMap();
+Protocol.Debugger.onPaused(message => {
+ InspectorTest.logCallFrames(message.params.callFrames);
+ InspectorTest.log('');
+ Protocol.Debugger.resume();
+});
+
+Protocol.Debugger.enable();
+Protocol.Debugger.setBlackboxPatterns({patterns: ['framework\.js']});
+
+InspectorTest.runTestSuite([
+ function testConsoleAssert(next) {
+ Protocol.Debugger.setPauseOnExceptions({state: 'all'})
+ .then(() => InspectorTest.log('> all frames in framework:'))
+ .then(
+ () => Protocol.Runtime.evaluate(
+ {expression: 'frameworkAssert()//# sourceURL=framework.js'}))
+ .then(() => InspectorTest.log('> mixed, top frame in framework:'))
+ .then(
+ () => Protocol.Runtime.evaluate(
+ {expression: 'frameworkAssert()//# sourceURL=user.js'}))
+ .then(() => Protocol.Debugger.setPauseOnExceptions({state: 'none'}))
+ .then(next);
+ },
+
+ function testCaughtException(next) {
+ Protocol.Debugger.setPauseOnExceptions({state: 'all'})
+ .then(() => InspectorTest.log('> all frames in framework:'))
+ .then(
+ () => Protocol.Runtime.evaluate(
+ {expression: 'throwCaughtError()//# sourceURL=framework.js'}))
+ .then(() => InspectorTest.log('> mixed, top frame in framework:'))
+ .then(
+ () => Protocol.Runtime.evaluate(
+ {expression: 'throwCaughtError()//# sourceURL=user.js'}))
+ .then(() => Protocol.Debugger.setPauseOnExceptions({state: 'none'}))
+ .then(next);
+ },
+
+ function testUncaughtException(next) {
+ Protocol.Debugger.setPauseOnExceptions({state: 'all'})
+ .then(() => InspectorTest.log('> all frames in framework:'))
+ .then(
+ () => Protocol.Runtime.evaluate(
+ {expression: 'throwUncaughtError()//# sourceURL=framework.js'}))
+ .then(() => InspectorTest.log('> mixed, top frame in framework:'))
+ .then(
+ () => Protocol.Runtime.evaluate(
+ {expression: 'throwUncaughtError()//# sourceURL=user.js'}))
+ .then(() => Protocol.Debugger.setPauseOnExceptions({state: 'none'}))
+ .then(next);
+ },
+
+ function testBreakpoint(next) {
+ Protocol.Debugger.setBreakpointByUrl({lineNumber: 24, url: 'framework.js'})
+ .then(() => InspectorTest.log('> all frames in framework:'))
+ .then(
+ () => Protocol.Runtime.evaluate(
+ {expression: 'breakpoint()//# sourceURL=framework.js'}))
+ .then(() => InspectorTest.log('> mixed, top frame in framework:'))
+ .then(
+ () => Protocol.Runtime.evaluate(
+ {expression: 'breakpoint()//# sourceURL=user.js'}))
+ .then(next);
+ },
+
+ function testDebuggerStatement(next) {
+ InspectorTest.log('> all frames in framework:');
+ Protocol.Runtime
+ .evaluate({expression: 'debuggerStatement()//# sourceURL=framework.js'})
+ .then(() => InspectorTest.log('> mixed, top frame in framework:'))
+ .then(
+ () => Protocol.Runtime.evaluate(
+ {expression: 'debuggerStatement()//# sourceURL=user.js'}))
+ .then(next);
+ },
+
+ function testSyncDOMBreakpoint(next) {
+ InspectorTest.log('> all frames in framework:');
+ Protocol.Runtime
+ .evaluate({expression: 'syncDOMBreakpoint()//# sourceURL=framework.js'})
+ .then(() => InspectorTest.log('> mixed, top frame in framework:'))
+ .then(
+ () => Protocol.Runtime.evaluate(
+ {expression: 'syncDOMBreakpoint()//# sourceURL=user.js'}))
+ .then(next);
+ },
+
+ function testAsyncDOMBreakpoint(next) {
+ schedulePauseOnNextStatement('', '');
+ InspectorTest.log('> all frames in framework:');
+ Protocol.Runtime
+ .evaluate(
+ {expression: 'asyncDOMBreakpoint()//# sourceURL=framework.js'})
+ .then(() => cancelPauseOnNextStatement())
+ .then(
+ () => Protocol.Runtime.evaluate(
+ {expression: '42//# sourceURL=user.js'}))
+ .then(() => schedulePauseOnNextStatement('', ''))
+ .then(
+ () => Protocol.Runtime.evaluate(
+ {expression: 'asyncDOMBreakpoint()//# sourceURL=user.js'}))
+ .then(next);
+ },
+
+ function testCaughtSyntaxError(next) {
+ Protocol.Debugger.setPauseOnExceptions({state: 'all'})
+ .then(() => InspectorTest.log('> all frames in framework:'))
+ .then(() => Protocol.Runtime.evaluate({
+ expression: 'throwCaughtSyntaxError()//# sourceURL=framework.js'
+ }))
+ .then(() => InspectorTest.log('> mixed, top frame in framework:'))
+ .then(
+ () => Protocol.Runtime.evaluate(
+ {expression: 'throwCaughtSyntaxError()//# sourceURL=user.js'}))
+ .then(() => Protocol.Debugger.setPauseOnExceptions({state: 'none'}))
+ .then(next);
+ },
+
+ function testCaughtJSONParseError(next) {
+ Protocol.Debugger.setPauseOnExceptions({state: 'all'})
+ .then(() => InspectorTest.log('> all frames in framework:'))
+ .then(
+ () => Protocol.Runtime.evaluate(
+ {expression: 'throwFromJSONParse()//# sourceURL=framework.js'}))
+ .then(() => InspectorTest.log('> mixed, top frame in framework:'))
+ .then(
+ () => Protocol.Runtime.evaluate(
+ {expression: 'throwFromJSONParse()//# sourceURL=user.js'}))
+ .then(() => Protocol.Debugger.setPauseOnExceptions({state: 'none'}))
+ .then(next);
+ }
+]);
« no previous file with comments | « src/objects-inl.h ('k') | test/inspector/debugger/framework-break-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698