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

Unified Diff: third_party/WebKit/LayoutTests/inspector-protocol/debugger/stepping-with-blackboxed-ranges.js

Issue 2968523003: [DevTools] Migrate inspector-protocol/debugger tests to new harness (Closed)
Patch Set: all tests Created 3 years, 6 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: third_party/WebKit/LayoutTests/inspector-protocol/debugger/stepping-with-blackboxed-ranges.js
diff --git a/third_party/WebKit/LayoutTests/inspector-protocol/debugger/stepping-with-blackboxed-ranges.js b/third_party/WebKit/LayoutTests/inspector-protocol/debugger/stepping-with-blackboxed-ranges.js
new file mode 100644
index 0000000000000000000000000000000000000000..497572845515e1147502aa8c6fd359a45f8f5172
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/inspector-protocol/debugger/stepping-with-blackboxed-ranges.js
@@ -0,0 +1,131 @@
+(async function(testRunner) {
+ let {page, session, dp} = await testRunner.startBlank('');
+
+ function printCallFrames(response) {
+ var callFrames = response.params.callFrames;
+ var topCallFrame = callFrames[0];
+ if (topCallFrame.functionName.startsWith('blackboxed'))
+ testRunner.log('FAIL: blackboxed function in top call frame');
+ for (var callFrame of callFrames)
+ testRunner.log(callFrame.functionName + ': ' + callFrame.location.lineNumber + ':' + callFrame.location.columnNumber);
+ testRunner.log('');
+ }
+
+ function printError(response) {
+ if (response.error)
+ testRunner.log(response.error.message);
+ }
+
+ await session.evaluate(
+`function blackboxedBoo()
+{
+ var a = 42;
+ var b = foo();
+ return a + b;
+}
+//# sourceURL=blackboxed-script.js
+`);
+
+ await session.evaluate(
+`function notBlackboxedFoo()
+{
+ var a = 42;
+ var b = blackboxedBoo();
+ return a + b;
+}
+
+function blackboxedFoo()
+{
+ var a = 42;
+ var b = notBlackboxedFoo();
+ return a + b;
+}
+
+function notBlackboxedBoo()
+{
+ var a = 42;
+ var b = blackboxedFoo();
+ return a + b;
+}
+//# sourceURL=mixed-source.js
+`);
+
+ await session.evaluate(`
+
+
+
+
+
+function testFunction()
+{
+ notBlackboxedBoo(); // for setup ranges and stepOut
+ notBlackboxedBoo(); // for stepIn
+}
+
+function foo()
+{
+ debugger;
+ return 239;
+}
+ `);
+
+ await dp.Debugger.enable();
+ session.evaluate('setTimeout(testFunction, 0);');
+
+ var response = await dp.Debugger.oncePaused();
+ printCallFrames(response);
+ var scriptId = response.params.callFrames[2].location.scriptId;
+
+ printError(await dp.Debugger.setBlackboxedRanges({
+ scriptId: response.params.callFrames[1].location.scriptId,
+ positions: [{lineNumber: 0, columnNumber: 0}] // blackbox ranges for blackboxed.js
+ }));
+
+ var incorrectPositions = [
+ [{lineNumber: 0, columnNumber: 0}, {lineNumber: 0, columnNumber: 0}],
+ [{lineNumber: 0, columnNumber: 1}, {lineNumber: 0, columnNumber: 0}],
+ [{lineNumber: 0, columnNumber: -1}],
+ ];
+ for (var positions of incorrectPositions) {
+ testRunner.log('Try to set positions: ' + JSON.stringify(positions));
+ printError(await dp.Debugger.setBlackboxedRanges({scriptId, positions}));
+ }
+
+ await dp.Debugger.setBlackboxedRanges({
+ scriptId,
+ positions: [{lineNumber: 6, columnNumber: 0}, {lineNumber: 14, columnNumber: 0}] // blackbox ranges for mixed.js
+ });
+
+ testRunner.log('action: stepOut');
+ dp.Debugger.stepOut();
+ printCallFrames(await dp.Debugger.oncePaused());
+ testRunner.log('action: stepOut');
+ dp.Debugger.stepOut();
+ printCallFrames(await dp.Debugger.oncePaused());
+ testRunner.log('action: stepOut');
+ dp.Debugger.stepOut();
+ printCallFrames(await dp.Debugger.oncePaused());
+ testRunner.log('action: stepInto');
+ dp.Debugger.stepInto();
+ printCallFrames(await dp.Debugger.oncePaused());
+ testRunner.log('action: stepOver');
+ dp.Debugger.stepOver();
+ await dp.Debugger.oncePaused();
+ testRunner.log('action: stepInto');
+ dp.Debugger.stepInto();
+ printCallFrames(await dp.Debugger.oncePaused());
+ testRunner.log('action: stepOver');
+ dp.Debugger.stepOver();
+ await dp.Debugger.oncePaused();
+ testRunner.log('action: stepInto');
+ dp.Debugger.stepInto();
+ printCallFrames(await dp.Debugger.oncePaused());
+ testRunner.log('action: stepOver');
+ dp.Debugger.stepOver();
+ await dp.Debugger.oncePaused();
+ testRunner.log('action: stepInto');
+ dp.Debugger.stepInto();
+ printCallFrames(await dp.Debugger.oncePaused());
+ await dp.Debugger.resume();
+ testRunner.completeTest();
+})

Powered by Google App Engine
This is Rietveld 408576698