| 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 531 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 542 EXPECT_EQ(ArcSessionManager::State::ACTIVE, arc_session_manager()->state()); | 542 EXPECT_EQ(ArcSessionManager::State::ACTIVE, arc_session_manager()->state()); |
| 543 EXPECT_FALSE(prefs->GetBoolean(prefs::kArcBackupRestoreEnabled)); | 543 EXPECT_FALSE(prefs->GetBoolean(prefs::kArcBackupRestoreEnabled)); |
| 544 EXPECT_FALSE(prefs->GetBoolean(prefs::kArcLocationServiceEnabled)); | 544 EXPECT_FALSE(prefs->GetBoolean(prefs::kArcLocationServiceEnabled)); |
| 545 | 545 |
| 546 // Stop ARC and shutdown the service. | 546 // Stop ARC and shutdown the service. |
| 547 prefs->RemoveManagedPref(prefs::kArcEnabled); | 547 prefs->RemoveManagedPref(prefs::kArcEnabled); |
| 548 WaitForDataRemoved(ArcSessionManager::State::STOPPED); | 548 WaitForDataRemoved(ArcSessionManager::State::STOPPED); |
| 549 arc_session_manager()->Shutdown(); | 549 arc_session_manager()->Shutdown(); |
| 550 } | 550 } |
| 551 | 551 |
| 552 TEST_P(ArcSessionManagerPolicyTest, ReenableManagedArc) { |
| 553 sync_preferences::TestingPrefServiceSyncable* const prefs = |
| 554 profile()->GetTestingPrefService(); |
| 555 |
| 556 // Set ARC to be managed. |
| 557 prefs->SetManagedPref(prefs::kArcEnabled, new base::Value(true)); |
| 558 EXPECT_TRUE(arc::IsArcPlayStoreEnabledForProfile(profile())); |
| 559 |
| 560 arc_session_manager()->SetProfile(profile()); |
| 561 arc_session_manager()->RequestEnable(); |
| 562 EXPECT_TRUE(arc_session_manager()->enable_requested()); |
| 563 |
| 564 // Simulate close OptIn. Session manager should stop. |
| 565 SetArcPlayStoreEnabledForProfile(profile(), false); |
| 566 EXPECT_TRUE(arc::IsArcPlayStoreEnabledForProfile(profile())); |
| 567 EXPECT_FALSE(arc_session_manager()->enable_requested()); |
| 568 |
| 569 // Restart ARC again |
| 570 SetArcPlayStoreEnabledForProfile(profile(), true); |
| 571 EXPECT_TRUE(arc::IsArcPlayStoreEnabledForProfile(profile())); |
| 572 EXPECT_TRUE(arc_session_manager()->enable_requested()); |
| 573 |
| 574 arc_session_manager()->Shutdown(); |
| 575 } |
| 576 |
| 552 INSTANTIATE_TEST_CASE_P( | 577 INSTANTIATE_TEST_CASE_P( |
| 553 ArcSessionManagerPolicyTest, | 578 ArcSessionManagerPolicyTest, |
| 554 ArcSessionManagerPolicyTest, | 579 ArcSessionManagerPolicyTest, |
| 555 testing::Combine( | 580 testing::Combine( |
| 556 testing::Values(base::Value(), base::Value(false), base::Value(true)), | 581 testing::Values(base::Value(), base::Value(false), base::Value(true)), |
| 557 testing::Values(base::Value(), base::Value(false), base::Value(true)))); | 582 testing::Values(base::Value(), base::Value(false), base::Value(true)))); |
| 558 | 583 |
| 559 class ArcSessionManagerKioskTest : public ArcSessionManagerTestBase { | 584 class ArcSessionManagerKioskTest : public ArcSessionManagerTestBase { |
| 560 public: | 585 public: |
| 561 ArcSessionManagerKioskTest() = default; | 586 ArcSessionManagerKioskTest() = default; |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 758 // ArcPlayStoreEnabledPreferenceHandler is not running, so the state should | 783 // ArcPlayStoreEnabledPreferenceHandler is not running, so the state should |
| 759 // be kept as is. | 784 // be kept as is. |
| 760 EXPECT_EQ(ArcSessionManager::State::NEGOTIATING_TERMS_OF_SERVICE, | 785 EXPECT_EQ(ArcSessionManager::State::NEGOTIATING_TERMS_OF_SERVICE, |
| 761 arc_session_manager()->state()); | 786 arc_session_manager()->state()); |
| 762 // Managed user's preference should not be overwritten. | 787 // Managed user's preference should not be overwritten. |
| 763 if (!IsManagedUser()) | 788 if (!IsManagedUser()) |
| 764 EXPECT_FALSE(IsArcPlayStoreEnabledForProfile(profile())); | 789 EXPECT_FALSE(IsArcPlayStoreEnabledForProfile(profile())); |
| 765 } | 790 } |
| 766 | 791 |
| 767 } // namespace arc | 792 } // namespace arc |
| OLD | NEW |