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

Side by Side Diff: ash/system/chromeos/rotation/tray_rotation_lock_unittest.cc

Issue 759063002: Move Screen Rotation from MaximizeModeController to ScreenOrientationController (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix Linux Compile Created 5 years, 11 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 | « ash/system/chromeos/rotation/tray_rotation_lock.cc ('k') | ash/system/chromeos/tray_display.cc » ('j') | 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 "ash/system/chromeos/rotation/tray_rotation_lock.h" 5 #include "ash/system/chromeos/rotation/tray_rotation_lock.h"
6 6
7 #include "ash/ash_switches.h" 7 #include "ash/ash_switches.h"
8 #include "ash/content/display/screen_orientation_controller_chromeos.h"
8 #include "ash/display/display_manager.h" 9 #include "ash/display/display_manager.h"
9 #include "ash/root_window_controller.h" 10 #include "ash/root_window_controller.h"
10 #include "ash/shelf/shelf_widget.h" 11 #include "ash/shelf/shelf_widget.h"
11 #include "ash/shell.h" 12 #include "ash/shell.h"
12 #include "ash/system/status_area_widget.h" 13 #include "ash/system/status_area_widget.h"
13 #include "ash/system/tray/system_tray.h" 14 #include "ash/system/tray/system_tray.h"
14 #include "ash/system/tray/system_tray_delegate.h" 15 #include "ash/system/tray/system_tray_delegate.h"
15 #include "ash/test/ash_test_base.h" 16 #include "ash/test/ash_test_base.h"
16 #include "ash/test/status_area_widget_test_helper.h" 17 #include "ash/test/status_area_widget_test_helper.h"
17 #include "ash/wm/maximize_mode/maximize_mode_controller.h" 18 #include "ash/wm/maximize_mode/maximize_mode_controller.h"
(...skipping 28 matching lines...) Expand all
46 // created. On a secondary display both the tray view and default view will 47 // created. On a secondary display both the tray view and default view will
47 // be null. 48 // be null.
48 void SetUpForStatusAreaWidget(StatusAreaWidget* status_area_widget); 49 void SetUpForStatusAreaWidget(StatusAreaWidget* status_area_widget);
49 50
50 // Resets |tray_| |tray_view_| and |default_view_| so that all components of 51 // Resets |tray_| |tray_view_| and |default_view_| so that all components of
51 // TrayRotationLock have been cleared. Tests may then call 52 // TrayRotationLock have been cleared. Tests may then call
52 // SetUpForStatusAreaWidget in order to initial the components. 53 // SetUpForStatusAreaWidget in order to initial the components.
53 void TearDownViews(); 54 void TearDownViews();
54 55
55 // test::AshTestBase: 56 // test::AshTestBase:
56 virtual void SetUp() override; 57 void SetUp() override;
57 virtual void TearDown() override; 58 void TearDown() override;
58 59
59 private: 60 private:
60 scoped_ptr<TrayRotationLock> tray_; 61 scoped_ptr<TrayRotationLock> tray_;
61 scoped_ptr<views::View> tray_view_; 62 scoped_ptr<views::View> tray_view_;
62 scoped_ptr<views::View> default_view_; 63 scoped_ptr<views::View> default_view_;
63 64
64 DISALLOW_COPY_AND_ASSIGN(TrayRotationLockTest); 65 DISALLOW_COPY_AND_ASSIGN(TrayRotationLockTest);
65 }; 66 };
66 67
67 void TrayRotationLockTest::SetUpForStatusAreaWidget( 68 void TrayRotationLockTest::SetUpForStatusAreaWidget(
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 Shell::GetInstance()->maximize_mode_controller()-> 112 Shell::GetInstance()->maximize_mode_controller()->
112 EnableMaximizeModeWindowManager(false); 113 EnableMaximizeModeWindowManager(false);
113 } 114 }
114 115
115 // Tests that when the tray view is created, while MaximizeMode is active, and 116 // Tests that when the tray view is created, while MaximizeMode is active, and
116 // rotation is locked, that it is visible. 117 // rotation is locked, that it is visible.
117 TEST_F(TrayRotationLockTest, CreateTrayViewDuringMaximizeModeAndRotationLock) { 118 TEST_F(TrayRotationLockTest, CreateTrayViewDuringMaximizeModeAndRotationLock) {
118 TearDownViews(); 119 TearDownViews();
119 Shell::GetInstance()->maximize_mode_controller()-> 120 Shell::GetInstance()->maximize_mode_controller()->
120 EnableMaximizeModeWindowManager(true); 121 EnableMaximizeModeWindowManager(true);
121 Shell::GetInstance()-> maximize_mode_controller()->SetRotationLocked(true); 122 Shell::GetInstance()->screen_orientation_controller()->SetRotationLocked(
123 true);
122 SetUpForStatusAreaWidget(StatusAreaWidgetTestHelper::GetStatusAreaWidget()); 124 SetUpForStatusAreaWidget(StatusAreaWidgetTestHelper::GetStatusAreaWidget());
123 EXPECT_TRUE(tray_view()->visible()); 125 EXPECT_TRUE(tray_view()->visible());
124 Shell::GetInstance()->maximize_mode_controller()-> 126 Shell::GetInstance()->maximize_mode_controller()->
125 EnableMaximizeModeWindowManager(false); 127 EnableMaximizeModeWindowManager(false);
126 EXPECT_FALSE(tray_view()->visible()); 128 EXPECT_FALSE(tray_view()->visible());
127 } 129 }
128 130
129 // Tests that the enabling of MaximizeMode affects a previously created tray 131 // Tests that the enabling of MaximizeMode affects a previously created tray
130 // view, changing the visibility. 132 // view, changing the visibility.
131 TEST_F(TrayRotationLockTest, TrayViewVisibilityChangesDuringMaximizeMode) { 133 TEST_F(TrayRotationLockTest, TrayViewVisibilityChangesDuringMaximizeMode) {
132 ASSERT_FALSE(tray_view()->visible()); 134 ASSERT_FALSE(tray_view()->visible());
133 Shell::GetInstance()->maximize_mode_controller()-> 135 Shell::GetInstance()->maximize_mode_controller()->
134 EnableMaximizeModeWindowManager(true); 136 EnableMaximizeModeWindowManager(true);
135 Shell::GetInstance()->maximize_mode_controller()->SetRotationLocked(true); 137 Shell::GetInstance()->screen_orientation_controller()->SetRotationLocked(
138 true);
136 EXPECT_TRUE(tray_view()->visible()); 139 EXPECT_TRUE(tray_view()->visible());
137 Shell::GetInstance()->maximize_mode_controller()-> 140 Shell::GetInstance()->maximize_mode_controller()->
138 EnableMaximizeModeWindowManager(false); 141 EnableMaximizeModeWindowManager(false);
139 EXPECT_FALSE(tray_view()->visible()); 142 EXPECT_FALSE(tray_view()->visible());
140 } 143 }
141 144
142 // Tests that the when the tray view is created for a secondary display, that 145 // Tests that the when the tray view is created for a secondary display, that
143 // it is not visible, and that MaximizeMode does not affect visibility. 146 // it is not visible, and that MaximizeMode does not affect visibility.
144 TEST_F(TrayRotationLockTest, CreateSecondaryTrayView) { 147 TEST_F(TrayRotationLockTest, CreateSecondaryTrayView) {
145 if (!SupportsMultipleDisplays()) 148 if (!SupportsMultipleDisplays())
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 SetUpForStatusAreaWidget( 200 SetUpForStatusAreaWidget(
198 StatusAreaWidgetTestHelper::GetSecondaryStatusAreaWidget()); 201 StatusAreaWidgetTestHelper::GetSecondaryStatusAreaWidget());
199 EXPECT_EQ(NULL, default_view()); 202 EXPECT_EQ(NULL, default_view());
200 } 203 }
201 204
202 // Tests that activating the default view causes the display to have its 205 // Tests that activating the default view causes the display to have its
203 // rotation locked, and that the tray view becomes visible. 206 // rotation locked, and that the tray view becomes visible.
204 TEST_F(TrayRotationLockTest, PerformActionOnDefaultView) { 207 TEST_F(TrayRotationLockTest, PerformActionOnDefaultView) {
205 MaximizeModeController* maximize_mode_controller = Shell::GetInstance()-> 208 MaximizeModeController* maximize_mode_controller = Shell::GetInstance()->
206 maximize_mode_controller(); 209 maximize_mode_controller();
207 ASSERT_FALSE(maximize_mode_controller->rotation_locked()); 210 ScreenOrientationController* screen_orientation_controller =
208 Shell::GetInstance()->maximize_mode_controller()-> 211 Shell::GetInstance()->screen_orientation_controller();
209 EnableMaximizeModeWindowManager(true); 212 ASSERT_FALSE(screen_orientation_controller->rotation_locked());
213 maximize_mode_controller->EnableMaximizeModeWindowManager(true);
210 ASSERT_FALSE(tray_view()->visible()); 214 ASSERT_FALSE(tray_view()->visible());
211 215
212 ui::GestureEvent tap( 216 ui::GestureEvent tap(
213 0, 0, 0, base::TimeDelta(), ui::GestureEventDetails(ui::ET_GESTURE_TAP)); 217 0, 0, 0, base::TimeDelta(), ui::GestureEventDetails(ui::ET_GESTURE_TAP));
214 default_view()->OnGestureEvent(&tap); 218 default_view()->OnGestureEvent(&tap);
215 EXPECT_TRUE(maximize_mode_controller->rotation_locked()); 219 EXPECT_TRUE(screen_orientation_controller->rotation_locked());
216 EXPECT_TRUE(tray_view()->visible()); 220 EXPECT_TRUE(tray_view()->visible());
217 221
218 Shell::GetInstance()->maximize_mode_controller()-> 222 maximize_mode_controller->EnableMaximizeModeWindowManager(false);
219 EnableMaximizeModeWindowManager(false);
220 } 223 }
221 224
222 } // namespace ash 225 } // namespace ash
OLDNEW
« no previous file with comments | « ash/system/chromeos/rotation/tray_rotation_lock.cc ('k') | ash/system/chromeos/tray_display.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698