Commit d47f961d authored by Lukasz Anforowicz's avatar Lukasz Anforowicz Committed by Commit Bot

Make the tests resilient to extra console messages.

Bug: 1085629
Change-Id: I9f4b25a064f523b30208405b17f33b1b0596f7d3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2212999Reviewed-by: default avatarKaran Bhatia <karandeepb@chromium.org>
Commit-Queue: Łukasz Anforowicz <lukasza@chromium.org>
Cr-Commit-Position: refs/heads/master@{#772035}
parent 588c4a94
......@@ -369,20 +369,10 @@ class CorbAndCorsExtensionBrowserTest
return base::UTF16ToUTF8(console_message.message);
});
if (IsOutOfBlinkCorsEnabled()) {
// Expect exactly 1 CORS error message.
EXPECT_THAT(messages, testing::ElementsAre(testing::HasSubstr(
"has been blocked by CORS policy")));
} else {
// We allow more than 1 error message, because in some test cases there
// might be 2 error messages (one from InBlink CORS and one from
// FileURLLoaderFactory). This doesn't seem worth fixing in product code
// (because InBlink CORS support will go away soon).
EXPECT_FALSE(messages.empty());
EXPECT_THAT(
messages,
testing::Each(testing::HasSubstr("has been blocked by CORS policy")));
}
// We allow more than 1 console message, because the test might flakily see
// extra console messages - see https://crbug.com/1085629.
EXPECT_THAT(messages, testing::Contains(testing::HasSubstr(
"has been blocked by CORS policy")));
}
void VerifyFetchFromContentScriptWasBlockedByCorb(
......
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