| 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/mock_screen_orientation_client.h" | 10 #include "components/test_runner/mock_screen_orientation_client.h" |
| 11 #include "components/test_runner/test_interfaces.h" | 11 #include "components/test_runner/test_interfaces.h" |
| 12 #include "components/test_runner/test_runner.h" | 12 #include "components/test_runner/test_runner.h" |
| 13 #include "components/test_runner/web_test_delegate.h" | 13 #include "components/test_runner/web_test_delegate.h" |
| 14 #include "components/test_runner/web_test_interfaces.h" | 14 #include "components/test_runner/web_test_interfaces.h" |
| 15 | 15 |
| 16 namespace test_runner { | 16 namespace test_runner { |
| 17 | 17 |
| 18 namespace { | |
| 19 | |
| 20 std::string DumpAllBackForwardLists(TestInterfaces* interfaces, | |
| 21 WebTestDelegate* delegate) { | |
| 22 std::string result; | |
| 23 const std::vector<WebTestProxyBase*>& window_list = | |
| 24 interfaces->GetWindowList(); | |
| 25 for (size_t i = 0; i < window_list.size(); ++i) | |
| 26 result.append(delegate->DumpHistoryForWindow(window_list.at(i))); | |
| 27 return result; | |
| 28 } | |
| 29 | |
| 30 } // namespace | |
| 31 | |
| 32 WebTestProxyBase::WebTestProxyBase() | 18 WebTestProxyBase::WebTestProxyBase() |
| 33 : test_interfaces_(nullptr), | 19 : test_interfaces_(nullptr), |
| 34 delegate_(nullptr), | 20 delegate_(nullptr), |
| 35 web_view_(nullptr), | 21 web_view_(nullptr), |
| 36 web_widget_(nullptr) {} | 22 web_widget_(nullptr) {} |
| 37 | 23 |
| 38 WebTestProxyBase::~WebTestProxyBase() { | 24 WebTestProxyBase::~WebTestProxyBase() { |
| 39 test_interfaces_->WindowClosed(this); | 25 test_interfaces_->WindowClosed(this); |
| 40 } | 26 } |
| 41 | 27 |
| 42 void WebTestProxyBase::SetInterfaces(WebTestInterfaces* interfaces) { | 28 void WebTestProxyBase::SetInterfaces(WebTestInterfaces* interfaces) { |
| 43 test_interfaces_ = interfaces->GetTestInterfaces(); | 29 test_interfaces_ = interfaces->GetTestInterfaces(); |
| 44 test_interfaces_->WindowOpened(this); | 30 test_interfaces_->WindowOpened(this); |
| 45 } | 31 } |
| 46 | 32 |
| 47 std::string WebTestProxyBase::DumpBackForwardLists() { | |
| 48 return DumpAllBackForwardLists(test_interfaces_, delegate_); | |
| 49 } | |
| 50 | |
| 51 void WebTestProxyBase::GetScreenOrientationForTesting( | 33 void WebTestProxyBase::GetScreenOrientationForTesting( |
| 52 blink::WebScreenInfo& screen_info) { | 34 blink::WebScreenInfo& screen_info) { |
| 53 MockScreenOrientationClient* mock_client = | 35 MockScreenOrientationClient* mock_client = |
| 54 test_interfaces_->GetTestRunner()->getMockScreenOrientationClient(); | 36 test_interfaces_->GetTestRunner()->getMockScreenOrientationClient(); |
| 55 if (mock_client->IsDisabled()) | 37 if (mock_client->IsDisabled()) |
| 56 return; | 38 return; |
| 57 // Override screen orientation information with mock data. | 39 // Override screen orientation information with mock data. |
| 58 screen_info.orientationType = mock_client->CurrentOrientationType(); | 40 screen_info.orientationType = mock_client->CurrentOrientationType(); |
| 59 screen_info.orientationAngle = mock_client->CurrentOrientationAngle(); | 41 screen_info.orientationAngle = mock_client->CurrentOrientationAngle(); |
| 60 } | 42 } |
| 61 | 43 |
| 62 } // namespace test_runner | 44 } // namespace test_runner |
| OLD | NEW |