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
3 // found in the LICENSE file.
5 #include "components/test_runner/web_test_interfaces.h"
7 #include "components/test_runner/app_banner_client.h"
8 #include "components/test_runner/mock_web_audio_device.h"
9 #include "components/test_runner/mock_web_media_stream_center.h"
10 #include "components/test_runner/mock_web_midi_accessor.h"
11 #include "components/test_runner/mock_webrtc_peer_connection_handler.h"
12 #include "components/test_runner/test_interfaces.h"
13 #include "components/test_runner/test_runner.h"
15 using namespace blink
;
17 namespace test_runner
{
19 WebTestInterfaces::WebTestInterfaces() : interfaces_(new TestInterfaces()) {
22 WebTestInterfaces::~WebTestInterfaces() {
25 void WebTestInterfaces::SetWebView(WebView
* web_view
, WebTestProxyBase
* proxy
) {
26 interfaces_
->SetWebView(web_view
, proxy
);
29 void WebTestInterfaces::SetDelegate(WebTestDelegate
* delegate
) {
30 interfaces_
->SetDelegate(delegate
);
33 void WebTestInterfaces::BindTo(WebFrame
* frame
) {
34 interfaces_
->BindTo(frame
);
37 void WebTestInterfaces::ResetAll() {
38 interfaces_
->ResetAll();
41 void WebTestInterfaces::SetTestIsRunning(bool running
) {
42 interfaces_
->SetTestIsRunning(running
);
45 void WebTestInterfaces::ConfigureForTestWithURL(const WebURL
& test_url
,
46 bool generate_pixels
) {
47 interfaces_
->ConfigureForTestWithURL(test_url
, generate_pixels
);
50 WebTestRunner
* WebTestInterfaces::TestRunner() {
51 return interfaces_
->GetTestRunner();
54 WebThemeEngine
* WebTestInterfaces::ThemeEngine() {
55 return interfaces_
->GetThemeEngine();
58 TestInterfaces
* WebTestInterfaces::GetTestInterfaces() {
59 return interfaces_
.get();
62 WebMediaStreamCenter
* WebTestInterfaces::CreateMediaStreamCenter(
63 WebMediaStreamCenterClient
* client
) {
64 return new MockWebMediaStreamCenter(client
, interfaces_
.get());
67 WebRTCPeerConnectionHandler
*
68 WebTestInterfaces::CreateWebRTCPeerConnectionHandler(
69 WebRTCPeerConnectionHandlerClient
* client
) {
70 return new MockWebRTCPeerConnectionHandler(client
, interfaces_
.get());
73 WebMIDIAccessor
* WebTestInterfaces::CreateMIDIAccessor(
74 WebMIDIAccessorClient
* client
) {
75 return new MockWebMIDIAccessor(client
, interfaces_
.get());
78 WebAudioDevice
* WebTestInterfaces::CreateAudioDevice(double sample_rate
) {
79 return new MockWebAudioDevice(sample_rate
);
82 scoped_ptr
<blink::WebAppBannerClient
>
83 WebTestInterfaces::CreateAppBannerClient() {
84 scoped_ptr
<AppBannerClient
> client(new AppBannerClient
);
85 interfaces_
->SetAppBannerClient(client
.get());
89 AppBannerClient
* WebTestInterfaces::GetAppBannerClient() {
90 return interfaces_
->GetAppBannerClient();
93 } // namespace test_runner