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

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

Issue 2523723002: Update display::Display::kInvalidDisplayID constant. (Closed)
Patch Set: Fix includes. Created 4 years, 1 month 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/root_window_settings.cc ('k') | ash/system/chromeos/screen_layout_observer.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 <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"
11 #include "ash/common/system/tray/system_tray_delegate.h" 11 #include "ash/common/system/tray/system_tray_delegate.h"
12 #include "ash/common/wm/maximize_mode/maximize_mode_controller.h" 12 #include "ash/common/wm/maximize_mode/maximize_mode_controller.h"
13 #include "ash/common/wm_shell.h" 13 #include "ash/common/wm_shell.h"
14 #include "ash/display/screen_orientation_controller_chromeos.h" 14 #include "ash/display/screen_orientation_controller_chromeos.h"
15 #include "ash/root_window_controller.h" 15 #include "ash/root_window_controller.h"
16 #include "ash/shell.h" 16 #include "ash/shell.h"
17 #include "ash/test/ash_test_base.h" 17 #include "ash/test/ash_test_base.h"
18 #include "ash/test/status_area_widget_test_helper.h" 18 #include "ash/test/status_area_widget_test_helper.h"
19 #include "base/command_line.h" 19 #include "base/command_line.h"
20 #include "base/time/time.h" 20 #include "base/time/time.h"
21 #include "ui/display/display_switches.h" 21 #include "ui/display/display_switches.h"
22 #include "ui/display/manager/display_manager.h" 22 #include "ui/display/manager/display_manager.h"
23 #include "ui/display/types/display_constants.h"
23 #include "ui/events/event.h" 24 #include "ui/events/event.h"
24 #include "ui/events/event_constants.h" 25 #include "ui/events/event_constants.h"
25 #include "ui/views/view.h" 26 #include "ui/views/view.h"
26 27
27 namespace ash { 28 namespace ash {
28 29
29 class TrayRotationLockTest : public test::AshTestBase { 30 class TrayRotationLockTest : public test::AshTestBase {
30 public: 31 public:
31 TrayRotationLockTest() {} 32 TrayRotationLockTest() {}
32 ~TrayRotationLockTest() override {} 33 ~TrayRotationLockTest() override {}
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 EXPECT_TRUE(tray_view()->visible()); 234 EXPECT_TRUE(tray_view()->visible());
234 235
235 maximize_mode_controller->EnableMaximizeModeWindowManager(false); 236 maximize_mode_controller->EnableMaximizeModeWindowManager(false);
236 } 237 }
237 238
238 // Tests that when the tray is created without the internal display being known, 239 // Tests that when the tray is created without the internal display being known,
239 // that it will still display correctly once the internal display is known. 240 // that it will still display correctly once the internal display is known.
240 TEST_F(TrayRotationLockTest, InternalDisplayNotAvailableAtCreation) { 241 TEST_F(TrayRotationLockTest, InternalDisplayNotAvailableAtCreation) {
241 int64_t internal_display_id = display::Display::InternalDisplayId(); 242 int64_t internal_display_id = display::Display::InternalDisplayId();
242 TearDownViews(); 243 TearDownViews();
243 display::Display::SetInternalDisplayId(display::Display::kInvalidDisplayID); 244 display::Display::SetInternalDisplayId(display::kInvalidDisplayId);
244 245
245 std::unique_ptr<TrayRotationLock> tray(new TrayRotationLock( 246 std::unique_ptr<TrayRotationLock> tray(new TrayRotationLock(
246 StatusAreaWidgetTestHelper::GetStatusAreaWidget()->system_tray())); 247 StatusAreaWidgetTestHelper::GetStatusAreaWidget()->system_tray()));
247 248
248 display::Display::SetInternalDisplayId(internal_display_id); 249 display::Display::SetInternalDisplayId(internal_display_id);
249 std::unique_ptr<views::View> tray_view(CreateTrayView(tray.get())); 250 std::unique_ptr<views::View> tray_view(CreateTrayView(tray.get()));
250 std::unique_ptr<views::View> default_view(tray->CreateDefaultView( 251 std::unique_ptr<views::View> default_view(tray->CreateDefaultView(
251 StatusAreaWidgetTestHelper::GetUserLoginStatus())); 252 StatusAreaWidgetTestHelper::GetUserLoginStatus()));
252 EXPECT_TRUE(default_view); 253 EXPECT_TRUE(default_view);
253 WmShell::Get()->maximize_mode_controller()->EnableMaximizeModeWindowManager( 254 WmShell::Get()->maximize_mode_controller()->EnableMaximizeModeWindowManager(
254 true); 255 true);
255 EXPECT_TRUE(default_view->visible()); 256 EXPECT_TRUE(default_view->visible());
256 } 257 }
257 258
258 // Tests that when the tray view is deleted, while TrayRotationLock has not been 259 // Tests that when the tray view is deleted, while TrayRotationLock has not been
259 // deleted, that updates to the rotation lock state do not crash. 260 // deleted, that updates to the rotation lock state do not crash.
260 TEST_F(TrayRotationLockTest, LockUpdatedDuringDesctruction) { 261 TEST_F(TrayRotationLockTest, LockUpdatedDuringDesctruction) {
261 WmShell::Get()->maximize_mode_controller()->EnableMaximizeModeWindowManager( 262 WmShell::Get()->maximize_mode_controller()->EnableMaximizeModeWindowManager(
262 true); 263 true);
263 DestroyTrayView(); 264 DestroyTrayView();
264 Shell::GetInstance()->screen_orientation_controller()->SetRotationLocked( 265 Shell::GetInstance()->screen_orientation_controller()->SetRotationLocked(
265 true); 266 true);
266 WmShell::Get()->maximize_mode_controller()->EnableMaximizeModeWindowManager( 267 WmShell::Get()->maximize_mode_controller()->EnableMaximizeModeWindowManager(
267 false); 268 false);
268 } 269 }
269 270
270 } // namespace ash 271 } // namespace ash
OLDNEW
« no previous file with comments | « ash/root_window_settings.cc ('k') | ash/system/chromeos/screen_layout_observer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698