| 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 public: | 46 public: |
| 47 MOCK_METHOD1(handleInputEvent, | 47 MOCK_METHOD1(handleInputEvent, |
| 48 blink::WebInputEventResult(const blink::WebInputEvent&)); | 48 blink::WebInputEventResult(const blink::WebInputEvent&)); |
| 49 }; | 49 }; |
| 50 | 50 |
| 51 } // namespace | 51 } // namespace |
| 52 | 52 |
| 53 class InteractiveRenderWidget : public RenderWidget { | 53 class InteractiveRenderWidget : public RenderWidget { |
| 54 public: | 54 public: |
| 55 explicit InteractiveRenderWidget(CompositorDependencies* compositor_deps) | 55 explicit InteractiveRenderWidget(CompositorDependencies* compositor_deps) |
| 56 : RenderWidget(compositor_deps, | 56 : RenderWidget(++next_routing_id_, |
| 57 compositor_deps, |
| 57 blink::WebPopupTypeNone, | 58 blink::WebPopupTypeNone, |
| 58 ScreenInfo(), | 59 ScreenInfo(), |
| 59 false, | 60 false, |
| 60 false, | 61 false, |
| 61 false), | 62 false), |
| 62 always_overscroll_(false) { | 63 always_overscroll_(false) { |
| 63 webwidget_internal_ = &mock_webwidget_; | 64 webwidget_internal_ = &mock_webwidget_; |
| 64 InitRoutingID(++next_routing_id_); | |
| 65 } | 65 } |
| 66 | 66 |
| 67 void SetTouchRegion(const std::vector<gfx::Rect>& rects) { | 67 void SetTouchRegion(const std::vector<gfx::Rect>& rects) { |
| 68 rects_ = rects; | 68 rects_ = rects; |
| 69 } | 69 } |
| 70 | 70 |
| 71 void SendInputEvent(const blink::WebInputEvent& event) { | 71 void SendInputEvent(const blink::WebInputEvent& event) { |
| 72 OnHandleInputEvent( | 72 OnHandleInputEvent( |
| 73 &event, ui::LatencyInfo(), | 73 &event, ui::LatencyInfo(), |
| 74 ui::WebInputEventTraits::ShouldBlockEventStream(event) | 74 ui::WebInputEventTraits::ShouldBlockEventStream(event) |
| (...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 363 touch.MovePoint(0, 30, 30); | 363 touch.MovePoint(0, 30, 30); |
| 364 touch.touchStartOrFirstTouchMove = false; | 364 touch.touchStartOrFirstTouchMove = false; |
| 365 widget()->SendInputEvent(touch); | 365 widget()->SendInputEvent(touch); |
| 366 histogram_tester().ExpectTotalCount("Event.Touch.TouchLatencyOutsideFling", | 366 histogram_tester().ExpectTotalCount("Event.Touch.TouchLatencyOutsideFling", |
| 367 2); | 367 2); |
| 368 } | 368 } |
| 369 | 369 |
| 370 class PopupRenderWidget : public RenderWidget { | 370 class PopupRenderWidget : public RenderWidget { |
| 371 public: | 371 public: |
| 372 explicit PopupRenderWidget(CompositorDependencies* compositor_deps) | 372 explicit PopupRenderWidget(CompositorDependencies* compositor_deps) |
| 373 : RenderWidget(compositor_deps, | 373 : RenderWidget(1, |
| 374 compositor_deps, |
| 374 blink::WebPopupTypePage, | 375 blink::WebPopupTypePage, |
| 375 ScreenInfo(), | 376 ScreenInfo(), |
| 376 false, | 377 false, |
| 377 false, | 378 false, |
| 378 false) { | 379 false) { |
| 379 webwidget_internal_ = &mock_webwidget_; | 380 webwidget_internal_ = &mock_webwidget_; |
| 380 InitRoutingID(1); | |
| 381 did_show_ = true; | 381 did_show_ = true; |
| 382 } | 382 } |
| 383 | 383 |
| 384 IPC::TestSink* sink() { return &sink_; } | 384 IPC::TestSink* sink() { return &sink_; } |
| 385 | 385 |
| 386 MockWebWidget* mock_webwidget() { return &mock_webwidget_; } | 386 MockWebWidget* mock_webwidget() { return &mock_webwidget_; } |
| 387 | 387 |
| 388 void SetScreenMetricsEmulationParameters( | 388 void SetScreenMetricsEmulationParameters( |
| 389 bool, | 389 bool, |
| 390 const blink::WebDeviceEmulationParams&) override {} | 390 const blink::WebDeviceEmulationParams&) override {} |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 485 blink::WebRect popup_emulated_rect(130, 170, 100, 400); | 485 blink::WebRect popup_emulated_rect(130, 170, 100, 400); |
| 486 widget()->setWindowRect(popup_emulated_rect); | 486 widget()->setWindowRect(popup_emulated_rect); |
| 487 | 487 |
| 488 EXPECT_EQ(popup_emulated_rect.x, widget()->windowRect().x); | 488 EXPECT_EQ(popup_emulated_rect.x, widget()->windowRect().x); |
| 489 EXPECT_EQ(popup_emulated_rect.y, widget()->windowRect().y); | 489 EXPECT_EQ(popup_emulated_rect.y, widget()->windowRect().y); |
| 490 EXPECT_EQ(popup_emulated_rect.x, widget()->viewRect().x); | 490 EXPECT_EQ(popup_emulated_rect.x, widget()->viewRect().x); |
| 491 EXPECT_EQ(popup_emulated_rect.y, widget()->viewRect().y); | 491 EXPECT_EQ(popup_emulated_rect.y, widget()->viewRect().y); |
| 492 } | 492 } |
| 493 | 493 |
| 494 } // namespace content | 494 } // namespace content |
| OLD | NEW |