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

Unified Diff: test/inspector/debugger/set-blackbox-patterns.js

Issue 2782783003: [inspector] deoptimize function in Debug::PrepareStepIn
Patch Set: rebased Created 3 years, 9 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
Index: test/inspector/debugger/set-blackbox-patterns.js
diff --git a/test/inspector/debugger/set-blackbox-patterns.js b/test/inspector/debugger/set-blackbox-patterns.js
index 12e9e214d3ec50f954322449d1390a263ad6e466..5a791b6d3ec8d2d5f6da11b58504c20dff09b638 100644
--- a/test/inspector/debugger/set-blackbox-patterns.js
+++ b/test/inspector/debugger/set-blackbox-patterns.js
@@ -2,58 +2,70 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-InspectorTest.addScript(
-`function bar()
-{
- return 42;
-}`);
-
-InspectorTest.addScript(
-`function foo()
-{
- var a = bar();
- return a + 1;
+InspectorTest.log('Checks Protocol.Debugger.setBlackboxPatterns');
+
+InspectorTest.addScript(`
+function bar() {
+ return 42;
+}
+//# sourceURL=bar.js`);
+
+InspectorTest.addScript(`
+function foo() {
+ var a = bar();
+ return a + 1;
}
//# sourceURL=foo.js`);
-InspectorTest.addScript(
-`function qwe()
-{
- var a = foo();
- return a + 1;
+InspectorTest.addScript(`
+function qwe() {
+ var a = foo();
+ return a + 1;
}
//# sourceURL=qwe.js`);
-InspectorTest.addScript(
-`function baz()
-{
+InspectorTest.addScript(`
+function baz() {
var a = qwe();
return a + 1;
}
//# sourceURL=baz.js`);
+InspectorTest.setupScriptMap();
+InspectorTest.logProtocolCommandCalls('Debugger.pause');
+InspectorTest.logProtocolCommandCalls('Debugger.stepInto');
+InspectorTest.logProtocolCommandCalls('Debugger.stepOver');
Protocol.Debugger.enable();
-Protocol.Debugger.setBlackboxPatterns({ patterns: [ "foo([" ] }).then(dumpError);
-
-function dumpError(message)
-{
- InspectorTest.log(message.error.message);
- Protocol.Debugger.onPaused(dumpStackAndRunNextCommand);
- Protocol.Debugger.setBlackboxPatterns({ patterns: [ "baz\.js", "foo\.js" ] });
- Protocol.Runtime.evaluate({ "expression": "debugger;baz()" });
-}
+InspectorTest.runAsyncTestSuite([
+ async function testIncorrectPattern() {
+ let message = await Protocol.Debugger.setBlackboxPatterns({
+ patterns: [ "foo([" ] });
+ InspectorTest.log(message.error.message);
+ },
-var commands = [ "stepInto", "stepInto", "stepInto", "stepOut", "stepInto", "stepInto" ];
-function dumpStackAndRunNextCommand(message)
-{
- InspectorTest.log("Paused in");
- var callFrames = message.params.callFrames;
- for (var callFrame of callFrames)
- InspectorTest.log((callFrame.functionName || "(...)") + ":" + (callFrame.location.lineNumber + 1));
- var command = commands.shift();
- if (!command) {
- InspectorTest.completeTest();
- return;
+ async function testStepping() {
+ await Protocol.Debugger.setBlackboxPatterns({
+ patterns: [ "baz\.js", "foo\.js" ] });
+ await Protocol.Debugger.pause();
+ Protocol.Runtime.evaluate({expression: 'baz()\n'});
+ await logPauseLocation(await Protocol.Debugger.oncePaused());
+ Protocol.Debugger.stepInto();
+ await logPauseLocation(await Protocol.Debugger.oncePaused());
+ Protocol.Debugger.stepInto();
+ await logPauseLocation(await Protocol.Debugger.oncePaused());
+ Protocol.Debugger.stepOut();
+ await logPauseLocation(await Protocol.Debugger.oncePaused());
+ Protocol.Debugger.stepInto();
+ await logPauseLocation(await Protocol.Debugger.oncePaused());
+ Protocol.Debugger.stepInto();
+ await logPauseLocation(await Protocol.Debugger.oncePaused());
+ await Protocol.Debugger.resume();
}
- Protocol.Debugger[command]();
+]);
+
+function logPauseLocation(message) {
+ InspectorTest.log('\nStack:');
+ InspectorTest.logCallFrames(message.params.callFrames);
+ InspectorTest.log('\nBreak location:');
+ return InspectorTest.logSourceLocation(message.params.callFrames[0].location);
}

Powered by Google App Engine
This is Rietveld 408576698