| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_interfaces.h" | 5 #include "components/test_runner/web_test_interfaces.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
| 10 #include "components/test_runner/app_banner_client.h" | |
| 11 #include "components/test_runner/mock_web_audio_device.h" | 10 #include "components/test_runner/mock_web_audio_device.h" |
| 12 #include "components/test_runner/mock_web_media_stream_center.h" | 11 #include "components/test_runner/mock_web_media_stream_center.h" |
| 13 #include "components/test_runner/mock_web_midi_accessor.h" | 12 #include "components/test_runner/mock_web_midi_accessor.h" |
| 14 #include "components/test_runner/mock_webrtc_peer_connection_handler.h" | 13 #include "components/test_runner/mock_webrtc_peer_connection_handler.h" |
| 15 #include "components/test_runner/test_interfaces.h" | 14 #include "components/test_runner/test_interfaces.h" |
| 16 #include "components/test_runner/test_runner.h" | 15 #include "components/test_runner/test_runner.h" |
| 17 #include "components/test_runner/web_frame_test_client.h" | 16 #include "components/test_runner/web_frame_test_client.h" |
| 18 #include "components/test_runner/web_view_test_client.h" | 17 #include "components/test_runner/web_view_test_client.h" |
| 19 #include "components/test_runner/web_view_test_proxy.h" | 18 #include "components/test_runner/web_view_test_proxy.h" |
| 20 #include "components/test_runner/web_widget_test_client.h" | 19 #include "components/test_runner/web_widget_test_client.h" |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 | 75 |
| 77 WebMIDIAccessor* WebTestInterfaces::CreateMIDIAccessor( | 76 WebMIDIAccessor* WebTestInterfaces::CreateMIDIAccessor( |
| 78 WebMIDIAccessorClient* client) { | 77 WebMIDIAccessorClient* client) { |
| 79 return new MockWebMIDIAccessor(client, interfaces_.get()); | 78 return new MockWebMIDIAccessor(client, interfaces_.get()); |
| 80 } | 79 } |
| 81 | 80 |
| 82 WebAudioDevice* WebTestInterfaces::CreateAudioDevice(double sample_rate) { | 81 WebAudioDevice* WebTestInterfaces::CreateAudioDevice(double sample_rate) { |
| 83 return new MockWebAudioDevice(sample_rate); | 82 return new MockWebAudioDevice(sample_rate); |
| 84 } | 83 } |
| 85 | 84 |
| 86 std::unique_ptr<blink::WebAppBannerClient> | |
| 87 WebTestInterfaces::CreateAppBannerClient() { | |
| 88 std::unique_ptr<AppBannerClient> client(new AppBannerClient); | |
| 89 interfaces_->SetAppBannerClient(client.get()); | |
| 90 return std::move(client); | |
| 91 } | |
| 92 | |
| 93 std::unique_ptr<WebFrameTestClient> WebTestInterfaces::CreateWebFrameTestClient( | 85 std::unique_ptr<WebFrameTestClient> WebTestInterfaces::CreateWebFrameTestClient( |
| 94 WebViewTestProxyBase* web_view_test_proxy_base, | 86 WebViewTestProxyBase* web_view_test_proxy_base, |
| 95 WebFrameTestProxyBase* web_frame_test_proxy_base) { | 87 WebFrameTestProxyBase* web_frame_test_proxy_base) { |
| 96 // TODO(lukasza): Do not pass the WebTestDelegate below - it's lifetime can | 88 // TODO(lukasza): Do not pass the WebTestDelegate below - it's lifetime can |
| 97 // differ from the lifetime of WebFrameTestClient - https://crbug.com/606594. | 89 // differ from the lifetime of WebFrameTestClient - https://crbug.com/606594. |
| 98 return base::MakeUnique<WebFrameTestClient>(interfaces_->GetDelegate(), | 90 return base::MakeUnique<WebFrameTestClient>(interfaces_->GetDelegate(), |
| 99 web_view_test_proxy_base, | 91 web_view_test_proxy_base, |
| 100 web_frame_test_proxy_base); | 92 web_frame_test_proxy_base); |
| 101 } | 93 } |
| 102 | 94 |
| 103 std::unique_ptr<WebViewTestClient> WebTestInterfaces::CreateWebViewTestClient( | 95 std::unique_ptr<WebViewTestClient> WebTestInterfaces::CreateWebViewTestClient( |
| 104 WebViewTestProxyBase* web_view_test_proxy_base) { | 96 WebViewTestProxyBase* web_view_test_proxy_base) { |
| 105 return base::MakeUnique<WebViewTestClient>(web_view_test_proxy_base); | 97 return base::MakeUnique<WebViewTestClient>(web_view_test_proxy_base); |
| 106 } | 98 } |
| 107 | 99 |
| 108 std::unique_ptr<WebWidgetTestClient> | 100 std::unique_ptr<WebWidgetTestClient> |
| 109 WebTestInterfaces::CreateWebWidgetTestClient( | 101 WebTestInterfaces::CreateWebWidgetTestClient( |
| 110 WebWidgetTestProxyBase* web_widget_test_proxy_base) { | 102 WebWidgetTestProxyBase* web_widget_test_proxy_base) { |
| 111 return base::MakeUnique<WebWidgetTestClient>(web_widget_test_proxy_base); | 103 return base::MakeUnique<WebWidgetTestClient>(web_widget_test_proxy_base); |
| 112 } | 104 } |
| 113 | 105 |
| 114 std::vector<blink::WebView*> WebTestInterfaces::GetWindowList() { | 106 std::vector<blink::WebView*> WebTestInterfaces::GetWindowList() { |
| 115 std::vector<blink::WebView*> result; | 107 std::vector<blink::WebView*> result; |
| 116 for (WebViewTestProxyBase* proxy : interfaces_->GetWindowList()) | 108 for (WebViewTestProxyBase* proxy : interfaces_->GetWindowList()) |
| 117 result.push_back(proxy->web_view()); | 109 result.push_back(proxy->web_view()); |
| 118 return result; | 110 return result; |
| 119 } | 111 } |
| 120 | 112 |
| 121 } // namespace test_runner | 113 } // namespace test_runner |
| OLD | NEW |