2
* Copyright (C) 2007, 2012 Apple Inc. All rights reserved.
3
* Copyright (C) 2007 Eric Seidel <eric@webkit.org>
4
* Copyright (C) 2008 Nuanti Ltd.
5
* Copyright (C) 2009 Jan Michael Alonzo <jmalonzo@gmail.com>
6
* Copyright (C) 2009,2011 Collabora Ltd.
7
* Copyright (C) 2010 Joone Hur <joone@kldp.org>
8
* Copyright (C) 2011 ProFUSION Embedded Systems
9
* Copyright (C) 2011 Samsung Electronics
10
* Copyright (C) 2012 Intel Corporation
12
* Redistribution and use in source and binary forms, with or without
13
* modification, are permitted provided that the following conditions
16
* 1. Redistributions of source code must retain the above copyright
17
* notice, this list of conditions and the following disclaimer.
18
* 2. Redistributions in binary form must reproduce the above copyright
19
* notice, this list of conditions and the following disclaimer in the
20
* documentation and/or other materials provided with the distribution.
21
* 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
22
* its contributors may be used to endorse or promote products derived
23
* from this software without specific prior written permission.
25
* THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
26
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
27
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
28
* DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
29
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
30
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
31
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
32
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
33
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
34
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
38
#include "TestRunner.h"
40
#include "DumpRenderTree.h"
41
#include "DumpRenderTreeChrome.h"
42
#include "JSStringUtils.h"
43
#include "NotImplemented.h"
44
#include "WebCoreSupport/DumpRenderTreeSupportEfl.h"
45
#include "WorkQueue.h"
46
#include "WorkQueueItem.h"
47
#include "ewk_private.h"
49
#include <Ecore_File.h>
50
#include <JavaScriptCore/JSRetainPtr.h>
51
#include <JavaScriptCore/JSStringRef.h>
52
#include <JavaScriptCore/OpaqueJSString.h>
54
#include <editing/FindOptions.h>
56
#include <wtf/text/WTFString.h>
58
// Same as Mac cache model enum in Source/WebKit/mac/WebView/WebPreferences.h.
60
WebCacheModelDocumentViewer = 0,
61
WebCacheModelDocumentBrowser = 1,
62
WebCacheModelPrimaryWebBrowser = 2
65
TestRunner::~TestRunner()
69
void TestRunner::addDisallowedURL(JSStringRef)
74
void TestRunner::clearBackForwardList()
76
Ewk_History* history = ewk_view_history_get(browser->mainView());
80
Ewk_History_Item* item = ewk_history_history_item_current_get(history);
81
ewk_history_clear(history);
82
ewk_history_history_item_add(history, item);
83
ewk_history_history_item_set(history, item);
84
ewk_history_item_free(item);
87
JSStringRef TestRunner::copyDecodedHostName(JSStringRef)
93
JSStringRef TestRunner::copyEncodedHostName(JSStringRef)
99
void TestRunner::dispatchPendingLoadRequests()
101
// FIXME: Implement for testing fix for 6727495
105
void TestRunner::display()
110
void TestRunner::keepWebHistory()
112
DumpRenderTreeSupportEfl::setShouldTrackVisitedLinks(true);
115
JSValueRef TestRunner::computedStyleIncludingVisitedInfo(JSContextRef context, JSValueRef value)
117
return DumpRenderTreeSupportEfl::computedStyleIncludingVisitedInfo(context, value);
120
size_t TestRunner::webHistoryItemCount()
122
const Ewk_History* history = ewk_view_history_get(browser->mainView());
126
return ewk_history_back_list_length(history) + ewk_history_forward_list_length(history);
129
unsigned TestRunner::workerThreadCount() const
131
return DumpRenderTreeSupportEfl::workerThreadCount();
134
void TestRunner::notifyDone()
136
if (m_waitToDump && !topLoadingFrame && !WorkQueue::shared()->count())
138
m_waitToDump = false;
139
waitForPolicy = false;
142
JSStringRef TestRunner::pathToLocalResource(JSContextRef context, JSStringRef url)
144
String requestedUrl(url->characters(), url->length());
146
String requestedRoot;
148
if (requestedUrl.find("LayoutTests") != notFound) {
149
// If the URL contains LayoutTests we need to remap that to
150
// LOCAL_RESOURCE_ROOT which is the path of the LayoutTests directory
151
// within the WebKit source tree.
152
requestedRoot = "/tmp/LayoutTests";
153
resourceRoot = getenv("LOCAL_RESOURCE_ROOT");
154
} else if (requestedUrl.find("tmp") != notFound) {
155
// If the URL is a child of /tmp we need to convert it to be a child
156
// DUMPRENDERTREE_TEMP replace tmp with DUMPRENDERTREE_TEMP
157
requestedRoot = "/tmp";
158
resourceRoot = getenv("DUMPRENDERTREE_TEMP");
161
size_t indexOfRootStart = requestedUrl.reverseFind(requestedRoot);
162
size_t indexOfSeparatorAfterRoot = indexOfRootStart + requestedRoot.length();
163
String fullPathToUrl = "file://" + resourceRoot + requestedUrl.substring(indexOfSeparatorAfterRoot);
165
return JSStringCreateWithUTF8CString(fullPathToUrl.utf8().data());
168
void TestRunner::queueLoad(JSStringRef url, JSStringRef target)
170
WebCore::KURL baseURL(WebCore::KURL(), String::fromUTF8(ewk_frame_uri_get(browser->mainFrame())));
171
WebCore::KURL absoluteURL(baseURL, url->string());
173
JSRetainPtr<JSStringRef> jsAbsoluteURL(
174
Adopt, JSStringCreateWithUTF8CString(absoluteURL.string().utf8().data()));
176
WorkQueue::shared()->queue(new LoadItem(jsAbsoluteURL.get(), target));
179
void TestRunner::setAcceptsEditing(bool acceptsEditing)
181
ewk_view_editable_set(browser->mainView(), acceptsEditing);
184
void TestRunner::setAlwaysAcceptCookies(bool alwaysAcceptCookies)
186
ewk_cookies_policy_set(alwaysAcceptCookies ? EWK_COOKIE_JAR_ACCEPT_ALWAYS : EWK_COOKIE_JAR_ACCEPT_NEVER);
189
void TestRunner::setCustomPolicyDelegate(bool enabled, bool permissive)
191
policyDelegateEnabled = enabled;
192
policyDelegatePermissive = permissive;
195
void TestRunner::waitForPolicyDelegate()
197
setCustomPolicyDelegate(true, false);
198
waitForPolicy = true;
202
void TestRunner::setScrollbarPolicy(JSStringRef, JSStringRef)
207
void TestRunner::addOriginAccessWhitelistEntry(JSStringRef sourceOrigin, JSStringRef protocol, JSStringRef host, bool includeSubdomains)
210
kurl.setProtocol(String(protocol->characters(), protocol->length()));
211
kurl.setHost(String(host->characters(), host->length()));
213
ewk_security_policy_whitelist_origin_add(sourceOrigin->string().utf8().data(), kurl.string().utf8().data(), includeSubdomains);
216
void TestRunner::removeOriginAccessWhitelistEntry(JSStringRef sourceOrigin, JSStringRef protocol, JSStringRef host, bool includeSubdomains)
219
kurl.setProtocol(String(protocol->characters(), protocol->length()));
220
kurl.setHost(String(host->characters(), host->length()));
222
ewk_security_policy_whitelist_origin_del(sourceOrigin->string().utf8().data(), kurl.string().utf8().data(), includeSubdomains);
225
void TestRunner::setMainFrameIsFirstResponder(bool)
230
void TestRunner::setTabKeyCyclesThroughElements(bool)
235
void TestRunner::setUseDashboardCompatibilityMode(bool)
240
static CString gUserStyleSheet;
241
static bool gUserStyleSheetEnabled = true;
243
void TestRunner::setUserStyleSheetEnabled(bool flag)
245
gUserStyleSheetEnabled = flag;
246
ewk_view_setting_user_stylesheet_set(browser->mainView(), flag ? gUserStyleSheet.data() : 0);
249
void TestRunner::setUserStyleSheetLocation(JSStringRef path)
251
gUserStyleSheet = path->string().utf8();
253
if (gUserStyleSheetEnabled)
254
setUserStyleSheetEnabled(true);
257
void TestRunner::setValueForUser(JSContextRef context, JSValueRef nodeObject, JSStringRef value)
259
DumpRenderTreeSupportEfl::setValueForUser(context, nodeObject, value->string());
262
void TestRunner::setViewModeMediaFeature(JSStringRef mode)
264
Evas_Object* view = browser->mainView();
268
if (equals(mode, "windowed"))
269
ewk_view_mode_set(view, EWK_VIEW_MODE_WINDOWED);
270
else if (equals(mode, "floating"))
271
ewk_view_mode_set(view, EWK_VIEW_MODE_FLOATING);
272
else if (equals(mode, "fullscreen"))
273
ewk_view_mode_set(view, EWK_VIEW_MODE_FULLSCREEN);
274
else if (equals(mode, "maximized"))
275
ewk_view_mode_set(view, EWK_VIEW_MODE_MAXIMIZED);
276
else if (equals(mode, "minimized"))
277
ewk_view_mode_set(view, EWK_VIEW_MODE_MINIMIZED);
280
void TestRunner::setWindowIsKey(bool)
285
void TestRunner::setSmartInsertDeleteEnabled(bool flag)
287
DumpRenderTreeSupportEfl::setSmartInsertDeleteEnabled(browser->mainView(), flag);
290
static Eina_Bool waitToDumpWatchdogFired(void*)
292
waitToDumpWatchdog = 0;
293
gTestRunner->waitToDumpWatchdogTimerFired();
294
return ECORE_CALLBACK_CANCEL;
297
void TestRunner::setWaitToDump(bool waitUntilDone)
299
static const double timeoutSeconds = 30;
301
m_waitToDump = waitUntilDone;
302
if (m_waitToDump && !waitToDumpWatchdog)
303
waitToDumpWatchdog = ecore_timer_add(timeoutSeconds, waitToDumpWatchdogFired, 0);
306
int TestRunner::windowCount()
308
return browser->extraViews().size() + 1; // + 1 for the main view.
311
void TestRunner::setPrivateBrowsingEnabled(bool flag)
313
ewk_view_setting_private_browsing_set(browser->mainView(), flag);
316
void TestRunner::setJavaScriptCanAccessClipboard(bool flag)
318
ewk_view_setting_scripts_can_access_clipboard_set(browser->mainView(), flag);
321
void TestRunner::setXSSAuditorEnabled(bool flag)
323
ewk_view_setting_enable_xss_auditor_set(browser->mainView(), flag);
326
void TestRunner::setFrameFlatteningEnabled(bool flag)
328
ewk_view_setting_enable_frame_flattening_set(browser->mainView(), flag);
331
void TestRunner::setSpatialNavigationEnabled(bool flag)
333
ewk_view_setting_spatial_navigation_set(browser->mainView(), flag);
336
void TestRunner::setAllowUniversalAccessFromFileURLs(bool flag)
338
ewk_view_setting_allow_universal_access_from_file_urls_set(browser->mainView(), flag);
341
void TestRunner::setAllowFileAccessFromFileURLs(bool flag)
343
ewk_view_setting_allow_file_access_from_file_urls_set(browser->mainView(), flag);
346
void TestRunner::setAuthorAndUserStylesEnabled(bool flag)
348
DumpRenderTreeSupportEfl::setAuthorAndUserStylesEnabled(browser->mainView(), flag);
351
void TestRunner::setAutofilled(JSContextRef context, JSValueRef nodeObject, bool autofilled)
353
DumpRenderTreeSupportEfl::setAutofilled(context, nodeObject, autofilled);
356
void TestRunner::disableImageLoading()
358
ewk_view_setting_auto_load_images_set(browser->mainView(), EINA_FALSE);
361
void TestRunner::setMockDeviceOrientation(bool, double, bool, double, bool, double)
363
// FIXME: Implement for DeviceOrientation layout tests.
364
// See https://bugs.webkit.org/show_bug.cgi?id=30335.
368
void TestRunner::setMockGeolocationPosition(double latitude, double longitude, double accuracy, bool canProvideAltitude, double altitude, bool canProvideAltitudeAccuracy, double altitudeAccuracy, bool canProvideHeading, double heading, bool canProvideSpeed, double speed)
370
Evas_Object* view = browser->mainView();
371
if (browser->extraViews().size() > 0)
372
view = browser->extraViews().last();
374
DumpRenderTreeSupportEfl::setMockGeolocationPosition(view, latitude, longitude, accuracy, canProvideAltitude, altitude, canProvideAltitudeAccuracy, altitudeAccuracy, canProvideHeading, heading, canProvideSpeed, speed);
377
void TestRunner::setMockGeolocationPositionUnavailableError(JSStringRef message)
379
Evas_Object* view = browser->mainView();
380
if (browser->extraViews().size() > 0)
381
view = browser->extraViews().last();
383
DumpRenderTreeSupportEfl::setMockGeolocationPositionUnavailableError(view, message->string().utf8().data());
386
void TestRunner::setGeolocationPermission(bool allow)
388
setGeolocationPermissionCommon(allow);
389
Evas_Object* view = browser->mainView();
390
if (browser->extraViews().size() > 0)
391
view = browser->extraViews().last();
393
DumpRenderTreeSupportEfl::setMockGeolocationPermission(view, allow);
396
int TestRunner::numberOfPendingGeolocationPermissionRequests()
398
Evas_Object* view = browser->mainView();
399
if (browser->extraViews().size() > 0)
400
view = browser->extraViews().last();
402
return DumpRenderTreeSupportEfl::numberOfPendingGeolocationPermissionRequests(view);
405
void TestRunner::addMockSpeechInputResult(JSStringRef, double, JSStringRef)
407
// FIXME: Implement for speech input layout tests.
408
// See https://bugs.webkit.org/show_bug.cgi?id=39485.
412
void TestRunner::setMockSpeechInputDumpRect(bool)
414
// FIXME: Implement for speech input layout tests.
415
// See https://bugs.webkit.org/show_bug.cgi?id=39485.
419
void TestRunner::startSpeechInput(JSContextRef inputElement)
421
// FIXME: Implement for speech input layout tests.
422
// See https://bugs.webkit.org/show_bug.cgi?id=39485.
426
void TestRunner::setIconDatabaseEnabled(bool enabled)
428
ewk_settings_icon_database_path_set(0);
434
const char* tempDir = getenv("TMPDIR");
437
databasePath = String::fromUTF8(tempDir);
438
else if (tempDir = getenv("TEMP"))
439
databasePath = String::fromUTF8(tempDir);
441
databasePath = String::fromUTF8("/tmp");
443
databasePath.append("/DumpRenderTree/IconDatabase");
445
if (ecore_file_mkpath(databasePath.utf8().data()))
446
ewk_settings_icon_database_path_set(databasePath.utf8().data());
449
void TestRunner::setSelectTrailingWhitespaceEnabled(bool flag)
451
DumpRenderTreeSupportEfl::setSelectTrailingWhitespaceEnabled(browser->mainView(), flag);
454
void TestRunner::setPopupBlockingEnabled(bool flag)
456
ewk_view_setting_scripts_can_open_windows_set(browser->mainView(), !flag);
459
void TestRunner::setPluginsEnabled(bool flag)
461
ewk_view_setting_enable_plugins_set(browser->mainView(), flag);
464
bool TestRunner::elementDoesAutoCompleteForElementWithId(JSStringRef id)
466
const String elementId(id->string());
467
const Evas_Object* mainFrame = browser->mainFrame();
468
return DumpRenderTreeSupportEfl::elementDoesAutoCompleteForElementWithId(mainFrame, elementId);
471
void TestRunner::execCommand(JSStringRef name, JSStringRef value)
473
DumpRenderTreeSupportEfl::executeCoreCommandByName(browser->mainView(), name->string().utf8().data(), value->string().utf8().data());
476
bool TestRunner::findString(JSContextRef context, JSStringRef target, JSObjectRef optionsArray)
478
JSRetainPtr<JSStringRef> lengthPropertyName(Adopt, JSStringCreateWithUTF8CString("length"));
479
JSValueRef lengthValue = JSObjectGetProperty(context, optionsArray, lengthPropertyName.get(), 0);
480
if (!JSValueIsNumber(context, lengthValue))
483
WebCore::FindOptions options = 0;
485
const size_t length = static_cast<size_t>(JSValueToNumber(context, lengthValue, 0));
486
for (size_t i = 0; i < length; ++i) {
487
JSValueRef value = JSObjectGetPropertyAtIndex(context, optionsArray, i, 0);
488
if (!JSValueIsString(context, value))
491
JSRetainPtr<JSStringRef> optionName(Adopt, JSValueToStringCopy(context, value, 0));
493
if (equals(optionName, "CaseInsensitive"))
494
options |= WebCore::CaseInsensitive;
495
else if (equals(optionName, "AtWordStarts"))
496
options |= WebCore::AtWordStarts;
497
else if (equals(optionName, "TreatMedialCapitalAsWordStart"))
498
options |= WebCore::TreatMedialCapitalAsWordStart;
499
else if (equals(optionName, "Backwards"))
500
options |= WebCore::Backwards;
501
else if (equals(optionName, "WrapAround"))
502
options |= WebCore::WrapAround;
503
else if (equals(optionName, "StartInSelection"))
504
options |= WebCore::StartInSelection;
507
return DumpRenderTreeSupportEfl::findString(browser->mainView(), target->string(), options);
510
bool TestRunner::isCommandEnabled(JSStringRef name)
512
return DumpRenderTreeSupportEfl::isCommandEnabled(browser->mainView(), name->string().utf8().data());
515
void TestRunner::setCacheModel(int cacheModel)
517
unsigned int cacheTotalCapacity;
518
unsigned int cacheMinDeadCapacity;
519
unsigned int cacheMaxDeadCapacity;
520
double deadDecodedDataDeletionInterval;
521
unsigned int pageCacheCapacity;
523
// These constants are derived from the Mac cache model enum in Source/WebKit/mac/WebView/WebPreferences.h.
524
switch (cacheModel) {
525
case WebCacheModelDocumentViewer:
526
pageCacheCapacity = 0;
527
cacheTotalCapacity = 0;
528
cacheMinDeadCapacity = 0;
529
cacheMaxDeadCapacity = 0;
530
deadDecodedDataDeletionInterval = 0;
532
case WebCacheModelDocumentBrowser:
533
pageCacheCapacity = 2;
534
cacheTotalCapacity = 16 * 1024 * 1024;
535
cacheMinDeadCapacity = cacheTotalCapacity / 8;
536
cacheMaxDeadCapacity = cacheTotalCapacity / 4;
537
deadDecodedDataDeletionInterval = 0;
539
case WebCacheModelPrimaryWebBrowser:
540
pageCacheCapacity = 3;
541
cacheTotalCapacity = 32 * 1024 * 1024;
542
cacheMinDeadCapacity = cacheTotalCapacity / 4;
543
cacheMaxDeadCapacity = cacheTotalCapacity / 2;
544
deadDecodedDataDeletionInterval = 60;
547
fprintf(stderr, "trying to set an invalid value %d for the Cache model.", cacheModel);
551
ewk_settings_object_cache_capacity_set(cacheMinDeadCapacity, cacheMaxDeadCapacity, cacheTotalCapacity);
552
DumpRenderTreeSupportEfl::setDeadDecodedDataDeletionInterval(deadDecodedDataDeletionInterval);
553
ewk_settings_page_cache_capacity_set(pageCacheCapacity);
556
void TestRunner::setPersistentUserStyleSheetLocation(JSStringRef)
561
void TestRunner::clearPersistentUserStyleSheet()
566
void TestRunner::clearAllApplicationCaches()
568
ewk_settings_application_cache_clear();
571
void TestRunner::setApplicationCacheOriginQuota(unsigned long long quota)
573
Ewk_Security_Origin* origin = ewk_frame_security_origin_get(browser->mainFrame());
574
ewk_security_origin_application_cache_quota_set(origin, quota);
575
ewk_security_origin_free(origin);
578
void TestRunner::clearApplicationCacheForOrigin(OpaqueJSString* url)
580
Ewk_Security_Origin* origin = ewk_security_origin_new_from_string(url->string().utf8().data());
581
ewk_security_origin_application_cache_clear(origin);
582
ewk_security_origin_free(origin);
585
long long TestRunner::localStorageDiskUsageForOrigin(JSStringRef)
587
// FIXME: Implement to support getting disk usage in bytes for an origin.
592
JSValueRef TestRunner::originsWithApplicationCache(JSContextRef context)
594
// FIXME: Implement to get origins that contain application caches.
596
return JSValueMakeUndefined(context);
599
long long TestRunner::applicationCacheDiskUsageForOrigin(JSStringRef)
605
void TestRunner::clearAllDatabases()
607
ewk_web_database_remove_all();
610
void TestRunner::setDatabaseQuota(unsigned long long quota)
612
Ewk_Security_Origin* origin = ewk_frame_security_origin_get(browser->mainFrame());
613
ewk_security_origin_web_database_quota_set(origin, quota);
614
ewk_security_origin_free(origin);
617
JSValueRef TestRunner::originsWithLocalStorage(JSContextRef context)
620
return JSValueMakeUndefined(context);
623
void TestRunner::deleteAllLocalStorage()
628
void TestRunner::deleteLocalStorageForOrigin(JSStringRef)
633
void TestRunner::observeStorageTrackerNotifications(unsigned)
638
void TestRunner::syncLocalStorage()
643
void TestRunner::setDomainRelaxationForbiddenForURLScheme(bool forbidden, JSStringRef scheme)
645
DumpRenderTreeSupportEfl::setDomainRelaxationForbiddenForURLScheme(forbidden, scheme->string());
648
void TestRunner::goBack()
650
ewk_frame_back(browser->mainFrame());
653
void TestRunner::setDefersLoading(bool defers)
655
DumpRenderTreeSupportEfl::setDefersLoading(browser->mainView(), defers);
658
void TestRunner::setAppCacheMaximumSize(unsigned long long size)
660
ewk_settings_application_cache_max_quota_set(size);
663
bool TestRunner::pauseAnimationAtTimeOnElementWithId(JSStringRef animationName, double time, JSStringRef elementId)
665
return DumpRenderTreeSupportEfl::pauseAnimation(browser->mainFrame(), animationName->string().utf8().data(), elementId->string().utf8().data(), time);
668
bool TestRunner::pauseTransitionAtTimeOnElementWithId(JSStringRef propertyName, double time, JSStringRef elementId)
670
return DumpRenderTreeSupportEfl::pauseTransition(browser->mainFrame(), propertyName->string().utf8().data(), elementId->string().utf8().data(), time);
673
unsigned TestRunner::numberOfActiveAnimations() const
675
return DumpRenderTreeSupportEfl::activeAnimationsCount(browser->mainFrame());
678
static inline bool toBool(JSStringRef value)
680
return equals(value, "true") || equals(value, "1");
683
static inline int toInt(JSStringRef value)
685
return atoi(value->string().utf8().data());
688
void TestRunner::overridePreference(JSStringRef key, JSStringRef value)
690
if (equals(key, "WebKitJavaScriptEnabled"))
691
ewk_view_setting_enable_scripts_set(browser->mainView(), toBool(value));
692
else if (equals(key, "WebKitDefaultFontSize"))
693
ewk_view_setting_font_default_size_set(browser->mainView(), toInt(value));
694
else if (equals(key, "WebKitMinimumFontSize"))
695
ewk_view_setting_font_minimum_size_set(browser->mainView(), toInt(value));
696
else if (equals(key, "WebKitPluginsEnabled"))
697
ewk_view_setting_enable_plugins_set(browser->mainView(), toBool(value));
698
else if (equals(key, "WebKitWebGLEnabled"))
699
ewk_view_setting_enable_webgl_set(browser->mainView(), toBool(value));
700
else if (equals(key, "WebKitEnableCaretBrowsing"))
701
ewk_view_setting_caret_browsing_set(browser->mainView(), toBool(value));
702
else if (equals(key, "WebKitUsesPageCachePreferenceKey"))
703
ewk_view_setting_page_cache_set(browser->mainView(), toBool(value));
704
else if (equals(key, "WebKitHyperlinkAuditingEnabled"))
705
ewk_view_setting_enable_hyperlink_auditing_set(browser->mainView(), toBool(value));
706
else if (equals(key, "WebKitTabToLinksPreferenceKey"))
707
ewk_view_setting_include_links_in_focus_chain_set(browser->mainView(), toBool(value));
708
else if (equals(key, "WebKitOfflineWebApplicationCacheEnabled"))
709
ewk_view_setting_application_cache_set(browser->mainView(), toBool(value));
710
else if (equals(key, "WebKitLoadSiteIconsKey"))
711
DumpRenderTreeSupportEfl::setLoadsSiteIconsIgnoringImageLoadingSetting(browser->mainView(), toBool(value));
712
else if (equals(key, "WebKitCSSGridLayoutEnabled"))
713
DumpRenderTreeSupportEfl::setCSSGridLayoutEnabled(browser->mainView(), toBool(value));
714
else if (equals(key, "WebKitCSSRegionsEnabled"))
715
DumpRenderTreeSupportEfl::setCSSRegionsEnabled(browser->mainView(), toBool(value));
716
else if (equals(key, "WebKitWebAudioEnabled"))
717
ewk_view_setting_web_audio_set(browser->mainView(), toBool(value));
718
else if (equals(key, "WebKitDisplayImagesKey"))
719
ewk_view_setting_auto_load_images_set(browser->mainView(), toBool(value));
721
fprintf(stderr, "TestRunner::overridePreference tried to override unknown preference '%s'.\n", value->string().utf8().data());
724
void TestRunner::addUserScript(JSStringRef source, bool runAtStart, bool allFrames)
726
DumpRenderTreeSupportEfl::addUserScript(browser->mainView(), source->string(), runAtStart, allFrames);
729
void TestRunner::addUserStyleSheet(JSStringRef source, bool allFrames)
731
DumpRenderTreeSupportEfl::addUserStyleSheet(browser->mainView(), source->string(), allFrames);
734
void TestRunner::setDeveloperExtrasEnabled(bool enabled)
736
ewk_view_setting_enable_developer_extras_set(browser->mainView(), enabled);
739
void TestRunner::setAsynchronousSpellCheckingEnabled(bool)
744
void TestRunner::showWebInspector()
746
ewk_view_inspector_show(browser->mainView());
747
browser->waitInspectorLoadFinished();
750
void TestRunner::closeWebInspector()
752
ewk_view_inspector_close(browser->mainView());
755
void TestRunner::evaluateInWebInspector(long callId, JSStringRef script)
757
DumpRenderTreeSupportEfl::evaluateInWebInspector(browser->mainView(), callId, script->string());
760
void TestRunner::evaluateScriptInIsolatedWorldAndReturnValue(unsigned, JSObjectRef, JSStringRef)
765
void TestRunner::evaluateScriptInIsolatedWorld(unsigned worldID, JSObjectRef globalObject, JSStringRef script)
767
DumpRenderTreeSupportEfl::evaluateScriptInIsolatedWorld(browser->mainFrame(), worldID, globalObject, script->string());
770
void TestRunner::removeAllVisitedLinks()
772
Ewk_History* history = ewk_view_history_get(browser->mainView());
776
ewk_history_clear(history);
779
bool TestRunner::callShouldCloseOnWebView()
781
return DumpRenderTreeSupportEfl::callShouldCloseOnWebView(browser->mainFrame());
784
void TestRunner::apiTestNewWindowDataLoadBaseURL(JSStringRef, JSStringRef)
789
void TestRunner::apiTestGoToCurrentBackForwardItem()
794
void TestRunner::setWebViewEditable(bool)
796
ewk_frame_editable_set(browser->mainFrame(), EINA_TRUE);
799
JSRetainPtr<JSStringRef> TestRunner::markerTextForListItem(JSContextRef context, JSValueRef nodeObject) const
801
String markerTextChar = DumpRenderTreeSupportEfl::markerTextForListItem(context, nodeObject);
802
if (markerTextChar.isEmpty())
805
JSRetainPtr<JSStringRef> markerText(Adopt, JSStringCreateWithUTF8CString(markerTextChar.utf8().data()));
809
void TestRunner::authenticateSession(JSStringRef, JSStringRef, JSStringRef)
814
void TestRunner::abortModal()
819
void TestRunner::setSerializeHTTPLoads(bool serialize)
821
DumpRenderTreeSupportEfl::setSerializeHTTPLoads(serialize);
824
void TestRunner::setMinimumTimerInterval(double minimumTimerInterval)
826
ewk_view_setting_minimum_timer_interval_set(browser->mainView(), minimumTimerInterval);
829
void TestRunner::setTextDirection(JSStringRef direction)
831
Ewk_Text_Direction ewkDirection;
832
if (JSStringIsEqualToUTF8CString(direction, "auto"))
833
ewkDirection = EWK_TEXT_DIRECTION_DEFAULT;
834
else if (JSStringIsEqualToUTF8CString(direction, "rtl"))
835
ewkDirection = EWK_TEXT_DIRECTION_RIGHT_TO_LEFT;
836
else if (JSStringIsEqualToUTF8CString(direction, "ltr"))
837
ewkDirection = EWK_TEXT_DIRECTION_LEFT_TO_RIGHT;
839
fprintf(stderr, "TestRunner::setTextDirection called with unknown direction: '%s'.\n", direction->string().utf8().data());
843
ewk_view_text_direction_set(browser->mainView(), ewkDirection);
846
void TestRunner::addChromeInputField()
851
void TestRunner::removeChromeInputField()
856
void TestRunner::focusWebView()
861
void TestRunner::setBackingScaleFactor(double)
866
void TestRunner::grantWebNotificationPermission(JSStringRef origin)
870
void TestRunner::denyWebNotificationPermission(JSStringRef jsOrigin)
874
void TestRunner::removeAllWebNotificationPermissions()
878
void TestRunner::simulateWebNotificationClick(JSValueRef jsNotification)
882
void TestRunner::simulateLegacyWebNotificationClick(JSStringRef title)
886
void TestRunner::resetPageVisibility()
888
ewk_view_visibility_state_set(browser->mainView(), EWK_PAGE_VISIBILITY_STATE_VISIBLE, true);
891
void TestRunner::setPageVisibility(const char* visibility)
893
String newVisibility(visibility);
894
if (newVisibility == "visible")
895
ewk_view_visibility_state_set(browser->mainView(), EWK_PAGE_VISIBILITY_STATE_VISIBLE, false);
896
else if (newVisibility == "hidden")
897
ewk_view_visibility_state_set(browser->mainView(), EWK_PAGE_VISIBILITY_STATE_HIDDEN, false);
898
else if (newVisibility == "prerender")
899
ewk_view_visibility_state_set(browser->mainView(), EWK_PAGE_VISIBILITY_STATE_PRERENDER, false);
900
else if (newVisibility == "preview")
901
ewk_view_visibility_state_set(browser->mainView(), EWK_PAGE_VISIBILITY_STATE_PREVIEW, false);
904
void TestRunner::setAutomaticLinkDetectionEnabled(bool)
909
void TestRunner::sendWebIntentResponse(JSStringRef response)
911
Ewk_Intent_Request* request = browser->currentIntentRequest();
915
DumpRenderTreeSupportEfl::sendWebIntentResponse(request, response);
918
void TestRunner::deliverWebIntent(JSStringRef action, JSStringRef type, JSStringRef data)
920
DumpRenderTreeSupportEfl::deliverWebIntent(browser->mainFrame(), action, type, data);
923
void TestRunner::setStorageDatabaseIdleInterval(double)