| 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 3551 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3562 | 3562 |
| 3563 InitLauncherController(); | 3563 InitLauncherController(); |
| 3564 arc::ArcAuthService::SetShelfDelegateForTesting(launcher_controller_.get()); | 3564 arc::ArcAuthService::SetShelfDelegateForTesting(launcher_controller_.get()); |
| 3565 | 3565 |
| 3566 // Initial run, Arc is not managed and disabled, Play Store pin should be | 3566 // Initial run, Arc is not managed and disabled, Play Store pin should be |
| 3567 // available. | 3567 // available. |
| 3568 ValidateArcState(false, false, arc::ArcAuthService::State::STOPPED, | 3568 ValidateArcState(false, false, arc::ArcAuthService::State::STOPPED, |
| 3569 "AppList, Chrome, Play Store"); | 3569 "AppList, Chrome, Play Store"); |
| 3570 | 3570 |
| 3571 // Arc is managed and enabled, Play Store pin should be available. | 3571 // Arc is managed and enabled, Play Store pin should be available. |
| 3572 // Note: SHOWING_TERMS_OF_SERVICE here means that opt-in flow starts. |
| 3572 profile()->GetTestingPrefService()->SetManagedPref( | 3573 profile()->GetTestingPrefService()->SetManagedPref( |
| 3573 prefs::kArcEnabled, new base::FundamentalValue(true)); | 3574 prefs::kArcEnabled, new base::FundamentalValue(true)); |
| 3574 base::RunLoop().RunUntilIdle(); | 3575 base::RunLoop().RunUntilIdle(); |
| 3575 ValidateArcState(true, true, arc::ArcAuthService::State::FETCHING_CODE, | 3576 ValidateArcState(true, true, |
| 3577 arc::ArcAuthService::State::SHOWING_TERMS_OF_SERVICE, |
| 3576 "AppList, Chrome, Play Store"); | 3578 "AppList, Chrome, Play Store"); |
| 3577 | 3579 |
| 3578 // Arc is managed and disabled, Play Store pin should not be available. | 3580 // Arc is managed and disabled, Play Store pin should not be available. |
| 3579 profile()->GetTestingPrefService()->SetManagedPref( | 3581 profile()->GetTestingPrefService()->SetManagedPref( |
| 3580 prefs::kArcEnabled, new base::FundamentalValue(false)); | 3582 prefs::kArcEnabled, new base::FundamentalValue(false)); |
| 3581 base::RunLoop().RunUntilIdle(); | 3583 base::RunLoop().RunUntilIdle(); |
| 3582 ValidateArcState(false, true, arc::ArcAuthService::State::STOPPED, | 3584 ValidateArcState(false, true, arc::ArcAuthService::State::STOPPED, |
| 3583 "AppList, Chrome"); | 3585 "AppList, Chrome"); |
| 3584 | 3586 |
| 3585 // Arc is not managed and disabled, Play Store pin should be available. | 3587 // Arc is not managed and disabled, Play Store pin should be available. |
| 3586 profile()->GetTestingPrefService()->RemoveManagedPref(prefs::kArcEnabled); | 3588 profile()->GetTestingPrefService()->RemoveManagedPref(prefs::kArcEnabled); |
| 3587 base::RunLoop().RunUntilIdle(); | 3589 base::RunLoop().RunUntilIdle(); |
| 3588 ValidateArcState(false, false, arc::ArcAuthService::State::STOPPED, | 3590 ValidateArcState(false, false, arc::ArcAuthService::State::STOPPED, |
| 3589 "AppList, Chrome, Play Store"); | 3591 "AppList, Chrome, Play Store"); |
| 3590 | 3592 |
| 3591 // Arc is not managed and enabled, Play Store pin should be available. | 3593 // Arc is not managed and enabled, Play Store pin should be available. |
| 3592 EnableArc(true); | 3594 EnableArc(true); |
| 3593 ValidateArcState(true, false, arc::ArcAuthService::State::FETCHING_CODE, | 3595 ValidateArcState(true, false, |
| 3596 arc::ArcAuthService::State::SHOWING_TERMS_OF_SERVICE, |
| 3594 "AppList, Chrome, Play Store"); | 3597 "AppList, Chrome, Play Store"); |
| 3595 | 3598 |
| 3596 // User disables Arc. Arc is not managed and disabled, Play Store pin should | 3599 // User disables Arc. Arc is not managed and disabled, Play Store pin should |
| 3597 // be automatically removed. | 3600 // be automatically removed. |
| 3598 EnableArc(false); | 3601 EnableArc(false); |
| 3599 ValidateArcState(false, false, arc::ArcAuthService::State::STOPPED, | 3602 ValidateArcState(false, false, arc::ArcAuthService::State::STOPPED, |
| 3600 "AppList, Chrome"); | 3603 "AppList, Chrome"); |
| 3601 | 3604 |
| 3602 // Even if re-enable it again, Play Store pin does not appear automatically. | 3605 // Even if re-enable it again, Play Store pin does not appear automatically. |
| 3603 EnableArc(true); | 3606 EnableArc(true); |
| 3604 ValidateArcState(true, false, arc::ArcAuthService::State::FETCHING_CODE, | 3607 ValidateArcState(true, false, |
| 3608 arc::ArcAuthService::State::SHOWING_TERMS_OF_SERVICE, |
| 3605 "AppList, Chrome"); | 3609 "AppList, Chrome"); |
| 3606 } | 3610 } |
| 3607 | 3611 |
| 3608 namespace { | 3612 namespace { |
| 3609 | 3613 |
| 3610 class ChromeLauncherControllerOrientationTest | 3614 class ChromeLauncherControllerOrientationTest |
| 3611 : public ChromeLauncherControllerImplWithArcTest { | 3615 : public ChromeLauncherControllerImplWithArcTest { |
| 3612 public: | 3616 public: |
| 3613 ChromeLauncherControllerOrientationTest() {} | 3617 ChromeLauncherControllerOrientationTest() {} |
| 3614 ~ChromeLauncherControllerOrientationTest() override {} | 3618 ~ChromeLauncherControllerOrientationTest() override {} |
| (...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4021 | 4025 |
| 4022 // Pinned state should not change. | 4026 // Pinned state should not change. |
| 4023 EXPECT_EQ("AppList, Chrome, App1, App2", GetPinnedAppStatus()); | 4027 EXPECT_EQ("AppList, Chrome, App1, App2", GetPinnedAppStatus()); |
| 4024 launcher_controller_->UnpinAppWithID(extension2_->id()); | 4028 launcher_controller_->UnpinAppWithID(extension2_->id()); |
| 4025 EXPECT_EQ("AppList, Chrome, App1", GetPinnedAppStatus()); | 4029 EXPECT_EQ("AppList, Chrome, App1", GetPinnedAppStatus()); |
| 4026 | 4030 |
| 4027 // Resume syncing and sync information overrides local copy. | 4031 // Resume syncing and sync information overrides local copy. |
| 4028 StartAppSyncService(copy_sync_list); | 4032 StartAppSyncService(copy_sync_list); |
| 4029 EXPECT_EQ("AppList, Chrome, App1, App2", GetPinnedAppStatus()); | 4033 EXPECT_EQ("AppList, Chrome, App1, App2", GetPinnedAppStatus()); |
| 4030 } | 4034 } |
| OLD | NEW |