Commit 52fecc3a authored by Sergey Poromov's avatar Sergey Poromov Committed by Commit Bot

arc: Do not exit PS when ARC fails to provision.

Previously, when ARC failed to start to do provisioning failure,
especially no network connect, Public Session was exited too.
Now, the error is not ignored only for Kiosk mode, while in PS only
ARC container will be shut down, but user will be able to use PS without
Android apps.
Later we should consider starting ARC fully offline with installing apps
from the cache.

Bug: 871381
Test: Manual, new unit test
Change-Id: If3c7f03c12587930211ba6bf5f3b7177a4634fdc
Reviewed-on: https://chromium-review.googlesource.com/1213245Reviewed-by: default avatarLuis Hector Chavez <lhchavez@chromium.org>
Reviewed-by: default avatarYury Khmel <khmel@chromium.org>
Commit-Queue: Sergey Poromov <poromov@chromium.org>
Cr-Commit-Position: refs/heads/master@{#589886}
parent a9d73d33
...@@ -302,9 +302,13 @@ void ArcSessionManager::OnProvisioningFinished(ProvisioningResult result) { ...@@ -302,9 +302,13 @@ void ArcSessionManager::OnProvisioningFinished(ProvisioningResult result) {
scoped_opt_in_tracker_->TrackError(); scoped_opt_in_tracker_->TrackError();
if (result == ProvisioningResult::CHROME_SERVER_COMMUNICATION_ERROR) { if (result == ProvisioningResult::CHROME_SERVER_COMMUNICATION_ERROR) {
// TODO(poromov): Consider PublicSession offline mode. // TODO(poromov): Consider ARC PublicSession offline mode.
if (IsRobotOrOfflineDemoAccountMode()) { // Currently ARC session will be exited below, while the main user session
// will be kept alive without Android apps.
if (IsRobotOrOfflineDemoAccountMode())
VLOG(1) << "Robot account auth code fetching error"; VLOG(1) << "Robot account auth code fetching error";
if (IsArcKioskMode()) {
VLOG(1) << "Exiting kiosk session due to provisioning failure";
// Log out the user. All the cleanup will be done in Shutdown() method. // Log out the user. All the cleanup will be done in Shutdown() method.
// The callback is not called because auth code is empty. // The callback is not called because auth code is empty.
attempt_user_exit_callback_.Run(); attempt_user_exit_callback_.Run();
......
...@@ -1047,6 +1047,43 @@ TEST_F(ArcSessionManagerKioskTest, AuthFailure) { ...@@ -1047,6 +1047,43 @@ TEST_F(ArcSessionManagerKioskTest, AuthFailure) {
EXPECT_TRUE(terminated); EXPECT_TRUE(terminated);
} }
class ArcSessionManagerPublicSessionTest : public ArcSessionManagerTestBase {
public:
ArcSessionManagerPublicSessionTest() = default;
void SetUp() override {
ArcSessionManagerTestBase::SetUp();
const AccountId account_id(
AccountId::FromUserEmail(profile()->GetProfileUserName()));
GetFakeUserManager()->AddPublicAccountUser(account_id);
GetFakeUserManager()->LoginUser(account_id);
}
private:
DISALLOW_COPY_AND_ASSIGN(ArcSessionManagerPublicSessionTest);
};
TEST_F(ArcSessionManagerPublicSessionTest, AuthFailure) {
arc_session_manager()->SetProfile(profile());
arc_session_manager()->Initialize();
arc_session_manager()->RequestEnable();
EXPECT_EQ(ArcSessionManager::State::ACTIVE, arc_session_manager()->state());
// Replace chrome::AttemptUserExit() for testing.
// At the end of test, leave the dangling pointer |terminated|,
// assuming the callback is never invoked in OnProvisioningFinished()
// and not invoked then, including TearDown().
bool terminated = false;
arc_session_manager()->SetAttemptUserExitCallbackForTesting(
base::BindRepeating([](bool* terminated) { *terminated = true; },
&terminated));
arc_session_manager()->OnProvisioningFinished(
ProvisioningResult::CHROME_SERVER_COMMUNICATION_ERROR);
EXPECT_FALSE(terminated);
EXPECT_EQ(ArcSessionManager::State::STOPPED, arc_session_manager()->state());
}
class ArcSessionOobeOptInNegotiatorTest class ArcSessionOobeOptInNegotiatorTest
: public ArcSessionManagerTest, : public ArcSessionManagerTest,
public chromeos::ArcTermsOfServiceScreenView, public chromeos::ArcTermsOfServiceScreenView,
......
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