| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "components/test_runner/web_test_proxy.h" | 5 #include "components/test_runner/web_test_proxy.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include "components/test_runner/event_sender.h" | 10 #include "components/test_runner/event_sender.h" |
| 11 #include "components/test_runner/mock_screen_orientation_client.h" | 11 #include "components/test_runner/mock_screen_orientation_client.h" |
| 12 #include "components/test_runner/test_interfaces.h" | 12 #include "components/test_runner/test_interfaces.h" |
| 13 #include "components/test_runner/test_runner.h" | 13 #include "components/test_runner/test_runner.h" |
| 14 #include "components/test_runner/text_input_controller.h" |
| 14 #include "components/test_runner/web_test_delegate.h" | 15 #include "components/test_runner/web_test_delegate.h" |
| 15 #include "components/test_runner/web_test_interfaces.h" | 16 #include "components/test_runner/web_test_interfaces.h" |
| 16 | 17 |
| 17 namespace test_runner { | 18 namespace test_runner { |
| 18 | 19 |
| 19 WebTestProxyBase::WebTestProxyBase() | 20 WebTestProxyBase::WebTestProxyBase() |
| 20 : test_interfaces_(nullptr), | 21 : test_interfaces_(nullptr), |
| 21 delegate_(nullptr), | 22 delegate_(nullptr), |
| 22 web_view_(nullptr), | 23 web_view_(nullptr), |
| 23 web_widget_(nullptr), | 24 web_widget_(nullptr), |
| 24 event_sender_(new EventSender(this)) {} | 25 event_sender_(new EventSender(this)), |
| 26 text_input_controller_(new TextInputController(this)) {} |
| 25 | 27 |
| 26 WebTestProxyBase::~WebTestProxyBase() { | 28 WebTestProxyBase::~WebTestProxyBase() { |
| 27 test_interfaces_->WindowClosed(this); | 29 test_interfaces_->WindowClosed(this); |
| 28 } | 30 } |
| 29 | 31 |
| 30 void WebTestProxyBase::SetInterfaces(WebTestInterfaces* interfaces) { | 32 void WebTestProxyBase::SetInterfaces(WebTestInterfaces* interfaces) { |
| 31 test_interfaces_ = interfaces->GetTestInterfaces(); | 33 test_interfaces_ = interfaces->GetTestInterfaces(); |
| 32 test_interfaces_->WindowOpened(this); | 34 test_interfaces_->WindowOpened(this); |
| 33 } | 35 } |
| 34 | 36 |
| 35 void WebTestProxyBase::SetSendWheelGestures(bool send_gestures) { | 37 void WebTestProxyBase::SetSendWheelGestures(bool send_gestures) { |
| 36 event_sender_->set_send_wheel_gestures(send_gestures); | 38 event_sender_->set_send_wheel_gestures(send_gestures); |
| 37 } | 39 } |
| 38 | 40 |
| 39 void WebTestProxyBase::Reset() { | 41 void WebTestProxyBase::Reset() { |
| 40 event_sender_->Reset(); | 42 event_sender_->Reset(); |
| 43 // text_input_controller_ doesn't have any state to reset. |
| 41 } | 44 } |
| 42 | 45 |
| 43 void WebTestProxyBase::BindTo(blink::WebLocalFrame* frame) { | 46 void WebTestProxyBase::BindTo(blink::WebLocalFrame* frame) { |
| 44 event_sender_->Install(frame); | 47 event_sender_->Install(frame); |
| 48 text_input_controller_->Install(frame); |
| 45 } | 49 } |
| 46 | 50 |
| 47 void WebTestProxyBase::GetScreenOrientationForTesting( | 51 void WebTestProxyBase::GetScreenOrientationForTesting( |
| 48 blink::WebScreenInfo& screen_info) { | 52 blink::WebScreenInfo& screen_info) { |
| 49 MockScreenOrientationClient* mock_client = | 53 MockScreenOrientationClient* mock_client = |
| 50 test_interfaces_->GetTestRunner()->getMockScreenOrientationClient(); | 54 test_interfaces_->GetTestRunner()->getMockScreenOrientationClient(); |
| 51 if (mock_client->IsDisabled()) | 55 if (mock_client->IsDisabled()) |
| 52 return; | 56 return; |
| 53 // Override screen orientation information with mock data. | 57 // Override screen orientation information with mock data. |
| 54 screen_info.orientationType = mock_client->CurrentOrientationType(); | 58 screen_info.orientationType = mock_client->CurrentOrientationType(); |
| 55 screen_info.orientationAngle = mock_client->CurrentOrientationAngle(); | 59 screen_info.orientationAngle = mock_client->CurrentOrientationAngle(); |
| 56 } | 60 } |
| 57 | 61 |
| 58 } // namespace test_runner | 62 } // namespace test_runner |
| OLD | NEW |