Commit 34c55a35 authored by Clark DuVall's avatar Clark DuVall Committed by Commit Bot

Fix GcmApiTest with NavigationLoaderOnUI enabled

ProfileSyncService may not be created if a command line flag turns off
sync. In this case, ProfileSyncServiceFactory::GetForProfile returns
null and crashes when IsSyncFeatureEnabled is called.

Bug: 978617
Change-Id: Idb381a82008065427d67d87583f56eca9d1e9606
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1715094
Commit-Queue: Clark DuVall <cduvall@chromium.org>
Reviewed-by: default avatarBoris Sazonov <bsazonov@chromium.org>
Cr-Commit-Position: refs/heads/master@{#680137}
parent b2f5094e
......@@ -57,6 +57,10 @@ void HeaderModificationDelegateOnUIThreadImpl::ProcessRequest(
const GURL& redirect_url) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
const PrefService* prefs = profile_->GetPrefs();
#if BUILDFLAG(ENABLE_DICE_SUPPORT)
syncer::SyncService* sync_service =
ProfileSyncServiceFactory::GetForProfile(profile_);
#endif
FixAccountConsistencyRequestHeader(
request_adapter, redirect_url, profile_->IsOffTheRecord(),
prefs->GetInteger(prefs::kIncognitoModeAvailability),
......@@ -66,8 +70,7 @@ void HeaderModificationDelegateOnUIThreadImpl::ProcessRequest(
prefs->GetBoolean(prefs::kAccountConsistencyMirrorRequired),
#endif
#if BUILDFLAG(ENABLE_DICE_SUPPORT)
ProfileSyncServiceFactory::GetForProfile(profile_)
->IsSyncFeatureEnabled(),
sync_service && sync_service->IsSyncFeatureEnabled(),
prefs->GetString(prefs::kGoogleServicesSigninScopedDeviceId),
#endif
cookie_settings_.get());
......
# These tests currently fail when run with --enable-features=NavigationLoaderOnUI
# https://crbug.com/978617
-GcmApiTest.*
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