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 #include <stdio.h> 39 40 41 42 LayoutTestController::~LayoutTestController() 43 { 44 // FIXME: implement 45 } 46 47 void LayoutTestController::addDisallowedURL(JSStringRef url) 48 { 49 // FIXME: implement 50 } 51 52 void LayoutTestController::clearBackForwardList() 53 { 54 } 55 56 JSStringRef LayoutTestController::copyDecodedHostName(JSStringRef name) 57 { 58 // FIXME: implement 59 return 0; 60 } 61 62 JSStringRef LayoutTestController::copyEncodedHostName(JSStringRef name) 63 { 64 // FIXME: implement 65 return 0; 66 } 67 68 void LayoutTestController::dispatchPendingLoadRequests() 69 { 70 // FIXME: Implement for testing fix for 6727495 71 } 72 73 void LayoutTestController::display() 74 { 75 } 76 77 void LayoutTestController::keepWebHistory() 78 { 79 // FIXME: implement 80 } 81 82 void LayoutTestController::notifyDone() 83 { 84 if (m_waitToDump && !WorkQueue::shared()->count()) 85 notifyDoneFired(); 86 m_waitToDump = false; 87 } 88 89 JSStringRef LayoutTestController::pathToLocalResource(JSContextRef context, JSStringRef url) 90 { 91 // Function introduced in r28690. This may need special-casing on Windows. 92 return JSStringRetain(url); // Do nothing on Unix. 93 } 94 95 void LayoutTestController::queueLoad(JSStringRef url, JSStringRef target) 96 { 97 // FIXME: We need to resolve relative URLs here 98 WorkQueue::shared()->queue(new LoadItem(url, target)); 99 } 100 101 void LayoutTestController::setAcceptsEditing(bool acceptsEditing) 102 { 103 } 104 105 void LayoutTestController::setAlwaysAcceptCookies(bool alwaysAcceptCookies) 106 { 107 // FIXME: Implement this (and restore the default value before running each test in DumpRenderTree.cpp). 108 } 109 110 void LayoutTestController::setCustomPolicyDelegate(bool, bool) 111 { 112 // FIXME: implement 113 } 114 115 void LayoutTestController::setMainFrameIsFirstResponder(bool flag) 116 { 117 // FIXME: implement 118 } 119 120 void LayoutTestController::setTabKeyCyclesThroughElements(bool cycles) 121 { 122 // FIXME: implement 123 } 124 125 void LayoutTestController::setUseDashboardCompatibilityMode(bool flag) 126 { 127 // FIXME: implement 128 } 129 130 void LayoutTestController::setUserStyleSheetEnabled(bool flag) 131 { 132 } 133 134 void LayoutTestController::setUserStyleSheetLocation(JSStringRef path) 135 { 136 } 137 138 void LayoutTestController::setValueForUser(JSContextRef context, JSValueRef element, JSStringRef value) 139 { 140 // FIXME: implement 141 } 142 143 void LayoutTestController::setViewModeMediaFeature(JSStringRef mode) 144 { 145 // FIXME: implement 146 } 147 148 void LayoutTestController::setWindowIsKey(bool windowIsKey) 149 { 150 // FIXME: implement 151 } 152 153 void LayoutTestController::setSmartInsertDeleteEnabled(bool flag) 154 { 155 // FIXME: implement 156 } 157 158 void LayoutTestController::setJavaScriptProfilingEnabled(bool flag) 159 { 160 } 161 162 void LayoutTestController::setWaitToDump(bool waitUntilDone) 163 { 164 static const int timeoutSeconds = 10; 165 166 m_waitToDump = waitUntilDone; 167 } 168 169 int LayoutTestController::windowCount() 170 { 171 // FIXME: implement 172 return 1; 173 } 174 175 void LayoutTestController::setPrivateBrowsingEnabled(bool privateBrowsingEnabled) 176 { 177 // FIXME: implement 178 } 179 180 void LayoutTestController::setJavaScriptCanAccessClipboard(bool enabled) 181 { 182 // FIXME: implement 183 } 184 185 void LayoutTestController::setXSSAuditorEnabled(bool enabled) 186 { 187 // FIXME: implement 188 } 189 190 void LayoutTestController::setFrameFlatteningEnabled(bool enabled) 191 { 192 // FIXME: implement 193 } 194 195 void LayoutTestController::setAllowUniversalAccessFromFileURLs(bool enabled) 196 { 197 // FIXME: implement 198 } 199 200 void LayoutTestController::setAllowFileAccessFromFileURLs(bool enabled) 201 { 202 // FIXME: implement 203 } 204 205 void LayoutTestController::setAuthorAndUserStylesEnabled(bool flag) 206 { 207 // FIXME: implement 208 } 209 210 void LayoutTestController::setAutofilled(JSContextRef, JSValueRef element, bool isAutofilled) 211 { 212 // FIXME: implement 213 } 214 215 void LayoutTestController::setPopupBlockingEnabled(bool popupBlockingEnabled) 216 { 217 // FIXME: implement 218 } 219 220 void LayoutTestController::setPluginsEnabled(bool flag) 221 { 222 // FIXME: Implement 223 } 224 225 bool LayoutTestController::elementDoesAutoCompleteForElementWithId(JSStringRef id) 226 { 227 // FIXME: implement 228 return false; 229 } 230 231 void LayoutTestController::execCommand(JSStringRef name, JSStringRef value) 232 { 233 // FIXME: implement 234 } 235 236 void LayoutTestController::setPersistentUserStyleSheetLocation(JSStringRef jsURL) 237 { 238 // FIXME: implement 239 } 240 241 void LayoutTestController::clearPersistentUserStyleSheet() 242 { 243 // FIXME: implement 244 } 245 246 void LayoutTestController::clearAllApplicationCaches() 247 { 248 // FIXME: Implement to support application cache quotas. 249 } 250 251 void LayoutTestController::clearApplicationCacheForOrigin(JSStringRef url) 252 { 253 // FIXME: Implement to support deleting all application cache for an origin. 254 } 255 256 void LayoutTestController::setApplicationCacheOriginQuota(unsigned long long quota) 257 { 258 // FIXME: Implement to support application cache quotas. 259 } 260 261 JSValueRef LayoutTestController::originsWithApplicationCache(JSContextRef context) 262 { 263 // FIXME: Implement to get origins that have application caches. 264 return 0; 265 } 266 267 void LayoutTestController::clearAllDatabases() 268 { 269 // FIXME: implement 270 } 271 272 void LayoutTestController::setDatabaseQuota(unsigned long long quota) 273 { 274 // FIXME: implement 275 } 276 277 void LayoutTestController::setDomainRelaxationForbiddenForURLScheme(bool, JSStringRef) 278 { 279 // FIXME: implement 280 } 281 282 void LayoutTestController::setAppCacheMaximumSize(unsigned long long size) 283 { 284 // FIXME: implement 285 } 286 287 unsigned LayoutTestController::numberOfActiveAnimations() const 288 { 289 // FIXME: implement 290 return 0; 291 } 292 293 void LayoutTestController::suspendAnimations() const 294 { 295 // FIXME: implement 296 } 297 298 void LayoutTestController::resumeAnimations() const 299 { 300 // FIXME: implement 301 } 302 303 unsigned LayoutTestController::workerThreadCount() const 304 { 305 // FIXME: implement 306 return 0; 307 } 308 309 void LayoutTestController::setSelectTrailingWhitespaceEnabled(bool flag) 310 { 311 // FIXME: implement 312 } 313 314 bool LayoutTestController::pauseTransitionAtTimeOnElementWithId(JSStringRef propertyName, double time, JSStringRef elementId) 315 { 316 // FIXME: implement 317 return false; 318 } 319 320 void LayoutTestController::setMockDeviceOrientation(bool canProvideAlpha, double alpha, bool canProvideBeta, double beta, bool canProvideGamma, double gamma) 321 { 322 // FIXME: Implement for DeviceOrientation layout tests. 323 // See https://bugs.webkit.org/show_bug.cgi?id=30335. 324 } 325 326 void LayoutTestController::setMockGeolocationPosition(double latitude, double longitude, double accuracy) 327 { 328 // FIXME: Implement for Geolocation layout tests. 329 // See https://bugs.webkit.org/show_bug.cgi?id=28264. 330 } 331 332 void LayoutTestController::setMockGeolocationError(int code, JSStringRef message) 333 { 334 // FIXME: Implement for Geolocation layout tests. 335 // See https://bugs.webkit.org/show_bug.cgi?id=28264. 336 } 337 338 void LayoutTestController::setGeolocationPermission(bool allow) 339 { 340 // FIXME: Implement for Geolocation layout tests. 341 setGeolocationPermissionCommon(allow); 342 } 343 344 int LayoutTestController::numberOfPendingGeolocationPermissionRequests() 345 { 346 // FIXME: Implement for Geolocation layout tests. 347 return -1; 348 } 349 350 void LayoutTestController::addMockSpeechInputResult(JSStringRef result, double confidence, JSStringRef language) 351 { 352 // FIXME: Implement for speech input layout tests. 353 // See https://bugs.webkit.org/show_bug.cgi?id=39485. 354 } 355 356 void LayoutTestController::setIconDatabaseEnabled(bool iconDatabaseEnabled) 357 { 358 // FIXME: implement 359 } 360 361 bool LayoutTestController::pauseAnimationAtTimeOnElementWithId(JSStringRef animationName, double time, JSStringRef elementId) 362 { 363 // FIXME: implement 364 return false; 365 } 366 367 bool LayoutTestController::sampleSVGAnimationForElementAtTime(JSStringRef animationId, double time, JSStringRef elementId) 368 { 369 // FIXME: implement 370 return false; 371 } 372 373 void LayoutTestController::setCacheModel(int) 374 { 375 // FIXME: implement 376 } 377 378 bool LayoutTestController::isCommandEnabled(JSStringRef /*name*/) 379 { 380 // FIXME: implement 381 return false; 382 } 383 384 size_t LayoutTestController::webHistoryItemCount() 385 { 386 // FIXME: implement 387 return 0; 388 } 389 390 void LayoutTestController::waitForPolicyDelegate() 391 { 392 // FIXME: Implement this. 393 } 394 395 void LayoutTestController::overridePreference(JSStringRef /* key */, JSStringRef /* value */) 396 { 397 // FIXME: implement 398 } 399 400 void LayoutTestController::addUserScript(JSStringRef source, bool runAtStart, bool allFrames) 401 { 402 printf("LayoutTestController::addUserScript not implemented.\n"); 403 } 404 405 void LayoutTestController::addUserStyleSheet(JSStringRef source, bool allFrames) 406 { 407 printf("LayoutTestController::addUserStyleSheet not implemented.\n"); 408 } 409 410 void LayoutTestController::showWebInspector() 411 { 412 // FIXME: Implement this. 413 } 414 415 void LayoutTestController::closeWebInspector() 416 { 417 // FIXME: Implement this. 418 } 419 420 void LayoutTestController::evaluateInWebInspector(long callId, JSStringRef script) 421 { 422 // FIXME: Implement this. 423 } 424 425 void LayoutTestController::removeAllVisitedLinks() 426 { 427 // FIXME: Implement this. 428 } 429 430 void LayoutTestController::setTimelineProfilingEnabled(bool enabled) 431 { 432 433 } 434 435 void LayoutTestController::evaluateScriptInIsolatedWorld(unsigned worldId, JSObjectRef globalObject, JSStringRef script) 436 { 437 438 } 439 440 void LayoutTestController::disableImageLoading() 441 { 442 443 } 444 445 void LayoutTestController::addOriginAccessWhitelistEntry(JSStringRef sourceOrigin, JSStringRef destinationProtocol, JSStringRef destinationHost, bool allowDestinationSubdomains) 446 { 447 // FIXME: implement 448 } 449 450 void LayoutTestController::removeOriginAccessWhitelistEntry(JSStringRef sourceOrigin, JSStringRef destinationProtocol, JSStringRef destinationHost, bool allowDestinationSubdomains) 451 { 452 // FIXME: implement 453 } 454 455 void LayoutTestController::setScrollbarPolicy(JSStringRef orientation, JSStringRef policy) 456 { 457 // FIXME: implement 458 } 459 460 JSRetainPtr<JSStringRef> LayoutTestController::counterValueForElementById(JSStringRef id) 461 { 462 return 0; 463 } 464 465 int LayoutTestController::pageNumberForElementById(JSStringRef, float, float) 466 { 467 // FIXME: implement 468 return -1; 469 } 470 471 int LayoutTestController::numberOfPages(float, float) 472 { 473 // FIXME: implement 474 return -1; 475 } 476 477 void LayoutTestController::apiTestNewWindowDataLoadBaseURL(JSStringRef utf8Data, JSStringRef baseURL) 478 { 479 480 } 481 482 void LayoutTestController::apiTestGoToCurrentBackForwardItem() 483 { 484 485 } 486 487 void LayoutTestController::setSpatialNavigationEnabled(bool) 488 { 489 490 } 491 492 void LayoutTestController::setWebViewEditable(bool) 493 { 494 } 495 496 bool LayoutTestController::callShouldCloseOnWebView() 497 { 498 return false; 499 } 500 501 JSRetainPtr<JSStringRef> LayoutTestController::layerTreeAsText() const 502 { 503 return 0; 504 } 505 506 JSRetainPtr<JSStringRef> LayoutTestController::markerTextForListItem(JSContextRef context, JSValueRef nodeObject) const 507 { 508 return 0; 509 } 510 511 JSValueRef LayoutTestController::computedStyleIncludingVisitedInfo(JSContextRef, JSValueRef) 512 { 513 return 0; 514 } 515 516 JSValueRef LayoutTestController::nodesFromRect(JSContextRef context, JSValueRef value, int x, int y, unsigned top, unsigned right, unsigned bottom, unsigned left, bool ignoreClipping) 517 { 518 // FIXME: Implement this. 519 return 0; 520 } 521 522 void LayoutTestController::authenticateSession(JSStringRef, JSStringRef, JSStringRef) 523 { 524 } 525 526 void LayoutTestController::setEditingBehavior(const char* editingBehavior) 527 { 528 // FIXME: Implement 529 } 530 531 void LayoutTestController::abortModal() 532 { 533 } 534 535 bool LayoutTestController::hasSpellingMarker(int, int) 536 { 537 // FIXME: Implement 538 return false; 539 } 540 541 bool LayoutTestController::hasGrammarMarker(int, int) 542 { 543 // FIXME: Implement 544 return false; 545 } 546 547 void LayoutTestController::dumpConfigurationForViewport(int /*deviceDPI*/, int /*deviceWidth*/, int /*deviceHeight*/, int /*availableWidth*/, int /*availableHeight*/) 548 { 549 // FIXME: Implement 550 } 551 552 JSRetainPtr<JSStringRef> LayoutTestController::pageProperty(const char* propertyName, int pageNumber) const 553 { 554 // FIXME: Implement 555 return 0; 556 } 557 558 bool LayoutTestController::isPageBoxVisible(int pageNumber) const 559 { 560 // FIXME: Implement 561 return true; 562 } 563 564 JSRetainPtr<JSStringRef> LayoutTestController::pageSizeAndMarginsInPixels(int pageNumber, int width, int height, int marginTop, int marginRight, int marginBottom, int marginLeft) const 565 { 566 // FIXME: Implement 567 return 0; 568 } 569 570 void LayoutTestController::setAsynchronousSpellCheckingEnabled(bool) 571 { 572 // FIXME: Implement this. 573 } 574 575 bool LayoutTestController::findString(JSContextRef context, JSStringRef target, JSObjectRef optionsArray) 576 { 577 // FIXME: Implement 578 return false; 579 } 580 581 void LayoutTestController::setSerializeHTTPLoads(bool) 582 { 583 // FIXME: Implement. 584 } 585 586 void LayoutTestController::setMinimumTimerInterval(double interval) { 587 588 } 589 590 void LayoutTestController::syncLocalStorage() 591 { 592 // FIXME: Implement. 593 } 594 595 void LayoutTestController::observeStorageTrackerNotifications(unsigned number) 596 { 597 // FIXME: Implement. 598 } 599 600 void LayoutTestController::deleteAllLocalStorage() 601 { 602 // FIXME: Implement. 603 } 604 605 JSValueRef LayoutTestController::originsWithLocalStorage(JSContextRef context) 606 { 607 // FIXME: Implement. 608 return 0; 609 } 610 611 void LayoutTestController::deleteLocalStorageForOrigin(JSStringRef URL) 612 { 613 // FIXME: Implement. 614 } 615 616 const OpaqueJSValue* LayoutTestController::shadowRoot(const OpaqueJSContext*, const OpaqueJSValue*) 617 { 618 // FIXME: Implement. 619 return 0; 620 } 621