| OLD | NEW |
| 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/renderer/render_widget.h" | 5 #include "content/renderer/render_widget.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "content/common/input/synthetic_web_input_event_builders.h" | 10 #include "content/common/input/synthetic_web_input_event_builders.h" |
| 11 #include "content/common/input/web_input_event_traits.h" |
| 11 #include "content/common/input_messages.h" | 12 #include "content/common/input_messages.h" |
| 12 #include "content/public/test/mock_render_thread.h" | 13 #include "content/public/test/mock_render_thread.h" |
| 13 #include "content/test/fake_compositor_dependencies.h" | 14 #include "content/test/fake_compositor_dependencies.h" |
| 14 #include "content/test/mock_render_process.h" | 15 #include "content/test/mock_render_process.h" |
| 15 #include "ipc/ipc_test_sink.h" | 16 #include "ipc/ipc_test_sink.h" |
| 16 #include "testing/gtest/include/gtest/gtest.h" | 17 #include "testing/gtest/include/gtest/gtest.h" |
| 17 #include "third_party/WebKit/public/web/WebInputEvent.h" | 18 #include "third_party/WebKit/public/web/WebInputEvent.h" |
| 18 #include "ui/gfx/geometry/rect.h" | 19 #include "ui/gfx/geometry/rect.h" |
| 19 | 20 |
| 20 namespace content { | 21 namespace content { |
| (...skipping 10 matching lines...) Expand all Loading... |
| 31 always_overscroll_(false) { | 32 always_overscroll_(false) { |
| 32 // A RenderWidget is not fully initialized until it has a routing ID. | 33 // A RenderWidget is not fully initialized until it has a routing ID. |
| 33 SetRoutingID(++next_routing_id_); | 34 SetRoutingID(++next_routing_id_); |
| 34 } | 35 } |
| 35 | 36 |
| 36 void SetTouchRegion(const std::vector<gfx::Rect>& rects) { | 37 void SetTouchRegion(const std::vector<gfx::Rect>& rects) { |
| 37 rects_ = rects; | 38 rects_ = rects; |
| 38 } | 39 } |
| 39 | 40 |
| 40 void SendInputEvent(const blink::WebInputEvent& event) { | 41 void SendInputEvent(const blink::WebInputEvent& event) { |
| 41 OnHandleInputEvent(&event, ui::LatencyInfo(), | 42 OnHandleInputEvent( |
| 42 InputEventDispatchType::DISPATCH_TYPE_NORMAL); | 43 &event, ui::LatencyInfo(), |
| 44 WebInputEventTraits::ShouldBlockEventOnRenderer(event) |
| 45 ? InputEventDispatchType::DISPATCH_TYPE_BLOCKING |
| 46 : InputEventDispatchType::DISPATCH_TYPE_NON_BLOCKING); |
| 43 } | 47 } |
| 44 | 48 |
| 45 void set_always_overscroll(bool overscroll) { | 49 void set_always_overscroll(bool overscroll) { |
| 46 always_overscroll_ = overscroll; | 50 always_overscroll_ = overscroll; |
| 47 } | 51 } |
| 48 | 52 |
| 49 IPC::TestSink* sink() { return &sink_; } | 53 IPC::TestSink* sink() { return &sink_; } |
| 50 | 54 |
| 51 protected: | 55 protected: |
| 52 ~InteractiveRenderWidget() override {} | 56 ~InteractiveRenderWidget() override {} |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 InputHostMsg_DidOverscroll::Read(message, ¶ms); | 220 InputHostMsg_DidOverscroll::Read(message, ¶ms); |
| 217 const DidOverscrollParams& overscroll = base::get<0>(params); | 221 const DidOverscrollParams& overscroll = base::get<0>(params); |
| 218 EXPECT_EQ(gfx::Vector2dF(10, 5), overscroll.latest_overscroll_delta); | 222 EXPECT_EQ(gfx::Vector2dF(10, 5), overscroll.latest_overscroll_delta); |
| 219 EXPECT_EQ(gfx::Vector2dF(5, 5), overscroll.accumulated_overscroll); | 223 EXPECT_EQ(gfx::Vector2dF(5, 5), overscroll.accumulated_overscroll); |
| 220 EXPECT_EQ(gfx::PointF(1, 1), overscroll.causal_event_viewport_point); | 224 EXPECT_EQ(gfx::PointF(1, 1), overscroll.causal_event_viewport_point); |
| 221 EXPECT_EQ(gfx::Vector2dF(-10, -5), overscroll.current_fling_velocity); | 225 EXPECT_EQ(gfx::Vector2dF(-10, -5), overscroll.current_fling_velocity); |
| 222 widget()->sink()->ClearMessages(); | 226 widget()->sink()->ClearMessages(); |
| 223 } | 227 } |
| 224 | 228 |
| 225 } // namespace content | 229 } // namespace content |
| OLD | NEW |