Commit ababcef7 authored by Alex Ilin's avatar Alex Ilin Committed by Commit Bot

[sync] Fix sync integration multiprofile tests

crrev.com/c/2066840 made it impossible to create a Chrome profile
outside of the user data directory. Unfortunately, some sync tests
rely on this to be able to test two profiles syncing to the same
account.

This CL adds a command line flag --allow-profiles-outside-user-dir
that restores previous behaviour. This flag should be only used as a
workaround to fix the sync tests before we have more robust solution.

Bug: 1060366
Change-Id: I864a32d5e5d06b029bab1233b33fbb80d27ea137
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2096769
Commit-Queue: Alex Ilin <alexilin@chromium.org>
Reviewed-by: default avatarMarc Treib <treib@chromium.org>
Cr-Commit-Position: refs/heads/master@{#749333}
parent 320e3985
......@@ -551,7 +551,9 @@ void ProfileManager::CreateProfileAsync(const base::FilePath& profile_path,
"profile_path",
profile_path.AsUTF8Unsafe());
bool is_allowed_path = IsAllowedProfilePath(profile_path);
bool is_allowed_path = IsAllowedProfilePath(profile_path) ||
base::CommandLine::ForCurrentProcess()->HasSwitch(
switches::kAllowProfilesOutsideUserDir);
// Make sure the path is correct and this profile is not pending deletion.
if (!is_allowed_path || IsProfileDirectoryMarkedForDeletion(profile_path)) {
......@@ -1415,7 +1417,9 @@ Profile* ProfileManager::CreateAndInitializeProfile(
const base::FilePath& profile_dir) {
TRACE_EVENT0("browser", "ProfileManager::CreateAndInitializeProfile");
if (!IsAllowedProfilePath(profile_dir)) {
if (!IsAllowedProfilePath(profile_dir) &&
!base::CommandLine::ForCurrentProcess()->HasSwitch(
switches::kAllowProfilesOutsideUserDir)) {
LOG(ERROR) << "Cannot create profile at path "
<< profile_dir.AsUTF8Unsafe();
return nullptr;
......
......@@ -344,6 +344,12 @@ void SyncTest::AddTestSwitches(base::CommandLine* cl) {
// should be removed.
if (!cl->HasSwitch(switches::kSyncEnableGetUpdatesBeforeCommit))
cl->AppendSwitch(switches::kSyncEnableGetUpdatesBeforeCommit);
// TODO(crbug.com/1060366): This is a temporary switch to allow having two
// profiles syncing the same account. Having a profile outside of the user
// directory isn't supported in Chrome.
if (!cl->HasSwitch(switches::kAllowProfilesOutsideUserDir))
cl->AppendSwitch(switches::kAllowProfilesOutsideUserDir);
}
void SyncTest::BeforeSetupClient(int index,
......
......@@ -33,6 +33,13 @@ const char kAllowHttpScreenCapture[] = "allow-http-screen-capture";
// Don't block outdated plugins.
const char kAllowOutdatedPlugins[] = "allow-outdated-plugins";
// Allows profiles to be created outside of the user data dir.
// TODO(https://crbug.com/1060366): Various places in Chrome assume that all
// profiles are within the user data dir. Some tests need to violate that
// assumption. The switch should be removed after this workaround is no longer
// needed.
const char kAllowProfilesOutsideUserDir[] = "allow-profiles-outside-user-dir";
// By default, an https page cannot run JavaScript, CSS or plugins from http
// URLs. This provides an override to get the old insecure behavior.
const char kAllowRunningInsecureContent[] = "allow-running-insecure-content";
......
......@@ -32,6 +32,7 @@ namespace switches {
extern const char kAllowCrossOriginAuthPrompt[];
extern const char kAllowHttpScreenCapture[];
extern const char kAllowOutdatedPlugins[];
extern const char kAllowProfilesOutsideUserDir[];
extern const char kAllowRunningInsecureContent[];
extern const char kAllowSilentPush[];
extern const char kApp[];
......
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