Skip to content

Commit

Permalink
Fix ChromeNetworkServiceBrowserTest.EncryptedCookies on Windows
Browse files Browse the repository at this point in the history
This test has not been working on Windows and the root cause
was that the data migration code in content/browser/network_sandbox.cc
was deleting the file called 'cookies' because NTFS used
case-insensitive matching for the 'old' cookie file.

This migration caused the test 'cookies' file created within
the PRE_ fixture to be copied and deleted on the start of the
non-PRE fixture when creating the default network context, since
the migration code believed it to be an old cookies file as
it was contained in the `unsandboxed_data_path` and migration
had occurred.

This always caused there to be no cookies in the 'cookies'
database, since it no longer existing on disk by the time that
the test started executing.

This only had effect on platforms that supplied both an
`unsandboxed_data_path` and also specified
`trigger_migration` to be true, which happened to only
be Windows.

Renaming the file to something other than 'cookies' fixes
this issue, since the migration code is still needed.

The macOS failures are likely a different root cause but
the test can be re-enabled on macOS in a future CL.

BUG=868667

Change-Id: Icf453d16ec2324d65cf00074baa1e6c266f871b4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4985832
Reviewed-by: Adam Rice <ricea@chromium.org>
Commit-Queue: Will Harris <wfh@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1216631}
  • Loading branch information
Will Harris authored and Chromium LUCI CQ committed Oct 29, 2023
1 parent c5db3ab commit 0a0d3e3
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions chrome/browser/net/chrome_network_service_browsertest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ class ChromeNetworkServiceBrowserTest
context_params->file_paths->data_directory =
browser()->profile()->GetPath();
context_params->file_paths->cookie_database_name =
base::FilePath(FILE_PATH_LITERAL("cookies"));
base::FilePath(FILE_PATH_LITERAL("test-cookies"));
context_params->cert_verifier_params = content::GetCertVerifierParams(
cert_verifier::mojom::CertVerifierCreationParams::New());
content::CreateNetworkContextInNetworkService(
Expand All @@ -137,8 +137,8 @@ IN_PROC_BROWSER_TEST_P(ChromeNetworkServiceBrowserTest, PRE_EncryptedCookies) {
FlushCookies(cookie_manager.get());
}

// This flakes on Mac10.12 and Windows: http://crbug.com/868667
#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN)
// This flakes on Mac10.12: http://crbug.com/868667
#if BUILDFLAG(IS_MAC)
#define MAYBE_EncryptedCookies DISABLED_EncryptedCookies
#else
#define MAYBE_EncryptedCookies EncryptedCookies
Expand Down

0 comments on commit 0a0d3e3

Please sign in to comment.