| 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 "content/shell/test_runner/web_test_interfaces.h" | 5 #include "content/shell/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 "content/shell/test_runner/mock_web_audio_device.h" | 10 #include "content/shell/test_runner/mock_web_audio_device.h" |
| 11 #include "content/shell/test_runner/mock_web_media_stream_center.h" | 11 #include "content/shell/test_runner/mock_web_media_stream_center.h" |
| 12 #include "content/shell/test_runner/mock_web_midi_accessor.h" | 12 #include "content/shell/test_runner/mock_web_midi_accessor.h" |
| 13 #include "content/shell/test_runner/mock_webrtc_peer_connection_handler.h" | 13 #include "content/shell/test_runner/mock_webrtc_peer_connection_handler.h" |
| 14 #include "content/shell/test_runner/test_interfaces.h" | 14 #include "content/shell/test_runner/test_interfaces.h" |
| 15 #include "content/shell/test_runner/test_runner.h" | 15 #include "content/shell/test_runner/test_runner.h" |
| 16 #include "content/shell/test_runner/web_frame_test_client.h" | 16 #include "content/shell/test_runner/web_frame_test_client.h" |
| 17 #include "content/shell/test_runner/web_view_test_client.h" | 17 #include "content/shell/test_runner/web_view_test_client.h" |
| 18 #include "content/shell/test_runner/web_view_test_proxy.h" | 18 #include "content/shell/test_runner/web_view_test_proxy.h" |
| 19 #include "content/shell/test_runner/web_widget_test_client.h" | 19 #include "content/shell/test_runner/web_widget_test_client.h" |
| 20 #include "content/shell/test_runner/web_widget_test_proxy.h" | 20 #include "content/shell/test_runner/web_widget_test_proxy.h" |
| 21 #include "third_party/WebKit/public/platform/modules/webmidi/WebMIDIAccessor.h" |
| 21 | 22 |
| 22 using namespace blink; | 23 using namespace blink; |
| 23 | 24 |
| 24 namespace test_runner { | 25 namespace test_runner { |
| 25 | 26 |
| 26 WebTestInterfaces::WebTestInterfaces() : interfaces_(new TestInterfaces()) {} | 27 WebTestInterfaces::WebTestInterfaces() : interfaces_(new TestInterfaces()) {} |
| 27 | 28 |
| 28 WebTestInterfaces::~WebTestInterfaces() {} | 29 WebTestInterfaces::~WebTestInterfaces() {} |
| 29 | 30 |
| 30 void WebTestInterfaces::SetMainView(WebView* web_view) { | 31 void WebTestInterfaces::SetMainView(WebView* web_view) { |
| (...skipping 26 matching lines...) Expand all Loading... |
| 57 } | 58 } |
| 58 | 59 |
| 59 WebThemeEngine* WebTestInterfaces::ThemeEngine() { | 60 WebThemeEngine* WebTestInterfaces::ThemeEngine() { |
| 60 return interfaces_->GetThemeEngine(); | 61 return interfaces_->GetThemeEngine(); |
| 61 } | 62 } |
| 62 | 63 |
| 63 TestInterfaces* WebTestInterfaces::GetTestInterfaces() { | 64 TestInterfaces* WebTestInterfaces::GetTestInterfaces() { |
| 64 return interfaces_.get(); | 65 return interfaces_.get(); |
| 65 } | 66 } |
| 66 | 67 |
| 67 WebMediaStreamCenter* WebTestInterfaces::CreateMediaStreamCenter( | 68 std::unique_ptr<WebMediaStreamCenter> |
| 68 WebMediaStreamCenterClient* client) { | 69 WebTestInterfaces::CreateMediaStreamCenter(WebMediaStreamCenterClient* client) { |
| 69 return new MockWebMediaStreamCenter(); | 70 return base::MakeUnique<MockWebMediaStreamCenter>(); |
| 70 } | 71 } |
| 71 | 72 |
| 72 WebRTCPeerConnectionHandler* | 73 std::unique_ptr<WebRTCPeerConnectionHandler> |
| 73 WebTestInterfaces::CreateWebRTCPeerConnectionHandler( | 74 WebTestInterfaces::CreateWebRTCPeerConnectionHandler( |
| 74 WebRTCPeerConnectionHandlerClient* client) { | 75 WebRTCPeerConnectionHandlerClient* client) { |
| 75 return new MockWebRTCPeerConnectionHandler(client, interfaces_.get()); | 76 return base::MakeUnique<MockWebRTCPeerConnectionHandler>(client, |
| 77 interfaces_.get()); |
| 76 } | 78 } |
| 77 | 79 |
| 78 WebMIDIAccessor* WebTestInterfaces::CreateMIDIAccessor( | 80 std::unique_ptr<WebMIDIAccessor> WebTestInterfaces::CreateMIDIAccessor( |
| 79 WebMIDIAccessorClient* client) { | 81 WebMIDIAccessorClient* client) { |
| 80 return new MockWebMIDIAccessor(client, interfaces_.get()); | 82 return base::MakeUnique<MockWebMIDIAccessor>(client, interfaces_.get()); |
| 81 } | 83 } |
| 82 | 84 |
| 83 WebAudioDevice* WebTestInterfaces::CreateAudioDevice(double sample_rate, | 85 std::unique_ptr<WebAudioDevice> WebTestInterfaces::CreateAudioDevice( |
| 84 int frames_per_buffer) { | 86 double sample_rate, |
| 85 return new MockWebAudioDevice(sample_rate, frames_per_buffer); | 87 int frames_per_buffer) { |
| 88 return base::MakeUnique<MockWebAudioDevice>(sample_rate, frames_per_buffer); |
| 86 } | 89 } |
| 87 | 90 |
| 88 std::unique_ptr<WebFrameTestClient> WebTestInterfaces::CreateWebFrameTestClient( | 91 std::unique_ptr<WebFrameTestClient> WebTestInterfaces::CreateWebFrameTestClient( |
| 89 WebViewTestProxyBase* web_view_test_proxy_base, | 92 WebViewTestProxyBase* web_view_test_proxy_base, |
| 90 WebFrameTestProxyBase* web_frame_test_proxy_base) { | 93 WebFrameTestProxyBase* web_frame_test_proxy_base) { |
| 91 // TODO(lukasza): Do not pass the WebTestDelegate below - it's lifetime can | 94 // TODO(lukasza): Do not pass the WebTestDelegate below - it's lifetime can |
| 92 // differ from the lifetime of WebFrameTestClient - https://crbug.com/606594. | 95 // differ from the lifetime of WebFrameTestClient - https://crbug.com/606594. |
| 93 return base::MakeUnique<WebFrameTestClient>(interfaces_->GetDelegate(), | 96 return base::MakeUnique<WebFrameTestClient>(interfaces_->GetDelegate(), |
| 94 web_view_test_proxy_base, | 97 web_view_test_proxy_base, |
| 95 web_frame_test_proxy_base); | 98 web_frame_test_proxy_base); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 107 } | 110 } |
| 108 | 111 |
| 109 std::vector<blink::WebView*> WebTestInterfaces::GetWindowList() { | 112 std::vector<blink::WebView*> WebTestInterfaces::GetWindowList() { |
| 110 std::vector<blink::WebView*> result; | 113 std::vector<blink::WebView*> result; |
| 111 for (WebViewTestProxyBase* proxy : interfaces_->GetWindowList()) | 114 for (WebViewTestProxyBase* proxy : interfaces_->GetWindowList()) |
| 112 result.push_back(proxy->web_view()); | 115 result.push_back(proxy->web_view()); |
| 113 return result; | 116 return result; |
| 114 } | 117 } |
| 115 | 118 |
| 116 } // namespace test_runner | 119 } // namespace test_runner |
| OLD | NEW |