Commit 5a141e43 authored by Elly Fong-Jones's avatar Elly Fong-Jones Committed by Commit Bot

net: de-flake ChromeNetworkServiceBrowserTest

This test tries to set a cookie in its PRE_ step, then read it back from disk in
its normal step; to ensure that that actually happens, it should also flush the
cookie store and wait for the flush to complete :)

This should de-flake this test on all platforms.

Bug: 868667,998740
Change-Id: I1f169122b10db9c6288cbb5226a51668e8b3350f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1827860Reviewed-by: default avatarJohn Abd-El-Malek <jam@chromium.org>
Commit-Queue: Elly Fong-Jones <ellyjones@chromium.org>
Cr-Commit-Position: refs/heads/master@{#700806}
parent 0b131db4
......@@ -19,10 +19,6 @@
#include "services/network/public/cpp/features.h"
#include "services/network/public/mojom/network_service.mojom.h"
#if defined(OS_MACOSX)
#include "base/mac/mac_util.h"
#endif
namespace content {
namespace {
......@@ -59,6 +55,14 @@ void SetCookie(
run_loop.Run();
}
void FlushCookies(
const mojo::Remote<network::mojom::CookieManager>& cookie_manager) {
base::RunLoop run_loop;
cookie_manager->FlushCookieStore(
base::BindLambdaForTesting([&]() { run_loop.Quit(); }));
run_loop.Run();
}
// See |NetworkServiceBrowserTest| for content's version of tests.
class ChromeNetworkServiceBrowserTest : public InProcessBrowserTest {
public:
......@@ -96,23 +100,11 @@ IN_PROC_BROWSER_TEST_F(ChromeNetworkServiceBrowserTest, PRE_EncryptedCookies) {
ASSERT_EQ(1u, cookies.size());
EXPECT_EQ(kCookieName, cookies[0].Name());
EXPECT_EQ(kCookieValue, cookies[0].Value());
FlushCookies(cookie_manager);
}
#if defined(OS_WIN)
// The cookies.size() ASSERT is failing flakily on the Win7 bots.
// See https://crbug.com/868667
#define MAYBE_EncryptedCookies DISABLED_EncryptedCookies
#else
#define MAYBE_EncryptedCookies EncryptedCookies
#endif
IN_PROC_BROWSER_TEST_F(ChromeNetworkServiceBrowserTest,
MAYBE_EncryptedCookies) {
#if defined(OS_MACOSX)
// TODO(https://crbug.com/868667): Fix and reenable test.
if (base::mac::IsOS10_11())
return;
#endif
IN_PROC_BROWSER_TEST_F(ChromeNetworkServiceBrowserTest, EncryptedCookies) {
net::CookieCryptoDelegate* crypto_delegate =
cookie_config::GetCookieCryptoDelegate();
std::string ciphertext;
......
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