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