Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include <memory> | 5 #include <memory> |
| 6 #include <string> | 6 #include <string> |
| 7 #include <tuple> | 7 #include <tuple> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 237 arc_session_manager()->state()); | 237 arc_session_manager()->state()); |
| 238 | 238 |
| 239 pref->SetBoolean(prefs::kArcEnabled, false); | 239 pref->SetBoolean(prefs::kArcEnabled, false); |
| 240 | 240 |
| 241 ASSERT_TRUE(WaitForDataRemoved(ArcSessionManager::State::STOPPED)); | 241 ASSERT_TRUE(WaitForDataRemoved(ArcSessionManager::State::STOPPED)); |
| 242 | 242 |
| 243 // Correctly stop service. | 243 // Correctly stop service. |
| 244 arc_session_manager()->Shutdown(); | 244 arc_session_manager()->Shutdown(); |
| 245 } | 245 } |
| 246 | 246 |
| 247 TEST_F(ArcSessionManagerTest, DisabledForEphemeralDataUsers) { | |
| 248 PrefService* const prefs = profile()->GetPrefs(); | |
| 249 EXPECT_FALSE(prefs->GetBoolean(prefs::kArcSignedIn)); | |
| 250 prefs->SetBoolean(prefs::kArcEnabled, true); | |
| 251 | |
| 252 chromeos::FakeChromeUserManager* const fake_user_manager = | |
| 253 GetFakeUserManager(); | |
| 254 | |
| 255 fake_user_manager->AddUser(fake_user_manager->GetGuestAccountId()); | |
| 256 fake_user_manager->SwitchActiveUser(fake_user_manager->GetGuestAccountId()); | |
| 257 arc_session_manager()->OnPrimaryUserProfilePrepared(profile()); | |
| 258 ASSERT_EQ(ArcSessionManager::State::NOT_INITIALIZED, | |
| 259 arc_session_manager()->state()); | |
| 260 | |
| 261 fake_user_manager->AddUser(user_manager::DemoAccountId()); | |
| 262 fake_user_manager->SwitchActiveUser(user_manager::DemoAccountId()); | |
| 263 arc_session_manager()->Shutdown(); | |
| 264 arc_session_manager()->OnPrimaryUserProfilePrepared(profile()); | |
| 265 ASSERT_EQ(ArcSessionManager::State::NOT_INITIALIZED, | |
| 266 arc_session_manager()->state()); | |
| 267 | |
| 268 const AccountId public_account_id( | |
| 269 AccountId::FromUserEmail("public_user@gmail.com")); | |
| 270 fake_user_manager->AddPublicAccountUser(public_account_id); | |
| 271 fake_user_manager->SwitchActiveUser(public_account_id); | |
| 272 arc_session_manager()->Shutdown(); | |
| 273 arc_session_manager()->OnPrimaryUserProfilePrepared(profile()); | |
| 274 ASSERT_EQ(ArcSessionManager::State::NOT_INITIALIZED, | |
| 275 arc_session_manager()->state()); | |
| 276 | |
| 277 const AccountId not_in_list_account_id( | |
|
hidehiko
2017/02/23 19:05:54
Note: this case is redundant, because this is cove
| |
| 278 AccountId::FromUserEmail("not_in_list_user@gmail.com")); | |
| 279 fake_user_manager->set_ephemeral_users_enabled(true); | |
| 280 fake_user_manager->AddUser(not_in_list_account_id); | |
| 281 fake_user_manager->SwitchActiveUser(not_in_list_account_id); | |
| 282 fake_user_manager->RemoveUserFromList(not_in_list_account_id); | |
| 283 arc_session_manager()->Shutdown(); | |
| 284 arc_session_manager()->OnPrimaryUserProfilePrepared(profile()); | |
| 285 ASSERT_EQ(ArcSessionManager::State::NOT_INITIALIZED, | |
| 286 arc_session_manager()->state()); | |
| 287 | |
| 288 // Correctly stop service. | |
| 289 arc_session_manager()->Shutdown(); | |
| 290 } | |
| 291 | |
| 292 TEST_F(ArcSessionManagerTest, BaseWorkflow) { | 247 TEST_F(ArcSessionManagerTest, BaseWorkflow) { |
| 293 ASSERT_TRUE(arc_session_manager()->IsSessionStopped()); | 248 ASSERT_TRUE(arc_session_manager()->IsSessionStopped()); |
| 294 ASSERT_EQ(ArcSessionManager::State::NOT_INITIALIZED, | 249 ASSERT_EQ(ArcSessionManager::State::NOT_INITIALIZED, |
| 295 arc_session_manager()->state()); | 250 arc_session_manager()->state()); |
| 296 EXPECT_TRUE(arc_session_manager()->sign_in_start_time().is_null()); | 251 EXPECT_TRUE(arc_session_manager()->sign_in_start_time().is_null()); |
| 297 EXPECT_TRUE(arc_session_manager()->arc_start_time().is_null()); | 252 EXPECT_TRUE(arc_session_manager()->arc_start_time().is_null()); |
| 298 | 253 |
| 299 arc_session_manager()->OnPrimaryUserProfilePrepared(profile()); | 254 arc_session_manager()->OnPrimaryUserProfilePrepared(profile()); |
| 300 | 255 |
| 301 // By default ARC is not enabled. | 256 // By default ARC is not enabled. |
| (...skipping 532 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 834 EXPECT_EQ(ArcSessionManager::State::SHOWING_TERMS_OF_SERVICE, | 789 EXPECT_EQ(ArcSessionManager::State::SHOWING_TERMS_OF_SERVICE, |
| 835 arc_session_manager()->state()); | 790 arc_session_manager()->state()); |
| 836 CloseLoginDisplayHost(); | 791 CloseLoginDisplayHost(); |
| 837 ReportActorDestroyed(); | 792 ReportActorDestroyed(); |
| 838 EXPECT_EQ(ArcSessionManager::State::STOPPED, arc_session_manager()->state()); | 793 EXPECT_EQ(ArcSessionManager::State::STOPPED, arc_session_manager()->state()); |
| 839 if (!IsManagedUser()) | 794 if (!IsManagedUser()) |
| 840 EXPECT_FALSE(IsArcPlayStoreEnabledForProfile(profile())); | 795 EXPECT_FALSE(IsArcPlayStoreEnabledForProfile(profile())); |
| 841 } | 796 } |
| 842 | 797 |
| 843 } // namespace arc | 798 } // namespace arc |
| OLD | NEW |