Battery Status API: add UMA logging for Linux.
[chromium-blink-merge.git] / content / browser / renderer_host / input / mock_input_router_client.cc
blob068af8c9206c6e12af80f9a8ce661acfff62553a
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
3 // found in the LICENSE file.
5 #include "content/browser/renderer_host/input/mock_input_router_client.h"
7 #include "content/browser/renderer_host/input/input_router.h"
8 #include "content/common/input/input_event.h"
9 #include "testing/gtest/include/gtest/gtest.h"
11 using base::TimeDelta;
12 using blink::WebGestureEvent;
13 using blink::WebInputEvent;
14 using blink::WebMouseEvent;
15 using blink::WebMouseWheelEvent;
16 using blink::WebTouchEvent;
17 using blink::WebTouchPoint;
19 namespace content {
21 MockInputRouterClient::MockInputRouterClient()
22 : input_router_(NULL),
23 in_flight_event_count_(0),
24 has_touch_handler_(false),
25 filter_state_(INPUT_EVENT_ACK_STATE_NOT_CONSUMED),
26 filter_input_event_called_(false),
27 did_flush_called_count_(0),
28 set_needs_flush_called_(false) {}
30 MockInputRouterClient::~MockInputRouterClient() {}
32 InputEventAckState MockInputRouterClient::FilterInputEvent(
33 const WebInputEvent& input_event,
34 const ui::LatencyInfo& latency_info) {
35 filter_input_event_called_ = true;
36 last_filter_event_.reset(new InputEvent(input_event, latency_info, false));
37 return filter_state_;
40 void MockInputRouterClient::IncrementInFlightEventCount() {
41 ++in_flight_event_count_;
44 void MockInputRouterClient::DecrementInFlightEventCount() {
45 --in_flight_event_count_;
48 void MockInputRouterClient::OnHasTouchEventHandlers(
49 bool has_handlers) {
50 has_touch_handler_ = has_handlers;
53 void MockInputRouterClient::SetNeedsFlush() {
54 set_needs_flush_called_ = true;
57 void MockInputRouterClient::DidFlush() {
58 ++did_flush_called_count_;
61 void MockInputRouterClient::DidOverscroll(const DidOverscrollParams& params) {
62 overscroll_ = params;
65 bool MockInputRouterClient::GetAndResetFilterEventCalled() {
66 bool filter_input_event_called = filter_input_event_called_;
67 filter_input_event_called_ = false;
68 return filter_input_event_called;
71 size_t MockInputRouterClient::GetAndResetDidFlushCount() {
72 size_t did_flush_called_count = did_flush_called_count_;
73 did_flush_called_count_ = 0;
74 return did_flush_called_count;
77 DidOverscrollParams MockInputRouterClient::GetAndResetOverscroll() {
78 DidOverscrollParams overscroll;
79 std::swap(overscroll_, overscroll);
80 return overscroll;
83 } // namespace content