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

Side by Side Diff: chrome/browser/chromeos/display/display_preferences_unittest.cc

Issue 2113053003: Moves Shell::maximize_mode_controller() to WmShell (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: order Created 4 years, 5 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/chromeos/display/display_preferences.h" 5 #include "chrome/browser/chromeos/display/display_preferences.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <string> 9 #include <string>
10 #include <utility> 10 #include <utility>
11 #include <vector> 11 #include <vector>
12 12
13 #include "ash/common/wm/maximize_mode/maximize_mode_controller.h" 13 #include "ash/common/wm/maximize_mode/maximize_mode_controller.h"
14 #include "ash/common/wm_shell.h"
14 #include "ash/display/display_layout_store.h" 15 #include "ash/display/display_layout_store.h"
15 #include "ash/display/display_manager.h" 16 #include "ash/display/display_manager.h"
16 #include "ash/display/display_util.h" 17 #include "ash/display/display_util.h"
17 #include "ash/display/json_converter.h" 18 #include "ash/display/json_converter.h"
18 #include "ash/display/resolution_notification_controller.h" 19 #include "ash/display/resolution_notification_controller.h"
19 #include "ash/display/screen_orientation_controller_chromeos.h" 20 #include "ash/display/screen_orientation_controller_chromeos.h"
20 #include "ash/display/window_tree_host_manager.h" 21 #include "ash/display/window_tree_host_manager.h"
21 #include "ash/screen_util.h" 22 #include "ash/screen_util.h"
22 #include "ash/shell.h" 23 #include "ash/shell.h"
23 #include "ash/test/ash_test_base.h" 24 #include "ash/test/ash_test_base.h"
(...skipping 758 matching lines...) Expand 10 before | Expand all | Expand 10 after
782 display_manager->SetDisplayRotation(display::Display::InternalDisplayId(), 783 display_manager->SetDisplayRotation(display::Display::InternalDisplayId(),
783 display::Display::ROTATE_0, 784 display::Display::ROTATE_0,
784 display::Display::ROTATION_SOURCE_USER); 785 display::Display::ROTATION_SOURCE_USER);
785 786
786 // Open up 270 degrees to trigger maximize mode 787 // Open up 270 degrees to trigger maximize mode
787 scoped_refptr<chromeos::AccelerometerUpdate> update( 788 scoped_refptr<chromeos::AccelerometerUpdate> update(
788 new chromeos::AccelerometerUpdate()); 789 new chromeos::AccelerometerUpdate());
789 update->Set(chromeos::ACCELEROMETER_SOURCE_ATTACHED_KEYBOARD, 0.0f, 0.0f, 790 update->Set(chromeos::ACCELEROMETER_SOURCE_ATTACHED_KEYBOARD, 0.0f, 0.0f,
790 kMeanGravity); 791 kMeanGravity);
791 update->Set(chromeos::ACCELEROMETER_SOURCE_SCREEN, 0.0f, -kMeanGravity, 0.0f); 792 update->Set(chromeos::ACCELEROMETER_SOURCE_SCREEN, 0.0f, -kMeanGravity, 0.0f);
792 ash::MaximizeModeController* controller = shell->maximize_mode_controller(); 793 ash::MaximizeModeController* controller =
794 ash::WmShell::Get()->maximize_mode_controller();
793 controller->OnAccelerometerUpdated(update); 795 controller->OnAccelerometerUpdated(update);
794 EXPECT_TRUE(controller->IsMaximizeModeWindowManagerEnabled()); 796 EXPECT_TRUE(controller->IsMaximizeModeWindowManagerEnabled());
795 797
796 // Trigger 90 degree rotation 798 // Trigger 90 degree rotation
797 update->Set(chromeos::ACCELEROMETER_SOURCE_ATTACHED_KEYBOARD, -kMeanGravity, 799 update->Set(chromeos::ACCELEROMETER_SOURCE_ATTACHED_KEYBOARD, -kMeanGravity,
798 0.0f, 0.0f); 800 0.0f, 0.0f);
799 update->Set(chromeos::ACCELEROMETER_SOURCE_SCREEN, -kMeanGravity, 0.0f, 0.0f); 801 update->Set(chromeos::ACCELEROMETER_SOURCE_SCREEN, -kMeanGravity, 0.0f, 0.0f);
800 controller->OnAccelerometerUpdated(update); 802 controller->OnAccelerometerUpdated(update);
801 shell->screen_orientation_controller()->OnAccelerometerUpdated(update); 803 shell->screen_orientation_controller()->OnAccelerometerUpdated(update);
802 EXPECT_EQ(display::Display::ROTATE_90, GetCurrentInternalDisplayRotation()); 804 EXPECT_EQ(display::Display::ROTATE_90, GetCurrentInternalDisplayRotation());
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
929 EXPECT_FALSE(rotation_lock); 931 EXPECT_FALSE(rotation_lock);
930 EXPECT_EQ(display::Display::ROTATE_0, before_maximize_mode_rotation); 932 EXPECT_EQ(display::Display::ROTATE_0, before_maximize_mode_rotation);
931 933
932 // Open up 270 degrees to trigger maximize mode 934 // Open up 270 degrees to trigger maximize mode
933 scoped_refptr<chromeos::AccelerometerUpdate> update( 935 scoped_refptr<chromeos::AccelerometerUpdate> update(
934 new chromeos::AccelerometerUpdate()); 936 new chromeos::AccelerometerUpdate());
935 update->Set(chromeos::ACCELEROMETER_SOURCE_ATTACHED_KEYBOARD, 0.0f, 0.0f, 937 update->Set(chromeos::ACCELEROMETER_SOURCE_ATTACHED_KEYBOARD, 0.0f, 0.0f,
936 kMeanGravity); 938 kMeanGravity);
937 update->Set(chromeos::ACCELEROMETER_SOURCE_SCREEN, 0.0f, -kMeanGravity, 0.0f); 939 update->Set(chromeos::ACCELEROMETER_SOURCE_SCREEN, 0.0f, -kMeanGravity, 0.0f);
938 ash::MaximizeModeController* maximize_mode_controller = 940 ash::MaximizeModeController* maximize_mode_controller =
939 shell->maximize_mode_controller(); 941 ash::WmShell::Get()->maximize_mode_controller();
940 maximize_mode_controller->OnAccelerometerUpdated(update); 942 maximize_mode_controller->OnAccelerometerUpdated(update);
941 EXPECT_TRUE(maximize_mode_controller->IsMaximizeModeWindowManagerEnabled()); 943 EXPECT_TRUE(maximize_mode_controller->IsMaximizeModeWindowManagerEnabled());
942 bool screen_orientation_rotation_lock = IsRotationLocked(); 944 bool screen_orientation_rotation_lock = IsRotationLocked();
943 display::Display::Rotation maximize_mode_rotation = 945 display::Display::Rotation maximize_mode_rotation =
944 GetCurrentInternalDisplayRotation(); 946 GetCurrentInternalDisplayRotation();
945 EXPECT_TRUE(screen_orientation_rotation_lock); 947 EXPECT_TRUE(screen_orientation_rotation_lock);
946 EXPECT_EQ(display::Display::ROTATE_90, maximize_mode_rotation); 948 EXPECT_EQ(display::Display::ROTATE_90, maximize_mode_rotation);
947 } 949 }
948 950
949 // Tests that rotation lock being set causes the rotation state to be saved. 951 // Tests that rotation lock being set causes the rotation state to be saved.
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
1114 1116
1115 EXPECT_EQ(gfx::Rect(0, 0, 200, 200), 1117 EXPECT_EQ(gfx::Rect(0, 0, 200, 200),
1116 display_manager->GetDisplayForId(list[0]).bounds()); 1118 display_manager->GetDisplayForId(list[0]).bounds());
1117 EXPECT_EQ(gfx::Rect(-200, 0, 200, 200), 1119 EXPECT_EQ(gfx::Rect(-200, 0, 200, 200),
1118 display_manager->GetDisplayForId(list[1]).bounds()); 1120 display_manager->GetDisplayForId(list[1]).bounds());
1119 EXPECT_EQ(gfx::Rect(-100, 200, 300, 300), 1121 EXPECT_EQ(gfx::Rect(-100, 200, 300, 300),
1120 display_manager->GetDisplayForId(list[2]).bounds()); 1122 display_manager->GetDisplayForId(list[2]).bounds());
1121 } 1123 }
1122 1124
1123 } // namespace chromeos 1125 } // namespace chromeos
OLDNEW
« no previous file with comments | « ash/wm/power_button_controller.cc ('k') | chrome/browser/extensions/display_info_provider_chromeos_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698