Index: chrome/browser/chromeos/arc/arc_auth_service.cc |
diff --git a/chrome/browser/chromeos/arc/arc_auth_service.cc b/chrome/browser/chromeos/arc/arc_auth_service.cc |
index b9e6986c54d8648191e565c52f478c4d283041e0..ed8da4a40f936f2653ee87815e2db78e8f01b176 100644 |
--- a/chrome/browser/chromeos/arc/arc_auth_service.cc |
+++ b/chrome/browser/chromeos/arc/arc_auth_service.cc |
@@ -57,6 +57,9 @@ ArcAuthService* g_arc_auth_service = nullptr; |
// Skip creating UI in unit tests |
bool g_disable_ui_for_testing = false; |
+// Skip checking for cryptohome data ephemeral users. |
+bool g_allow_cryptohome_data_ephemeral_user_for_testing = false; |
khmel
2016/07/18 20:23:42
In most browser tests user is logged as Ephemeral
xiyuan
2016/07/18 20:59:12
Sounds like UserManagerBase::IsUserCryptohomeDataE
khmel
2016/07/18 22:15:11
Yes, this helps
|
+ |
// Use specified ash::ShelfDelegate for unit tests. |
ash::ShelfDelegate* g_shelf_delegate_for_testing = nullptr; |
@@ -133,6 +136,11 @@ void ArcAuthService::DisableUIForTesting() { |
} |
// static |
+void ArcAuthService::AllowCryptohomeDataEphemeralUserForTesting() { |
+ g_allow_cryptohome_data_ephemeral_user_for_testing = true; |
+} |
+ |
+// static |
void ArcAuthService::SetShelfDelegateForTesting( |
ash::ShelfDelegate* shelf_delegate) { |
g_shelf_delegate_for_testing = shelf_delegate; |
@@ -178,7 +186,8 @@ bool ArcAuthService::IsAllowedForProfile(const Profile* profile) { |
return false; |
} |
- if (user_manager::UserManager::Get() |
+ if (!g_allow_cryptohome_data_ephemeral_user_for_testing && |
+ user_manager::UserManager::Get() |
->IsCurrentUserCryptohomeDataEphemeral()) { |
VLOG(2) << "Users with ephemeral data are not supported in Arc."; |
return false; |
@@ -342,9 +351,6 @@ void ArcAuthService::OnPrimaryUserProfilePrepared(Profile* profile) { |
Shutdown(); |
- profile_ = profile; |
- SetState(State::STOPPED); |
- |
if (!IsAllowedForProfile(profile)) |
return; |
@@ -354,6 +360,9 @@ void ArcAuthService::OnPrimaryUserProfilePrepared(Profile* profile) { |
return; |
} |
+ profile_ = profile; |
+ SetState(State::STOPPED); |
+ |
PrefServiceSyncableFromProfile(profile_)->AddSyncedPrefObserver( |
prefs::kArcEnabled, this); |
@@ -637,6 +646,9 @@ bool ArcAuthService::IsArcManaged() const { |
bool ArcAuthService::IsArcEnabled() const { |
DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
+ if (!IsAllowed()) |
+ return false; |
+ |
DCHECK(profile_); |
return profile_->GetPrefs()->GetBoolean(prefs::kArcEnabled); |
} |