| 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 <tuple> | 7 #include <tuple> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 #include "ui/gfx/geometry/rect.h" | 25 #include "ui/gfx/geometry/rect.h" |
| 26 | 26 |
| 27 using testing::_; | 27 using testing::_; |
| 28 | 28 |
| 29 namespace content { | 29 namespace content { |
| 30 | 30 |
| 31 namespace { | 31 namespace { |
| 32 | 32 |
| 33 const char* EVENT_LISTENER_RESULT_HISTOGRAM = "Event.PassiveListeners"; | 33 const char* EVENT_LISTENER_RESULT_HISTOGRAM = "Event.PassiveListeners"; |
| 34 | 34 |
| 35 constexpr cc::FrameSinkId kArbitraryFrameSinkId(0, 1); |
| 36 |
| 35 enum { | 37 enum { |
| 36 PASSIVE_LISTENER_UMA_ENUM_PASSIVE, | 38 PASSIVE_LISTENER_UMA_ENUM_PASSIVE, |
| 37 PASSIVE_LISTENER_UMA_ENUM_UNCANCELABLE, | 39 PASSIVE_LISTENER_UMA_ENUM_UNCANCELABLE, |
| 38 PASSIVE_LISTENER_UMA_ENUM_SUPPRESSED, | 40 PASSIVE_LISTENER_UMA_ENUM_SUPPRESSED, |
| 39 PASSIVE_LISTENER_UMA_ENUM_CANCELABLE, | 41 PASSIVE_LISTENER_UMA_ENUM_CANCELABLE, |
| 40 PASSIVE_LISTENER_UMA_ENUM_CANCELABLE_AND_CANCELED, | 42 PASSIVE_LISTENER_UMA_ENUM_CANCELABLE_AND_CANCELED, |
| 41 PASSIVE_LISTENER_UMA_ENUM_FORCED_NON_BLOCKING_DUE_TO_FLING, | 43 PASSIVE_LISTENER_UMA_ENUM_FORCED_NON_BLOCKING_DUE_TO_FLING, |
| 42 PASSIVE_LISTENER_UMA_ENUM_COUNT | 44 PASSIVE_LISTENER_UMA_ENUM_COUNT |
| 43 }; | 45 }; |
| 44 | 46 |
| 45 class MockWebWidget : public blink::WebWidget { | 47 class MockWebWidget : public blink::WebWidget { |
| 46 public: | 48 public: |
| 47 MOCK_METHOD1(handleInputEvent, | 49 MOCK_METHOD1(handleInputEvent, |
| 48 blink::WebInputEventResult(const blink::WebInputEvent&)); | 50 blink::WebInputEventResult(const blink::WebInputEvent&)); |
| 49 }; | 51 }; |
| 50 | 52 |
| 51 } // namespace | 53 } // namespace |
| 52 | 54 |
| 53 class InteractiveRenderWidget : public RenderWidget { | 55 class InteractiveRenderWidget : public RenderWidget { |
| 54 public: | 56 public: |
| 55 explicit InteractiveRenderWidget(CompositorDependencies* compositor_deps) | 57 explicit InteractiveRenderWidget(CompositorDependencies* compositor_deps) |
| 56 : RenderWidget(compositor_deps, | 58 : RenderWidget(compositor_deps, |
| 57 blink::WebPopupTypeNone, | 59 blink::WebPopupTypeNone, |
| 58 ScreenInfo(), | 60 ScreenInfo(), |
| 61 kArbitraryFrameSinkId, |
| 59 false, | 62 false, |
| 60 false, | 63 false, |
| 61 false), | 64 false), |
| 62 always_overscroll_(false) { | 65 always_overscroll_(false) { |
| 63 webwidget_internal_ = &mock_webwidget_; | 66 webwidget_internal_ = &mock_webwidget_; |
| 64 // A RenderWidget is not fully initialized until it has a routing ID. | 67 // A RenderWidget is not fully initialized until it has a routing ID. |
| 65 SetRoutingID(++next_routing_id_); | 68 SetRoutingID(++next_routing_id_); |
| 66 } | 69 } |
| 67 | 70 |
| 68 void SetTouchRegion(const std::vector<gfx::Rect>& rects) { | 71 void SetTouchRegion(const std::vector<gfx::Rect>& rects) { |
| (...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 368 histogram_tester().ExpectTotalCount("Event.Touch.TouchLatencyOutsideFling", | 371 histogram_tester().ExpectTotalCount("Event.Touch.TouchLatencyOutsideFling", |
| 369 2); | 372 2); |
| 370 } | 373 } |
| 371 | 374 |
| 372 class PopupRenderWidget : public RenderWidget { | 375 class PopupRenderWidget : public RenderWidget { |
| 373 public: | 376 public: |
| 374 explicit PopupRenderWidget(CompositorDependencies* compositor_deps) | 377 explicit PopupRenderWidget(CompositorDependencies* compositor_deps) |
| 375 : RenderWidget(compositor_deps, | 378 : RenderWidget(compositor_deps, |
| 376 blink::WebPopupTypePage, | 379 blink::WebPopupTypePage, |
| 377 ScreenInfo(), | 380 ScreenInfo(), |
| 381 kArbitraryFrameSinkId, |
| 378 false, | 382 false, |
| 379 false, | 383 false, |
| 380 false) { | 384 false) { |
| 381 webwidget_internal_ = &mock_webwidget_; | 385 webwidget_internal_ = &mock_webwidget_; |
| 382 // A RenderWidget is not fully initialized until it has a routing ID. | 386 // A RenderWidget is not fully initialized until it has a routing ID. |
| 383 SetRoutingID(1); | 387 SetRoutingID(1); |
| 384 did_show_ = true; | 388 did_show_ = true; |
| 385 } | 389 } |
| 386 | 390 |
| 387 IPC::TestSink* sink() { return &sink_; } | 391 IPC::TestSink* sink() { return &sink_; } |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 488 blink::WebRect popup_emulated_rect(130, 170, 100, 400); | 492 blink::WebRect popup_emulated_rect(130, 170, 100, 400); |
| 489 widget()->setWindowRect(popup_emulated_rect); | 493 widget()->setWindowRect(popup_emulated_rect); |
| 490 | 494 |
| 491 EXPECT_EQ(popup_emulated_rect.x, widget()->windowRect().x); | 495 EXPECT_EQ(popup_emulated_rect.x, widget()->windowRect().x); |
| 492 EXPECT_EQ(popup_emulated_rect.y, widget()->windowRect().y); | 496 EXPECT_EQ(popup_emulated_rect.y, widget()->windowRect().y); |
| 493 EXPECT_EQ(popup_emulated_rect.x, widget()->viewRect().x); | 497 EXPECT_EQ(popup_emulated_rect.x, widget()->viewRect().x); |
| 494 EXPECT_EQ(popup_emulated_rect.y, widget()->viewRect().y); | 498 EXPECT_EQ(popup_emulated_rect.y, widget()->viewRect().y); |
| 495 } | 499 } |
| 496 | 500 |
| 497 } // namespace content | 501 } // namespace content |
| OLD | NEW |