initial import
[vuplus_webkit] / Tools / DumpRenderTree / wx / LayoutTestControllerWx.cpp
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 #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 long long LayoutTestController::localStorageDiskUsageForOrigin(JSStringRef originIdentifier)
257 {
258     // FIXME: Implement to support getting disk usage in bytes for an origin.
259     return 0;
260 }
261
262 void LayoutTestController::setApplicationCacheOriginQuota(unsigned long long quota)
263 {
264     // FIXME: Implement to support application cache quotas.
265 }
266
267 long long LayoutTestController::applicationCacheDiskUsageForOrigin(JSStringRef origin)
268 {
269     // FIXME: Implement to support getting disk usage by all application caches for an origin.
270     return 0;
271 }
272
273
274 JSValueRef LayoutTestController::originsWithApplicationCache(JSContextRef context)
275 {
276     // FIXME: Implement to get origins that have application caches.
277     return 0;
278 }
279
280 void LayoutTestController::clearAllDatabases()
281 {
282     // FIXME: implement
283 }
284  
285 void LayoutTestController::setDatabaseQuota(unsigned long long quota)
286 {    
287     // FIXME: implement
288 }
289
290 void LayoutTestController::goBack()
291 {
292     // FIXME: implement to enable loader/navigation-while-deferring-loads.html
293 }
294
295 void LayoutTestController::setDefersLoading(bool)
296 {
297     // FIXME: implement to enable loader/navigation-while-deferring-loads.html
298 }
299
300 void LayoutTestController::setDomainRelaxationForbiddenForURLScheme(bool, JSStringRef)
301 {
302     // FIXME: implement
303 }
304
305 void LayoutTestController::setAppCacheMaximumSize(unsigned long long size)
306 {
307     // FIXME: implement
308 }
309
310 unsigned LayoutTestController::numberOfActiveAnimations() const
311 {
312     // FIXME: implement
313     return 0;
314 }
315
316 void LayoutTestController::suspendAnimations() const
317 {
318     // FIXME: implement
319 }
320
321 void LayoutTestController::resumeAnimations() const
322 {
323     // FIXME: implement
324 }
325
326 unsigned LayoutTestController::workerThreadCount() const
327 {
328     // FIXME: implement
329     return 0;
330 }
331
332 void LayoutTestController::setSelectTrailingWhitespaceEnabled(bool flag)
333 {
334     // FIXME: implement
335 }
336
337 bool LayoutTestController::pauseTransitionAtTimeOnElementWithId(JSStringRef propertyName, double time, JSStringRef elementId)
338 {
339     // FIXME: implement
340     return false;
341 }
342
343 void LayoutTestController::setMockDeviceOrientation(bool canProvideAlpha, double alpha, bool canProvideBeta, double beta, bool canProvideGamma, double gamma)
344 {
345     // FIXME: Implement for DeviceOrientation layout tests.
346     // See https://bugs.webkit.org/show_bug.cgi?id=30335.
347 }
348
349 void LayoutTestController::setMockGeolocationPosition(double latitude, double longitude, double accuracy)
350 {
351     // FIXME: Implement for Geolocation layout tests.
352     // See https://bugs.webkit.org/show_bug.cgi?id=28264.
353 }
354
355 void LayoutTestController::setMockGeolocationError(int code, JSStringRef message)
356 {
357     // FIXME: Implement for Geolocation layout tests.
358     // See https://bugs.webkit.org/show_bug.cgi?id=28264.
359 }
360
361 void LayoutTestController::setGeolocationPermission(bool allow)
362 {
363     // FIXME: Implement for Geolocation layout tests.
364     setGeolocationPermissionCommon(allow);
365 }
366
367 int LayoutTestController::numberOfPendingGeolocationPermissionRequests()
368 {
369     // FIXME: Implement for Geolocation layout tests.
370     return -1;
371 }
372
373 void LayoutTestController::addMockSpeechInputResult(JSStringRef result, double confidence, JSStringRef language)
374 {
375     // FIXME: Implement for speech input layout tests.
376     // See https://bugs.webkit.org/show_bug.cgi?id=39485.
377 }
378
379 void LayoutTestController::startSpeechInput(JSContextRef inputElement)
380 {
381     // FIXME: Implement for speech input layout tests.
382     // See https://bugs.webkit.org/show_bug.cgi?id=39485.
383 }
384
385 void LayoutTestController::setIconDatabaseEnabled(bool iconDatabaseEnabled)
386 {
387     // FIXME: implement
388 }
389
390 bool LayoutTestController::pauseAnimationAtTimeOnElementWithId(JSStringRef animationName, double time, JSStringRef elementId)
391 {
392     // FIXME: implement
393     return false;
394 }
395
396 bool LayoutTestController::sampleSVGAnimationForElementAtTime(JSStringRef animationId, double time, JSStringRef elementId)
397 {
398     // FIXME: implement
399     return false;
400 }
401
402 void LayoutTestController::setCacheModel(int)
403 {
404     // FIXME: implement
405 }
406
407 bool LayoutTestController::isCommandEnabled(JSStringRef /*name*/)
408 {
409     // FIXME: implement
410     return false;
411 }
412
413 size_t LayoutTestController::webHistoryItemCount()
414 {
415     // FIXME: implement
416     return 0;
417 }
418
419 void LayoutTestController::waitForPolicyDelegate()
420 {
421     // FIXME: Implement this.
422 }
423
424 void LayoutTestController::overridePreference(JSStringRef /* key */, JSStringRef /* value */)
425 {
426     // FIXME: implement
427 }
428
429 void LayoutTestController::addUserScript(JSStringRef source, bool runAtStart, bool allFrames)
430 {
431     printf("LayoutTestController::addUserScript not implemented.\n");
432 }
433
434 void LayoutTestController::addUserStyleSheet(JSStringRef source, bool allFrames)
435 {
436     printf("LayoutTestController::addUserStyleSheet not implemented.\n");
437 }
438
439 void LayoutTestController::showWebInspector()
440 {
441     // FIXME: Implement this.
442 }
443
444 void LayoutTestController::closeWebInspector()
445 {
446     // FIXME: Implement this.
447 }
448
449 void LayoutTestController::evaluateInWebInspector(long callId, JSStringRef script)
450 {
451     // FIXME: Implement this.
452 }
453
454 void LayoutTestController::removeAllVisitedLinks()
455 {
456     // FIXME: Implement this.
457 }
458
459 void LayoutTestController::evaluateScriptInIsolatedWorld(unsigned worldID, JSObjectRef globalObject, JSStringRef script)
460 {
461
462 }
463
464 void LayoutTestController::disableImageLoading()
465 {
466
467 }
468
469 void LayoutTestController::addOriginAccessWhitelistEntry(JSStringRef sourceOrigin, JSStringRef destinationProtocol, JSStringRef destinationHost, bool allowDestinationSubdomains)
470 {
471     // FIXME: implement
472 }
473
474 void LayoutTestController::removeOriginAccessWhitelistEntry(JSStringRef sourceOrigin, JSStringRef destinationProtocol, JSStringRef destinationHost, bool allowDestinationSubdomains)
475 {
476     // FIXME: implement
477 }
478
479 void LayoutTestController::setScrollbarPolicy(JSStringRef orientation, JSStringRef policy)
480 {
481     // FIXME: implement
482 }
483
484 JSRetainPtr<JSStringRef> LayoutTestController::counterValueForElementById(JSStringRef id)
485 {
486     return 0;
487 }
488
489 int LayoutTestController::pageNumberForElementById(JSStringRef, float, float)
490 {
491     // FIXME: implement
492     return -1;
493 }
494
495 int LayoutTestController::numberOfPages(float, float)
496 {
497     // FIXME: implement
498     return -1;
499 }
500
501 void LayoutTestController::apiTestNewWindowDataLoadBaseURL(JSStringRef utf8Data, JSStringRef baseURL)
502 {
503
504 }
505
506 void LayoutTestController::apiTestGoToCurrentBackForwardItem()
507 {
508
509 }
510
511 void LayoutTestController::setSpatialNavigationEnabled(bool)
512 {
513
514 }
515
516 void LayoutTestController::setWebViewEditable(bool)
517 {
518 }
519
520 bool LayoutTestController::callShouldCloseOnWebView()
521 {
522     return false;
523 }
524
525 JSRetainPtr<JSStringRef> LayoutTestController::layerTreeAsText() const
526 {
527     return 0;
528 }
529
530 JSRetainPtr<JSStringRef> LayoutTestController::markerTextForListItem(JSContextRef context, JSValueRef nodeObject) const
531 {
532     return 0;
533 }
534
535 JSValueRef LayoutTestController::computedStyleIncludingVisitedInfo(JSContextRef, JSValueRef)
536 {
537     return 0;
538 }
539
540 JSValueRef LayoutTestController::nodesFromRect(JSContextRef context, JSValueRef value, int x, int y, unsigned top, unsigned right, unsigned bottom, unsigned left, bool ignoreClipping)
541 {
542     // FIXME: Implement this.
543     return 0;
544 }
545
546 void LayoutTestController::authenticateSession(JSStringRef, JSStringRef, JSStringRef)
547 {
548 }
549
550 void LayoutTestController::setEditingBehavior(const char* editingBehavior)
551 {
552     // FIXME: Implement
553 }
554
555 void LayoutTestController::abortModal()
556 {
557 }
558
559 bool LayoutTestController::hasSpellingMarker(int, int)
560 {
561     // FIXME: Implement
562     return false;
563 }
564
565 bool LayoutTestController::hasGrammarMarker(int, int)
566 {
567     // FIXME: Implement
568     return false;
569 }
570
571 void LayoutTestController::dumpConfigurationForViewport(int /*deviceDPI*/, int /*deviceWidth*/, int /*deviceHeight*/, int /*availableWidth*/, int /*availableHeight*/)
572 {
573     // FIXME: Implement
574 }
575
576 JSRetainPtr<JSStringRef> LayoutTestController::pageProperty(const char* propertyName, int pageNumber) const
577 {
578     // FIXME: Implement
579     return 0;
580 }
581
582 bool LayoutTestController::isPageBoxVisible(int pageNumber) const
583 {
584     // FIXME: Implement
585     return true;
586 }
587
588 JSRetainPtr<JSStringRef> LayoutTestController::pageSizeAndMarginsInPixels(int pageNumber, int width, int height, int marginTop, int marginRight, int marginBottom, int marginLeft) const
589 {
590     // FIXME: Implement
591     return 0;
592 }
593
594 void LayoutTestController::setAsynchronousSpellCheckingEnabled(bool)
595 {
596     // FIXME: Implement this.
597 }
598
599 bool LayoutTestController::findString(JSContextRef context, JSStringRef target, JSObjectRef optionsArray)
600 {
601     // FIXME: Implement
602     return false;
603 }
604
605 void LayoutTestController::setSerializeHTTPLoads(bool)
606 {
607     // FIXME: Implement.
608 }
609
610 void LayoutTestController::setMinimumTimerInterval(double interval) {
611
612 }
613
614 void LayoutTestController::syncLocalStorage()
615 {
616     // FIXME: Implement.
617 }
618
619 void LayoutTestController::observeStorageTrackerNotifications(unsigned number)
620 {
621     // FIXME: Implement.
622 }
623
624 void LayoutTestController::deleteAllLocalStorage()
625 {
626     // FIXME: Implement.
627 }
628
629 JSValueRef LayoutTestController::originsWithLocalStorage(JSContextRef context)
630 {
631     // FIXME: Implement.
632     return 0;
633 }
634
635 void LayoutTestController::deleteLocalStorageForOrigin(JSStringRef URL)
636 {
637     // FIXME: Implement.
638 }
639
640 void LayoutTestController::setTextDirection(JSStringRef direction)
641 {
642     // FIXME: Implement.
643 }
644
645 void LayoutTestController::allowRoundingHacks()
646 {
647 }