Commit 0f5cb500 authored by Henrique Grandinetti's avatar Henrique Grandinetti Committed by Commit Bot

Reset ArcSupervisionTransition when ARC is disabled.

Bug: 850589
Change-Id: Ic7fbe53143ac5ffb940822a0af76e89f5060e084
Reviewed-on: https://chromium-review.googlesource.com/1142207Reviewed-by: default avatarYury Khmel <khmel@chromium.org>
Reviewed-by: default avatarAlexander Alekseev <alemate@chromium.org>
Commit-Queue: Henrique Grandinetti <hgrandinetti@google.com>
Cr-Commit-Position: refs/heads/master@{#576457}
parent bbc82f70
......@@ -1006,6 +1006,9 @@ void ArcSessionManager::StopArc() {
profile_->GetPrefs()->SetBoolean(prefs::kArcPaiStarted, false);
profile_->GetPrefs()->SetBoolean(prefs::kArcTermsAccepted, false);
profile_->GetPrefs()->SetBoolean(prefs::kArcFastAppReinstallStarted, false);
profile_->GetPrefs()->SetInteger(
prefs::kArcSupervisionTransition,
static_cast<int>(ArcSupervisionTransition::NO_TRANSITION));
}
ShutdownSession();
if (support_host_)
......
......@@ -622,6 +622,39 @@ TEST_F(ArcSessionManagerTest, RegularToChildTransition_FlagOff) {
arc_session_manager()->Shutdown();
}
TEST_F(ArcSessionManagerTest, ClearArcTransitionOnShutdown) {
profile()->GetPrefs()->SetInteger(
prefs::kArcSupervisionTransition,
static_cast<int>(ArcSupervisionTransition::NO_TRANSITION));
// Initialize ARC.
arc_session_manager()->SetProfile(profile());
arc_session_manager()->Initialize();
arc_session_manager()->RequestEnable();
base::RunLoop().RunUntilIdle();
ASSERT_EQ(ArcSessionManager::State::NEGOTIATING_TERMS_OF_SERVICE,
arc_session_manager()->state());
arc_session_manager()->OnTermsOfServiceNegotiatedForTesting(true);
arc_session_manager()->StartArcForTesting();
arc_session_manager()->OnProvisioningFinished(ProvisioningResult::SUCCESS);
EXPECT_EQ(
static_cast<int>(ArcSupervisionTransition::NO_TRANSITION),
profile()->GetPrefs()->GetInteger(prefs::kArcSupervisionTransition));
// Child started graduation.
profile()->GetPrefs()->SetInteger(
prefs::kArcSupervisionTransition,
static_cast<int>(ArcSupervisionTransition::CHILD_TO_REGULAR));
// Simulate ARC shutdown.
arc_session_manager()->RequestDisable();
EXPECT_EQ(
static_cast<int>(ArcSupervisionTransition::NO_TRANSITION),
profile()->GetPrefs()->GetInteger(prefs::kArcSupervisionTransition));
arc_session_manager()->Shutdown();
}
TEST_F(ArcSessionManagerTest, IgnoreSecondErrorReporting) {
arc_session_manager()->SetProfile(profile());
arc_session_manager()->Initialize();
......
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