2 * Copyright (C) 2008 Kevin Ollivier <kevino@theolliviers.com>
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
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.
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.
30 #include "LayoutTestController.h"
32 #include "DumpRenderTree.h"
33 #include "WorkQueue.h"
34 #include "WorkQueueItem.h"
35 #include <JavaScriptCore/JSRetainPtr.h>
36 #include <JavaScriptCore/JSStringRef.h>
40 LayoutTestController::~LayoutTestController()
45 void LayoutTestController::addDisallowedURL(JSStringRef url
)
50 void LayoutTestController::clearBackForwardList()
54 JSStringRef
LayoutTestController::copyDecodedHostName(JSStringRef name
)
60 JSStringRef
LayoutTestController::copyEncodedHostName(JSStringRef name
)
66 void LayoutTestController::dispatchPendingLoadRequests()
68 // FIXME: Implement for testing fix for 6727495
71 void LayoutTestController::display()
75 void LayoutTestController::keepWebHistory()
80 void LayoutTestController::notifyDone()
82 if (m_waitToDump
&& !WorkQueue::shared()->count())
87 JSStringRef
LayoutTestController::pathToLocalResource(JSContextRef context
, JSStringRef url
)
89 // Function introduced in r28690. This may need special-casing on Windows.
90 return JSStringRetain(url
); // Do nothing on Unix.
93 void LayoutTestController::queueLoad(JSStringRef url
, JSStringRef target
)
95 // FIXME: We need to resolve relative URLs here
96 WorkQueue::shared()->queue(new LoadItem(url
, target
));
99 void LayoutTestController::setAcceptsEditing(bool acceptsEditing
)
103 void LayoutTestController::setAlwaysAcceptCookies(bool alwaysAcceptCookies
)
105 // FIXME: Implement this (and restore the default value before running each test in DumpRenderTree.cpp).
108 void LayoutTestController::setCustomPolicyDelegate(bool, bool)
113 void LayoutTestController::setMainFrameIsFirstResponder(bool flag
)
118 void LayoutTestController::setTabKeyCyclesThroughElements(bool cycles
)
123 void LayoutTestController::setUseDashboardCompatibilityMode(bool flag
)
128 void LayoutTestController::setUserStyleSheetEnabled(bool flag
)
132 void LayoutTestController::setUserStyleSheetLocation(JSStringRef path
)
136 void LayoutTestController::setWindowIsKey(bool windowIsKey
)
141 void LayoutTestController::setSmartInsertDeleteEnabled(bool flag
)
146 void LayoutTestController::setJavaScriptProfilingEnabled(bool flag
)
150 void LayoutTestController::setWaitToDump(bool waitUntilDone
)
152 static const int timeoutSeconds
= 10;
154 m_waitToDump
= waitUntilDone
;
157 int LayoutTestController::windowCount()
163 void LayoutTestController::setPrivateBrowsingEnabled(bool privateBrowsingEnabled
)
168 void LayoutTestController::setXSSAuditorEnabled(bool enabled
)
173 void LayoutTestController::setAllowUniversalAccessFromFileURLs(bool enabled
)
178 void LayoutTestController::setAuthorAndUserStylesEnabled(bool flag
)
183 void LayoutTestController::setPopupBlockingEnabled(bool popupBlockingEnabled
)
188 bool LayoutTestController::elementDoesAutoCompleteForElementWithId(JSStringRef id
)
194 void LayoutTestController::execCommand(JSStringRef name
, JSStringRef value
)
199 void LayoutTestController::setPersistentUserStyleSheetLocation(JSStringRef jsURL
)
204 void LayoutTestController::clearPersistentUserStyleSheet()
209 void LayoutTestController::clearAllDatabases()
214 void LayoutTestController::setDatabaseQuota(unsigned long long quota
)
219 void LayoutTestController::setAppCacheMaximumSize(unsigned long long size
)
224 unsigned LayoutTestController::numberOfActiveAnimations() const
230 unsigned LayoutTestController::workerThreadCount() const
236 void LayoutTestController::setSelectTrailingWhitespaceEnabled(bool flag
)
241 bool LayoutTestController::pauseTransitionAtTimeOnElementWithId(JSStringRef propertyName
, double time
, JSStringRef elementId
)
247 void LayoutTestController::setMockGeolocationPosition(double latitude
, double longitude
, double accuracy
)
249 // FIXME: Implement for Geolocation layout tests.
250 // See https://bugs.webkit.org/show_bug.cgi?id=28264.
253 void LayoutTestController::setMockGeolocationError(int code
, JSStringRef message
)
255 // FIXME: Implement for Geolocation layout tests.
256 // See https://bugs.webkit.org/show_bug.cgi?id=28264.
259 void LayoutTestController::setIconDatabaseEnabled(bool iconDatabaseEnabled
)
264 bool LayoutTestController::pauseAnimationAtTimeOnElementWithId(JSStringRef animationName
, double time
, JSStringRef elementId
)
270 bool LayoutTestController::sampleSVGAnimationForElementAtTime(JSStringRef animationId
, double time
, JSStringRef elementId
)
276 void LayoutTestController::setCacheModel(int)
281 bool LayoutTestController::isCommandEnabled(JSStringRef
/*name*/)
287 size_t LayoutTestController::webHistoryItemCount()
293 void LayoutTestController::waitForPolicyDelegate()
295 // FIXME: Implement this.
298 void LayoutTestController::overridePreference(JSStringRef
/* key */, JSStringRef
/* value */)
303 void LayoutTestController::addUserScript(JSStringRef source
, bool runAtStart
)
305 printf("LayoutTestController::addUserScript not implemented.\n");
308 void LayoutTestController::addUserStyleSheet(JSStringRef source
)
310 printf("LayoutTestController::addUserStyleSheet not implemented.\n");
313 void LayoutTestController::showWebInspector()
315 // FIXME: Implement this.
318 void LayoutTestController::closeWebInspector()
320 // FIXME: Implement this.
323 void LayoutTestController::evaluateInWebInspector(long callId
, JSStringRef script
)
325 // FIXME: Implement this.
328 void LayoutTestController::removeAllVisitedLinks()
330 // FIXME: Implement this.
333 void LayoutTestController::setTimelineProfilingEnabled(bool enabled
)
338 void LayoutTestController::evaluateScriptInIsolatedWorld(unsigned worldId
, JSObjectRef globalObject
, JSStringRef script
)
343 void LayoutTestController::disableImageLoading()
348 void LayoutTestController::whiteListAccessFromOrigin(JSStringRef sourceOrigin
, JSStringRef destinationProtocol
, JSStringRef destinationHost
, bool allowDestinationSubdomains
)
353 JSRetainPtr
<JSStringRef
> LayoutTestController::counterValueForElementById(JSStringRef id
)