Commit 8ab0ab03 authored by Dmitry Gozman's avatar Dmitry Gozman Committed by Commit Bot

[DevTools] Unflake inspector-protocol/network/disable-interception-midway.js layout test

BUG=734762,745345

Change-Id: Ia9fa22f8259eb50281e1fd9087162e3c087df052
Reviewed-on: https://chromium-review.googlesource.com/597007Reviewed-by: default avatarAndrey Lushnikov <lushnikov@chromium.org>
Commit-Queue: Dmitry Gozman <dgozman@chromium.org>
Cr-Commit-Position: refs/heads/master@{#491819}
parent 4d28ef91
......@@ -2734,9 +2734,6 @@ crbug.com/709227 external/wpt/offscreen-canvas/fill-and-stroke-styles/2d.pattern
# ====== Tests from enabling .any.js/.worker.js tests end here ========
crbug.com/745345 http/tests/inspector-protocol/network/disable-interception-midway.js [ Failure Pass ]
crbug.com/745345 virtual/mojo-loading/http/tests/inspector-protocol/network/disable-interception-midway.js [ Failure Pass ]
# ====== Begin of display: contents tests ======
crbug.com/657748 external/wpt/css/css-display-3/display-contents-before-after-002.html [ Failure ]
......
......@@ -4,19 +4,13 @@ Network agent enabled
Request interception enabled
Page agent enabled
Runtime agent enabled
Network.requestIntercepted ID 1 GET resource-iframe.html type: Document
Network.requestIntercepted ID 1 GET disable-iframe.html type: Document
allowRequest ID 1
Network.responseReceived resource-iframe.html 200 text/html
Network.responseReceived disable-iframe.html 200 text/html
Network.requestIntercepted ID 2 GET i-dont-exist.css type: Stylesheet
----- disableRequestInterception -----
Network.responseReceived i-dont-exist.css 404 text/html
Network.loadingFailed i-dont-exist.css net::ERR_ABORTED
Network.requestIntercepted ID 3 GET script.js type: Script
Network.responseReceived script.js 404 text/html
Network.loadingFailed script.js net::ERR_ABORTED
Network.requestIntercepted ID 4 GET script2.js type: Script
----- disableRequestInterception -----
Network.responseReceived script2.js 404 text/html
Network.loadingFailed script2.js net::ERR_ABORTED
Page.frameStoppedLoading
Network.responseReceived post-echo.pl 200 text/plain
Post - ECHO SUCCESS!
......
......@@ -5,28 +5,16 @@
var InterceptionHelper = await testRunner.loadScript('../resources/interception-test.js');
var helper = new InterceptionHelper(testRunner, session);
var numRequests = 0;
var maybeDisableRequestInterception = function(event) {
numRequests++;
// To make this test non-flaky wait until the first three requests have
// been made before disabling. We can't wait for all for because the
// scripts are blocking.
if (numRequests === 3)
helper.disableRequestInterception(event);
};
var requestInterceptedDict = {
'resource-iframe.html': event => helper.allowRequest(event),
'i-dont-exist.css': maybeDisableRequestInterception,
'script.js': maybeDisableRequestInterception,
'script2.js': maybeDisableRequestInterception,
'post-echo.pl': maybeDisableRequestInterception,
'disable-iframe.html': event => helper.allowRequest(event),
'i-dont-exist.css': event => helper.disableRequestInterception(event),
'post-echo.pl': event => helper.allowRequest(event),
};
await helper.startInterceptionTest(requestInterceptedDict, 1);
session.evaluate(`
var iframe = document.createElement('iframe');
iframe.src = '${testRunner.url('./resources/resource-iframe.html')}';
iframe.src = '${testRunner.url('./resources/disable-iframe.html')}';
document.body.appendChild(iframe);
`);
})
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="i-dont-exist.css">
<script>
var xhr = new XMLHttpRequest;
xhr.open('POST', 'post-echo.pl', true);
xhr.onreadystatechange = function () {
if (xhr.readyState != 4)
return;
console.log(xhr.responseText);
}
xhr.send("Post - ECHO SUCCESS!");
</script>
</head>
</html>
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