Commit d0f32e03 authored by Yutaka Hirano's avatar Yutaka Hirano Committed by Commit Bot

Unflake ExtensionWebRequestApiPolicyTest.WebRequestCORSWithExtraHeaders

Currently we have an expecation for an completion event for a CORS
preflight request, but because the preflight request is rejected by
the CORS module we may see a cancel event from the CORS module instead,
which causes flakiness.

We do not have a way to express such racy expecations, so let's remove
the expecation from the test. The coverage is lowered but it's better
than flaky tests.

Bug: 1020185
Change-Id: I66f3ceb4f24f5440ecada005d442bed41f503626
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1973442
Commit-Queue: Yutaka Hirano <yhirano@chromium.org>
Reviewed-by: default avatarDevlin <rdevlin.cronin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#727341}
parent 5ae1d025
......@@ -675,15 +675,8 @@ class ExtensionWebRequestApiPolicyTest
std::string test_name_ = "test_cors.html";
};
// Flaky on Win10: http://crbug.com/1020185
#if defined(OS_WIN)
#define MAYBE_WebRequestCORSWithExtraHeaders \
DISABLED_WebRequestCORSWithExtraHeaders
#else
#define MAYBE_WebRequestCORSWithExtraHeaders WebRequestCORSWithExtraHeaders
#endif
IN_PROC_BROWSER_TEST_P(ExtensionWebRequestApiPolicyTest,
MAYBE_WebRequestCORSWithExtraHeaders) {
WebRequestCORSWithExtraHeaders) {
ASSERT_TRUE(StartEmbeddedTestServer());
ASSERT_TRUE(RunExtensionSubtest("webrequest", test_name())) << message_;
}
......
......@@ -140,24 +140,15 @@ function setExpectationsForObservablePreflight(extraInfoSpec) {
type,
},
},
{ label: 'onCompleted-P',
event: 'onCompleted',
details: {
url,
method: 'OPTIONS',
ip: '127.0.0.1',
fromCache: false,
statusCode: 200,
statusLine: 'HTTP/1.1 200 OK',
initiator,
type,
},
},
];
const eventOrderForPreflight = [
'onBeforeRequest-P', 'onBeforeSendHeaders-P', 'onSendHeaders-P',
'onHeadersReceived-P', 'onResponseStarted-P', 'onCompleted-P',
'onHeadersReceived-P', 'onResponseStarted-P',
];
// The completion event of the preflight request coming from the network OR
// The cancellation event of the preflight request coming from the CORS module
// should arrive, but we are not sure which comes first - that is essentially
// racy, so we cannot have an expecation here.
let events;
let eventsOrder;
......@@ -178,21 +169,12 @@ function setExpectationsForObservablePreflight(extraInfoSpec) {
frameUrl: 'unknown frame URL',
},
},
].concat(eventsForPreflight, [
{ label: 'onErrorOccurred',
event: 'onErrorOccurred',
details: {
url: url,
method: 'GET',
error: 'net::ERR_FAILED',
initiator: initiator,
type: 'xmlhttprequest',
fromCache: false,
}
},
]);
eventOrder = ['onBeforeRequest'].concat(
eventOrderForPreflight, ['onErrorOccurred']);
].concat(eventsForPreflight);
eventOrder = ['onBeforeRequest'].concat(eventOrderForPreflight);
// We should see the cancellation of the actual request, but we cannot
// have that expecation here because we don't have an expecation on
// the completion of the preflight request. See above.
} else {
// In this case, the preflight request is made first, and blink will not
// make the actual request because of the lack of an
......
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