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

Unified Diff: third_party/WebKit/LayoutTests/inspector-protocol/timeline/page-frames.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/timeline/page-frames.js
diff --git a/third_party/WebKit/LayoutTests/inspector-protocol/timeline/page-frames.js b/third_party/WebKit/LayoutTests/inspector-protocol/timeline/page-frames.js
new file mode 100644
index 0000000000000000000000000000000000000000..28c9e259531481fd702f821dd4992e40c7cb0b0d
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/inspector-protocol/timeline/page-frames.js
@@ -0,0 +1,40 @@
+(async function(testRunner) {
+ let {page, session, dp} = await testRunner.startHTML(`
+ <iframe src='data:text/html,<script>window.foo = 42</script>' name='frame0'></iframe>
+ `, '');
+
+ function performActions() {
+ var frame1 = document.createElement('iframe');
+ frame1.name = 'Frame No. 1';
+ document.body.appendChild(frame1);
+ frame1.contentWindow.document.write('console.log("frame2")');
+
+ var frame2 = document.createElement('iframe');
+ frame2.src = 'blank.html';
+ document.body.appendChild(frame2);
+
+ return new Promise(fulfill => { frame2.addEventListener('load', fulfill, false) });
+ }
+
+ var tracingHelper = (await testRunner.loadScript('../resources/tracing-test.js'))(testRunner, session);
+ await session.evaluate(performActions.toString());
+ tracingHelper.invokeAsyncWithTracing('performActions', finish);
+
+ function finish(devtoolsEvents, data) {
+ testRunner.log('Frames in TracingStartedInPage');
+ var tracingStarted = tracingHelper.findEvent('TracingStartedInPage', 'I');
+ for (var frame of tracingStarted.args['data']['frames'] || [])
+ dumpFrame(frame);
+
+ testRunner.log('Frames in CommitLoad events');
+ var commitLoads = tracingHelper.findEvents('CommitLoad', 'X');
+ for (var event of commitLoads)
+ dumpFrame(event.args['data']);
+ testRunner.completeTest();
+ }
+
+ function dumpFrame(frame) {
+ var url = frame.url.replace(/.*\/(([^/]*\/){2}[^/]*$)/, '$1');
+ testRunner.log(`url: ${url} name: ${frame.name} parent: ${typeof frame.parent} nodeId: ${typeof frame.nodeId}`);
+ }
+})

Powered by Google App Engine
This is Rietveld 408576698