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

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

Issue 2766543002: Move even more from WmShell to Shell (Closed)
Patch Set: Created 3 years, 9 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
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"
11 #include "ash/display/screen_orientation_controller_chromeos.h" 10 #include "ash/display/screen_orientation_controller_chromeos.h"
12 #include "ash/shell.h" 11 #include "ash/shell.h"
13 #include "ash/test/ash_test_base.h" 12 #include "ash/test/ash_test_base.h"
14 #include "base/command_line.h" 13 #include "base/command_line.h"
15 #include "base/macros.h" 14 #include "base/macros.h"
16 #include "base/strings/string_number_conversions.h" 15 #include "base/strings/string_number_conversions.h"
17 #include "base/strings/stringprintf.h" 16 #include "base/strings/stringprintf.h"
18 #include "chrome/browser/extensions/display_info_provider_chromeos.h" 17 #include "chrome/browser/extensions/display_info_provider_chromeos.h"
19 #include "extensions/common/api/system_display.h" 18 #include "extensions/common/api/system_display.h"
20 #include "ui/display/display.h" 19 #include "ui/display/display.h"
(...skipping 893 matching lines...) Expand 10 before | Expand all | Expand 10 after
914 std::string error; 913 std::string error;
915 CallSetDisplayUnitInfo( 914 CallSetDisplayUnitInfo(
916 base::Int64ToString(display::Display::InternalDisplayId()), info, 915 base::Int64ToString(display::Display::InternalDisplayId()), info,
917 &success, &error); 916 &success, &error);
918 917
919 ASSERT_TRUE(success); 918 ASSERT_TRUE(success);
920 EXPECT_TRUE(error.empty()); 919 EXPECT_TRUE(error.empty());
921 EXPECT_FALSE(screen_orientation_controller->rotation_locked()); 920 EXPECT_FALSE(screen_orientation_controller->rotation_locked());
922 921
923 // Entering maximize mode enables accelerometer screen rotations. 922 // Entering maximize mode enables accelerometer screen rotations.
924 ash::WmShell::Get() 923 ash::Shell::Get()
925 ->maximize_mode_controller() 924 ->maximize_mode_controller()
926 ->EnableMaximizeModeWindowManager(true); 925 ->EnableMaximizeModeWindowManager(true);
927 // Rotation lock should not activate because DisplayInfoProvider::SetInfo() 926 // Rotation lock should not activate because DisplayInfoProvider::SetInfo()
928 // was called when not in maximize mode. 927 // was called when not in maximize mode.
929 EXPECT_FALSE(screen_orientation_controller->rotation_locked()); 928 EXPECT_FALSE(screen_orientation_controller->rotation_locked());
930 929
931 // ScreenOrientationController rotations override display info. 930 // ScreenOrientationController rotations override display info.
932 screen_orientation_controller->SetDisplayRotation( 931 screen_orientation_controller->SetDisplayRotation(
933 display::Display::ROTATE_0, display::Display::ROTATION_SOURCE_ACTIVE); 932 display::Display::ROTATE_0, display::Display::ROTATION_SOURCE_ACTIVE);
934 EXPECT_EQ(display::Display::ROTATE_0, GetCurrentInternalDisplayRotation()); 933 EXPECT_EQ(display::Display::ROTATE_0, GetCurrentInternalDisplayRotation());
935 934
936 // Exiting maximize mode should restore the initial rotation 935 // Exiting maximize mode should restore the initial rotation
937 ash::WmShell::Get() 936 ash::Shell::Get()
938 ->maximize_mode_controller() 937 ->maximize_mode_controller()
939 ->EnableMaximizeModeWindowManager(false); 938 ->EnableMaximizeModeWindowManager(false);
940 EXPECT_EQ(display::Display::ROTATE_90, GetCurrentInternalDisplayRotation()); 939 EXPECT_EQ(display::Display::ROTATE_90, GetCurrentInternalDisplayRotation());
941 } 940 }
942 941
943 // Tests that rotation changes made during maximize mode lock the display 942 // Tests that rotation changes made during maximize mode lock the display
944 // against accelerometer rotations. 943 // against accelerometer rotations.
945 TEST_F(DisplayInfoProviderChromeosTest, SetRotationDuringMaximizeMode) { 944 TEST_F(DisplayInfoProviderChromeosTest, SetRotationDuringMaximizeMode) {
946 // Entering maximize mode enables accelerometer screen rotations. 945 // Entering maximize mode enables accelerometer screen rotations.
947 ash::WmShell::Get() 946 ash::Shell::Get()
948 ->maximize_mode_controller() 947 ->maximize_mode_controller()
949 ->EnableMaximizeModeWindowManager(true); 948 ->EnableMaximizeModeWindowManager(true);
950 949
951 ASSERT_FALSE(ash::Shell::GetInstance() 950 ASSERT_FALSE(ash::Shell::GetInstance()
952 ->screen_orientation_controller() 951 ->screen_orientation_controller()
953 ->rotation_locked()); 952 ->rotation_locked());
954 953
955 api::system_display::DisplayProperties info; 954 api::system_display::DisplayProperties info;
956 info.rotation.reset(new int(90)); 955 info.rotation.reset(new int(90));
957 956
(...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after
1441 EXPECT_EQ(pairs.pair1.touch_point.y, data.point_pairs[0].second.y()); 1440 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()); 1441 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()); 1442 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()); 1443 EXPECT_EQ(pairs.pair4.touch_point.y, data.point_pairs[3].second.y());
1445 1444
1446 EXPECT_EQ(bounds.width, data.bounds.width()); 1445 EXPECT_EQ(bounds.width, data.bounds.width());
1447 EXPECT_EQ(bounds.height, data.bounds.height()); 1446 EXPECT_EQ(bounds.height, data.bounds.height());
1448 } 1447 }
1449 } // namespace 1448 } // namespace
1450 } // namespace extensions 1449 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698