1 /* 2 * Copyright (C) 2008 Kevin Ollivier <kevino (at) 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 40 LayoutTestController::~LayoutTestController() 41 { 42 // FIXME: implement 43 } 44 45 void LayoutTestController::addDisallowedURL(JSStringRef url) 46 { 47 // FIXME: implement 48 } 49 50 void LayoutTestController::clearBackForwardList() 51 { 52 } 53 54 JSStringRef LayoutTestController::copyDecodedHostName(JSStringRef name) 55 { 56 // FIXME: implement 57 return 0; 58 } 59 60 JSStringRef LayoutTestController::copyEncodedHostName(JSStringRef name) 61 { 62 // FIXME: implement 63 return 0; 64 } 65 66 void LayoutTestController::dispatchPendingLoadRequests() 67 { 68 // FIXME: Implement for testing fix for 6727495 69 } 70 71 void LayoutTestController::display() 72 { 73 } 74 75 void LayoutTestController::keepWebHistory() 76 { 77 // FIXME: implement 78 } 79 80 void LayoutTestController::notifyDone() 81 { 82 if (m_waitToDump && !WorkQueue::shared()->count()) 83 notifyDoneFired(); 84 m_waitToDump = false; 85 } 86 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 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 99 void LayoutTestController::setAcceptsEditing(bool acceptsEditing) 100 { 101 } 102 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 108 void LayoutTestController::setCustomPolicyDelegate(bool, bool) 109 { 110 // FIXME: implement 111 } 112 113 void LayoutTestController::setMainFrameIsFirstResponder(bool flag) 114 { 115 // FIXME: implement 116 } 117 118 void LayoutTestController::setTabKeyCyclesThroughElements(bool cycles) 119 { 120 // FIXME: implement 121 } 122 123 void LayoutTestController::setUseDashboardCompatibilityMode(bool flag) 124 { 125 // FIXME: implement 126 } 127 128 void LayoutTestController::setUserStyleSheetEnabled(bool flag) 129 { 130 } 131 132 void LayoutTestController::setUserStyleSheetLocation(JSStringRef path) 133 { 134 } 135 136 void LayoutTestController::setWindowIsKey(bool windowIsKey) 137 { 138 // FIXME: implement 139 } 140 141 void LayoutTestController::setSmartInsertDeleteEnabled(bool flag) 142 { 143 // FIXME: implement 144 } 145 146 void LayoutTestController::setJavaScriptProfilingEnabled(bool flag) 147 { 148 } 149 150 void LayoutTestController::setWaitToDump(bool waitUntilDone) 151 { 152 static const int timeoutSeconds = 10; 153 154 m_waitToDump = waitUntilDone; 155 } 156 157 int LayoutTestController::windowCount() 158 { 159 // FIXME: implement 160 return 1; 161 } 162 163 void LayoutTestController::setPrivateBrowsingEnabled(bool privateBrowsingEnabled) 164 { 165 // FIXME: implement 166 } 167 168 void LayoutTestController::setXSSAuditorEnabled(bool enabled) 169 { 170 // FIXME: implement 171 } 172 173 void LayoutTestController::setFrameSetFlatteningEnabled(bool enabled) 174 { 175 // FIXME: implement 176 } 177 178 void LayoutTestController::setAllowUniversalAccessFromFileURLs(bool enabled) 179 { 180 // FIXME: implement 181 } 182 183 void LayoutTestController::setAuthorAndUserStylesEnabled(bool flag) 184 { 185 // FIXME: implement 186 } 187 188 void LayoutTestController::setPopupBlockingEnabled(bool popupBlockingEnabled) 189 { 190 // FIXME: implement 191 } 192 193 bool LayoutTestController::elementDoesAutoCompleteForElementWithId(JSStringRef id) 194 { 195 // FIXME: implement 196 return false; 197 } 198 199 void LayoutTestController::execCommand(JSStringRef name, JSStringRef value) 200 { 201 // FIXME: implement 202 } 203 204 void LayoutTestController::setPersistentUserStyleSheetLocation(JSStringRef jsURL) 205 { 206 // FIXME: implement 207 } 208 209 void LayoutTestController::clearPersistentUserStyleSheet() 210 { 211 // FIXME: implement 212 } 213 214 void LayoutTestController::clearAllDatabases() 215 { 216 // FIXME: implement 217 } 218 219 void LayoutTestController::setDatabaseQuota(unsigned long long quota) 220 { 221 // FIXME: implement 222 } 223 224 void LayoutTestController::setDomainRelaxationForbiddenForURLScheme(bool, JSStringRef) 225 { 226 // FIXME: implement 227 } 228 229 void LayoutTestController::setAppCacheMaximumSize(unsigned long long size) 230 { 231 // FIXME: implement 232 } 233 234 unsigned LayoutTestController::numberOfActiveAnimations() const 235 { 236 // FIXME: implement 237 return 0; 238 } 239 240 unsigned LayoutTestController::workerThreadCount() const 241 { 242 // FIXME: implement 243 return 0; 244 } 245 246 void LayoutTestController::setSelectTrailingWhitespaceEnabled(bool flag) 247 { 248 // FIXME: implement 249 } 250 251 bool LayoutTestController::pauseTransitionAtTimeOnElementWithId(JSStringRef propertyName, double time, JSStringRef elementId) 252 { 253 // FIXME: implement 254 return false; 255 } 256 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 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 269 void LayoutTestController::setIconDatabaseEnabled(bool iconDatabaseEnabled) 270 { 271 // FIXME: implement 272 } 273 274 bool LayoutTestController::pauseAnimationAtTimeOnElementWithId(JSStringRef animationName, double time, JSStringRef elementId) 275 { 276 // FIXME: implement 277 return false; 278 } 279 280 bool LayoutTestController::sampleSVGAnimationForElementAtTime(JSStringRef animationId, double time, JSStringRef elementId) 281 { 282 // FIXME: implement 283 return false; 284 } 285 286 void LayoutTestController::setCacheModel(int) 287 { 288 // FIXME: implement 289 } 290 291 bool LayoutTestController::isCommandEnabled(JSStringRef /*name*/) 292 { 293 // FIXME: implement 294 return false; 295 } 296 297 size_t LayoutTestController::webHistoryItemCount() 298 { 299 // FIXME: implement 300 return 0; 301 } 302 303 void LayoutTestController::waitForPolicyDelegate() 304 { 305 // FIXME: Implement this. 306 } 307 308 void LayoutTestController::overridePreference(JSStringRef /* key */, JSStringRef /* value */) 309 { 310 // FIXME: implement 311 } 312 313 void LayoutTestController::addUserScript(JSStringRef source, bool runAtStart) 314 { 315 printf("LayoutTestController::addUserScript not implemented.\n"); 316 } 317 318 void LayoutTestController::addUserStyleSheet(JSStringRef source) 319 { 320 printf("LayoutTestController::addUserStyleSheet not implemented.\n"); 321 } 322 323 void LayoutTestController::showWebInspector() 324 { 325 // FIXME: Implement this. 326 } 327 328 void LayoutTestController::closeWebInspector() 329 { 330 // FIXME: Implement this. 331 } 332 333 void LayoutTestController::evaluateInWebInspector(long callId, JSStringRef script) 334 { 335 // FIXME: Implement this. 336 } 337 338 void LayoutTestController::removeAllVisitedLinks() 339 { 340 // FIXME: Implement this. 341 } 342 343 void LayoutTestController::setTimelineProfilingEnabled(bool enabled) 344 { 345 346 } 347 348 void LayoutTestController::evaluateScriptInIsolatedWorld(unsigned worldId, JSObjectRef globalObject, JSStringRef script) 349 { 350 351 } 352 353 void LayoutTestController::disableImageLoading() 354 { 355 356 } 357 358 void LayoutTestController::whiteListAccessFromOrigin(JSStringRef sourceOrigin, JSStringRef destinationProtocol, JSStringRef destinationHost, bool allowDestinationSubdomains) 359 { 360 361 } 362 363 JSRetainPtr<JSStringRef> LayoutTestController::counterValueForElementById(JSStringRef id) 364 { 365 return 0; 366 } 367 368 int LayoutTestController::pageNumberForElementById(JSStringRef, float, float) 369 { 370 // FIXME: implement 371 return -1; 372 } 373 374 int LayoutTestController::numberOfPages(float, float) 375 { 376 // FIXME: implement 377 return -1; 378 }