| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "chrome/browser/ui/ash/launcher/chrome_launcher_controller_impl.h" | 5 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller_impl.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <map> | 10 #include <map> |
| (...skipping 3632 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3643 // Inject |launcher_controller_| as ShelfDelegate to verify the behavior | 3643 // Inject |launcher_controller_| as ShelfDelegate to verify the behavior |
| 3644 // of removing pinned icon in ArcSessionManager::OnOptInPreferenceChanged(). | 3644 // of removing pinned icon in ArcSessionManager::OnOptInPreferenceChanged(). |
| 3645 SetShelfDelegate(); | 3645 SetShelfDelegate(); |
| 3646 | 3646 |
| 3647 // Initial run, ARC is not managed and disabled, Play Store pin should be | 3647 // Initial run, ARC is not managed and disabled, Play Store pin should be |
| 3648 // available. | 3648 // available. |
| 3649 ValidateArcState(false, false, arc::ArcSessionManager::State::STOPPED, | 3649 ValidateArcState(false, false, arc::ArcSessionManager::State::STOPPED, |
| 3650 "AppList, Chrome, Play Store"); | 3650 "AppList, Chrome, Play Store"); |
| 3651 | 3651 |
| 3652 // ARC is managed and enabled, Play Store pin should be available. | 3652 // ARC is managed and enabled, Play Store pin should be available. |
| 3653 // Note: SHOWING_TERMS_OF_SERVICE here means that opt-in flow starts. | 3653 // Note: NEGOTIATING_TERMS_OF_SERVICE here means that opt-in flow starts. |
| 3654 profile()->GetTestingPrefService()->SetManagedPref(prefs::kArcEnabled, | 3654 profile()->GetTestingPrefService()->SetManagedPref(prefs::kArcEnabled, |
| 3655 new base::Value(true)); | 3655 new base::Value(true)); |
| 3656 base::RunLoop().RunUntilIdle(); | 3656 base::RunLoop().RunUntilIdle(); |
| 3657 ValidateArcState(true, true, | 3657 ValidateArcState(true, true, |
| 3658 arc::ArcSessionManager::State::SHOWING_TERMS_OF_SERVICE, | 3658 arc::ArcSessionManager::State::NEGOTIATING_TERMS_OF_SERVICE, |
| 3659 "AppList, Chrome, Play Store"); | 3659 "AppList, Chrome, Play Store"); |
| 3660 | 3660 |
| 3661 // ARC is managed and disabled, Play Store pin should not be available. | 3661 // ARC is managed and disabled, Play Store pin should not be available. |
| 3662 profile()->GetTestingPrefService()->SetManagedPref(prefs::kArcEnabled, | 3662 profile()->GetTestingPrefService()->SetManagedPref(prefs::kArcEnabled, |
| 3663 new base::Value(false)); | 3663 new base::Value(false)); |
| 3664 base::RunLoop().RunUntilIdle(); | 3664 base::RunLoop().RunUntilIdle(); |
| 3665 ValidateArcState(false, true, arc::ArcSessionManager::State::STOPPED, | 3665 ValidateArcState(false, true, arc::ArcSessionManager::State::STOPPED, |
| 3666 "AppList, Chrome"); | 3666 "AppList, Chrome"); |
| 3667 | 3667 |
| 3668 // ARC is not managed and disabled, Play Store pin should be available. | 3668 // ARC is not managed and disabled, Play Store pin should be available. |
| 3669 profile()->GetTestingPrefService()->RemoveManagedPref(prefs::kArcEnabled); | 3669 profile()->GetTestingPrefService()->RemoveManagedPref(prefs::kArcEnabled); |
| 3670 base::RunLoop().RunUntilIdle(); | 3670 base::RunLoop().RunUntilIdle(); |
| 3671 ValidateArcState(false, false, arc::ArcSessionManager::State::STOPPED, | 3671 ValidateArcState(false, false, arc::ArcSessionManager::State::STOPPED, |
| 3672 "AppList, Chrome, Play Store"); | 3672 "AppList, Chrome, Play Store"); |
| 3673 | 3673 |
| 3674 // ARC is not managed and enabled, Play Store pin should be available. | 3674 // ARC is not managed and enabled, Play Store pin should be available. |
| 3675 EnableArc(true); | 3675 EnableArc(true); |
| 3676 ValidateArcState(true, false, | 3676 ValidateArcState(true, false, |
| 3677 arc::ArcSessionManager::State::SHOWING_TERMS_OF_SERVICE, | 3677 arc::ArcSessionManager::State::NEGOTIATING_TERMS_OF_SERVICE, |
| 3678 "AppList, Chrome, Play Store"); | 3678 "AppList, Chrome, Play Store"); |
| 3679 | 3679 |
| 3680 // User disables ARC. ARC is not managed and disabled, Play Store pin should | 3680 // User disables ARC. ARC is not managed and disabled, Play Store pin should |
| 3681 // be automatically removed. | 3681 // be automatically removed. |
| 3682 EnableArc(false); | 3682 EnableArc(false); |
| 3683 ValidateArcState(false, false, arc::ArcSessionManager::State::STOPPED, | 3683 ValidateArcState(false, false, arc::ArcSessionManager::State::STOPPED, |
| 3684 "AppList, Chrome"); | 3684 "AppList, Chrome"); |
| 3685 | 3685 |
| 3686 // Even if re-enable it again, Play Store pin does not appear automatically. | 3686 // Even if re-enable it again, Play Store pin does not appear automatically. |
| 3687 EnableArc(true); | 3687 EnableArc(true); |
| 3688 ValidateArcState(true, false, | 3688 ValidateArcState(true, false, |
| 3689 arc::ArcSessionManager::State::SHOWING_TERMS_OF_SERVICE, | 3689 arc::ArcSessionManager::State::NEGOTIATING_TERMS_OF_SERVICE, |
| 3690 "AppList, Chrome"); | 3690 "AppList, Chrome"); |
| 3691 } | 3691 } |
| 3692 | 3692 |
| 3693 namespace { | 3693 namespace { |
| 3694 | 3694 |
| 3695 class ChromeLauncherControllerOrientationTest | 3695 class ChromeLauncherControllerOrientationTest |
| 3696 : public ChromeLauncherControllerImplWithArcTest { | 3696 : public ChromeLauncherControllerImplWithArcTest { |
| 3697 public: | 3697 public: |
| 3698 ChromeLauncherControllerOrientationTest() {} | 3698 ChromeLauncherControllerOrientationTest() {} |
| 3699 ~ChromeLauncherControllerOrientationTest() override {} | 3699 ~ChromeLauncherControllerOrientationTest() override {} |
| (...skipping 557 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4257 EXPECT_EQ(ash::SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS, | 4257 EXPECT_EQ(ash::SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS, |
| 4258 shelf_controller->auto_hide()); | 4258 shelf_controller->auto_hide()); |
| 4259 EXPECT_EQ(2u, shelf_controller->auto_hide_change_count()); | 4259 EXPECT_EQ(2u, shelf_controller->auto_hide_change_count()); |
| 4260 | 4260 |
| 4261 PrefService* prefs = profile()->GetTestingPrefService(); | 4261 PrefService* prefs = profile()->GetTestingPrefService(); |
| 4262 EXPECT_EQ("Left", prefs->GetString(prefs::kShelfAlignmentLocal)); | 4262 EXPECT_EQ("Left", prefs->GetString(prefs::kShelfAlignmentLocal)); |
| 4263 EXPECT_EQ("Left", prefs->GetString(prefs::kShelfAlignment)); | 4263 EXPECT_EQ("Left", prefs->GetString(prefs::kShelfAlignment)); |
| 4264 EXPECT_EQ("Always", prefs->GetString(prefs::kShelfAutoHideBehaviorLocal)); | 4264 EXPECT_EQ("Always", prefs->GetString(prefs::kShelfAutoHideBehaviorLocal)); |
| 4265 EXPECT_EQ("Always", prefs->GetString(prefs::kShelfAutoHideBehavior)); | 4265 EXPECT_EQ("Always", prefs->GetString(prefs::kShelfAutoHideBehavior)); |
| 4266 } | 4266 } |
| OLD | NEW |