1 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are
6 * met:
7 *
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above
11 * copyright notice, this list of conditions and the following disclaimer
12 * in the documentation and/or other materials provided with the
13 * distribution.
14 * * Neither the name of Google Inc. nor the names of its
15 * contributors may be used to endorse or promote products derived from
16 * this software without specific prior written permission.
17 *
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */
30
31 #include "public/testing/WebTestInterfaces.h"
32
33 #include "MockWebAudioDevice.h"
34 #include "MockWebMIDIAccessor.h"
35 #include "MockWebMediaStreamCenter.h"
36 #include "MockWebRTCPeerConnectionHandler.h"
37 #include "TestInterfaces.h"
38 #include "TestRunner.h"
39
40 using namespace blink;
41
42 namespace WebTestRunner {
43
WebTestInterfaces()44 WebTestInterfaces::WebTestInterfaces()
45 : m_interfaces(new TestInterfaces())
46 {
47 }
48
~WebTestInterfaces()49 WebTestInterfaces::~WebTestInterfaces()
50 {
51 }
52
setWebView(WebView * webView,WebTestProxyBase * proxy)53 void WebTestInterfaces::setWebView(WebView* webView, WebTestProxyBase* proxy)
54 {
55 m_interfaces->setWebView(webView, proxy);
56 }
57
setDelegate(WebTestDelegate * delegate)58 void WebTestInterfaces::setDelegate(WebTestDelegate* delegate)
59 {
60 m_interfaces->setDelegate(delegate);
61 }
62
bindTo(WebFrame * frame)63 void WebTestInterfaces::bindTo(WebFrame* frame)
64 {
65 m_interfaces->bindTo(frame);
66 }
67
resetAll()68 void WebTestInterfaces::resetAll()
69 {
70 m_interfaces->resetAll();
71 }
72
setTestIsRunning(bool running)73 void WebTestInterfaces::setTestIsRunning(bool running)
74 {
75 m_interfaces->setTestIsRunning(running);
76 }
77
configureForTestWithURL(const WebURL & testURL,bool generatePixels)78 void WebTestInterfaces::configureForTestWithURL(const WebURL& testURL, bool generatePixels)
79 {
80 m_interfaces->configureForTestWithURL(testURL, generatePixels);
81 }
82
testRunner()83 WebTestRunner* WebTestInterfaces::testRunner()
84 {
85 return m_interfaces->testRunner();
86 }
87
themeEngine()88 WebThemeEngine* WebTestInterfaces::themeEngine()
89 {
90 return m_interfaces->themeEngine();
91 }
92
testInterfaces()93 TestInterfaces* WebTestInterfaces::testInterfaces()
94 {
95 return m_interfaces.get();
96 }
97
createMediaStreamCenter(WebMediaStreamCenterClient * client)98 WebMediaStreamCenter* WebTestInterfaces::createMediaStreamCenter(WebMediaStreamCenterClient* client)
99 {
100 return new MockWebMediaStreamCenter(client);
101 }
102
createWebRTCPeerConnectionHandler(WebRTCPeerConnectionHandlerClient * client)103 WebRTCPeerConnectionHandler* WebTestInterfaces::createWebRTCPeerConnectionHandler(WebRTCPeerConnectionHandlerClient* client)
104 {
105 return new MockWebRTCPeerConnectionHandler(client, m_interfaces.get());
106 }
107
createMIDIAccessor(WebMIDIAccessorClient * client)108 WebMIDIAccessor* WebTestInterfaces::createMIDIAccessor(WebMIDIAccessorClient* client)
109 {
110 return new MockWebMIDIAccessor(client, m_interfaces.get());
111 }
112
createAudioDevice(double sampleRate)113 WebAudioDevice* WebTestInterfaces::createAudioDevice(double sampleRate)
114 {
115 return new MockWebAudioDevice(sampleRate);
116 }
117
118 }
119