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

Unified Diff: test/inspector/protocol-test.js

Issue 2574803002: [inspector] add async instrumentation for setTimeout in tests (Closed)
Patch Set: addressed comments Created 4 years 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 | « test/inspector/inspector-test.cc ('k') | test/inspector/task-runner.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/inspector/protocol-test.js
diff --git a/test/inspector/protocol-test.js b/test/inspector/protocol-test.js
index dada81cc0da7a820d96e4d7928be8599c65d8b1e..37e6447f79235410871e23ffebe0d79bb5832674 100644
--- a/test/inspector/protocol-test.js
+++ b/test/inspector/protocol-test.js
@@ -101,6 +101,17 @@ InspectorTest.logObject = function(object, title)
InspectorTest.log(lines.join("\n"));
}
+InspectorTest.logCallFrames = function(callFrames)
+{
+ for (var frame of callFrames) {
+ var functionName = frame.functionName || '(anonymous)';
+ var url = frame.url ? frame.url : InspectorTest._scriptMap.get(frame.location.scriptId).url;
+ var lineNumber = frame.location ? frame.location.lineNumber : frame.lineNumber;
+ var columnNumber = frame.location ? frame.location.columnNumber : frame.columnNumber;
+ InspectorTest.log(`${functionName} (${url}:${lineNumber}:${columnNumber})`);
+ }
+}
+
InspectorTest.completeTest = function()
{
Protocol.Debugger.disable().then(() => quit());
@@ -113,7 +124,7 @@ InspectorTest.completeTestAfterPendingTimeouts = function()
awaitPromise: true }).then(InspectorTest.completeTest);
}
-InspectorTest.addScript = (string) => compileAndRunWithOrigin(string, "", 0, 0);
+InspectorTest.addScript = (string, lineOffset, columnOffset) => compileAndRunWithOrigin(string, "", lineOffset || 0, columnOffset || 0);
InspectorTest.addScriptWithUrl = (string, url) => compileAndRunWithOrigin(string, url, 0, 0);
InspectorTest.startDumpingProtocolMessages = function()
@@ -143,6 +154,12 @@ InspectorTest.checkExpectation = function(fail, name, messageObject)
InspectorTest.expectedSuccess = InspectorTest.checkExpectation.bind(null, false);
InspectorTest.expectedError = InspectorTest.checkExpectation.bind(null, true);
+InspectorTest.setupScriptMap = function() {
+ if (InspectorTest._scriptMap)
+ return;
+ InspectorTest._scriptMap = new Map();
+}
+
InspectorTest.runTestSuite = function(testSuite)
{
function nextTest()
@@ -194,6 +211,8 @@ InspectorTest._dispatchMessage = function(messageObject)
} else {
var eventName = messageObject["method"];
var eventHandler = InspectorTest._eventHandler[eventName];
+ if (InspectorTest._scriptMap && eventName === "Debugger.scriptParsed")
+ InspectorTest._scriptMap.set(messageObject.params.scriptId, JSON.parse(JSON.stringify(messageObject.params)));
if (eventHandler)
eventHandler(messageObject);
}
« no previous file with comments | « test/inspector/inspector-test.cc ('k') | test/inspector/task-runner.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698