Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(443)

Side by Side Diff: content/renderer/render_widget_unittest.cc

Issue 2288313002: Return the WebViewFrameWidget in RenderWidget::webwidget() if there (Closed)
Patch Set: rename webwidget_ -> webwidget_internal_ Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 class InteractiveRenderWidget : public RenderWidget { 50 class InteractiveRenderWidget : public RenderWidget {
51 public: 51 public:
52 explicit InteractiveRenderWidget(CompositorDependencies* compositor_deps) 52 explicit InteractiveRenderWidget(CompositorDependencies* compositor_deps)
53 : RenderWidget(compositor_deps, 53 : RenderWidget(compositor_deps,
54 blink::WebPopupTypeNone, 54 blink::WebPopupTypeNone,
55 ScreenInfo(), 55 ScreenInfo(),
56 false, 56 false,
57 false, 57 false,
58 false), 58 false),
59 always_overscroll_(false) { 59 always_overscroll_(false) {
60 webwidget_ = &mock_webwidget_; 60 webwidget_internal_ = &mock_webwidget_;
61 // A RenderWidget is not fully initialized until it has a routing ID. 61 // A RenderWidget is not fully initialized until it has a routing ID.
62 SetRoutingID(++next_routing_id_); 62 SetRoutingID(++next_routing_id_);
63 } 63 }
64 64
65 void SetTouchRegion(const std::vector<gfx::Rect>& rects) { 65 void SetTouchRegion(const std::vector<gfx::Rect>& rects) {
66 rects_ = rects; 66 rects_ = rects;
67 } 67 }
68 68
69 void SendInputEvent(const blink::WebInputEvent& event) { 69 void SendInputEvent(const blink::WebInputEvent& event) {
70 OnHandleInputEvent( 70 OnHandleInputEvent(
71 &event, ui::LatencyInfo(), 71 &event, ui::LatencyInfo(),
72 ui::WebInputEventTraits::ShouldBlockEventStream(event) 72 ui::WebInputEventTraits::ShouldBlockEventStream(event)
73 ? InputEventDispatchType::DISPATCH_TYPE_BLOCKING 73 ? InputEventDispatchType::DISPATCH_TYPE_BLOCKING
74 : InputEventDispatchType::DISPATCH_TYPE_NON_BLOCKING); 74 : InputEventDispatchType::DISPATCH_TYPE_NON_BLOCKING);
75 } 75 }
76 76
77 void set_always_overscroll(bool overscroll) { 77 void set_always_overscroll(bool overscroll) {
78 always_overscroll_ = overscroll; 78 always_overscroll_ = overscroll;
79 } 79 }
80 80
81 IPC::TestSink* sink() { return &sink_; } 81 IPC::TestSink* sink() { return &sink_; }
82 82
83 MockWebWidget* mock_webwidget() { return &mock_webwidget_; } 83 MockWebWidget* mock_webwidget() { return &mock_webwidget_; }
84 84
85 protected: 85 protected:
86 ~InteractiveRenderWidget() override { webwidget_ = nullptr; } 86 ~InteractiveRenderWidget() override { webwidget_internal_ = nullptr; }
87 87
88 // Overridden from RenderWidget: 88 // Overridden from RenderWidget:
89 bool HasTouchEventHandlersAt(const gfx::Point& point) const override { 89 bool HasTouchEventHandlersAt(const gfx::Point& point) const override {
90 for (std::vector<gfx::Rect>::const_iterator iter = rects_.begin(); 90 for (std::vector<gfx::Rect>::const_iterator iter = rects_.begin();
91 iter != rects_.end(); ++iter) { 91 iter != rects_.end(); ++iter) {
92 if ((*iter).Contains(point)) 92 if ((*iter).Contains(point))
93 return true; 93 return true;
94 } 94 }
95 return false; 95 return false;
96 } 96 }
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after
360 2); 360 2);
361 361
362 touch.MovePoint(0, 30, 30); 362 touch.MovePoint(0, 30, 30);
363 touch.touchStartOrFirstTouchMove = false; 363 touch.touchStartOrFirstTouchMove = false;
364 widget()->SendInputEvent(touch); 364 widget()->SendInputEvent(touch);
365 histogram_tester().ExpectTotalCount("Event.Touch.TouchLatencyOutsideFling", 365 histogram_tester().ExpectTotalCount("Event.Touch.TouchLatencyOutsideFling",
366 2); 366 2);
367 } 367 }
368 368
369 } // namespace content 369 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/render_widget_mouse_lock_dispatcher.cc ('k') | content/test/layouttest_support.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698