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