[BlackBerry] DumpRenderTreeSupport: update the set position methods
[WebKit-https.git] / Tools / DumpRenderTree / blackberry / TestRunnerBlackBerry.cpp
1 /*
2  * Copyright (C) 2009, 2010, 2012 Research In Motion Limited. All rights reserved.
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
17  */
18
19 #include "config.h"
20 #include "TestRunner.h"
21
22 #include "DatabaseTracker.h"
23 #include "Document.h"
24 #include "DocumentLoader.h"
25 #include "DocumentMarker.h"
26 #include "DumpRenderTree.h"
27 #include "DumpRenderTreeBlackBerry.h"
28 #include "DumpRenderTreeSupport.h"
29 #include "EditingBehaviorTypes.h"
30 #include "EditorClientBlackBerry.h"
31 #include "Element.h"
32 #include "Frame.h"
33 #include "HTMLInputElement.h"
34 #include "JSElement.h"
35 #include "KURL.h"
36 #include "NotImplemented.h"
37 #include "Page.h"
38 #include "RenderTreeAsText.h"
39 #include "SchemeRegistry.h"
40 #include "SecurityOrigin.h"
41 #include "SecurityPolicy.h"
42 #include "Settings.h"
43 #include "WorkQueue.h"
44 #include "WorkQueueItem.h"
45
46 #include <JavaScriptCore/APICast.h>
47 #include <SharedPointer.h>
48 #include <WebPage.h>
49 #include <WebSettings.h>
50
51 #include <wtf/OwnArrayPtr.h>
52 #include <wtf/UnusedParam.h>
53 #include <wtf/text/CString.h>
54
55 using WebCore::toElement;
56 using WebCore::toJS;
57
58 TestRunner::~TestRunner()
59 {
60 }
61
62 void TestRunner::addDisallowedURL(JSStringRef url)
63 {
64     UNUSED_PARAM(url);
65     notImplemented();
66 }
67
68 void TestRunner::clearAllDatabases()
69 {
70 #if ENABLE(DATABASE)
71     WebCore::DatabaseTracker::tracker().deleteAllDatabases();
72 #endif
73 }
74
75 void TestRunner::clearBackForwardList()
76 {
77     BlackBerry::WebKit::DumpRenderTree::currentInstance()->page()->clearBackForwardList(true);
78 }
79
80 void TestRunner::clearPersistentUserStyleSheet()
81 {
82     notImplemented();
83 }
84
85 JSStringRef TestRunner::copyDecodedHostName(JSStringRef name)
86 {
87     UNUSED_PARAM(name);
88     notImplemented();
89     return 0;
90 }
91
92 JSStringRef TestRunner::copyEncodedHostName(JSStringRef name)
93 {
94     UNUSED_PARAM(name);
95     notImplemented();
96     return 0;
97 }
98
99 void TestRunner::dispatchPendingLoadRequests()
100 {
101     notImplemented();
102 }
103
104 void TestRunner::display()
105 {
106     notImplemented();
107 }
108
109 static String jsStringRefToWebCoreString(JSStringRef str)
110 {
111     size_t strArrSize = JSStringGetMaximumUTF8CStringSize(str);
112     OwnArrayPtr<char> strArr = adoptArrayPtr(new char[strArrSize]);
113     JSStringGetUTF8CString(str, strArr.get(), strArrSize);
114     return String::fromUTF8(strArr.get());
115 }
116
117 void TestRunner::execCommand(JSStringRef name, JSStringRef value)
118 {
119     if (!mainFrame)
120         return;
121
122     String nameStr = jsStringRefToWebCoreString(name);
123     String valueStr = jsStringRefToWebCoreString(value);
124
125     mainFrame->editor()->command(nameStr).execute(valueStr);
126 }
127
128 bool TestRunner::isCommandEnabled(JSStringRef name)
129 {
130     if (!mainFrame)
131         return false;
132
133     String nameStr = jsStringRefToWebCoreString(name);
134
135     return mainFrame->editor()->command(nameStr).isEnabled();
136 }
137
138 void TestRunner::keepWebHistory()
139 {
140     notImplemented();
141 }
142
143 void TestRunner::notifyDone()
144 {
145     if (m_waitToDump && (!topLoadingFrame || BlackBerry::WebKit::DumpRenderTree::currentInstance()->loadFinished()) && !WorkQueue::shared()->count())
146         dump();
147
148     m_waitToDump = false;
149     waitForPolicy = false;
150 }
151
152 JSStringRef TestRunner::pathToLocalResource(JSContextRef, JSStringRef url)
153 {
154     return JSStringRetain(url);
155 }
156
157 void TestRunner::queueLoad(JSStringRef url, JSStringRef target)
158 {
159     size_t urlArrSize = JSStringGetMaximumUTF8CStringSize(url);
160     OwnArrayPtr<char> urlArr = adoptArrayPtr(new char[urlArrSize]);
161     JSStringGetUTF8CString(url, urlArr.get(), urlArrSize);
162
163     WebCore::KURL base = mainFrame->loader()->documentLoader()->response().url();
164     WebCore::KURL absolute(base, urlArr.get());
165
166     JSRetainPtr<JSStringRef> absoluteURL(Adopt, JSStringCreateWithUTF8CString(absolute.string().utf8().data()));
167     WorkQueue::shared()->queue(new LoadItem(absoluteURL.get(), target));
168 }
169
170 void TestRunner::setAcceptsEditing(bool acceptsEditing)
171 {
172     BlackBerry::WebKit::DumpRenderTree::currentInstance()->setAcceptsEditing(acceptsEditing);
173 }
174
175 void TestRunner::setAppCacheMaximumSize(unsigned long long quota)
176 {
177     UNUSED_PARAM(quota);
178     notImplemented();
179 }
180
181 void TestRunner::setAuthorAndUserStylesEnabled(bool enable)
182 {
183     mainFrame->page()->settings()->setAuthorAndUserStylesEnabled(enable);
184 }
185
186 void TestRunner::setCacheModel(int)
187 {
188     notImplemented();
189 }
190
191 void TestRunner::setCustomPolicyDelegate(bool setDelegate, bool permissive)
192 {
193     BlackBerry::WebKit::DumpRenderTree::currentInstance()->setCustomPolicyDelegate(setDelegate, permissive);
194 }
195
196 void TestRunner::clearApplicationCacheForOrigin(OpaqueJSString*)
197 {
198     // FIXME: Implement to support deleting all application caches for an origin.
199     notImplemented();
200 }
201
202 long long TestRunner::localStorageDiskUsageForOrigin(JSStringRef)
203 {
204     // FIXME: Implement to support getting disk usage in bytes for an origin.
205     notImplemented();
206     return 0;
207 }
208
209 JSValueRef TestRunner::originsWithApplicationCache(JSContextRef context)
210 {
211     // FIXME: Implement to get origins that contain application caches.
212     notImplemented();
213     return JSValueMakeUndefined(context);
214 }
215
216 void TestRunner::setDatabaseQuota(unsigned long long quota)
217 {
218     if (!mainFrame)
219         return;
220
221     WebCore::DatabaseTracker::tracker().setQuota(mainFrame->document()->securityOrigin(), quota);
222 }
223
224 void TestRunner::setDomainRelaxationForbiddenForURLScheme(bool forbidden, JSStringRef scheme)
225 {
226     WebCore::SchemeRegistry::setDomainRelaxationForbiddenForURLScheme(forbidden, jsStringRefToWebCoreString(scheme));
227 }
228
229 void TestRunner::setIconDatabaseEnabled(bool iconDatabaseEnabled)
230 {
231     UNUSED_PARAM(iconDatabaseEnabled);
232     notImplemented();
233 }
234
235 void TestRunner::setMainFrameIsFirstResponder(bool flag)
236 {
237     UNUSED_PARAM(flag);
238     notImplemented();
239 }
240
241 void TestRunner::setPersistentUserStyleSheetLocation(JSStringRef path)
242 {
243     UNUSED_PARAM(path);
244     notImplemented();
245 }
246
247 void TestRunner::setPopupBlockingEnabled(bool flag)
248 {
249     BlackBerry::WebKit::DumpRenderTree::currentInstance()->page()->settings()->setJavaScriptOpenWindowsAutomatically(!flag);
250 }
251
252 void TestRunner::setPrivateBrowsingEnabled(bool flag)
253 {
254     UNUSED_PARAM(flag);
255     notImplemented();
256 }
257
258 void TestRunner::setXSSAuditorEnabled(bool flag)
259 {
260     BlackBerry::WebKit::DumpRenderTree::currentInstance()->page()->settings()->setXSSAuditorEnabled(flag);
261 }
262
263 void TestRunner::setSelectTrailingWhitespaceEnabled(bool flag)
264 {
265     BlackBerry::WebKit::DumpRenderTree::currentInstance()->setSelectTrailingWhitespaceEnabled(flag);
266 }
267
268 void TestRunner::setSmartInsertDeleteEnabled(bool flag)
269 {
270     UNUSED_PARAM(flag);
271     notImplemented();
272 }
273
274 void TestRunner::setTabKeyCyclesThroughElements(bool cycles)
275 {
276     if (!mainFrame)
277         return;
278
279     mainFrame->page()->setTabKeyCyclesThroughElements(cycles);
280 }
281
282 void TestRunner::setUseDashboardCompatibilityMode(bool flag)
283 {
284     UNUSED_PARAM(flag);
285     notImplemented();
286 }
287
288 void TestRunner::setUserStyleSheetEnabled(bool flag)
289 {
290     UNUSED_PARAM(flag);
291     notImplemented();
292 }
293
294 void TestRunner::setUserStyleSheetLocation(JSStringRef path)
295 {
296     String pathStr = jsStringRefToWebCoreString(path);
297     BlackBerry::WebKit::DumpRenderTree::currentInstance()->page()->settings()->setUserStyleSheetLocation(pathStr.utf8().data());
298 }
299
300 void TestRunner::waitForPolicyDelegate()
301 {
302     setCustomPolicyDelegate(true, true);
303     setWaitToDump(true);
304     waitForPolicy = true;
305 }
306
307 size_t TestRunner::webHistoryItemCount()
308 {
309     SharedArray<BlackBerry::WebKit::WebPage::BackForwardEntry> backForwardList;
310     BlackBerry::WebKit::DumpRenderTree::currentInstance()->page()->getBackForwardList(backForwardList);
311     return backForwardList.length();
312 }
313
314 int TestRunner::windowCount()
315 {
316     notImplemented();
317     return 0;
318 }
319
320 bool TestRunner::elementDoesAutoCompleteForElementWithId(JSStringRef id)
321 {
322     UNUSED_PARAM(id);
323     notImplemented();
324     return false;
325 }
326
327 void TestRunner::setWaitToDump(bool waitToDump)
328 {
329     // Change from 30s to 35s because some test cases in multipart need 30 seconds,
330     // refer to http/tests/multipart/resources/multipart-wait-before-boundary.php please.
331     static const double kWaitToDumpWatchdogInterval = 35.0;
332     m_waitToDump = waitToDump;
333     if (m_waitToDump)
334         BlackBerry::WebKit::DumpRenderTree::currentInstance()->setWaitToDumpWatchdog(kWaitToDumpWatchdogInterval);
335 }
336
337 void TestRunner::setWindowIsKey(bool windowIsKey)
338 {
339     m_windowIsKey = windowIsKey;
340     notImplemented();
341 }
342
343 void TestRunner::removeAllVisitedLinks()
344 {
345     notImplemented();
346 }
347
348 void TestRunner::overridePreference(JSStringRef key, JSStringRef value)
349 {
350     if (!mainFrame)
351         return;
352
353     String keyStr = jsStringRefToWebCoreString(key);
354     String valueStr = jsStringRefToWebCoreString(value);
355
356     if (keyStr == "WebKitUsesPageCachePreferenceKey")
357         BlackBerry::WebKit::DumpRenderTree::currentInstance()->page()->settings()->setMaximumPagesInCache(1);
358     else if (keyStr == "WebKitUsePreHTML5ParserQuirks")
359         mainFrame->page()->settings()->setUsePreHTML5ParserQuirks(true);
360     else if (keyStr == "WebKitTabToLinksPreferenceKey")
361         DumpRenderTreeSupport::setLinksIncludedInFocusChain(valueStr == "true" || valueStr == "1");
362     else if (keyStr == "WebKitHyperlinkAuditingEnabled")
363         mainFrame->page()->settings()->setHyperlinkAuditingEnabled(valueStr == "true" || valueStr == "1");
364     else if (keyStr == "WebSocketsEnabled")
365         BlackBerry::WebKit::DumpRenderTree::currentInstance()->page()->settings()->setWebSocketsEnabled(valueStr == "true" || valueStr == "1");
366     else if (keyStr == "WebKitDefaultTextEncodingName")
367         BlackBerry::WebKit::DumpRenderTree::currentInstance()->page()->settings()->setDefaultTextEncodingName(valueStr);
368     else if (keyStr == "WebKitDisplayImagesKey")
369         BlackBerry::WebKit::DumpRenderTree::currentInstance()->page()->settings()->setLoadsImagesAutomatically(valueStr == "true" || valueStr == "1");
370 }
371
372 void TestRunner::setAlwaysAcceptCookies(bool alwaysAcceptCookies)
373 {
374     UNUSED_PARAM(alwaysAcceptCookies);
375     notImplemented();
376 }
377
378 void TestRunner::setMockGeolocationPosition(double latitude, double longitude, double accuracy, bool providesAltitude, double altitude, bool providesAltitudeAccuracy, double altitudeAccuracy, bool providesHeading, double heading, bool providesSpeed, double speed)
379 {
380     DumpRenderTreeSupport::setMockGeolocationPosition(BlackBerry::WebKit::DumpRenderTree::currentInstance()->page(), latitude, longitude, accuracy, providesAltitude, altitude, providesAltitudeAccuracy, altitudeAccuracy, providesHeading, heading, providesSpeed, speed);
381 }
382
383 void TestRunner::setMockGeolocationPositionUnavailableError(JSStringRef message)
384 {
385     String messageStr = jsStringRefToWebCoreString(message);
386     DumpRenderTreeSupport::setMockGeolocationPositionUnavailableError(BlackBerry::WebKit::DumpRenderTree::currentInstance()->page(), messageStr);
387 }
388
389 void TestRunner::showWebInspector()
390 {
391     notImplemented();
392 }
393
394 void TestRunner::closeWebInspector()
395 {
396     notImplemented();
397 }
398
399 void TestRunner::evaluateInWebInspector(long callId, JSStringRef script)
400 {
401     UNUSED_PARAM(callId);
402     UNUSED_PARAM(script);
403     notImplemented();
404 }
405
406 void TestRunner::evaluateScriptInIsolatedWorldAndReturnValue(unsigned worldID, JSObjectRef globalObject, JSStringRef script)
407 {
408     UNUSED_PARAM(worldID);
409     UNUSED_PARAM(globalObject);
410     UNUSED_PARAM(script);
411     notImplemented();
412 }
413
414 void TestRunner::evaluateScriptInIsolatedWorld(unsigned worldID, JSObjectRef globalObject, JSStringRef script)
415 {
416     UNUSED_PARAM(worldID);
417     UNUSED_PARAM(globalObject);
418     UNUSED_PARAM(script);
419     notImplemented();
420 }
421
422 void TestRunner::addUserScript(JSStringRef source, bool runAtStart, bool allFrames)
423 {
424     UNUSED_PARAM(source);
425     UNUSED_PARAM(runAtStart);
426     UNUSED_PARAM(allFrames);
427     notImplemented();
428 }
429
430 void TestRunner::addUserStyleSheet(JSStringRef, bool)
431 {
432     notImplemented();
433 }
434
435 void TestRunner::setScrollbarPolicy(JSStringRef, JSStringRef)
436 {
437     notImplemented();
438 }
439
440 void TestRunner::setWebViewEditable(bool)
441 {
442     notImplemented();
443 }
444
445 void TestRunner::authenticateSession(JSStringRef url, JSStringRef username, JSStringRef password)
446 {
447     notImplemented();
448 }
449
450 bool TestRunner::callShouldCloseOnWebView()
451 {
452     notImplemented();
453     return false;
454 }
455
456 void TestRunner::setSpatialNavigationEnabled(bool enable)
457 {
458     notImplemented();
459 }
460
461 void TestRunner::addOriginAccessWhitelistEntry(JSStringRef sourceOrigin, JSStringRef destinationProtocol, JSStringRef destinationHost, bool allowDestinationSubdomains)
462 {
463     WebCore::SecurityPolicy::addOriginAccessWhitelistEntry(*WebCore::SecurityOrigin::createFromString(jsStringRefToWebCoreString(sourceOrigin)),
464         jsStringRefToWebCoreString(destinationProtocol),
465         jsStringRefToWebCoreString(destinationHost),
466         allowDestinationSubdomains);
467 }
468
469 void TestRunner::removeOriginAccessWhitelistEntry(JSStringRef sourceOrigin, JSStringRef destinationProtocol, JSStringRef destinationHost, bool allowDestinationSubdomains)
470 {
471     WebCore::SecurityPolicy::removeOriginAccessWhitelistEntry(*WebCore::SecurityOrigin::createFromString(jsStringRefToWebCoreString(sourceOrigin)),
472         jsStringRefToWebCoreString(destinationProtocol),
473         jsStringRefToWebCoreString(destinationHost),
474         allowDestinationSubdomains);
475 }
476
477 void TestRunner::setAllowFileAccessFromFileURLs(bool enabled)
478 {
479     if (!mainFrame)
480         return;
481
482     mainFrame->page()->settings()->setAllowFileAccessFromFileURLs(enabled);
483 }
484
485 void TestRunner::setAllowUniversalAccessFromFileURLs(bool enabled)
486 {
487     if (!mainFrame)
488         return;
489
490     mainFrame->page()->settings()->setAllowUniversalAccessFromFileURLs(enabled);
491 }
492
493 void TestRunner::apiTestNewWindowDataLoadBaseURL(JSStringRef utf8Data, JSStringRef baseURL)
494 {
495     notImplemented();
496 }
497
498 void TestRunner::apiTestGoToCurrentBackForwardItem()
499 {
500     notImplemented();
501 }
502
503 void TestRunner::setJavaScriptCanAccessClipboard(bool flag)
504 {
505     BlackBerry::WebKit::DumpRenderTree::currentInstance()->page()->setJavaScriptCanAccessClipboard(flag);
506 }
507
508 JSValueRef TestRunner::computedStyleIncludingVisitedInfo(JSContextRef context, JSValueRef value)
509 {
510     return DumpRenderTreeSupport::computedStyleIncludingVisitedInfo(context, value);
511 }
512
513 JSRetainPtr<JSStringRef> TestRunner::layerTreeAsText() const
514 {
515     notImplemented();
516     return 0;
517 }
518
519 JSRetainPtr<JSStringRef> TestRunner::markerTextForListItem(JSContextRef context, JSValueRef nodeObject) const
520 {
521     WebCore::Element* element = toElement(toJS(toJS(context), nodeObject));
522     if (!element)
523         return 0;
524
525     JSRetainPtr<JSStringRef> markerText(Adopt, JSStringCreateWithUTF8CString(WebCore::markerTextForListItem(element).utf8().data()));
526     return markerText;
527 }
528
529 void TestRunner::setPluginsEnabled(bool flag)
530 {
531     notImplemented();
532 }
533
534 void TestRunner::abortModal()
535 {
536     notImplemented();
537 }
538
539 void TestRunner::clearAllApplicationCaches()
540 {
541     notImplemented();
542 }
543
544 void TestRunner::setApplicationCacheOriginQuota(unsigned long long quota)
545 {
546     notImplemented();
547 }
548
549 void TestRunner::setMockDeviceOrientation(bool canProvideAlpha, double alpha, bool canProvideBeta, double beta, bool canProvideGamma, double gamma)
550 {
551     DumpRenderTreeSupport::setMockDeviceOrientation(BlackBerry::WebKit::DumpRenderTree::currentInstance()->page(), canProvideAlpha, alpha, canProvideBeta, beta, canProvideGamma, gamma);
552 }
553
554 void TestRunner::addMockSpeechInputResult(JSStringRef result, double confidence, JSStringRef language)
555 {
556     notImplemented();
557 }
558
559 void TestRunner::setGeolocationPermission(bool allow)
560 {
561     setGeolocationPermissionCommon(allow);
562     DumpRenderTreeSupport::setMockGeolocationPermission(BlackBerry::WebKit::DumpRenderTree::currentInstance()->page(), allow);
563 }
564
565 void TestRunner::setViewModeMediaFeature(const JSStringRef mode)
566 {
567     notImplemented();
568 }
569
570 void TestRunner::setSerializeHTTPLoads(bool)
571 {
572     // FIXME: Implement if needed for https://bugs.webkit.org/show_bug.cgi?id=50758.
573     notImplemented();
574 }
575
576 void TestRunner::setTextDirection(JSStringRef)
577 {
578     notImplemented();
579 }
580
581 void TestRunner::goBack()
582 {
583     // FIXME: implement to enable loader/navigation-while-deferring-loads.html
584     notImplemented();
585 }
586
587 void TestRunner::setDefersLoading(bool)
588 {
589     // FIXME: implement to enable loader/navigation-while-deferring-loads.html
590     notImplemented();
591 }
592
593 JSValueRef TestRunner::originsWithLocalStorage(JSContextRef context)
594 {
595     notImplemented();
596     return JSValueMakeUndefined(context);
597 }
598
599 void TestRunner::observeStorageTrackerNotifications(unsigned)
600 {
601     notImplemented();
602 }
603
604 void TestRunner::syncLocalStorage()
605 {
606     notImplemented();
607 }
608
609 void TestRunner::deleteAllLocalStorage()
610 {
611     notImplemented();
612 }
613
614 void TestRunner::setAsynchronousSpellCheckingEnabled(bool)
615 {
616     notImplemented();
617 }
618
619 int TestRunner::numberOfPendingGeolocationPermissionRequests()
620 {
621     return DumpRenderTreeSupport::numberOfPendingGeolocationPermissionRequests(BlackBerry::WebKit::DumpRenderTree::currentInstance()->page());
622 }
623
624 bool TestRunner::findString(JSContextRef context, JSStringRef target, JSObjectRef optionsArray)
625 {
626     WebCore::FindOptions options = 0;
627
628     String nameStr = jsStringRefToWebCoreString(target);
629
630     JSRetainPtr<JSStringRef> lengthPropertyName(Adopt, JSStringCreateWithUTF8CString("length"));
631     size_t length = 0;
632     if (optionsArray) {
633         JSValueRef lengthValue = JSObjectGetProperty(context, optionsArray, lengthPropertyName.get(), 0);
634         if (!JSValueIsNumber(context, lengthValue))
635             return false;
636         length = static_cast<size_t>(JSValueToNumber(context, lengthValue, 0));
637     }
638
639     for (size_t i = 0; i < length; ++i) {
640         JSValueRef value = JSObjectGetPropertyAtIndex(context, optionsArray, i, 0);
641         if (!JSValueIsString(context, value))
642             continue;
643
644         JSRetainPtr<JSStringRef> optionName(Adopt, JSValueToStringCopy(context, value, 0));
645
646         if (JSStringIsEqualToUTF8CString(optionName.get(), "CaseInsensitive"))
647             options |= WebCore::CaseInsensitive;
648         else if (JSStringIsEqualToUTF8CString(optionName.get(), "AtWordStarts"))
649             options |= WebCore::AtWordStarts;
650         else if (JSStringIsEqualToUTF8CString(optionName.get(), "TreatMedialCapitalAsWordStart"))
651             options |= WebCore::TreatMedialCapitalAsWordStart;
652         else if (JSStringIsEqualToUTF8CString(optionName.get(), "Backwards"))
653             options |= WebCore::Backwards;
654         else if (JSStringIsEqualToUTF8CString(optionName.get(), "WrapAround"))
655             options |= WebCore::WrapAround;
656         else if (JSStringIsEqualToUTF8CString(optionName.get(), "StartInSelection"))
657             options |= WebCore::StartInSelection;
658     }
659
660     // FIXME: we don't need to call WebPage::findNextString(), this is a workaround
661     // so that test platform/blackberry/editing/text-iterator/findString-markers.html can pass.
662
663     // Our layout tests assume find will wrap and highlight all matches.
664     BlackBerry::WebKit::DumpRenderTree::currentInstance()->page()->findNextString(nameStr.utf8().data(),
665         !(options & WebCore::Backwards), !(options & WebCore::CaseInsensitive), true /* wrap */, true /* highlightAllMatches */);
666
667     return mainFrame->page()->findString(nameStr, options);
668 }
669
670 void TestRunner::deleteLocalStorageForOrigin(JSStringRef URL)
671 {
672     // FIXME: Implement.
673 }
674
675 void TestRunner::setValueForUser(JSContextRef context, JSValueRef nodeObject, JSStringRef value)
676 {
677     JSC::ExecState* exec = toJS(context);
678     WebCore::Element* element = toElement(toJS(exec, nodeObject));
679     if (!element)
680         return;
681     WebCore::HTMLInputElement* inputElement = element->toInputElement();
682     if (!inputElement)
683         return;
684
685     inputElement->setValueForUser(jsStringRefToWebCoreString(value));
686 }
687
688 long long TestRunner::applicationCacheDiskUsageForOrigin(JSStringRef origin)
689 {
690     // FIXME: Implement to support getting disk usage by all application caches for an origin.
691     return 0;
692 }
693
694 void TestRunner::addChromeInputField()
695 {
696 }
697
698 void TestRunner::removeChromeInputField()
699 {
700 }
701
702 void TestRunner::focusWebView()
703 {
704 }
705
706 void TestRunner::setBackingScaleFactor(double)
707 {
708 }
709
710 void TestRunner::setMockSpeechInputDumpRect(bool)
711 {
712 }
713
714 void TestRunner::grantWebNotificationPermission(JSStringRef origin)
715 {
716 }
717
718 void TestRunner::denyWebNotificationPermission(JSStringRef jsOrigin)
719 {
720 }
721
722 void TestRunner::removeAllWebNotificationPermissions()
723 {
724 }
725
726 void TestRunner::simulateWebNotificationClick(JSValueRef jsNotification)
727 {
728 }
729
730 void TestRunner::simulateLegacyWebNotificationClick(JSStringRef title)
731 {
732 }
733
734 void TestRunner::resetPageVisibility()
735 {
736     notImplemented();
737 }
738
739 void TestRunner::setPageVisibility(const char*)
740 {
741     notImplemented();
742 }
743
744 void TestRunner::setAutomaticLinkDetectionEnabled(bool)
745 {
746     notImplemented();
747 }
748
749 void TestRunner::setStorageDatabaseIdleInterval(double)
750 {
751     // FIXME: Implement this.
752     notImplemented();
753 }
754
755 void TestRunner::closeIdleLocalStorageDatabases()
756 {
757     notImplemented();
758 }