| 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 3674 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3685 // Inject |launcher_controller_| as ShelfDelegate to verify the behavior | 3685 // Inject |launcher_controller_| as ShelfDelegate to verify the behavior |
| 3686 // of removing pinned icon in ArcSessionManager::OnOptInPreferenceChanged(). | 3686 // of removing pinned icon in ArcSessionManager::OnOptInPreferenceChanged(). |
| 3687 SetShelfDelegate(); | 3687 SetShelfDelegate(); |
| 3688 | 3688 |
| 3689 // Initial run, ARC is not managed and disabled, Play Store pin should be | 3689 // Initial run, ARC is not managed and disabled, Play Store pin should be |
| 3690 // available. | 3690 // available. |
| 3691 ValidateArcState(false, false, arc::ArcSessionManager::State::STOPPED, | 3691 ValidateArcState(false, false, arc::ArcSessionManager::State::STOPPED, |
| 3692 "AppList, Chrome, Play Store"); | 3692 "AppList, Chrome, Play Store"); |
| 3693 | 3693 |
| 3694 // ARC is managed and enabled, Play Store pin should be available. | 3694 // ARC is managed and enabled, Play Store pin should be available. |
| 3695 // Note: SHOWING_TERMS_OF_SERVICE here means that opt-in flow starts. | 3695 // Note: NEGOTIATING_TERMS_OF_SERVICE here means that opt-in flow starts. |
| 3696 profile()->GetTestingPrefService()->SetManagedPref(prefs::kArcEnabled, | 3696 profile()->GetTestingPrefService()->SetManagedPref(prefs::kArcEnabled, |
| 3697 new base::Value(true)); | 3697 new base::Value(true)); |
| 3698 base::RunLoop().RunUntilIdle(); | 3698 base::RunLoop().RunUntilIdle(); |
| 3699 ValidateArcState(true, true, | 3699 ValidateArcState(true, true, |
| 3700 arc::ArcSessionManager::State::SHOWING_TERMS_OF_SERVICE, | 3700 arc::ArcSessionManager::State::NEGOTIATING_TERMS_OF_SERVICE, |
| 3701 "AppList, Chrome, Play Store"); | 3701 "AppList, Chrome, Play Store"); |
| 3702 | 3702 |
| 3703 // ARC is managed and disabled, Play Store pin should not be available. | 3703 // ARC is managed and disabled, Play Store pin should not be available. |
| 3704 profile()->GetTestingPrefService()->SetManagedPref(prefs::kArcEnabled, | 3704 profile()->GetTestingPrefService()->SetManagedPref(prefs::kArcEnabled, |
| 3705 new base::Value(false)); | 3705 new base::Value(false)); |
| 3706 base::RunLoop().RunUntilIdle(); | 3706 base::RunLoop().RunUntilIdle(); |
| 3707 ValidateArcState(false, true, arc::ArcSessionManager::State::STOPPED, | 3707 ValidateArcState(false, true, arc::ArcSessionManager::State::STOPPED, |
| 3708 "AppList, Chrome"); | 3708 "AppList, Chrome"); |
| 3709 | 3709 |
| 3710 // ARC is not managed and disabled, Play Store pin should be available. | 3710 // ARC is not managed and disabled, Play Store pin should be available. |
| 3711 profile()->GetTestingPrefService()->RemoveManagedPref(prefs::kArcEnabled); | 3711 profile()->GetTestingPrefService()->RemoveManagedPref(prefs::kArcEnabled); |
| 3712 base::RunLoop().RunUntilIdle(); | 3712 base::RunLoop().RunUntilIdle(); |
| 3713 ValidateArcState(false, false, arc::ArcSessionManager::State::STOPPED, | 3713 ValidateArcState(false, false, arc::ArcSessionManager::State::STOPPED, |
| 3714 "AppList, Chrome, Play Store"); | 3714 "AppList, Chrome, Play Store"); |
| 3715 | 3715 |
| 3716 // ARC is not managed and enabled, Play Store pin should be available. | 3716 // ARC is not managed and enabled, Play Store pin should be available. |
| 3717 EnablePlayStore(true); | 3717 EnablePlayStore(true); |
| 3718 ValidateArcState(true, false, | 3718 ValidateArcState(true, false, |
| 3719 arc::ArcSessionManager::State::SHOWING_TERMS_OF_SERVICE, | 3719 arc::ArcSessionManager::State::NEGOTIATING_TERMS_OF_SERVICE, |
| 3720 "AppList, Chrome, Play Store"); | 3720 "AppList, Chrome, Play Store"); |
| 3721 | 3721 |
| 3722 // User disables ARC. ARC is not managed and disabled, Play Store pin should | 3722 // User disables ARC. ARC is not managed and disabled, Play Store pin should |
| 3723 // be automatically removed. | 3723 // be automatically removed. |
| 3724 EnablePlayStore(false); | 3724 EnablePlayStore(false); |
| 3725 ValidateArcState(false, false, arc::ArcSessionManager::State::STOPPED, | 3725 ValidateArcState(false, false, arc::ArcSessionManager::State::STOPPED, |
| 3726 "AppList, Chrome"); | 3726 "AppList, Chrome"); |
| 3727 | 3727 |
| 3728 // Even if re-enable it again, Play Store pin does not appear automatically. | 3728 // Even if re-enable it again, Play Store pin does not appear automatically. |
| 3729 EnablePlayStore(true); | 3729 EnablePlayStore(true); |
| 3730 ValidateArcState(true, false, | 3730 ValidateArcState(true, false, |
| 3731 arc::ArcSessionManager::State::SHOWING_TERMS_OF_SERVICE, | 3731 arc::ArcSessionManager::State::NEGOTIATING_TERMS_OF_SERVICE, |
| 3732 "AppList, Chrome"); | 3732 "AppList, Chrome"); |
| 3733 } | 3733 } |
| 3734 | 3734 |
| 3735 namespace { | 3735 namespace { |
| 3736 | 3736 |
| 3737 class ChromeLauncherControllerOrientationTest | 3737 class ChromeLauncherControllerOrientationTest |
| 3738 : public ChromeLauncherControllerImplWithArcTest { | 3738 : public ChromeLauncherControllerImplWithArcTest { |
| 3739 public: | 3739 public: |
| 3740 ChromeLauncherControllerOrientationTest() {} | 3740 ChromeLauncherControllerOrientationTest() {} |
| 3741 ~ChromeLauncherControllerOrientationTest() override {} | 3741 ~ChromeLauncherControllerOrientationTest() override {} |
| (...skipping 568 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4310 EXPECT_EQ(ash::SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS, | 4310 EXPECT_EQ(ash::SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS, |
| 4311 shelf_controller->auto_hide()); | 4311 shelf_controller->auto_hide()); |
| 4312 EXPECT_EQ(2u, shelf_controller->auto_hide_change_count()); | 4312 EXPECT_EQ(2u, shelf_controller->auto_hide_change_count()); |
| 4313 | 4313 |
| 4314 PrefService* prefs = profile()->GetTestingPrefService(); | 4314 PrefService* prefs = profile()->GetTestingPrefService(); |
| 4315 EXPECT_EQ("Left", prefs->GetString(prefs::kShelfAlignmentLocal)); | 4315 EXPECT_EQ("Left", prefs->GetString(prefs::kShelfAlignmentLocal)); |
| 4316 EXPECT_EQ("Left", prefs->GetString(prefs::kShelfAlignment)); | 4316 EXPECT_EQ("Left", prefs->GetString(prefs::kShelfAlignment)); |
| 4317 EXPECT_EQ("Always", prefs->GetString(prefs::kShelfAutoHideBehaviorLocal)); | 4317 EXPECT_EQ("Always", prefs->GetString(prefs::kShelfAutoHideBehaviorLocal)); |
| 4318 EXPECT_EQ("Always", prefs->GetString(prefs::kShelfAutoHideBehavior)); | 4318 EXPECT_EQ("Always", prefs->GetString(prefs::kShelfAutoHideBehavior)); |
| 4319 } | 4319 } |
| OLD | NEW |