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 ...@@ -675,15 +675,8 @@ class ExtensionWebRequestApiPolicyTest
std::string test_name_ = "test_cors.html"; 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, IN_PROC_BROWSER_TEST_P(ExtensionWebRequestApiPolicyTest,
MAYBE_WebRequestCORSWithExtraHeaders) { WebRequestCORSWithExtraHeaders) {
ASSERT_TRUE(StartEmbeddedTestServer()); ASSERT_TRUE(StartEmbeddedTestServer());
ASSERT_TRUE(RunExtensionSubtest("webrequest", test_name())) << message_; ASSERT_TRUE(RunExtensionSubtest("webrequest", test_name())) << message_;
} }
......
...@@ -140,24 +140,15 @@ function setExpectationsForObservablePreflight(extraInfoSpec) { ...@@ -140,24 +140,15 @@ function setExpectationsForObservablePreflight(extraInfoSpec) {
type, 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 = [ const eventOrderForPreflight = [
'onBeforeRequest-P', 'onBeforeSendHeaders-P', 'onSendHeaders-P', '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 events;
let eventsOrder; let eventsOrder;
...@@ -178,21 +169,12 @@ function setExpectationsForObservablePreflight(extraInfoSpec) { ...@@ -178,21 +169,12 @@ function setExpectationsForObservablePreflight(extraInfoSpec) {
frameUrl: 'unknown frame URL', frameUrl: 'unknown frame URL',
}, },
}, },
].concat(eventsForPreflight, [ ].concat(eventsForPreflight);
{ label: 'onErrorOccurred', eventOrder = ['onBeforeRequest'].concat(eventOrderForPreflight);
event: 'onErrorOccurred',
details: { // We should see the cancellation of the actual request, but we cannot
url: url, // have that expecation here because we don't have an expecation on
method: 'GET', // the completion of the preflight request. See above.
error: 'net::ERR_FAILED',
initiator: initiator,
type: 'xmlhttprequest',
fromCache: false,
}
},
]);
eventOrder = ['onBeforeRequest'].concat(
eventOrderForPreflight, ['onErrorOccurred']);
} else { } else {
// In this case, the preflight request is made first, and blink will not // In this case, the preflight request is made first, and blink will not
// make the actual request because of the lack of an // 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