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

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

Issue 2663493003: Move the TouchEventQueue to be completely virtual. (Closed)
Patch Set: Fix nits Created 3 years, 10 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 | « content/browser/renderer_host/input/touch_event_queue.cc ('k') | no next file » | 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 "content/browser/renderer_host/input/touch_event_queue.h" 5 #include "content/browser/renderer_host/input/touch_event_queue.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <memory> 9 #include <memory>
10 #include <utility> 10 #include <utility>
11 11
12 #include "base/location.h" 12 #include "base/location.h"
13 #include "base/logging.h" 13 #include "base/logging.h"
14 #include "base/message_loop/message_loop.h" 14 #include "base/message_loop/message_loop.h"
15 #include "base/run_loop.h" 15 #include "base/run_loop.h"
16 #include "base/single_thread_task_runner.h" 16 #include "base/single_thread_task_runner.h"
17 #include "base/threading/thread_task_runner_handle.h" 17 #include "base/threading/thread_task_runner_handle.h"
18 #include "content/browser/renderer_host/input/legacy_touch_event_queue.h"
18 #include "content/browser/renderer_host/input/timeout_monitor.h" 19 #include "content/browser/renderer_host/input/timeout_monitor.h"
19 #include "content/common/input/synthetic_web_input_event_builders.h" 20 #include "content/common/input/synthetic_web_input_event_builders.h"
20 #include "content/common/input/web_touch_event_traits.h" 21 #include "content/common/input/web_touch_event_traits.h"
21 #include "testing/gtest/include/gtest/gtest.h" 22 #include "testing/gtest/include/gtest/gtest.h"
22 #include "third_party/WebKit/public/platform/WebInputEvent.h" 23 #include "third_party/WebKit/public/platform/WebInputEvent.h"
23 #include "ui/events/base_event_utils.h" 24 #include "ui/events/base_event_utils.h"
24 25
25 using blink::WebGestureEvent; 26 using blink::WebGestureEvent;
26 using blink::WebInputEvent; 27 using blink::WebInputEvent;
27 using blink::WebTouchEvent; 28 using blink::WebTouchEvent;
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after
319 320
320 int GetUniqueTouchEventID() { return sent_events_ids_.back(); } 321 int GetUniqueTouchEventID() { return sent_events_ids_.back(); }
321 322
322 private: 323 private:
323 void SendTouchEvent() { 324 void SendTouchEvent() {
324 SendTouchEvent(touch_event_); 325 SendTouchEvent(touch_event_);
325 touch_event_.ResetPoints(); 326 touch_event_.ResetPoints();
326 } 327 }
327 328
328 void ResetQueueWithConfig(const TouchEventQueue::Config& config) { 329 void ResetQueueWithConfig(const TouchEventQueue::Config& config) {
329 queue_.reset(new TouchEventQueue(this, config)); 330 queue_.reset(new LegacyTouchEventQueue(this, config));
330 queue_->OnHasTouchEventHandlers(true); 331 queue_->OnHasTouchEventHandlers(true);
331 } 332 }
332 333
333 std::unique_ptr<TouchEventQueue> queue_; 334 std::unique_ptr<LegacyTouchEventQueue> queue_;
334 size_t acked_event_count_; 335 size_t acked_event_count_;
335 WebTouchEvent last_acked_event_; 336 WebTouchEvent last_acked_event_;
336 std::vector<WebTouchEvent> sent_events_; 337 std::vector<WebTouchEvent> sent_events_;
337 InputEventAckState last_acked_event_state_; 338 InputEventAckState last_acked_event_state_;
338 SyntheticWebTouchEvent touch_event_; 339 SyntheticWebTouchEvent touch_event_;
339 std::unique_ptr<WebTouchEvent> followup_touch_event_; 340 std::unique_ptr<WebTouchEvent> followup_touch_event_;
340 std::unique_ptr<WebGestureEvent> followup_gesture_event_; 341 std::unique_ptr<WebGestureEvent> followup_gesture_event_;
341 std::unique_ptr<InputEventAckState> sync_ack_result_; 342 std::unique_ptr<InputEventAckState> sync_ack_result_;
342 double slop_length_dips_; 343 double slop_length_dips_;
343 gfx::PointF anchor_; 344 gfx::PointF anchor_;
(...skipping 2407 matching lines...) Expand 10 before | Expand all | Expand 10 after
2751 EXPECT_EQ(WebInputEvent::TouchMove, sent_event().type()); 2752 EXPECT_EQ(WebInputEvent::TouchMove, sent_event().type());
2752 EXPECT_FALSE(sent_event().touchStartOrFirstTouchMove); 2753 EXPECT_FALSE(sent_event().touchStartOrFirstTouchMove);
2753 2754
2754 ReleaseTouchPoint(0); 2755 ReleaseTouchPoint(0);
2755 SendTouchEventAck(INPUT_EVENT_ACK_STATE_CONSUMED); 2756 SendTouchEventAck(INPUT_EVENT_ACK_STATE_CONSUMED);
2756 EXPECT_EQ(WebInputEvent::TouchEnd, sent_event().type()); 2757 EXPECT_EQ(WebInputEvent::TouchEnd, sent_event().type());
2757 EXPECT_FALSE(sent_event().touchStartOrFirstTouchMove); 2758 EXPECT_FALSE(sent_event().touchStartOrFirstTouchMove);
2758 } 2759 }
2759 2760
2760 } // namespace content 2761 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/renderer_host/input/touch_event_queue.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698