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

Side by Side Diff: ui/views/mus/pointer_watcher_event_router_unittest.cc

Issue 2374883002: views/mus: Change 'reset(new' to base::MakeUnqiue. (Closed)
Patch Set: Created 4 years, 2 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/views/mus/input_method_mus_unittest.cc ('k') | ui/views/mus/views_mus_test_suite.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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/views/mus/pointer_watcher_event_router.h" 5 #include "ui/views/mus/pointer_watcher_event_router.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "services/ui/public/cpp/tests/window_tree_client_private.h" 10 #include "services/ui/public/cpp/tests/window_tree_client_private.h"
(...skipping 12 matching lines...) Expand all
23 ~TestPointerWatcher() override {} 23 ~TestPointerWatcher() override {}
24 24
25 ui::PointerEvent* last_event_observed() { return last_event_observed_.get(); } 25 ui::PointerEvent* last_event_observed() { return last_event_observed_.get(); }
26 26
27 void Reset() { last_event_observed_.reset(); } 27 void Reset() { last_event_observed_.reset(); }
28 28
29 // PointerWatcher: 29 // PointerWatcher:
30 void OnPointerEventObserved(const ui::PointerEvent& event, 30 void OnPointerEventObserved(const ui::PointerEvent& event,
31 const gfx::Point& location_in_screen, 31 const gfx::Point& location_in_screen,
32 Widget* target) override { 32 Widget* target) override {
33 last_event_observed_.reset(new ui::PointerEvent(event)); 33 last_event_observed_ = base::MakeUnique<ui::PointerEvent>(event);
34 } 34 }
35 35
36 private: 36 private:
37 std::unique_ptr<ui::PointerEvent> last_event_observed_; 37 std::unique_ptr<ui::PointerEvent> last_event_observed_;
38 38
39 DISALLOW_COPY_AND_ASSIGN(TestPointerWatcher); 39 DISALLOW_COPY_AND_ASSIGN(TestPointerWatcher);
40 }; 40 };
41 41
42 } // namespace 42 } // namespace
43 43
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 watcher2.Reset(); 235 watcher2.Reset();
236 236
237 // Removing the last PointerWatcher stops sending events to it. 237 // Removing the last PointerWatcher stops sending events to it.
238 pointer_watcher_event_router->RemovePointerWatcher(&watcher2); 238 pointer_watcher_event_router->RemovePointerWatcher(&watcher2);
239 OnPointerEventObserved(pointer_event_move); 239 OnPointerEventObserved(pointer_event_move);
240 EXPECT_FALSE(watcher1.last_event_observed()); 240 EXPECT_FALSE(watcher1.last_event_observed());
241 EXPECT_FALSE(watcher2.last_event_observed()); 241 EXPECT_FALSE(watcher2.last_event_observed());
242 } 242 }
243 243
244 } // namespace views 244 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/mus/input_method_mus_unittest.cc ('k') | ui/views/mus/views_mus_test_suite.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698