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

Unified Diff: third_party/WebKit/LayoutTests/inspector-protocol/debugger/continueToLocation.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/continueToLocation.js
diff --git a/third_party/WebKit/LayoutTests/inspector-protocol/debugger/continueToLocation.js b/third_party/WebKit/LayoutTests/inspector-protocol/debugger/continueToLocation.js
new file mode 100644
index 0000000000000000000000000000000000000000..466535a8756036157678375ee60002c5b69978be
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/inspector-protocol/debugger/continueToLocation.js
@@ -0,0 +1,79 @@
+(async function(testRunner) {
+ let {page, session, dp} = await testRunner.startBlank('');
+
+ function statementsExample()
chenwilliam 2017/06/30 20:23:27 should we standardize on whether to have inspected
+ {
+ var self = arguments.callee;
+
+ debugger;
+
+ self.step = 1;
+
+ self.step = 2;
+
+ void [
+ self.step = 3,
+ self.step = 4,
+ self.step = 5,
+ self.step = 6
+ ];
+
+ self.step = 7;
+ }
+
+ var scenarios = [
+ // requested line number, expected control parameter 'step', expected line number
+ [ 8, 1, 8 ],
+ [ 8, 1, 8 ],
+ [ 12, 6, 17 ],
+ [ 13, 6, 17 ],
+ [ 17, 6, 17 ],
+ [ 17, 6, 17 ],
+ ];
+
+ dp.Debugger.enable();
+ var functionResponse = await dp.Runtime.evaluate({expression: statementsExample.toString() + '; statementsExample'});
+ var functionObjectId = functionResponse.result.result.objectId;
+
+ var detailsResponse = await dp.Runtime.getProperties({objectId: functionObjectId});
+ var scriptId;
+ for (var prop of detailsResponse.result.internalProperties) {
+ if (prop.name === '[[FunctionLocation]]')
+ scriptId = prop.value.value.scriptId;
+ }
+
+ for (var scenario of scenarios) {
+ var lineNumber = scenario[0];
+ var expectedResult = scenario[1];
+ var expectedLineNumber = scenario[2];
+ dp.Runtime.evaluate({expression: 'setTimeout(statementsExample, 0)' });
+ await dp.Debugger.oncePaused();
+ testRunner.log('Paused on debugger statement');
+
+ var continueToLocationResponse = await dp.Debugger.continueToLocation({location: {scriptId, lineNumber, columnNumber: 0}});
+ if (continueToLocationResponse.error) {
+ testRunner.log('Failed to execute continueToLocation ' + JSON.stringify(continueToLocationResponse.error));
+ testRunner.completeTest();
+ return;
+ }
+
+ var messageObject = await dp.Debugger.oncePaused();
+ testRunner.log('Paused after continueToLocation');
+ var actualLineNumber = messageObject.params.callFrames[0].location.lineNumber;
+ testRunner.log('Stopped on line ' + actualLineNumber + ', expected ' + expectedLineNumber + ', requested ' + lineNumber + ', (0-based numbers).');
+
+ dp.Debugger.onPaused(handleDebuggerPausedUnexpected);
+ var resultValue = (await dp.Runtime.evaluate({expression: 'statementsExample.step' })).result.result.value;
+ testRunner.log(`Control parameter 'step' calculation result: ${resultValue}, expected: ${expectedResult}`);
+ testRunner.log(resultValue == expectedResult ? 'SUCCESS' : 'FAIL');
+ dp.Debugger.resume();
+ dp.Debugger.offPaused(handleDebuggerPausedUnexpected);
+
+ function handleDebuggerPausedUnexpected() {
+ testRunner.log('Unexpected debugger pause');
+ testRunner.completeTest();
+ }
+ }
+
+ testRunner.completeTest();
+})

Powered by Google App Engine
This is Rietveld 408576698