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

Unified Diff: components/test_runner/event_sender.cc

Issue 2036873002: Making EventSender talk to the right WebWidget (for OOPIF support). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: components/test_runner/event_sender.cc
diff --git a/components/test_runner/event_sender.cc b/components/test_runner/event_sender.cc
index 7501c3fd3836aebfab8d9945aada772fb24678ef..44ab616bdf3fd0ec7083073880f1350f1e3aa140 100644
--- a/components/test_runner/event_sender.cc
+++ b/components/test_runner/event_sender.cc
@@ -18,6 +18,7 @@
#include "build/build_config.h"
#include "components/test_runner/mock_spell_check.h"
#include "components/test_runner/test_interfaces.h"
+#include "components/test_runner/web_frame_test_proxy.h"
#include "components/test_runner/web_task.h"
#include "components/test_runner/web_test_delegate.h"
#include "components/test_runner/web_test_proxy.h"
@@ -1194,8 +1195,9 @@ EventSender::SavedEvent::SavedEvent()
milliseconds(0),
modifiers(0) {}
-EventSender::EventSender(WebTestProxyBase* web_test_proxy_base)
- : web_test_proxy_base_(web_test_proxy_base),
+EventSender::EventSender(
+ WebFrameTestProxyBase* web_frame_test_proxy_base)
+ : web_frame_test_proxy_base_(web_frame_test_proxy_base),
send_wheel_gestures_(false),
replaying_saved_events_(false),
weak_factory_(this) {
@@ -1209,10 +1211,10 @@ void EventSender::Reset() {
current_drag_data_.reset();
current_drag_effect_ = blink::WebDragOperationNone;
current_drag_effects_allowed_ = blink::WebDragOperationNone;
- if (view() &&
+ if (widget() &&
current_pointer_state_[kMousePointerId].pressed_button_ !=
WebMouseEvent::ButtonNone)
- view()->mouseCaptureLost();
+ widget()->mouseCaptureLost();
current_pointer_state_.clear();
is_drag_mode_ = true;
force_layout_on_events_ = true;
@@ -1296,7 +1298,7 @@ void EventSender::PointerDown(
blink::WebPointerProperties::PointerType pointerType,
int pointerId) {
if (force_layout_on_events_)
- view()->updateAllLifecyclePhases();
+ widget()->updateAllLifecyclePhases();
DCHECK_NE(-1, button_number);
@@ -1334,7 +1336,7 @@ void EventSender::PointerUp(
blink::WebPointerProperties::PointerType pointerType,
int pointerId) {
if (force_layout_on_events_)
- view()->updateAllLifecyclePhases();
+ widget()->updateAllLifecyclePhases();
DCHECK_NE(-1, button_number);
@@ -1593,7 +1595,7 @@ void EventSender::KeyDown(const std::string& code_str,
// EventSender.m forces a layout here, with at least one
// test (fast/forms/focus-control-to-page.html) relying on this.
if (force_layout_on_events_)
- view()->updateAllLifecyclePhases();
+ widget()->updateAllLifecyclePhases();
// In the browser, if a keyboard event corresponds to an editor command,
// the command will be dispatched to the renderer just before dispatching
@@ -1645,7 +1647,7 @@ void EventSender::ClearKillRing() {}
std::vector<std::string> EventSender::ContextClick() {
if (force_layout_on_events_) {
- view()->updateAllLifecyclePhases();
+ widget()->updateAllLifecyclePhases();
}
UpdateClickCountForButton(WebMouseEvent::ButtonRight);
@@ -1832,7 +1834,7 @@ void EventSender::GestureFlingCancel() {
event.timeStampSeconds = GetCurrentEventTimeSec();
if (force_layout_on_events_)
- view()->updateAllLifecyclePhases();
+ widget()->updateAllLifecyclePhases();
HandleInputEventOnViewOrPopup(event);
}
@@ -1868,7 +1870,7 @@ void EventSender::GestureFlingStart(float x,
event.timeStampSeconds = GetCurrentEventTimeSec();
if (force_layout_on_events_)
- view()->updateAllLifecyclePhases();
+ widget()->updateAllLifecyclePhases();
HandleInputEventOnViewOrPopup(event);
}
@@ -2069,7 +2071,7 @@ void EventSender::MouseScrollBy(gin::Arguments* args,
void EventSender::MouseMoveTo(gin::Arguments* args) {
if (force_layout_on_events_)
- view()->updateAllLifecyclePhases();
+ widget()->updateAllLifecyclePhases();
double x;
double y;
@@ -2124,7 +2126,7 @@ void EventSender::MouseMoveTo(gin::Arguments* args) {
void EventSender::MouseLeave() {
if (force_layout_on_events_)
- view()->updateAllLifecyclePhases();
+ widget()->updateAllLifecyclePhases();
WebMouseEvent event;
InitMouseEvent(WebInputEvent::MouseLeave,
@@ -2172,7 +2174,7 @@ void EventSender::SendCurrentTouchEvent(WebInputEvent::Type type,
DCHECK_GT(static_cast<unsigned>(WebTouchEvent::touchesLengthCap),
touch_points_.size());
if (force_layout_on_events_)
- view()->updateAllLifecyclePhases();
+ widget()->updateAllLifecyclePhases();
WebTouchEvent touch_event;
touch_event.type = type;
@@ -2447,7 +2449,7 @@ void EventSender::GestureEvent(WebInputEvent::Type type,
event.timeStampSeconds = GetCurrentEventTimeSec();
if (force_layout_on_events_)
- view()->updateAllLifecyclePhases();
+ widget()->updateAllLifecyclePhases();
WebInputEventResult result = HandleInputEventOnViewOrPopup(event);
@@ -2492,7 +2494,7 @@ void EventSender::InitMouseWheelEvent(gin::Arguments* args,
// determined before we send events (as well as all the other methods
// that send an event do).
if (force_layout_on_events_)
- view()->updateAllLifecyclePhases();
+ widget()->updateAllLifecyclePhases();
double horizontal;
if (!args->GetNext(&horizontal)) {
@@ -2716,11 +2718,11 @@ WebInputEventResult EventSender::HandleInputEventOnViewOrPopup(
const WebInputEvent& event) {
last_event_timestamp_ = event.timeStampSeconds;
- if (WebPagePopup* popup = view()->pagePopup()) {
+ if (WebPagePopup* popup = widget()->pagePopup()) {
if (!WebInputEvent::isKeyboardEventType(event.type))
return popup->handleInputEvent(event);
}
- return view()->handleInputEvent(event);
+ return widget()->handleInputEvent(event);
Łukasz Anforowicz 2016/06/02 21:05:19 Even after this change http/tests/security/referre
}
void EventSender::SendGesturesForMouseWheelEvent(
@@ -2749,7 +2751,7 @@ void EventSender::SendGesturesForMouseWheelEvent(
}
if (force_layout_on_events_)
- view()->updateAllLifecyclePhases();
+ widget()->updateAllLifecyclePhases();
HandleInputEventOnViewOrPopup(begin_event);
@@ -2765,7 +2767,7 @@ void EventSender::SendGesturesForMouseWheelEvent(
begin_event.data.scrollBegin.deltaHintUnits;
if (force_layout_on_events_)
- view()->updateAllLifecyclePhases();
+ widget()->updateAllLifecyclePhases();
HandleInputEventOnViewOrPopup(update_event);
WebGestureEvent end_event;
@@ -2776,24 +2778,30 @@ void EventSender::SendGesturesForMouseWheelEvent(
begin_event.data.scrollBegin.deltaHintUnits;
if (force_layout_on_events_)
- view()->updateAllLifecyclePhases();
+ widget()->updateAllLifecyclePhases();
HandleInputEventOnViewOrPopup(end_event);
}
TestInterfaces* EventSender::interfaces() {
- return web_test_proxy_base_->test_interfaces();
+ return web_frame_test_proxy_base_->web_test_proxy_base()->test_interfaces();
}
WebTestDelegate* EventSender::delegate() {
- return web_test_proxy_base_->delegate();
+ return web_frame_test_proxy_base_->web_test_proxy_base()->delegate();
}
const blink::WebView* EventSender::view() const {
- return web_test_proxy_base_->web_view();
+ return web_frame_test_proxy_base_->web_frame()->view();
}
blink::WebView* EventSender::view() {
- return web_test_proxy_base_->web_view();
+ return web_frame_test_proxy_base_->web_frame()->view();
+}
+
+blink::WebWidget* EventSender::widget() {
+ if (web_frame_test_proxy_base_->web_frame())
+ return web_frame_test_proxy_base_->web_frame()->localRoot()->frameWidget();
+ return nullptr;
}
} // namespace test_runner

Powered by Google App Engine
This is Rietveld 408576698