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 "ash/system/chromeos/rotation/tray_rotation_lock.h" | 5 #include "ash/system/chromeos/rotation/tray_rotation_lock.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 | 8 |
9 #include "ash/common/system/status_area_widget.h" | 9 #include "ash/common/system/status_area_widget.h" |
10 #include "ash/common/system/tray/system_tray.h" | 10 #include "ash/common/system/tray/system_tray.h" |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 Shell::Get()->maximize_mode_controller()->EnableMaximizeModeWindowManager( | 126 Shell::Get()->maximize_mode_controller()->EnableMaximizeModeWindowManager( |
127 false); | 127 false); |
128 } | 128 } |
129 | 129 |
130 // Tests that when the tray view is created, while MaximizeMode is active, and | 130 // Tests that when the tray view is created, while MaximizeMode is active, and |
131 // rotation is locked, that it is visible. | 131 // rotation is locked, that it is visible. |
132 TEST_F(TrayRotationLockTest, CreateTrayViewDuringMaximizeModeAndRotationLock) { | 132 TEST_F(TrayRotationLockTest, CreateTrayViewDuringMaximizeModeAndRotationLock) { |
133 TearDownViews(); | 133 TearDownViews(); |
134 Shell::Get()->maximize_mode_controller()->EnableMaximizeModeWindowManager( | 134 Shell::Get()->maximize_mode_controller()->EnableMaximizeModeWindowManager( |
135 true); | 135 true); |
136 Shell::GetInstance()->screen_orientation_controller()->SetRotationLocked( | 136 Shell::GetInstance() |
137 true); | 137 ->screen_orientation_controller() |
| 138 ->ToggleUserRotationLock(); |
138 SetUpForStatusAreaWidget(StatusAreaWidgetTestHelper::GetStatusAreaWidget()); | 139 SetUpForStatusAreaWidget(StatusAreaWidgetTestHelper::GetStatusAreaWidget()); |
139 EXPECT_TRUE(tray_view()->visible()); | 140 EXPECT_TRUE(tray_view()->visible()); |
140 Shell::Get()->maximize_mode_controller()->EnableMaximizeModeWindowManager( | 141 Shell::Get()->maximize_mode_controller()->EnableMaximizeModeWindowManager( |
141 false); | 142 false); |
142 EXPECT_FALSE(tray_view()->visible()); | 143 EXPECT_FALSE(tray_view()->visible()); |
143 } | 144 } |
144 | 145 |
145 // Tests that the enabling of MaximizeMode affects a previously created tray | 146 // Tests that the enabling of MaximizeMode affects a previously created tray |
146 // view, changing the visibility. | 147 // view, changing the visibility. |
147 TEST_F(TrayRotationLockTest, TrayViewVisibilityChangesDuringMaximizeMode) { | 148 TEST_F(TrayRotationLockTest, TrayViewVisibilityChangesDuringMaximizeMode) { |
148 ASSERT_FALSE(tray_view()->visible()); | 149 ASSERT_FALSE(tray_view()->visible()); |
149 Shell::Get()->maximize_mode_controller()->EnableMaximizeModeWindowManager( | 150 Shell::Get()->maximize_mode_controller()->EnableMaximizeModeWindowManager( |
150 true); | 151 true); |
151 Shell::GetInstance()->screen_orientation_controller()->SetRotationLocked( | 152 Shell::GetInstance() |
152 true); | 153 ->screen_orientation_controller() |
| 154 ->ToggleUserRotationLock(); |
153 EXPECT_TRUE(tray_view()->visible()); | 155 EXPECT_TRUE(tray_view()->visible()); |
154 Shell::Get()->maximize_mode_controller()->EnableMaximizeModeWindowManager( | 156 Shell::Get()->maximize_mode_controller()->EnableMaximizeModeWindowManager( |
155 false); | 157 false); |
156 EXPECT_FALSE(tray_view()->visible()); | 158 EXPECT_FALSE(tray_view()->visible()); |
157 } | 159 } |
158 | 160 |
159 // Tests that the when the tray view is created for a secondary display, that | 161 // Tests that the when the tray view is created for a secondary display, that |
160 // it is not visible, and that MaximizeMode does not affect visibility. | 162 // it is not visible, and that MaximizeMode does not affect visibility. |
161 TEST_F(TrayRotationLockTest, CreateSecondaryTrayView) { | 163 TEST_F(TrayRotationLockTest, CreateSecondaryTrayView) { |
162 UpdateDisplay("400x400,200x200"); | 164 UpdateDisplay("400x400,200x200"); |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
251 true); | 253 true); |
252 EXPECT_TRUE(default_view->visible()); | 254 EXPECT_TRUE(default_view->visible()); |
253 } | 255 } |
254 | 256 |
255 // Tests that when the tray view is deleted, while TrayRotationLock has not been | 257 // Tests that when the tray view is deleted, while TrayRotationLock has not been |
256 // deleted, that updates to the rotation lock state do not crash. | 258 // deleted, that updates to the rotation lock state do not crash. |
257 TEST_F(TrayRotationLockTest, LockUpdatedDuringDesctruction) { | 259 TEST_F(TrayRotationLockTest, LockUpdatedDuringDesctruction) { |
258 Shell::Get()->maximize_mode_controller()->EnableMaximizeModeWindowManager( | 260 Shell::Get()->maximize_mode_controller()->EnableMaximizeModeWindowManager( |
259 true); | 261 true); |
260 DestroyTrayView(); | 262 DestroyTrayView(); |
261 Shell::GetInstance()->screen_orientation_controller()->SetRotationLocked( | 263 Shell::GetInstance() |
262 true); | 264 ->screen_orientation_controller() |
| 265 ->ToggleUserRotationLock(); |
263 Shell::Get()->maximize_mode_controller()->EnableMaximizeModeWindowManager( | 266 Shell::Get()->maximize_mode_controller()->EnableMaximizeModeWindowManager( |
264 false); | 267 false); |
265 } | 268 } |
266 | 269 |
267 } // namespace ash | 270 } // namespace ash |
OLD | NEW |