1 /*
2 * Copyright (C) 2008 Kevin Ollivier <kevino@theolliviers.com>
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 *
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
14 * its contributors may be used to endorse or promote products derived
15 * from this software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
18 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20 * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
21 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */
28
29 #include "config.h"
30 #include "LayoutTestController.h"
31
32 #include "DumpRenderTree.h"
33 #include "WorkQueue.h"
34 #include "WorkQueueItem.h"
35 #include <JavaScriptCore/JSRetainPtr.h>
36 #include <JavaScriptCore/JSStringRef.h>
37
38
39
~LayoutTestController()40 LayoutTestController::~LayoutTestController()
41 {
42 // FIXME: implement
43 }
44
addDisallowedURL(JSStringRef url)45 void LayoutTestController::addDisallowedURL(JSStringRef url)
46 {
47 // FIXME: implement
48 }
49
clearBackForwardList()50 void LayoutTestController::clearBackForwardList()
51 {
52 }
53
copyDecodedHostName(JSStringRef name)54 JSStringRef LayoutTestController::copyDecodedHostName(JSStringRef name)
55 {
56 // FIXME: implement
57 return 0;
58 }
59
copyEncodedHostName(JSStringRef name)60 JSStringRef LayoutTestController::copyEncodedHostName(JSStringRef name)
61 {
62 // FIXME: implement
63 return 0;
64 }
65
dispatchPendingLoadRequests()66 void LayoutTestController::dispatchPendingLoadRequests()
67 {
68 // FIXME: Implement for testing fix for 6727495
69 }
70
display()71 void LayoutTestController::display()
72 {
73 }
74
keepWebHistory()75 void LayoutTestController::keepWebHistory()
76 {
77 // FIXME: implement
78 }
79
notifyDone()80 void LayoutTestController::notifyDone()
81 {
82 if (m_waitToDump && !WorkQueue::shared()->count())
83 notifyDoneFired();
84 m_waitToDump = false;
85 }
86
pathToLocalResource(JSContextRef context,JSStringRef url)87 JSStringRef LayoutTestController::pathToLocalResource(JSContextRef context, JSStringRef url)
88 {
89 // Function introduced in r28690. This may need special-casing on Windows.
90 return JSStringRetain(url); // Do nothing on Unix.
91 }
92
queueLoad(JSStringRef url,JSStringRef target)93 void LayoutTestController::queueLoad(JSStringRef url, JSStringRef target)
94 {
95 // FIXME: We need to resolve relative URLs here
96 WorkQueue::shared()->queue(new LoadItem(url, target));
97 }
98
setAcceptsEditing(bool acceptsEditing)99 void LayoutTestController::setAcceptsEditing(bool acceptsEditing)
100 {
101 }
102
setAlwaysAcceptCookies(bool alwaysAcceptCookies)103 void LayoutTestController::setAlwaysAcceptCookies(bool alwaysAcceptCookies)
104 {
105 // FIXME: Implement this (and restore the default value before running each test in DumpRenderTree.cpp).
106 }
107
setCustomPolicyDelegate(bool,bool)108 void LayoutTestController::setCustomPolicyDelegate(bool, bool)
109 {
110 // FIXME: implement
111 }
112
setMainFrameIsFirstResponder(bool flag)113 void LayoutTestController::setMainFrameIsFirstResponder(bool flag)
114 {
115 // FIXME: implement
116 }
117
setTabKeyCyclesThroughElements(bool cycles)118 void LayoutTestController::setTabKeyCyclesThroughElements(bool cycles)
119 {
120 // FIXME: implement
121 }
122
setUseDashboardCompatibilityMode(bool flag)123 void LayoutTestController::setUseDashboardCompatibilityMode(bool flag)
124 {
125 // FIXME: implement
126 }
127
setUserStyleSheetEnabled(bool flag)128 void LayoutTestController::setUserStyleSheetEnabled(bool flag)
129 {
130 }
131
setUserStyleSheetLocation(JSStringRef path)132 void LayoutTestController::setUserStyleSheetLocation(JSStringRef path)
133 {
134 }
135
setWindowIsKey(bool windowIsKey)136 void LayoutTestController::setWindowIsKey(bool windowIsKey)
137 {
138 // FIXME: implement
139 }
140
setSmartInsertDeleteEnabled(bool flag)141 void LayoutTestController::setSmartInsertDeleteEnabled(bool flag)
142 {
143 // FIXME: implement
144 }
145
setJavaScriptProfilingEnabled(bool flag)146 void LayoutTestController::setJavaScriptProfilingEnabled(bool flag)
147 {
148 }
149
setWaitToDump(bool waitUntilDone)150 void LayoutTestController::setWaitToDump(bool waitUntilDone)
151 {
152 static const int timeoutSeconds = 10;
153
154 m_waitToDump = waitUntilDone;
155 }
156
windowCount()157 int LayoutTestController::windowCount()
158 {
159 // FIXME: implement
160 return 1;
161 }
162
setPrivateBrowsingEnabled(bool privateBrowsingEnabled)163 void LayoutTestController::setPrivateBrowsingEnabled(bool privateBrowsingEnabled)
164 {
165 // FIXME: implement
166 }
167
setXSSAuditorEnabled(bool enabled)168 void LayoutTestController::setXSSAuditorEnabled(bool enabled)
169 {
170 // FIXME: implement
171 }
172
setFrameSetFlatteningEnabled(bool enabled)173 void LayoutTestController::setFrameSetFlatteningEnabled(bool enabled)
174 {
175 // FIXME: implement
176 }
177
setAllowUniversalAccessFromFileURLs(bool enabled)178 void LayoutTestController::setAllowUniversalAccessFromFileURLs(bool enabled)
179 {
180 // FIXME: implement
181 }
182
setAuthorAndUserStylesEnabled(bool flag)183 void LayoutTestController::setAuthorAndUserStylesEnabled(bool flag)
184 {
185 // FIXME: implement
186 }
187
setPopupBlockingEnabled(bool popupBlockingEnabled)188 void LayoutTestController::setPopupBlockingEnabled(bool popupBlockingEnabled)
189 {
190 // FIXME: implement
191 }
192
elementDoesAutoCompleteForElementWithId(JSStringRef id)193 bool LayoutTestController::elementDoesAutoCompleteForElementWithId(JSStringRef id)
194 {
195 // FIXME: implement
196 return false;
197 }
198
execCommand(JSStringRef name,JSStringRef value)199 void LayoutTestController::execCommand(JSStringRef name, JSStringRef value)
200 {
201 // FIXME: implement
202 }
203
setPersistentUserStyleSheetLocation(JSStringRef jsURL)204 void LayoutTestController::setPersistentUserStyleSheetLocation(JSStringRef jsURL)
205 {
206 // FIXME: implement
207 }
208
clearPersistentUserStyleSheet()209 void LayoutTestController::clearPersistentUserStyleSheet()
210 {
211 // FIXME: implement
212 }
213
clearAllDatabases()214 void LayoutTestController::clearAllDatabases()
215 {
216 // FIXME: implement
217 }
218
setDatabaseQuota(unsigned long long quota)219 void LayoutTestController::setDatabaseQuota(unsigned long long quota)
220 {
221 // FIXME: implement
222 }
223
setDomainRelaxationForbiddenForURLScheme(bool,JSStringRef)224 void LayoutTestController::setDomainRelaxationForbiddenForURLScheme(bool, JSStringRef)
225 {
226 // FIXME: implement
227 }
228
setAppCacheMaximumSize(unsigned long long size)229 void LayoutTestController::setAppCacheMaximumSize(unsigned long long size)
230 {
231 // FIXME: implement
232 }
233
numberOfActiveAnimations() const234 unsigned LayoutTestController::numberOfActiveAnimations() const
235 {
236 // FIXME: implement
237 return 0;
238 }
239
workerThreadCount() const240 unsigned LayoutTestController::workerThreadCount() const
241 {
242 // FIXME: implement
243 return 0;
244 }
245
setSelectTrailingWhitespaceEnabled(bool flag)246 void LayoutTestController::setSelectTrailingWhitespaceEnabled(bool flag)
247 {
248 // FIXME: implement
249 }
250
pauseTransitionAtTimeOnElementWithId(JSStringRef propertyName,double time,JSStringRef elementId)251 bool LayoutTestController::pauseTransitionAtTimeOnElementWithId(JSStringRef propertyName, double time, JSStringRef elementId)
252 {
253 // FIXME: implement
254 return false;
255 }
256
setMockGeolocationPosition(double latitude,double longitude,double accuracy)257 void LayoutTestController::setMockGeolocationPosition(double latitude, double longitude, double accuracy)
258 {
259 // FIXME: Implement for Geolocation layout tests.
260 // See https://bugs.webkit.org/show_bug.cgi?id=28264.
261 }
262
setMockGeolocationError(int code,JSStringRef message)263 void LayoutTestController::setMockGeolocationError(int code, JSStringRef message)
264 {
265 // FIXME: Implement for Geolocation layout tests.
266 // See https://bugs.webkit.org/show_bug.cgi?id=28264.
267 }
268
setIconDatabaseEnabled(bool iconDatabaseEnabled)269 void LayoutTestController::setIconDatabaseEnabled(bool iconDatabaseEnabled)
270 {
271 // FIXME: implement
272 }
273
pauseAnimationAtTimeOnElementWithId(JSStringRef animationName,double time,JSStringRef elementId)274 bool LayoutTestController::pauseAnimationAtTimeOnElementWithId(JSStringRef animationName, double time, JSStringRef elementId)
275 {
276 // FIXME: implement
277 return false;
278 }
279
sampleSVGAnimationForElementAtTime(JSStringRef animationId,double time,JSStringRef elementId)280 bool LayoutTestController::sampleSVGAnimationForElementAtTime(JSStringRef animationId, double time, JSStringRef elementId)
281 {
282 // FIXME: implement
283 return false;
284 }
285
setCacheModel(int)286 void LayoutTestController::setCacheModel(int)
287 {
288 // FIXME: implement
289 }
290
isCommandEnabled(JSStringRef)291 bool LayoutTestController::isCommandEnabled(JSStringRef /*name*/)
292 {
293 // FIXME: implement
294 return false;
295 }
296
webHistoryItemCount()297 size_t LayoutTestController::webHistoryItemCount()
298 {
299 // FIXME: implement
300 return 0;
301 }
302
waitForPolicyDelegate()303 void LayoutTestController::waitForPolicyDelegate()
304 {
305 // FIXME: Implement this.
306 }
307
overridePreference(JSStringRef,JSStringRef)308 void LayoutTestController::overridePreference(JSStringRef /* key */, JSStringRef /* value */)
309 {
310 // FIXME: implement
311 }
312
addUserScript(JSStringRef source,bool runAtStart)313 void LayoutTestController::addUserScript(JSStringRef source, bool runAtStart)
314 {
315 printf("LayoutTestController::addUserScript not implemented.\n");
316 }
317
addUserStyleSheet(JSStringRef source)318 void LayoutTestController::addUserStyleSheet(JSStringRef source)
319 {
320 printf("LayoutTestController::addUserStyleSheet not implemented.\n");
321 }
322
showWebInspector()323 void LayoutTestController::showWebInspector()
324 {
325 // FIXME: Implement this.
326 }
327
closeWebInspector()328 void LayoutTestController::closeWebInspector()
329 {
330 // FIXME: Implement this.
331 }
332
evaluateInWebInspector(long callId,JSStringRef script)333 void LayoutTestController::evaluateInWebInspector(long callId, JSStringRef script)
334 {
335 // FIXME: Implement this.
336 }
337
removeAllVisitedLinks()338 void LayoutTestController::removeAllVisitedLinks()
339 {
340 // FIXME: Implement this.
341 }
342
setTimelineProfilingEnabled(bool enabled)343 void LayoutTestController::setTimelineProfilingEnabled(bool enabled)
344 {
345
346 }
347
evaluateScriptInIsolatedWorld(unsigned worldId,JSObjectRef globalObject,JSStringRef script)348 void LayoutTestController::evaluateScriptInIsolatedWorld(unsigned worldId, JSObjectRef globalObject, JSStringRef script)
349 {
350
351 }
352
disableImageLoading()353 void LayoutTestController::disableImageLoading()
354 {
355
356 }
357
whiteListAccessFromOrigin(JSStringRef sourceOrigin,JSStringRef destinationProtocol,JSStringRef destinationHost,bool allowDestinationSubdomains)358 void LayoutTestController::whiteListAccessFromOrigin(JSStringRef sourceOrigin, JSStringRef destinationProtocol, JSStringRef destinationHost, bool allowDestinationSubdomains)
359 {
360
361 }
362
counterValueForElementById(JSStringRef id)363 JSRetainPtr<JSStringRef> LayoutTestController::counterValueForElementById(JSStringRef id)
364 {
365 return 0;
366 }
367
pageNumberForElementById(JSStringRef,float,float)368 int LayoutTestController::pageNumberForElementById(JSStringRef, float, float)
369 {
370 // FIXME: implement
371 return -1;
372 }
373
numberOfPages(float,float)374 int LayoutTestController::numberOfPages(float, float)
375 {
376 // FIXME: implement
377 return -1;
378 }