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

Side by Side Diff: ash/wm/lock_state_controller_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
« no previous file with comments | « ash/wm/lock_state_controller.cc ('k') | ash/wm/lock_window_state.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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/wm/lock_state_controller.h" 5 #include "ash/wm/lock_state_controller.h"
6 6
7 #include <memory>
7 #include <utility> 8 #include <utility>
8 9
9 #include "ash/session/session_state_delegate.h" 10 #include "ash/session/session_state_delegate.h"
10 #include "ash/shell.h" 11 #include "ash/shell.h"
11 #include "ash/test/ash_test_base.h" 12 #include "ash/test/ash_test_base.h"
12 #include "ash/test/test_lock_state_controller_delegate.h" 13 #include "ash/test/test_lock_state_controller_delegate.h"
13 #include "ash/test/test_screenshot_delegate.h" 14 #include "ash/test/test_screenshot_delegate.h"
14 #include "ash/test/test_session_state_animator.h" 15 #include "ash/test/test_session_state_animator.h"
15 #include "ash/test/test_shell_delegate.h" 16 #include "ash/test/test_shell_delegate.h"
16 #include "ash/wm/maximize_mode/maximize_mode_controller.h" 17 #include "ash/wm/maximize_mode/maximize_mode_controller.h"
17 #include "ash/wm/power_button_controller.h" 18 #include "ash/wm/power_button_controller.h"
18 #include "ash/wm/session_state_animator.h" 19 #include "ash/wm/session_state_animator.h"
19 #include "base/memory/scoped_ptr.h"
20 #include "base/memory/scoped_vector.h" 20 #include "base/memory/scoped_vector.h"
21 #include "base/time/time.h" 21 #include "base/time/time.h"
22 #include "ui/events/test/event_generator.h" 22 #include "ui/events/test/event_generator.h"
23 #include "ui/gfx/geometry/size.h" 23 #include "ui/gfx/geometry/size.h"
24 24
25 #if defined(OS_CHROMEOS) 25 #if defined(OS_CHROMEOS)
26 #include "ui/display/chromeos/display_configurator.h" 26 #include "ui/display/chromeos/display_configurator.h"
27 #include "ui/display/chromeos/test/test_display_snapshot.h" 27 #include "ui/display/chromeos/test/test_display_snapshot.h"
28 #include "ui/display/types/display_constants.h" 28 #include "ui/display/types/display_constants.h"
29 #endif 29 #endif
(...skipping 18 matching lines...) Expand all
48 LockStateControllerTest() : power_button_controller_(NULL), 48 LockStateControllerTest() : power_button_controller_(NULL),
49 lock_state_controller_(NULL), 49 lock_state_controller_(NULL),
50 lock_state_controller_delegate_(NULL), 50 lock_state_controller_delegate_(NULL),
51 test_animator_(NULL) { 51 test_animator_(NULL) {
52 } 52 }
53 ~LockStateControllerTest() override {} 53 ~LockStateControllerTest() override {}
54 54
55 void SetUp() override { 55 void SetUp() override {
56 AshTestBase::SetUp(); 56 AshTestBase::SetUp();
57 57
58 scoped_ptr<LockStateControllerDelegate> lock_state_controller_delegate( 58 std::unique_ptr<LockStateControllerDelegate> lock_state_controller_delegate(
59 lock_state_controller_delegate_ = new TestLockStateControllerDelegate); 59 lock_state_controller_delegate_ = new TestLockStateControllerDelegate);
60 test_animator_ = new TestSessionStateAnimator; 60 test_animator_ = new TestSessionStateAnimator;
61 61
62 lock_state_controller_ = Shell::GetInstance()->lock_state_controller(); 62 lock_state_controller_ = Shell::GetInstance()->lock_state_controller();
63 lock_state_controller_->SetDelegate( 63 lock_state_controller_->SetDelegate(
64 std::move(lock_state_controller_delegate)); 64 std::move(lock_state_controller_delegate));
65 lock_state_controller_->set_animator_for_test(test_animator_); 65 lock_state_controller_->set_animator_for_test(test_animator_);
66 66
67 test_api_.reset(new LockStateController::TestApi(lock_state_controller_)); 67 test_api_.reset(new LockStateController::TestApi(lock_state_controller_));
68 68
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after
340 SetCanLockScreen(false); 340 SetCanLockScreen(false);
341 lock_state_controller_->OnLockStateChanged(false); 341 lock_state_controller_->OnLockStateChanged(false);
342 } 342 }
343 343
344 PowerButtonController* power_button_controller_; // not owned 344 PowerButtonController* power_button_controller_; // not owned
345 LockStateController* lock_state_controller_; // not owned 345 LockStateController* lock_state_controller_; // not owned
346 TestLockStateControllerDelegate* 346 TestLockStateControllerDelegate*
347 lock_state_controller_delegate_; // not owned 347 lock_state_controller_delegate_; // not owned
348 TestSessionStateAnimator* test_animator_; // not owned 348 TestSessionStateAnimator* test_animator_; // not owned
349 SessionStateDelegate* session_state_delegate_; // not owned 349 SessionStateDelegate* session_state_delegate_; // not owned
350 scoped_ptr<LockStateController::TestApi> test_api_; 350 std::unique_ptr<LockStateController::TestApi> test_api_;
351 TestShellDelegate* shell_delegate_; // not owned 351 TestShellDelegate* shell_delegate_; // not owned
352 352
353 private: 353 private:
354 DISALLOW_COPY_AND_ASSIGN(LockStateControllerTest); 354 DISALLOW_COPY_AND_ASSIGN(LockStateControllerTest);
355 }; 355 };
356 356
357 // Test the lock-to-shutdown flow for non-Chrome-OS hardware that doesn't 357 // Test the lock-to-shutdown flow for non-Chrome-OS hardware that doesn't
358 // correctly report power button releases. We should lock immediately the first 358 // correctly report power button releases. We should lock immediately the first
359 // time the button is pressed and shut down when it's pressed from the locked 359 // time the button is pressed and shut down when it's pressed from the locked
360 // state. 360 // state.
(...skipping 742 matching lines...) Expand 10 before | Expand all | Expand 10 after
1103 ReleasePowerButton(); 1103 ReleasePowerButton();
1104 1104
1105 ExpectPreLockAnimationStarted(); 1105 ExpectPreLockAnimationStarted();
1106 1106
1107 test_animator_->CompleteAllAnimations(true); 1107 test_animator_->CompleteAllAnimations(true);
1108 EXPECT_EQ(1, lock_state_controller_delegate_->num_lock_requests()); 1108 EXPECT_EQ(1, lock_state_controller_delegate_->num_lock_requests());
1109 } 1109 }
1110 1110
1111 } // namespace test 1111 } // namespace test
1112 } // namespace ash 1112 } // namespace ash
OLDNEW
« no previous file with comments | « ash/wm/lock_state_controller.cc ('k') | ash/wm/lock_window_state.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698