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 3701 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3712 ArcDefaultAppList::UseTestAppsDirectory(); | 3712 ArcDefaultAppList::UseTestAppsDirectory(); |
3713 ChromeLauncherControllerImplTest::SetUp(); | 3713 ChromeLauncherControllerImplTest::SetUp(); |
3714 } | 3714 } |
3715 | 3715 |
3716 private: | 3716 private: |
3717 DISALLOW_COPY_AND_ASSIGN(ChromeLauncherControllerArcDefaultAppsTest); | 3717 DISALLOW_COPY_AND_ASSIGN(ChromeLauncherControllerArcDefaultAppsTest); |
3718 }; | 3718 }; |
3719 | 3719 |
3720 } // namespace | 3720 } // namespace |
3721 | 3721 |
| 3722 TEST_F(ChromeLauncherControllerOrientationTest, |
| 3723 ArcOrientationLockBeforeWindowReady) { |
| 3724 ASSERT_TRUE(display::Display::HasInternalDisplay()); |
| 3725 |
| 3726 extension_service_->AddExtension(arc_support_host_.get()); |
| 3727 EnableArc(true); |
| 3728 |
| 3729 InitLauncherController(); |
| 3730 arc::ArcAuthService::SetShelfDelegateForTesting(launcher_controller_.get()); |
| 3731 |
| 3732 ash::ScreenOrientationController* controller = |
| 3733 ash::Shell::GetInstance()->screen_orientation_controller(); |
| 3734 |
| 3735 std::string app_id1("org.chromium.arc.1"); |
| 3736 int task_id1 = 1; |
| 3737 arc::mojom::AppInfo appinfo1 = |
| 3738 CreateAppInfo("Test1", "test", "com.example.app", OrientationLock::NONE); |
| 3739 |
| 3740 AddArcAppAndShortcut(appinfo1); |
| 3741 NotifyOnTaskCreated(appinfo1, task_id1); |
| 3742 NotifyOnTaskOrientationLockRequested(task_id1, OrientationLock::PORTRAIT); |
| 3743 |
| 3744 // Widgets will be deleted by the system. |
| 3745 CreateArcWindow(app_id1); |
| 3746 |
| 3747 EXPECT_FALSE(controller->rotation_locked()); |
| 3748 |
| 3749 EnableTabletMode(true); |
| 3750 EXPECT_TRUE(controller->rotation_locked()); |
| 3751 EXPECT_EQ(display::Display::ROTATE_90, |
| 3752 display::Screen::GetScreen()->GetPrimaryDisplay().rotation()); |
| 3753 |
| 3754 std::string app_id2("org.chromium.arc.2"); |
| 3755 int task_id2 = 2; |
| 3756 arc::mojom::AppInfo appinfo2 = |
| 3757 CreateAppInfo("Test2", "test", "com.example.app", OrientationLock::NONE); |
| 3758 // Create in tablet mode. |
| 3759 AddArcAppAndShortcut(appinfo2); |
| 3760 NotifyOnTaskCreated(appinfo2, task_id2); |
| 3761 NotifyOnTaskOrientationLockRequested(task_id2, OrientationLock::LANDSCAPE); |
| 3762 EXPECT_TRUE(controller->rotation_locked()); |
| 3763 EXPECT_EQ(display::Display::ROTATE_90, |
| 3764 display::Screen::GetScreen()->GetPrimaryDisplay().rotation()); |
| 3765 |
| 3766 // The screen will be locked when the window is created. |
| 3767 CreateArcWindow(app_id2); |
| 3768 EXPECT_TRUE(controller->rotation_locked()); |
| 3769 EXPECT_EQ(display::Display::ROTATE_0, |
| 3770 display::Screen::GetScreen()->GetPrimaryDisplay().rotation()); |
| 3771 } |
| 3772 |
3722 TEST_F(ChromeLauncherControllerOrientationTest, ArcOrientationLock) { | 3773 TEST_F(ChromeLauncherControllerOrientationTest, ArcOrientationLock) { |
3723 ASSERT_TRUE(display::Display::HasInternalDisplay()); | 3774 ASSERT_TRUE(display::Display::HasInternalDisplay()); |
3724 | 3775 |
3725 extension_service_->AddExtension(arc_support_host_.get()); | 3776 extension_service_->AddExtension(arc_support_host_.get()); |
3726 EnableArc(true); | 3777 EnableArc(true); |
3727 EnableTabletMode(true); | 3778 EnableTabletMode(true); |
3728 | 3779 |
3729 InitLauncherController(); | 3780 InitLauncherController(); |
3730 arc::ArcAuthService::SetShelfDelegateForTesting(launcher_controller_.get()); | 3781 arc::ArcAuthService::SetShelfDelegateForTesting(launcher_controller_.get()); |
3731 | 3782 |
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3957 app_service_->GetPinPosition(extension_misc::kChromeAppId))); | 4008 app_service_->GetPinPosition(extension_misc::kChromeAppId))); |
3958 EXPECT_TRUE( | 4009 EXPECT_TRUE( |
3959 position_1.Equals(app_service_->GetPinPosition(extension1_->id()))); | 4010 position_1.Equals(app_service_->GetPinPosition(extension1_->id()))); |
3960 EXPECT_TRUE( | 4011 EXPECT_TRUE( |
3961 position_1.Equals(app_service_->GetPinPosition(extension1_->id()))); | 4012 position_1.Equals(app_service_->GetPinPosition(extension1_->id()))); |
3962 EXPECT_TRUE( | 4013 EXPECT_TRUE( |
3963 position_2.Equals(app_service_->GetPinPosition(extension2_->id()))); | 4014 position_2.Equals(app_service_->GetPinPosition(extension2_->id()))); |
3964 EXPECT_TRUE( | 4015 EXPECT_TRUE( |
3965 position_3.Equals(app_service_->GetPinPosition(extension3_->id()))); | 4016 position_3.Equals(app_service_->GetPinPosition(extension3_->id()))); |
3966 } | 4017 } |
OLD | NEW |