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

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

Issue 1867223004: Convert //ash from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address comments Created 4 years, 8 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 "ash/system/chromeos/rotation/tray_rotation_lock.h" 5 #include "ash/system/chromeos/rotation/tray_rotation_lock.h"
6 6
7 #include <memory>
8
7 #include "ash/ash_switches.h" 9 #include "ash/ash_switches.h"
8 #include "ash/display/display_manager.h" 10 #include "ash/display/display_manager.h"
9 #include "ash/display/screen_orientation_controller_chromeos.h" 11 #include "ash/display/screen_orientation_controller_chromeos.h"
10 #include "ash/root_window_controller.h" 12 #include "ash/root_window_controller.h"
11 #include "ash/shelf/shelf_widget.h" 13 #include "ash/shelf/shelf_widget.h"
12 #include "ash/shell.h" 14 #include "ash/shell.h"
13 #include "ash/system/status_area_widget.h" 15 #include "ash/system/status_area_widget.h"
14 #include "ash/system/tray/system_tray.h" 16 #include "ash/system/tray/system_tray.h"
15 #include "ash/system/tray/system_tray_delegate.h" 17 #include "ash/system/tray/system_tray_delegate.h"
16 #include "ash/test/ash_test_base.h" 18 #include "ash/test/ash_test_base.h"
17 #include "ash/test/status_area_widget_test_helper.h" 19 #include "ash/test/status_area_widget_test_helper.h"
18 #include "ash/wm/maximize_mode/maximize_mode_controller.h" 20 #include "ash/wm/maximize_mode/maximize_mode_controller.h"
19 #include "base/command_line.h" 21 #include "base/command_line.h"
20 #include "base/memory/scoped_ptr.h"
21 #include "base/time/time.h" 22 #include "base/time/time.h"
22 #include "ui/events/event.h" 23 #include "ui/events/event.h"
23 #include "ui/events/event_constants.h" 24 #include "ui/events/event_constants.h"
24 #include "ui/views/view.h" 25 #include "ui/views/view.h"
25 26
26 namespace ash { 27 namespace ash {
27 28
28 class TrayRotationLockTest : public test::AshTestBase { 29 class TrayRotationLockTest : public test::AshTestBase {
29 public: 30 public:
30 TrayRotationLockTest() {} 31 TrayRotationLockTest() {}
(...skipping 27 matching lines...) Expand all
58 // Resets |tray_| |tray_view_| and |default_view_| so that all components of 59 // Resets |tray_| |tray_view_| and |default_view_| so that all components of
59 // TrayRotationLock have been cleared. Tests may then call 60 // TrayRotationLock have been cleared. Tests may then call
60 // SetUpForStatusAreaWidget in order to initial the components. 61 // SetUpForStatusAreaWidget in order to initial the components.
61 void TearDownViews(); 62 void TearDownViews();
62 63
63 // test::AshTestBase: 64 // test::AshTestBase:
64 void SetUp() override; 65 void SetUp() override;
65 void TearDown() override; 66 void TearDown() override;
66 67
67 private: 68 private:
68 scoped_ptr<TrayRotationLock> tray_; 69 std::unique_ptr<TrayRotationLock> tray_;
69 scoped_ptr<views::View> tray_view_; 70 std::unique_ptr<views::View> tray_view_;
70 scoped_ptr<views::View> default_view_; 71 std::unique_ptr<views::View> default_view_;
71 72
72 DISALLOW_COPY_AND_ASSIGN(TrayRotationLockTest); 73 DISALLOW_COPY_AND_ASSIGN(TrayRotationLockTest);
73 }; 74 };
74 75
75 views::View* TrayRotationLockTest::CreateTrayView( 76 views::View* TrayRotationLockTest::CreateTrayView(
76 TrayRotationLock* tray_rotation_lock) { 77 TrayRotationLock* tray_rotation_lock) {
77 return tray_rotation_lock->CreateTrayView( 78 return tray_rotation_lock->CreateTrayView(
78 StatusAreaWidgetTestHelper::GetUserLoginStatus()); 79 StatusAreaWidgetTestHelper::GetUserLoginStatus());
79 } 80 }
80 81
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 maximize_mode_controller->EnableMaximizeModeWindowManager(false); 241 maximize_mode_controller->EnableMaximizeModeWindowManager(false);
241 } 242 }
242 243
243 // Tests that when the tray is created without the internal display being known, 244 // Tests that when the tray is created without the internal display being known,
244 // that it will still display correctly once the internal display is known. 245 // that it will still display correctly once the internal display is known.
245 TEST_F(TrayRotationLockTest, InternalDisplayNotAvailableAtCreation) { 246 TEST_F(TrayRotationLockTest, InternalDisplayNotAvailableAtCreation) {
246 int64_t internal_display_id = gfx::Display::InternalDisplayId(); 247 int64_t internal_display_id = gfx::Display::InternalDisplayId();
247 TearDownViews(); 248 TearDownViews();
248 gfx::Display::SetInternalDisplayId(gfx::Display::kInvalidDisplayID); 249 gfx::Display::SetInternalDisplayId(gfx::Display::kInvalidDisplayID);
249 250
250 scoped_ptr<TrayRotationLock> tray(new TrayRotationLock( 251 std::unique_ptr<TrayRotationLock> tray(new TrayRotationLock(
251 StatusAreaWidgetTestHelper::GetStatusAreaWidget()->system_tray())); 252 StatusAreaWidgetTestHelper::GetStatusAreaWidget()->system_tray()));
252 253
253 gfx::Display::SetInternalDisplayId(internal_display_id); 254 gfx::Display::SetInternalDisplayId(internal_display_id);
254 scoped_ptr<views::View> tray_view(CreateTrayView(tray.get())); 255 std::unique_ptr<views::View> tray_view(CreateTrayView(tray.get()));
255 scoped_ptr<views::View> default_view(tray->CreateDefaultView( 256 std::unique_ptr<views::View> default_view(tray->CreateDefaultView(
256 StatusAreaWidgetTestHelper::GetUserLoginStatus())); 257 StatusAreaWidgetTestHelper::GetUserLoginStatus()));
257 EXPECT_TRUE(default_view); 258 EXPECT_TRUE(default_view);
258 Shell::GetInstance() 259 Shell::GetInstance()
259 ->maximize_mode_controller() 260 ->maximize_mode_controller()
260 ->EnableMaximizeModeWindowManager(true); 261 ->EnableMaximizeModeWindowManager(true);
261 EXPECT_TRUE(default_view->visible()); 262 EXPECT_TRUE(default_view->visible());
262 } 263 }
263 264
264 // Tests that when the tray view is deleted, while TrayRotationLock has not been 265 // Tests that when the tray view is deleted, while TrayRotationLock has not been
265 // deleted, that updates to the rotation lock state do not crash. 266 // deleted, that updates to the rotation lock state do not crash.
266 TEST_F(TrayRotationLockTest, LockUpdatedDuringDesctruction) { 267 TEST_F(TrayRotationLockTest, LockUpdatedDuringDesctruction) {
267 Shell::GetInstance() 268 Shell::GetInstance()
268 ->maximize_mode_controller() 269 ->maximize_mode_controller()
269 ->EnableMaximizeModeWindowManager(true); 270 ->EnableMaximizeModeWindowManager(true);
270 DestroyTrayView(); 271 DestroyTrayView();
271 Shell::GetInstance()->screen_orientation_controller()->SetRotationLocked( 272 Shell::GetInstance()->screen_orientation_controller()->SetRotationLocked(
272 true); 273 true);
273 Shell::GetInstance() 274 Shell::GetInstance()
274 ->maximize_mode_controller() 275 ->maximize_mode_controller()
275 ->EnableMaximizeModeWindowManager(false); 276 ->EnableMaximizeModeWindowManager(false);
276 } 277 }
277 278
278 } // namespace ash 279 } // namespace ash
OLDNEW
« no previous file with comments | « ash/system/chromeos/power/tray_power_unittest.cc ('k') | ash/system/chromeos/screen_security/screen_capture_tray_item.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698