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

Side by Side Diff: chrome/browser/extensions/display_info_provider_chromeos_unittest.cc

Issue 2795103003: Revert of [Merge to M58] cros: Treat set rotation for chrome.system.display API in touchview mode as if user … (Closed)
Patch Set: Created 3 years, 8 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/extensions/display_info_provider_chromeos.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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "extensions/browser/api/system_display/display_info_provider.h" 5 #include "extensions/browser/api/system_display/display_info_provider.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include "ash/common/wm/maximize_mode/maximize_mode_controller.h" 9 #include "ash/common/wm/maximize_mode/maximize_mode_controller.h"
10 #include "ash/common/wm_shell.h" 10 #include "ash/common/wm_shell.h"
(...skipping 14 matching lines...) Expand all
25 #include "ui/display/test/display_manager_test_api.h" 25 #include "ui/display/test/display_manager_test_api.h"
26 #include "ui/display/types/display_constants.h" 26 #include "ui/display/types/display_constants.h"
27 #include "ui/gfx/geometry/rect.h" 27 #include "ui/gfx/geometry/rect.h"
28 28
29 namespace extensions { 29 namespace extensions {
30 namespace { 30 namespace {
31 31
32 using DisplayUnitInfoList = DisplayInfoProvider::DisplayUnitInfoList; 32 using DisplayUnitInfoList = DisplayInfoProvider::DisplayUnitInfoList;
33 using DisplayLayoutList = DisplayInfoProvider::DisplayLayoutList; 33 using DisplayLayoutList = DisplayInfoProvider::DisplayLayoutList;
34 34
35 void EnableMaximizeMode(bool enable) {
36 ash::Shell::GetInstance()
37 ->maximize_mode_controller()
38 ->EnableMaximizeModeWindowManager(enable);
39 }
40
41 class DisplayInfoProviderChromeosTest : public ash::test::AshTestBase { 35 class DisplayInfoProviderChromeosTest : public ash::test::AshTestBase {
42 public: 36 public:
43 DisplayInfoProviderChromeosTest() {} 37 DisplayInfoProviderChromeosTest() {}
44 38
45 ~DisplayInfoProviderChromeosTest() override {} 39 ~DisplayInfoProviderChromeosTest() override {}
46 40
47 void SetUp() override { 41 void SetUp() override {
48 base::CommandLine::ForCurrentProcess()->AppendSwitch( 42 base::CommandLine::ForCurrentProcess()->AppendSwitch(
49 switches::kUseFirstDisplayAsInternal); 43 switches::kUseFirstDisplayAsInternal);
50 ash::test::AshTestBase::SetUp(); 44 ash::test::AshTestBase::SetUp();
(...skipping 870 matching lines...) Expand 10 before | Expand all | Expand 10 after
921 std::string error; 915 std::string error;
922 CallSetDisplayUnitInfo( 916 CallSetDisplayUnitInfo(
923 base::Int64ToString(display::Display::InternalDisplayId()), info, 917 base::Int64ToString(display::Display::InternalDisplayId()), info,
924 &success, &error); 918 &success, &error);
925 919
926 ASSERT_TRUE(success); 920 ASSERT_TRUE(success);
927 EXPECT_TRUE(error.empty()); 921 EXPECT_TRUE(error.empty());
928 EXPECT_FALSE(screen_orientation_controller->rotation_locked()); 922 EXPECT_FALSE(screen_orientation_controller->rotation_locked());
929 923
930 // Entering maximize mode enables accelerometer screen rotations. 924 // Entering maximize mode enables accelerometer screen rotations.
931 EnableMaximizeMode(true); 925 ash::WmShell::Get()
926 ->maximize_mode_controller()
927 ->EnableMaximizeModeWindowManager(true);
932 // Rotation lock should not activate because DisplayInfoProvider::SetInfo() 928 // Rotation lock should not activate because DisplayInfoProvider::SetInfo()
933 // was called when not in maximize mode. 929 // was called when not in maximize mode.
934 EXPECT_FALSE(screen_orientation_controller->rotation_locked()); 930 EXPECT_FALSE(screen_orientation_controller->rotation_locked());
935 931
936 // ScreenOrientationController rotations override display info. 932 // ScreenOrientationController rotations override display info.
937 ash::test::ScreenOrientationControllerTestApi test_api( 933 ash::test::ScreenOrientationControllerTestApi test_api(
938 screen_orientation_controller); 934 screen_orientation_controller);
939 test_api.SetDisplayRotation(display::Display::ROTATE_0, 935 test_api.SetDisplayRotation(display::Display::ROTATE_0,
940 display::Display::ROTATION_SOURCE_ACTIVE); 936 display::Display::ROTATION_SOURCE_ACTIVE);
941 EXPECT_EQ(display::Display::ROTATE_0, GetCurrentInternalDisplayRotation()); 937 EXPECT_EQ(display::Display::ROTATE_0, GetCurrentInternalDisplayRotation());
942 938
943 // Exiting maximize mode should restore the initial rotation 939 // Exiting maximize mode should restore the initial rotation
944 EnableMaximizeMode(false); 940 ash::WmShell::Get()
941 ->maximize_mode_controller()
942 ->EnableMaximizeModeWindowManager(false);
945 EXPECT_EQ(display::Display::ROTATE_90, GetCurrentInternalDisplayRotation()); 943 EXPECT_EQ(display::Display::ROTATE_90, GetCurrentInternalDisplayRotation());
946 } 944 }
947 945
948 // Tests that rotation changes made during maximize mode lock the display 946 // Tests that rotation changes made during maximize mode lock the display
949 // against accelerometer rotations, and is set as user rotation locked. 947 // against accelerometer rotations.
950 TEST_F(DisplayInfoProviderChromeosTest, SetRotationDuringMaximizeMode) { 948 TEST_F(DisplayInfoProviderChromeosTest, SetRotationDuringMaximizeMode) {
951 // Entering maximize mode enables accelerometer screen rotations. 949 // Entering maximize mode enables accelerometer screen rotations.
952 EnableMaximizeMode(true); 950 ash::WmShell::Get()
951 ->maximize_mode_controller()
952 ->EnableMaximizeModeWindowManager(true);
953 953
954 ASSERT_FALSE(ash::Shell::GetInstance() 954 ASSERT_FALSE(ash::Shell::GetInstance()
955 ->screen_orientation_controller() 955 ->screen_orientation_controller()
956 ->rotation_locked()); 956 ->rotation_locked());
957 ASSERT_FALSE(ash::Shell::GetInstance()
958 ->screen_orientation_controller()
959 ->user_rotation_locked());
960 957
961 api::system_display::DisplayProperties info; 958 api::system_display::DisplayProperties info;
962 info.rotation.reset(new int(90)); 959 info.rotation.reset(new int(90));
963 960
964 bool success = false; 961 bool success = false;
965 std::string error; 962 std::string error;
966 CallSetDisplayUnitInfo( 963 CallSetDisplayUnitInfo(
967 base::Int64ToString(display::Display::InternalDisplayId()), info, 964 base::Int64ToString(display::Display::InternalDisplayId()), info,
968 &success, &error); 965 &success, &error);
969 966
970 ASSERT_TRUE(success); 967 ASSERT_TRUE(success);
971 EXPECT_TRUE(error.empty()); 968 EXPECT_TRUE(error.empty());
972 EXPECT_TRUE(ash::Shell::GetInstance() 969 EXPECT_TRUE(ash::Shell::GetInstance()
973 ->screen_orientation_controller() 970 ->screen_orientation_controller()
974 ->rotation_locked()); 971 ->rotation_locked());
975 EXPECT_TRUE(ash::Shell::GetInstance()
976 ->screen_orientation_controller()
977 ->user_rotation_locked());
978 } 972 }
979 973
980 TEST_F(DisplayInfoProviderChromeosTest, SetInvalidRotation) { 974 TEST_F(DisplayInfoProviderChromeosTest, SetInvalidRotation) {
981 UpdateDisplay("1200x600,600x1000*2"); 975 UpdateDisplay("1200x600,600x1000*2");
982 976
983 const display::Display& secondary = display_manager()->GetSecondaryDisplay(); 977 const display::Display& secondary = display_manager()->GetSecondaryDisplay();
984 api::system_display::DisplayProperties info; 978 api::system_display::DisplayProperties info;
985 info.rotation.reset(new int(91)); 979 info.rotation.reset(new int(91));
986 980
987 bool success = false; 981 bool success = false;
(...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after
1450 EXPECT_EQ(pairs.pair1.touch_point.y, data.point_pairs[0].second.y()); 1444 EXPECT_EQ(pairs.pair1.touch_point.y, data.point_pairs[0].second.y());
1451 EXPECT_EQ(pairs.pair2.touch_point.y, data.point_pairs[1].second.y()); 1445 EXPECT_EQ(pairs.pair2.touch_point.y, data.point_pairs[1].second.y());
1452 EXPECT_EQ(pairs.pair3.touch_point.y, data.point_pairs[2].second.y()); 1446 EXPECT_EQ(pairs.pair3.touch_point.y, data.point_pairs[2].second.y());
1453 EXPECT_EQ(pairs.pair4.touch_point.y, data.point_pairs[3].second.y()); 1447 EXPECT_EQ(pairs.pair4.touch_point.y, data.point_pairs[3].second.y());
1454 1448
1455 EXPECT_EQ(bounds.width, data.bounds.width()); 1449 EXPECT_EQ(bounds.width, data.bounds.width());
1456 EXPECT_EQ(bounds.height, data.bounds.height()); 1450 EXPECT_EQ(bounds.height, data.bounds.height());
1457 } 1451 }
1458 } // namespace 1452 } // namespace
1459 } // namespace extensions 1453 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/display_info_provider_chromeos.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698