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

Side by Side Diff: content/browser/renderer_host/input/touch_event_queue_unittest.cc

Issue 1545243002: Convert Pass()→std::move() in //content/browser (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 12 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 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 "content/browser/renderer_host/input/touch_event_queue.h"
6
5 #include <stddef.h> 7 #include <stddef.h>
8 #include <utility>
6 9
7 #include "base/location.h" 10 #include "base/location.h"
8 #include "base/logging.h" 11 #include "base/logging.h"
9 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
10 #include "base/message_loop/message_loop.h" 13 #include "base/message_loop/message_loop.h"
11 #include "base/single_thread_task_runner.h" 14 #include "base/single_thread_task_runner.h"
12 #include "base/thread_task_runner_handle.h" 15 #include "base/thread_task_runner_handle.h"
13 #include "content/browser/renderer_host/input/timeout_monitor.h" 16 #include "content/browser/renderer_host/input/timeout_monitor.h"
14 #include "content/browser/renderer_host/input/touch_event_queue.h"
15 #include "content/common/input/synthetic_web_input_event_builders.h" 17 #include "content/common/input/synthetic_web_input_event_builders.h"
16 #include "content/common/input/web_touch_event_traits.h" 18 #include "content/common/input/web_touch_event_traits.h"
17 #include "testing/gtest/include/gtest/gtest.h" 19 #include "testing/gtest/include/gtest/gtest.h"
18 #include "third_party/WebKit/public/web/WebInputEvent.h" 20 #include "third_party/WebKit/public/web/WebInputEvent.h"
19 21
20 using blink::WebGestureEvent; 22 using blink::WebGestureEvent;
21 using blink::WebInputEvent; 23 using blink::WebInputEvent;
22 using blink::WebTouchEvent; 24 using blink::WebTouchEvent;
23 using blink::WebTouchPoint; 25 using blink::WebTouchPoint;
24 26
(...skipping 26 matching lines...) Expand all
51 } 53 }
52 54
53 void TearDown() override { queue_.reset(); } 55 void TearDown() override { queue_.reset(); }
54 56
55 // TouchEventQueueClient 57 // TouchEventQueueClient
56 void SendTouchEventImmediately( 58 void SendTouchEventImmediately(
57 const TouchEventWithLatencyInfo& event) override { 59 const TouchEventWithLatencyInfo& event) override {
58 sent_events_.push_back(event.event); 60 sent_events_.push_back(event.event);
59 sent_events_ids_.push_back(event.event.uniqueTouchEventId); 61 sent_events_ids_.push_back(event.event.uniqueTouchEventId);
60 if (sync_ack_result_) { 62 if (sync_ack_result_) {
61 auto sync_ack_result = sync_ack_result_.Pass(); 63 auto sync_ack_result = std::move(sync_ack_result_);
62 SendTouchEventAck(*sync_ack_result); 64 SendTouchEventAck(*sync_ack_result);
63 } 65 }
64 } 66 }
65 67
66 void OnTouchEventAck(const TouchEventWithLatencyInfo& event, 68 void OnTouchEventAck(const TouchEventWithLatencyInfo& event,
67 InputEventAckState ack_result) override { 69 InputEventAckState ack_result) override {
68 ++acked_event_count_; 70 ++acked_event_count_;
69 last_acked_event_ = event.event; 71 last_acked_event_ = event.event;
70 last_acked_event_state_ = ack_result; 72 last_acked_event_state_ = ack_result;
71 if (followup_touch_event_) { 73 if (followup_touch_event_) {
72 scoped_ptr<WebTouchEvent> followup_touch_event = 74 scoped_ptr<WebTouchEvent> followup_touch_event =
73 followup_touch_event_.Pass(); 75 std::move(followup_touch_event_);
74 SendTouchEvent(*followup_touch_event); 76 SendTouchEvent(*followup_touch_event);
75 } 77 }
76 if (followup_gesture_event_) { 78 if (followup_gesture_event_) {
77 scoped_ptr<WebGestureEvent> followup_gesture_event = 79 scoped_ptr<WebGestureEvent> followup_gesture_event =
78 followup_gesture_event_.Pass(); 80 std::move(followup_gesture_event_);
79 queue_->OnGestureScrollEvent( 81 queue_->OnGestureScrollEvent(
80 GestureEventWithLatencyInfo(*followup_gesture_event, 82 GestureEventWithLatencyInfo(*followup_gesture_event,
81 ui::LatencyInfo())); 83 ui::LatencyInfo()));
82 } 84 }
83 } 85 }
84 86
85 protected: 87 protected:
86 void SetUpForTouchMoveSlopTesting(double slop_length_dips) { 88 void SetUpForTouchMoveSlopTesting(double slop_length_dips) {
87 slop_length_dips_ = slop_length_dips; 89 slop_length_dips_ = slop_length_dips;
88 } 90 }
(...skipping 2518 matching lines...) Expand 10 before | Expand all | Expand 10 after
2607 // TouchMove should be allowed and test for touches state. 2609 // TouchMove should be allowed and test for touches state.
2608 const WebTouchEvent& event2 = sent_event(); 2610 const WebTouchEvent& event2 = sent_event();
2609 EXPECT_EQ(WebInputEvent::TouchMove, event2.type); 2611 EXPECT_EQ(WebInputEvent::TouchMove, event2.type);
2610 EXPECT_EQ(WebTouchPoint::StateStationary, event2.touches[0].state); 2612 EXPECT_EQ(WebTouchPoint::StateStationary, event2.touches[0].state);
2611 EXPECT_EQ(WebTouchPoint::StateMoved, event2.touches[1].state); 2613 EXPECT_EQ(WebTouchPoint::StateMoved, event2.touches[1].state);
2612 EXPECT_EQ(1U, GetAndResetSentEventCount()); 2614 EXPECT_EQ(1U, GetAndResetSentEventCount());
2613 EXPECT_EQ(1U, GetAndResetAckedEventCount()); 2615 EXPECT_EQ(1U, GetAndResetAckedEventCount());
2614 } 2616 }
2615 2617
2616 } // namespace content 2618 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698