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