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