Commit 036afc95 authored by Andrey Kosyakov's avatar Andrey Kosyakov Committed by Commit Bot

Deflake LayoutTests/http/tests/inspector-protocol/network/interception-on-both.js

The race between requestIntercepted and willSendRequest has become more
pronounced since we started fetching cookies from the cookie manager
in https://chromium-review.googlesource.com/c/1282443.

Change-Id: I98653cfe2ffca92724a2edc28c949fa1a08907fd
Reviewed-on: https://chromium-review.googlesource.com/c/1297130
Commit-Queue: Andrey Kosyakov <caseq@chromium.org>
Commit-Queue: Dmitry Gozman <dgozman@chromium.org>
Reviewed-by: default avatarDmitry Gozman <dgozman@chromium.org>
Cr-Commit-Position: refs/heads/master@{#602037}
parent 5526e3a4
Tests that a request can be intercepted on both request and response stages.
request will be sent: http://127.0.0.1:8000/inspector-protocol/network/resources/simple-iframe.html
intercepted request: http://127.0.0.1:8000/inspector-protocol/network/resources/simple-iframe.html
request will be sent http://127.0.0.1:8000/inspector-protocol/network/resources/simple-iframe.html
intercepted response: http://127.0.0.1:8000/inspector-protocol/network/resources/simple-iframe.html 200
response received http://127.0.0.1:8000/inspector-protocol/network/resources/simple-iframe.html
......@@ -8,13 +8,6 @@
await session.protocol.Network.enable();
await session.protocol.Runtime.enable();
session.protocol.Network.onRequestWillBeSent(event => {
testRunner.log(`request will be sent ${event.params.request.url}`);
});
session.protocol.Network.onResponseReceived(event => {
testRunner.log(`response received ${event.params.response.url}`);
});
await dp.Network.setRequestInterception({patterns: [
{urlPattern: '*', interceptionStage: 'Request'},
{urlPattern: '*', interceptionStage: 'HeadersReceived'}
......@@ -22,7 +15,11 @@
session.evaluate(`fetch('${testRunner.url('../network/resources/simple-iframe.html')}')`);
const intercepted1 = (await dp.Network.onceRequestIntercepted()).params;
const requestInterceptedPromise = dp.Network.onceRequestIntercepted();
const requestSent = (await session.protocol.Network.onceRequestWillBeSent()).params.request;
testRunner.log(`request will be sent: ${requestSent.url}`);
const intercepted1 = (await requestInterceptedPromise).params;
testRunner.log(`intercepted request: ${intercepted1.request.url}`);
dp.Network.continueInterceptedRequest({interceptionId: intercepted1.interceptionId});
......@@ -31,6 +28,8 @@
testRunner.log(`intercepted response: ${intercepted2.request.url} ${intercepted2.responseStatusCode}`);
dp.Network.continueInterceptedRequest({interceptionId: intercepted2.interceptionId});
const responseReceived = (await session.protocol.Network.onceResponseReceived()).params.response;
testRunner.log(`response received ${responseReceived.url}`);
await dp.Network.onceLoadingFinished();
testRunner.completeTest();
})
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