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

Unified Diff: third_party/WebKit/LayoutTests/inspector-protocol/page/frameAttachedStacktrace.js

Issue 2942573003: [DevTools] New harness for inspector-protocol layout tests (Closed)
Patch Set: Protocol -> dp 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/page/frameAttachedStacktrace.js
diff --git a/third_party/WebKit/LayoutTests/inspector-protocol/page/frameAttachedStacktrace.js b/third_party/WebKit/LayoutTests/inspector-protocol/page/frameAttachedStacktrace.js
new file mode 100644
index 0000000000000000000000000000000000000000..c33f0204bf31338acaa3fa2999cc950a0b0bf049
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/inspector-protocol/page/frameAttachedStacktrace.js
@@ -0,0 +1,59 @@
+(async function(testRunner) {
+ let {page, session, dp} = await testRunner.startURL('../resources/frame-attached-stacktrace-page.html', '');
+
+ const expectedNumberOfFrames = 3;
+ var currentFrameCount = 0;
+
+ dp.Page.onFrameAttached(data => {
+ currentFrameCount++;
+ testRunner.log("Frame Attached");
+ var stack = data.params.stack;
+ if (stack) {
+ logCallframes(stack.callFrames);
+ } else {
+ testRunner.log("Stack is empty");
+ testRunner.log("");
+ }
+ if (currentFrameCount >= expectedNumberOfFrames) {
+ testRunner.completeTest();
+ }
+ });
+
+ dp.Page.enable();
+ dp.Page.reload({ "ignoreCache": false });
+ await dp.Page.onceLoadEventFired();
+ session.evaluate('createFrame()');
+
+ // showUrl left in for debugging reasons.
+ function logCallframes(frames) {
+ testRunner.log("Call Frames :");
+ if (!frames) {
+ testRunner.log("No callframes");
+ testRunner.log("");
+ return;
+ }
+ testRunner.log("[");
+ for (var i = 0; i < frames.length; i++) {
+ var frame = frames[i];
+ testRunner.log(" [" + i + "] : {");
+ if (!frame) {
+ testRunner.log(" No Frame");
+ continue;
+ }
+ var url = frame.url || '';
+ if (url.indexOf('data:') !== 0 && url.indexOf('/') !== -1) {
+ var urlParts = url.split('/');
+ url = "<only showing file name>/" + urlParts[urlParts.length - 1];
+ }
+ testRunner.log(" columnNumber : " + frame.columnNumber);
+ testRunner.log(" functionName : " + frame.functionName);
+ testRunner.log(" lineNumber : " + frame.lineNumber);
+ testRunner.log(" scriptId : " + (frame.scriptId ? "<scriptId>" : null));
+ testRunner.log(" lineNumber : " + frame.lineNumber);
+ testRunner.log(" url : " + url);
+ testRunner.log(" }");
+ }
+ testRunner.log("]");
+ testRunner.log("");
+ }
+})

Powered by Google App Engine
This is Rietveld 408576698