abhishek.a21 | bdd07a8 | 2014-09-25 06:34:10 | [diff] [blame] | 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. |
| 4 | |
jochen | 73e711c | 2015-06-03 10:01:46 | [diff] [blame] | 5 | #include "components/test_runner/web_test_interfaces.h" |
abhishek.a21 | bdd07a8 | 2014-09-25 06:34:10 | [diff] [blame] | 6 | |
jochen | 73e711c | 2015-06-03 10:01:46 | [diff] [blame] | 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" |
abhishek.a21 | bdd07a8 | 2014-09-25 06:34:10 | [diff] [blame] | 14 | |
| 15 | using namespace blink; |
| 16 | |
jochen | f5f3175 | 2015-06-03 12:06:34 | [diff] [blame] | 17 | namespace test_runner { |
abhishek.a21 | bdd07a8 | 2014-09-25 06:34:10 | [diff] [blame] | 18 | |
| 19 | WebTestInterfaces::WebTestInterfaces() : interfaces_(new TestInterfaces()) { |
| 20 | } |
| 21 | |
| 22 | WebTestInterfaces::~WebTestInterfaces() { |
| 23 | } |
| 24 | |
| 25 | void WebTestInterfaces::SetWebView(WebView* web_view, WebTestProxyBase* proxy) { |
| 26 | interfaces_->SetWebView(web_view, proxy); |
| 27 | } |
| 28 | |
| 29 | void WebTestInterfaces::SetDelegate(WebTestDelegate* delegate) { |
| 30 | interfaces_->SetDelegate(delegate); |
| 31 | } |
| 32 | |
| 33 | void WebTestInterfaces::BindTo(WebFrame* frame) { |
| 34 | interfaces_->BindTo(frame); |
| 35 | } |
| 36 | |
| 37 | void WebTestInterfaces::ResetAll() { |
| 38 | interfaces_->ResetAll(); |
| 39 | } |
| 40 | |
| 41 | void WebTestInterfaces::SetTestIsRunning(bool running) { |
| 42 | interfaces_->SetTestIsRunning(running); |
| 43 | } |
| 44 | |
| 45 | void WebTestInterfaces::ConfigureForTestWithURL(const WebURL& test_url, |
| 46 | bool generate_pixels) { |
| 47 | interfaces_->ConfigureForTestWithURL(test_url, generate_pixels); |
| 48 | } |
| 49 | |
| 50 | WebTestRunner* WebTestInterfaces::TestRunner() { |
| 51 | return interfaces_->GetTestRunner(); |
| 52 | } |
| 53 | |
| 54 | WebThemeEngine* WebTestInterfaces::ThemeEngine() { |
| 55 | return interfaces_->GetThemeEngine(); |
| 56 | } |
| 57 | |
| 58 | TestInterfaces* WebTestInterfaces::GetTestInterfaces() { |
| 59 | return interfaces_.get(); |
| 60 | } |
| 61 | |
| 62 | WebMediaStreamCenter* WebTestInterfaces::CreateMediaStreamCenter( |
| 63 | WebMediaStreamCenterClient* client) { |
| 64 | return new MockWebMediaStreamCenter(client, interfaces_.get()); |
| 65 | } |
| 66 | |
| 67 | WebRTCPeerConnectionHandler* |
| 68 | WebTestInterfaces::CreateWebRTCPeerConnectionHandler( |
| 69 | WebRTCPeerConnectionHandlerClient* client) { |
| 70 | return new MockWebRTCPeerConnectionHandler(client, interfaces_.get()); |
| 71 | } |
| 72 | |
| 73 | WebMIDIAccessor* WebTestInterfaces::CreateMIDIAccessor( |
| 74 | WebMIDIAccessorClient* client) { |
| 75 | return new MockWebMIDIAccessor(client, interfaces_.get()); |
| 76 | } |
| 77 | |
| 78 | WebAudioDevice* WebTestInterfaces::CreateAudioDevice(double sample_rate) { |
| 79 | return new MockWebAudioDevice(sample_rate); |
| 80 | } |
| 81 | |
benwells | 0c0d3f1 | 2015-05-25 01:03:17 | [diff] [blame] | 82 | scoped_ptr<blink::WebAppBannerClient> |
| 83 | WebTestInterfaces::CreateAppBannerClient() { |
| 84 | scoped_ptr<AppBannerClient> client(new AppBannerClient); |
| 85 | interfaces_->SetAppBannerClient(client.get()); |
| 86 | return client.Pass(); |
| 87 | } |
| 88 | |
jochen | 746754c5 | 2015-06-05 16:40:41 | [diff] [blame] | 89 | AppBannerClient* WebTestInterfaces::GetAppBannerClient() { |
| 90 | return interfaces_->GetAppBannerClient(); |
| 91 | } |
| 92 | |
jochen | f5f3175 | 2015-06-03 12:06:34 | [diff] [blame] | 93 | } // namespace test_runner |