Commit 4abbfe19 authored by yhirano's avatar yhirano Committed by Commit bot

Deflake http/tests/inspector/tracing/timeline-receive-response-event.html

As a follow-up for [1], this CL fixes the flakiness of
timeline-receive-response-event.html by dumping only the first
ResourceReceivedData event for each request.

1: https://crrev.com/48f3e047d17e5f78543bb0bec1c421ba3a69cb79

BUG=666217

Review-Url: https://codereview.chromium.org/2563613004
Cr-Commit-Position: refs/heads/master@{#437810}
parent c91d1b99
...@@ -3,14 +3,12 @@ Tests the Timeline API instrumentation of a SendRequest, ReceiveResponse etc. ...@@ -3,14 +3,12 @@ Tests the Timeline API instrumentation of a SendRequest, ReceiveResponse etc.
ResourceSendRequest ResourceSendRequest
ResourceReceiveResponse ResourceReceiveResponse
ResourceReceivedData ResourceReceivedData
ResourceReceivedData
ResourceFinish ResourceFinish
EventDispatch EventDispatch
FunctionCall FunctionCall
ResourceSendRequest ResourceSendRequest
ResourceReceiveResponse ResourceReceiveResponse
ResourceReceivedData ResourceReceivedData
ResourceReceivedData
ResourceFinish ResourceFinish
EventDispatch EventDispatch
FunctionCall FunctionCall
......
...@@ -33,12 +33,21 @@ function test() ...@@ -33,12 +33,21 @@ function test()
var recordTypes = TimelineModel.TimelineModel.RecordType; var recordTypes = TimelineModel.TimelineModel.RecordType;
var typesToDump = new Set([recordTypes.ResourceSendRequest, recordTypes.ResourceReceiveResponse, recordTypes.ResourceReceivedData, recordTypes.ResourceFinish, var typesToDump = new Set([recordTypes.ResourceSendRequest, recordTypes.ResourceReceiveResponse, recordTypes.ResourceReceivedData, recordTypes.ResourceFinish,
recordTypes.EventDispatch, recordTypes.FunctionCall]); recordTypes.EventDispatch, recordTypes.FunctionCall]);
let hasAlreadyDumptReceivedDataFor = new Map();
function dumpEvent(traceEvent, level) function dumpEvent(traceEvent, level)
{ {
// Ignore stray paint & rendering events for better stability. // Ignore stray paint & rendering events for better stability.
var categoryName = Timeline.TimelineUIUtils.eventStyle(traceEvent).category.name; var categoryName = Timeline.TimelineUIUtils.eventStyle(traceEvent).category.name;
if (categoryName !== "loading" && categoryName !== "scripting") if (categoryName !== "loading" && categoryName !== "scripting")
return; return;
if (traceEvent.name === 'ResourceReceivedData') {
const requestId = traceEvent.args['data']['requestId'];
// Dump only the first ResourceReceivedData for a request for stability.
if (hasAlreadyDumptReceivedDataFor[requestId])
return;
hasAlreadyDumptReceivedDataFor[requestId] = true;
}
// Here and below: pretend coalesced record are just not there, as coalescation is time dependent and, hence, not stable. // Here and below: pretend coalesced record are just not there, as coalescation is time dependent and, hence, not stable.
// Filter out InjectedScript function call because they happen out of sync. // Filter out InjectedScript function call because they happen out of sync.
if (typesToDump.has(traceEvent.name) && (traceEvent.name !== "FunctionCall" || traceEvent.args["data"]["url"])) if (typesToDump.has(traceEvent.name) && (traceEvent.name !== "FunctionCall" || traceEvent.args["data"]["url"]))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment