Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(73)

Side by Side Diff: chrome/browser/ui/ash/launcher/chrome_launcher_controller_impl_unittest.cc

Issue 2398773003: Orientation request may arrive before the window is created. (Closed)
Patch Set: Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/browser/ui/ash/launcher/arc_app_window_launcher_controller.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 3703 matching lines...) Expand 10 before | Expand all | Expand 10 after
3714 ArcDefaultAppList::UseTestAppsDirectory(); 3714 ArcDefaultAppList::UseTestAppsDirectory();
3715 ChromeLauncherControllerImplTest::SetUp(); 3715 ChromeLauncherControllerImplTest::SetUp();
3716 } 3716 }
3717 3717
3718 private: 3718 private:
3719 DISALLOW_COPY_AND_ASSIGN(ChromeLauncherControllerArcDefaultAppsTest); 3719 DISALLOW_COPY_AND_ASSIGN(ChromeLauncherControllerArcDefaultAppsTest);
3720 }; 3720 };
3721 3721
3722 } // namespace 3722 } // namespace
3723 3723
3724 TEST_F(ChromeLauncherControllerOrientationTest,
3725 ArcOrientationLockBeforeWindowReady) {
3726 ASSERT_TRUE(display::Display::HasInternalDisplay());
3727
3728 extension_service_->AddExtension(arc_support_host_.get());
3729 EnableArc(true);
3730
3731 InitLauncherController();
3732 arc::ArcAuthService::SetShelfDelegateForTesting(launcher_controller_.get());
3733
3734 ash::ScreenOrientationController* controller =
3735 ash::Shell::GetInstance()->screen_orientation_controller();
3736
3737 std::string app_id1("org.chromium.arc.1");
3738 int task_id1 = 1;
3739 arc::mojom::AppInfo appinfo1 =
3740 CreateAppInfo("Test1", "test", "com.example.app", OrientationLock::NONE);
3741
3742 AddArcAppAndShortcut(appinfo1);
3743 NotifyOnTaskCreated(appinfo1, task_id1);
3744 NotifyOnTaskOrientationLockRequested(task_id1, OrientationLock::PORTRAIT);
3745
3746 // Widgets will be deleted by the system.
3747 CreateArcWindow(app_id1);
3748
3749 EXPECT_FALSE(controller->rotation_locked());
3750
3751 EnableTabletMode(true);
3752 EXPECT_TRUE(controller->rotation_locked());
3753 EXPECT_EQ(display::Display::ROTATE_90,
3754 display::Screen::GetScreen()->GetPrimaryDisplay().rotation());
3755
3756 std::string app_id2("org.chromium.arc.2");
3757 int task_id2 = 2;
3758 arc::mojom::AppInfo appinfo2 =
3759 CreateAppInfo("Test2", "test", "com.example.app", OrientationLock::NONE);
3760 // Create in tablet mode.
3761 AddArcAppAndShortcut(appinfo2);
3762 NotifyOnTaskCreated(appinfo2, task_id2);
3763 NotifyOnTaskOrientationLockRequested(task_id2, OrientationLock::LANDSCAPE);
3764 EXPECT_TRUE(controller->rotation_locked());
3765 EXPECT_EQ(display::Display::ROTATE_90,
3766 display::Screen::GetScreen()->GetPrimaryDisplay().rotation());
3767
3768 // The screen will be locked when the window is created.
3769 CreateArcWindow(app_id2);
3770 EXPECT_TRUE(controller->rotation_locked());
3771 EXPECT_EQ(display::Display::ROTATE_0,
3772 display::Screen::GetScreen()->GetPrimaryDisplay().rotation());
3773 }
3774
3724 TEST_F(ChromeLauncherControllerOrientationTest, ArcOrientationLock) { 3775 TEST_F(ChromeLauncherControllerOrientationTest, ArcOrientationLock) {
3725 ASSERT_TRUE(display::Display::HasInternalDisplay()); 3776 ASSERT_TRUE(display::Display::HasInternalDisplay());
3726 3777
3727 extension_service_->AddExtension(arc_support_host_.get()); 3778 extension_service_->AddExtension(arc_support_host_.get());
3728 EnableArc(true); 3779 EnableArc(true);
3729 EnableTabletMode(true); 3780 EnableTabletMode(true);
3730 3781
3731 InitLauncherController(); 3782 InitLauncherController();
3732 arc::ArcAuthService::SetShelfDelegateForTesting(launcher_controller_.get()); 3783 arc::ArcAuthService::SetShelfDelegateForTesting(launcher_controller_.get());
3733 3784
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
3959 app_service_->GetPinPosition(extension_misc::kChromeAppId))); 4010 app_service_->GetPinPosition(extension_misc::kChromeAppId)));
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_1.Equals(app_service_->GetPinPosition(extension1_->id()))); 4014 position_1.Equals(app_service_->GetPinPosition(extension1_->id())));
3964 EXPECT_TRUE( 4015 EXPECT_TRUE(
3965 position_2.Equals(app_service_->GetPinPosition(extension2_->id()))); 4016 position_2.Equals(app_service_->GetPinPosition(extension2_->id())));
3966 EXPECT_TRUE( 4017 EXPECT_TRUE(
3967 position_3.Equals(app_service_->GetPinPosition(extension3_->id()))); 4018 position_3.Equals(app_service_->GetPinPosition(extension3_->id())));
3968 } 4019 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/ash/launcher/arc_app_window_launcher_controller.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698