| 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 30 matching lines...) Expand all Loading... |
| 41 #include "chrome/browser/chromeos/login/users/fake_chrome_user_manager.h" | 41 #include "chrome/browser/chromeos/login/users/fake_chrome_user_manager.h" |
| 42 #include "chrome/browser/chromeos/login/users/scoped_user_manager_enabler.h" | 42 #include "chrome/browser/chromeos/login/users/scoped_user_manager_enabler.h" |
| 43 #include "chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.h" | 43 #include "chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.h" |
| 44 #include "chrome/browser/extensions/extension_service.h" | 44 #include "chrome/browser/extensions/extension_service.h" |
| 45 #include "chrome/browser/extensions/test_extension_system.h" | 45 #include "chrome/browser/extensions/test_extension_system.h" |
| 46 #include "chrome/browser/lifetime/scoped_keep_alive.h" | 46 #include "chrome/browser/lifetime/scoped_keep_alive.h" |
| 47 #include "chrome/browser/ui/app_list/app_list_syncable_service_factory.h" | 47 #include "chrome/browser/ui/app_list/app_list_syncable_service_factory.h" |
| 48 #include "chrome/browser/ui/app_list/arc/arc_app_list_prefs.h" | 48 #include "chrome/browser/ui/app_list/arc/arc_app_list_prefs.h" |
| 49 #include "chrome/browser/ui/app_list/arc/arc_app_test.h" | 49 #include "chrome/browser/ui/app_list/arc/arc_app_test.h" |
| 50 #include "chrome/browser/ui/app_list/arc/arc_app_utils.h" | 50 #include "chrome/browser/ui/app_list/arc/arc_app_utils.h" |
| 51 #include "chrome/browser/ui/app_list/arc/arc_default_app_list.h" |
| 51 #include "chrome/browser/ui/apps/chrome_app_delegate.h" | 52 #include "chrome/browser/ui/apps/chrome_app_delegate.h" |
| 52 #include "chrome/browser/ui/ash/chrome_launcher_prefs.h" | 53 #include "chrome/browser/ui/ash/chrome_launcher_prefs.h" |
| 53 #include "chrome/browser/ui/ash/launcher/app_window_launcher_controller.h" | 54 #include "chrome/browser/ui/ash/launcher/app_window_launcher_controller.h" |
| 55 #include "chrome/browser/ui/ash/launcher/arc_app_deferred_launcher_controller.h" |
| 54 #include "chrome/browser/ui/ash/launcher/browser_status_monitor.h" | 56 #include "chrome/browser/ui/ash/launcher/browser_status_monitor.h" |
| 55 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller_util.h" | 57 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller_util.h" |
| 56 #include "chrome/browser/ui/ash/launcher/extension_app_window_launcher_item_cont
roller.h" | 58 #include "chrome/browser/ui/ash/launcher/extension_app_window_launcher_item_cont
roller.h" |
| 57 #include "chrome/browser/ui/ash/launcher/launcher_application_menu_item_model.h" | 59 #include "chrome/browser/ui/ash/launcher/launcher_application_menu_item_model.h" |
| 58 #include "chrome/browser/ui/ash/launcher/launcher_controller_helper.h" | 60 #include "chrome/browser/ui/ash/launcher/launcher_controller_helper.h" |
| 59 #include "chrome/browser/ui/ash/launcher/launcher_item_controller.h" | 61 #include "chrome/browser/ui/ash/launcher/launcher_item_controller.h" |
| 60 #include "chrome/browser/ui/ash/multi_user/multi_user_util.h" | 62 #include "chrome/browser/ui/ash/multi_user/multi_user_util.h" |
| 61 #include "chrome/browser/ui/ash/multi_user/multi_user_window_manager.h" | 63 #include "chrome/browser/ui/ash/multi_user/multi_user_window_manager.h" |
| 62 #include "chrome/browser/ui/ash/multi_user/multi_user_window_manager_chromeos.h" | 64 #include "chrome/browser/ui/ash/multi_user/multi_user_window_manager_chromeos.h" |
| 63 #include "chrome/browser/ui/browser.h" | 65 #include "chrome/browser/ui/browser.h" |
| (...skipping 3502 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3566 | 3568 |
| 3567 views::Widget* window_none_ = nullptr; | 3569 views::Widget* window_none_ = nullptr; |
| 3568 views::Widget* window_landscape_ = nullptr; | 3570 views::Widget* window_landscape_ = nullptr; |
| 3569 views::Widget* window_portrait_ = nullptr; | 3571 views::Widget* window_portrait_ = nullptr; |
| 3570 views::Widget* window_current_ = nullptr; | 3572 views::Widget* window_current_ = nullptr; |
| 3571 | 3573 |
| 3572 private: | 3574 private: |
| 3573 DISALLOW_COPY_AND_ASSIGN(ChromeLauncherControllerOrientationTest); | 3575 DISALLOW_COPY_AND_ASSIGN(ChromeLauncherControllerOrientationTest); |
| 3574 }; | 3576 }; |
| 3575 | 3577 |
| 3578 class ChromeLauncherControllerArcDefaultAppsTest |
| 3579 : public ChromeLauncherControllerImplTest { |
| 3580 public: |
| 3581 ChromeLauncherControllerArcDefaultAppsTest() {} |
| 3582 ~ChromeLauncherControllerArcDefaultAppsTest() override {} |
| 3583 |
| 3584 protected: |
| 3585 void SetUp() override { |
| 3586 ArcDefaultAppList::UseTestAppsDirectory(); |
| 3587 ChromeLauncherControllerImplTest::SetUp(); |
| 3588 } |
| 3589 |
| 3590 private: |
| 3591 DISALLOW_COPY_AND_ASSIGN(ChromeLauncherControllerArcDefaultAppsTest); |
| 3592 }; |
| 3593 |
| 3576 } // namespace | 3594 } // namespace |
| 3577 | 3595 |
| 3578 TEST_F(ChromeLauncherControllerOrientationTest, ArcOrientationLock) { | 3596 TEST_F(ChromeLauncherControllerOrientationTest, ArcOrientationLock) { |
| 3579 ASSERT_TRUE(display::Display::HasInternalDisplay()); | 3597 ASSERT_TRUE(display::Display::HasInternalDisplay()); |
| 3580 | 3598 |
| 3581 extension_service_->AddExtension(arc_support_host_.get()); | 3599 extension_service_->AddExtension(arc_support_host_.get()); |
| 3582 arc_test_.SetUp(profile()); | 3600 arc_test_.SetUp(profile()); |
| 3583 EnableArc(true); | 3601 EnableArc(true); |
| 3584 EnableTabletMode(true); | 3602 EnableTabletMode(true); |
| 3585 | 3603 |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3729 EXPECT_FALSE(controller->rotation_locked()); | 3747 EXPECT_FALSE(controller->rotation_locked()); |
| 3730 EXPECT_EQ(display::Display::ROTATE_0, | 3748 EXPECT_EQ(display::Display::ROTATE_0, |
| 3731 display::Screen::GetScreen()->GetPrimaryDisplay().rotation()); | 3749 display::Screen::GetScreen()->GetPrimaryDisplay().rotation()); |
| 3732 | 3750 |
| 3733 NotifyOnTaskOrientationLockRequested(task_id_current_, | 3751 NotifyOnTaskOrientationLockRequested(task_id_current_, |
| 3734 OrientationLock::CURRENT); | 3752 OrientationLock::CURRENT); |
| 3735 EXPECT_TRUE(controller->rotation_locked()); | 3753 EXPECT_TRUE(controller->rotation_locked()); |
| 3736 EXPECT_EQ(display::Display::ROTATE_0, | 3754 EXPECT_EQ(display::Display::ROTATE_0, |
| 3737 display::Screen::GetScreen()->GetPrimaryDisplay().rotation()); | 3755 display::Screen::GetScreen()->GetPrimaryDisplay().rotation()); |
| 3738 } | 3756 } |
| 3757 |
| 3758 TEST_F(ChromeLauncherControllerArcDefaultAppsTest, DefaultApps) { |
| 3759 arc_test_.SetUp(profile()); |
| 3760 InitLauncherController(); |
| 3761 ChromeLauncherController::set_instance(launcher_controller_.get()); |
| 3762 |
| 3763 ArcAppListPrefs* const prefs = arc_test_.arc_app_list_prefs(); |
| 3764 EnableArc(false); |
| 3765 EXPECT_FALSE(arc_test_.arc_auth_service()->IsArcEnabled()); |
| 3766 ASSERT_TRUE(prefs->GetAppIds().size()); |
| 3767 |
| 3768 const std::string app_id = |
| 3769 ArcAppTest::GetAppId(arc_test_.fake_default_apps()[0]); |
| 3770 EXPECT_EQ(0, launcher_controller_->GetShelfIDForAppID(app_id)); |
| 3771 EXPECT_TRUE(arc::LaunchApp(profile(), app_id)); |
| 3772 EXPECT_TRUE(arc_test_.arc_auth_service()->IsArcEnabled()); |
| 3773 EXPECT_NE(0, launcher_controller_->GetShelfIDForAppID(app_id)); |
| 3774 |
| 3775 // Stop Arc again. Shelf item should go away. |
| 3776 EnableArc(false); |
| 3777 EXPECT_EQ(0, launcher_controller_->GetShelfIDForAppID(app_id)); |
| 3778 |
| 3779 EXPECT_TRUE(arc::LaunchApp(profile(), app_id)); |
| 3780 EXPECT_TRUE(arc_test_.arc_auth_service()->IsArcEnabled()); |
| 3781 |
| 3782 EXPECT_NE(0, launcher_controller_->GetShelfIDForAppID(app_id)); |
| 3783 EXPECT_TRUE(launcher_controller_->GetArcDeferredLauncher()->HasApp(app_id)); |
| 3784 |
| 3785 std::string window_app_id("org.chromium.arc.1"); |
| 3786 CreateArcWindow(window_app_id); |
| 3787 arc_test_.app_instance()->SendTaskCreated(1, |
| 3788 arc_test_.fake_default_apps()[0]); |
| 3789 |
| 3790 EXPECT_NE(0, launcher_controller_->GetShelfIDForAppID(app_id)); |
| 3791 EXPECT_FALSE(launcher_controller_->GetArcDeferredLauncher()->HasApp(app_id)); |
| 3792 } |
| OLD | NEW |