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

Side by Side Diff: ui/touch_selection/touch_selection_controller_unittest.cc

Issue 2259753003: Re-write many calls to WrapUnique() with MakeUnique() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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 | « ui/touch_selection/touch_handle_unittest.cc ('k') | ui/views/border.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 "ui/touch_selection/touch_selection_controller.h" 5 #include "ui/touch_selection/touch_selection_controller.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 } 96 }
97 97
98 void OnSelectionEvent(SelectionEventType event) override { 98 void OnSelectionEvent(SelectionEventType event) override {
99 events_.push_back(event); 99 events_.push_back(event);
100 last_event_start_ = controller_->GetStartPosition(); 100 last_event_start_ = controller_->GetStartPosition();
101 last_event_end_ = controller_->GetEndPosition(); 101 last_event_end_ = controller_->GetEndPosition();
102 last_event_bounds_rect_ = controller_->GetRectBetweenBounds(); 102 last_event_bounds_rect_ = controller_->GetRectBetweenBounds();
103 } 103 }
104 104
105 std::unique_ptr<TouchHandleDrawable> CreateDrawable() override { 105 std::unique_ptr<TouchHandleDrawable> CreateDrawable() override {
106 return base::WrapUnique(new MockTouchHandleDrawable(&dragging_enabled_)); 106 return base::MakeUnique<MockTouchHandleDrawable>(&dragging_enabled_);
107 } 107 }
108 108
109 void EnableLongPressDragSelection() { 109 void EnableLongPressDragSelection() {
110 TouchSelectionController::Config config = DefaultConfig(); 110 TouchSelectionController::Config config = DefaultConfig();
111 config.enable_longpress_drag_selection = true; 111 config.enable_longpress_drag_selection = true;
112 controller_.reset(new TouchSelectionController(this, config)); 112 controller_.reset(new TouchSelectionController(this, config));
113 } 113 }
114 114
115 void SetAnimationEnabled(bool enabled) { animation_enabled_ = enabled; } 115 void SetAnimationEnabled(bool enabled) { animation_enabled_ = enabled; }
116 void SetDraggingEnabled(bool enabled) { dragging_enabled_ = enabled; } 116 void SetDraggingEnabled(bool enabled) { dragging_enabled_ = enabled; }
(...skipping 1327 matching lines...) Expand 10 before | Expand all | Expand 10 after
1444 offset_rect.x(), offset_rect.bottom()); 1444 offset_rect.x(), offset_rect.bottom());
1445 EXPECT_TRUE(controller().WillHandleTouchEvent(event)); 1445 EXPECT_TRUE(controller().WillHandleTouchEvent(event));
1446 EXPECT_THAT(GetAndResetEvents(), ElementsAre(SELECTION_HANDLE_DRAG_STOPPED)); 1446 EXPECT_THAT(GetAndResetEvents(), ElementsAre(SELECTION_HANDLE_DRAG_STOPPED));
1447 EXPECT_EQ(test_controller.GetStartHandleOrientation(), 1447 EXPECT_EQ(test_controller.GetStartHandleOrientation(),
1448 TouchHandleOrientation::LEFT); 1448 TouchHandleOrientation::LEFT);
1449 EXPECT_EQ(test_controller.GetEndHandleOrientation(), 1449 EXPECT_EQ(test_controller.GetEndHandleOrientation(),
1450 TouchHandleOrientation::RIGHT); 1450 TouchHandleOrientation::RIGHT);
1451 } 1451 }
1452 1452
1453 } // namespace ui 1453 } // namespace ui
OLDNEW
« no previous file with comments | « ui/touch_selection/touch_handle_unittest.cc ('k') | ui/views/border.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698