| OLD | NEW |
| 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" |
| 11 #include "ash/display/screen_orientation_controller_chromeos.h" | 11 #include "ash/display/screen_orientation_controller_chromeos.h" |
| 12 #include "ash/shell.h" | 12 #include "ash/shell.h" |
| 13 #include "ash/test/ash_test_base.h" | 13 #include "ash/test/ash_test_base.h" |
| 14 #include "ash/test/screen_orientation_controller_test_api.h" |
| 14 #include "base/command_line.h" | 15 #include "base/command_line.h" |
| 15 #include "base/macros.h" | 16 #include "base/macros.h" |
| 16 #include "base/strings/string_number_conversions.h" | 17 #include "base/strings/string_number_conversions.h" |
| 17 #include "base/strings/stringprintf.h" | 18 #include "base/strings/stringprintf.h" |
| 18 #include "chrome/browser/extensions/display_info_provider_chromeos.h" | 19 #include "chrome/browser/extensions/display_info_provider_chromeos.h" |
| 19 #include "extensions/common/api/system_display.h" | 20 #include "extensions/common/api/system_display.h" |
| 20 #include "ui/display/display.h" | 21 #include "ui/display/display.h" |
| 21 #include "ui/display/display_layout.h" | 22 #include "ui/display/display_layout.h" |
| 22 #include "ui/display/display_switches.h" | 23 #include "ui/display/display_switches.h" |
| 23 #include "ui/display/manager/display_manager.h" | 24 #include "ui/display/manager/display_manager.h" |
| (...skipping 898 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 922 | 923 |
| 923 // Entering maximize mode enables accelerometer screen rotations. | 924 // Entering maximize mode enables accelerometer screen rotations. |
| 924 ash::WmShell::Get() | 925 ash::WmShell::Get() |
| 925 ->maximize_mode_controller() | 926 ->maximize_mode_controller() |
| 926 ->EnableMaximizeModeWindowManager(true); | 927 ->EnableMaximizeModeWindowManager(true); |
| 927 // Rotation lock should not activate because DisplayInfoProvider::SetInfo() | 928 // Rotation lock should not activate because DisplayInfoProvider::SetInfo() |
| 928 // was called when not in maximize mode. | 929 // was called when not in maximize mode. |
| 929 EXPECT_FALSE(screen_orientation_controller->rotation_locked()); | 930 EXPECT_FALSE(screen_orientation_controller->rotation_locked()); |
| 930 | 931 |
| 931 // ScreenOrientationController rotations override display info. | 932 // ScreenOrientationController rotations override display info. |
| 932 screen_orientation_controller->SetDisplayRotation( | 933 ash::test::ScreenOrientationControllerTestApi test_api( |
| 933 display::Display::ROTATE_0, display::Display::ROTATION_SOURCE_ACTIVE); | 934 screen_orientation_controller); |
| 935 test_api.SetDisplayRotation(display::Display::ROTATE_0, |
| 936 display::Display::ROTATION_SOURCE_ACTIVE); |
| 934 EXPECT_EQ(display::Display::ROTATE_0, GetCurrentInternalDisplayRotation()); | 937 EXPECT_EQ(display::Display::ROTATE_0, GetCurrentInternalDisplayRotation()); |
| 935 | 938 |
| 936 // Exiting maximize mode should restore the initial rotation | 939 // Exiting maximize mode should restore the initial rotation |
| 937 ash::WmShell::Get() | 940 ash::WmShell::Get() |
| 938 ->maximize_mode_controller() | 941 ->maximize_mode_controller() |
| 939 ->EnableMaximizeModeWindowManager(false); | 942 ->EnableMaximizeModeWindowManager(false); |
| 940 EXPECT_EQ(display::Display::ROTATE_90, GetCurrentInternalDisplayRotation()); | 943 EXPECT_EQ(display::Display::ROTATE_90, GetCurrentInternalDisplayRotation()); |
| 941 } | 944 } |
| 942 | 945 |
| 943 // Tests that rotation changes made during maximize mode lock the display | 946 // Tests that rotation changes made during maximize mode lock the display |
| (...skipping 497 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1441 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()); |
| 1442 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()); |
| 1443 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()); |
| 1444 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()); |
| 1445 | 1448 |
| 1446 EXPECT_EQ(bounds.width, data.bounds.width()); | 1449 EXPECT_EQ(bounds.width, data.bounds.width()); |
| 1447 EXPECT_EQ(bounds.height, data.bounds.height()); | 1450 EXPECT_EQ(bounds.height, data.bounds.height()); |
| 1448 } | 1451 } |
| 1449 } // namespace | 1452 } // namespace |
| 1450 } // namespace extensions | 1453 } // namespace extensions |
| OLD | NEW |