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