| 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 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 357 | 357 |
| 358 // Correctly stop service. | 358 // Correctly stop service. |
| 359 arc_session_manager()->Shutdown(); | 359 arc_session_manager()->Shutdown(); |
| 360 } | 360 } |
| 361 | 361 |
| 362 TEST_F(ArcSessionManagerTest, RemoveDataDir) { | 362 TEST_F(ArcSessionManagerTest, RemoveDataDir) { |
| 363 // Emulate the situation where the initial Google Play Store enabled | 363 // Emulate the situation where the initial Google Play Store enabled |
| 364 // preference is false for managed user, i.e., data dir is being removed at | 364 // preference is false for managed user, i.e., data dir is being removed at |
| 365 // beginning. | 365 // beginning. |
| 366 arc_session_manager()->SetProfile(profile()); | 366 arc_session_manager()->SetProfile(profile()); |
| 367 arc_session_manager()->RemoveArcData(); | 367 arc_session_manager()->RequestArcDataRemoval(); |
| 368 EXPECT_TRUE( | 368 EXPECT_TRUE( |
| 369 profile()->GetPrefs()->GetBoolean(prefs::kArcDataRemoveRequested)); | 369 profile()->GetPrefs()->GetBoolean(prefs::kArcDataRemoveRequested)); |
| 370 EXPECT_EQ(ArcSessionManager::State::REMOVING_DATA_DIR, | 370 EXPECT_EQ(ArcSessionManager::State::REMOVING_DATA_DIR, |
| 371 arc_session_manager()->state()); | 371 arc_session_manager()->state()); |
| 372 | 372 |
| 373 // Enable ARC. Data is removed asyncronously. At this moment session manager | 373 // Enable ARC. Data is removed asyncronously. At this moment session manager |
| 374 // should be in REMOVING_DATA_DIR state. | 374 // should be in REMOVING_DATA_DIR state. |
| 375 arc_session_manager()->RequestEnable(); | 375 arc_session_manager()->RequestEnable(); |
| 376 EXPECT_TRUE( | 376 EXPECT_TRUE( |
| 377 profile()->GetPrefs()->GetBoolean(prefs::kArcDataRemoveRequested)); | 377 profile()->GetPrefs()->GetBoolean(prefs::kArcDataRemoveRequested)); |
| 378 EXPECT_EQ(ArcSessionManager::State::REMOVING_DATA_DIR, | 378 EXPECT_EQ(ArcSessionManager::State::REMOVING_DATA_DIR, |
| 379 arc_session_manager()->state()); | 379 arc_session_manager()->state()); |
| 380 // Wait until data is removed. | 380 // Wait until data is removed. |
| 381 base::RunLoop().RunUntilIdle(); | 381 base::RunLoop().RunUntilIdle(); |
| 382 EXPECT_FALSE( | 382 EXPECT_FALSE( |
| 383 profile()->GetPrefs()->GetBoolean(prefs::kArcDataRemoveRequested)); | 383 profile()->GetPrefs()->GetBoolean(prefs::kArcDataRemoveRequested)); |
| 384 EXPECT_EQ(ArcSessionManager::State::SHOWING_TERMS_OF_SERVICE, | 384 EXPECT_EQ(ArcSessionManager::State::SHOWING_TERMS_OF_SERVICE, |
| 385 arc_session_manager()->state()); | 385 arc_session_manager()->state()); |
| 386 arc_session_manager()->StartArcForTesting(); | 386 arc_session_manager()->StartArcForTesting(); |
| 387 EXPECT_EQ(ArcSessionManager::State::ACTIVE, arc_session_manager()->state()); | 387 EXPECT_EQ(ArcSessionManager::State::ACTIVE, arc_session_manager()->state()); |
| 388 | 388 |
| 389 // Request to remove data and stop session manager. | 389 // Request to remove data and stop session manager. |
| 390 arc_session_manager()->RemoveArcData(); | 390 arc_session_manager()->RequestArcDataRemoval(); |
| 391 ASSERT_TRUE( | 391 ASSERT_TRUE( |
| 392 profile()->GetPrefs()->GetBoolean(prefs::kArcDataRemoveRequested)); | 392 profile()->GetPrefs()->GetBoolean(prefs::kArcDataRemoveRequested)); |
| 393 EXPECT_EQ(ArcSessionManager::State::ACTIVE, arc_session_manager()->state()); | 393 EXPECT_EQ(ArcSessionManager::State::ACTIVE, arc_session_manager()->state()); |
| 394 arc_session_manager()->Shutdown(); | 394 arc_session_manager()->Shutdown(); |
| 395 base::RunLoop().RunUntilIdle(); | 395 base::RunLoop().RunUntilIdle(); |
| 396 // Request should persist. | 396 // Request should persist. |
| 397 ASSERT_TRUE( | 397 ASSERT_TRUE( |
| 398 profile()->GetPrefs()->GetBoolean(prefs::kArcDataRemoveRequested)); | 398 profile()->GetPrefs()->GetBoolean(prefs::kArcDataRemoveRequested)); |
| 399 } | 399 } |
| 400 | 400 |
| (...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 706 TEST_P(ArcSessionOobeOptInNegotiatorTest, OobeTermsViewDestroyed) { | 706 TEST_P(ArcSessionOobeOptInNegotiatorTest, OobeTermsViewDestroyed) { |
| 707 view()->Show(); | 707 view()->Show(); |
| 708 EXPECT_EQ(ArcSessionManager::State::SHOWING_TERMS_OF_SERVICE, | 708 EXPECT_EQ(ArcSessionManager::State::SHOWING_TERMS_OF_SERVICE, |
| 709 arc_session_manager()->state()); | 709 arc_session_manager()->state()); |
| 710 CloseLoginDisplayHost(); | 710 CloseLoginDisplayHost(); |
| 711 ReportViewDestroyed(); | 711 ReportViewDestroyed(); |
| 712 EXPECT_EQ(ArcSessionManager::State::STOPPED, arc_session_manager()->state()); | 712 EXPECT_EQ(ArcSessionManager::State::STOPPED, arc_session_manager()->state()); |
| 713 } | 713 } |
| 714 | 714 |
| 715 } // namespace arc | 715 } // namespace arc |
| OLD | NEW |