forked from chromium/chromium
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
DevTools: Try to fix broken page-frames.js test
The test was flaky a long time ago but now fails consistently. The TracingStartedInPage trace event doesn't seem to be emitted anymore so I replaced this with the TracingStartedInBrowser event. That event doesn't emit nodeIds so I updated the expectation to assert that they are undfined. Also a drive-by cleanup to tracing-test which was trying to JSONify the wrong variable which meant the output in case the test failed was not helpful. Also clean up the test itself with const, JS style etc. Bug: 734762 Change-Id: I3f7f5665ace38525fca5967c5de6f6fba02d3d5a Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1983172 Reviewed-by: Mathias Bynens <mathias@chromium.org> Commit-Queue: Peter Marshall <petermarshall@chromium.org> Cr-Commit-Position: refs/heads/master@{#728177}
- Loading branch information
1 parent
693492c
commit 8c5da8e
Showing
4 changed files
with
17 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
third_party/blink/web_tests/inspector-protocol/timeline/page-frames-expected.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 14 additions & 12 deletions
26
third_party/blink/web_tests/inspector-protocol/timeline/page-frames.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,40 @@ | ||
(async function(testRunner) { | ||
var {page, session, dp} = await testRunner.startHTML(` | ||
const {page, session, dp} = await testRunner.startHTML(` | ||
<iframe src='data:text/html,<script>window.foo = 42</script>' name='frame0'></iframe> | ||
`, 'Tests certain trace events in iframes.'); | ||
|
||
function performActions() { | ||
var frame1 = document.createElement('iframe'); | ||
const 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'); | ||
const 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'); | ||
var tracingHelper = new TracingHelper(testRunner, session); | ||
var data = await tracingHelper.invokeAsyncWithTracing(performActions); | ||
const TracingHelper = await testRunner.loadScript('../resources/tracing-test.js'); | ||
const tracingHelper = new TracingHelper(testRunner, session); | ||
await tracingHelper.invokeAsyncWithTracing(performActions); | ||
|
||
testRunner.log('Frames in TracingStartedInPage'); | ||
var tracingStarted = tracingHelper.findEvent('TracingStartedInPage', 'I'); | ||
for (var frame of tracingStarted.args['data']['frames'] || []) | ||
testRunner.log('Frames in TracingStartedInBrowser'); | ||
const tracingStarted = tracingHelper.findEvent('TracingStartedInBrowser', 'I'); | ||
for (const 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) | ||
const commitLoads = tracingHelper.findEvents('CommitLoad', 'X'); | ||
for (const event of commitLoads) { | ||
dumpFrame(event.args['data']); | ||
} | ||
testRunner.completeTest(); | ||
|
||
function dumpFrame(frame) { | ||
var url = frame.url.replace(/.*\/(([^/]*\/){2}[^/]*$)/, '$1'); | ||
const url = frame.url.replace(/.*\/(([^/]*\/){2}[^/]*$)/, '$1'); | ||
testRunner.log(`url: ${url} name: ${frame.name} parent: ${typeof frame.parent} nodeId: ${typeof frame.nodeId}`); | ||
} | ||
}) |