Multiple File Input Icon Set Regardless of File List
[WebKit-https.git] / Tools / WebKitTestRunner / InjectedBundle / TestRunner.h
1 /*
2  * Copyright (C) 2010-2017 Apple Inc. All rights reserved.
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  * 1. Redistributions of source code must retain the above copyright
8  *    notice, this list of conditions and the following disclaimer.
9  * 2. Redistributions in binary form must reproduce the above copyright
10  *    notice, this list of conditions and the following disclaimer in the
11  *    documentation and/or other materials provided with the distribution.
12  *
13  * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
14  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
15  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
17  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
18  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
19  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
20  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
21  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
22  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
23  * THE POSSIBILITY OF SUCH DAMAGE.
24  */
25
26 #pragma once
27
28 #include "JSWrappable.h"
29 #include "StringFunctions.h"
30 #include "WhatToDump.h"
31 #include <JavaScriptCore/JSRetainPtr.h>
32 #include <WebKit/WKBundleScriptWorld.h>
33 #include <WebKit/WKRetainPtr.h>
34 #include <string>
35 #include <wtf/Ref.h>
36 #include <wtf/Seconds.h>
37 #include <wtf/text/WTFString.h>
38
39 #if PLATFORM(COCOA)
40 #include <wtf/RetainPtr.h>
41 #include <CoreFoundation/CFRunLoop.h>
42 typedef RetainPtr<CFRunLoopTimerRef> PlatformTimerRef;
43 #else
44 #include <wtf/RunLoop.h>
45 namespace WTR {
46 class TestRunner;
47 typedef RunLoop::Timer<TestRunner> PlatformTimerRef;
48 }
49 #endif
50
51 namespace WTR {
52
53 class TestRunner : public JSWrappable {
54 public:
55     static Ref<TestRunner> create();
56     virtual ~TestRunner();
57
58     // JSWrappable
59     virtual JSClassRef wrapperClass();
60
61     void makeWindowObject(JSContextRef, JSObjectRef windowObject, JSValueRef* exception);
62
63     bool isWebKit2() const { return true; }
64
65     // The basics.
66     WKURLRef testURL() const { return m_testURL.get(); }
67     void setTestURL(WKURLRef url) { m_testURL = url; }
68     void dumpAsText(bool dumpPixels);
69     void waitForPolicyDelegate();
70     void dumpChildFramesAsText() { setWhatToDump(WhatToDump::AllFramesText); }
71     void waitUntilDownloadFinished();
72     void waitUntilDone();
73     void notifyDone();
74     double preciseTime();
75     double timeout() { return m_timeout.milliseconds(); }
76
77     // Other dumping.
78     void dumpBackForwardList() { m_shouldDumpBackForwardListsForAllWindows = true; }
79     void dumpChildFrameScrollPositions() { m_shouldDumpAllFrameScrollPositions = true; }
80     void dumpEditingCallbacks() { m_dumpEditingCallbacks = true; }
81     void dumpSelectionRect() { m_dumpSelectionRect = true; }
82     void dumpStatusCallbacks() { m_dumpStatusCallbacks = true; }
83     void dumpTitleChanges() { m_dumpTitleChanges = true; }
84     void dumpFullScreenCallbacks() { m_dumpFullScreenCallbacks = true; }
85     void dumpFrameLoadCallbacks() { setShouldDumpFrameLoadCallbacks(true); }
86     void dumpProgressFinishedCallback() { setShouldDumpProgressFinishedCallback(true); }
87     void dumpResourceLoadCallbacks() { m_dumpResourceLoadCallbacks = true; }
88     void dumpResourceResponseMIMETypes() { m_dumpResourceResponseMIMETypes = true; }
89     void dumpWillCacheResponse() { m_dumpWillCacheResponse = true; }
90     void dumpApplicationCacheDelegateCallbacks() { m_dumpApplicationCacheDelegateCallbacks = true; }
91     void dumpDatabaseCallbacks() { m_dumpDatabaseCallbacks = true; }
92     void dumpDOMAsWebArchive() { setWhatToDump(WhatToDump::DOMAsWebArchive); }
93     void dumpPolicyDelegateCallbacks() { m_dumpPolicyCallbacks = true; }
94     void dumpResourceLoadStatistics();
95
96     void setShouldDumpFrameLoadCallbacks(bool value);
97     void setShouldDumpProgressFinishedCallback(bool value) { m_dumpProgressFinishedCallback = value; }
98
99     // Special options.
100     void keepWebHistory();
101     void setAcceptsEditing(bool value) { m_shouldAllowEditing = value; }
102     void setCanOpenWindows();
103     void setCloseRemainingWindowsWhenComplete(bool value) { m_shouldCloseExtraWindows = value; }
104     void setXSSAuditorEnabled(bool);
105     void setModernMediaControlsEnabled(bool);
106     void setWebGL2Enabled(bool);
107     void setWritableStreamAPIEnabled(bool);
108     void setReadableByteStreamAPIEnabled(bool);
109
110     void setAllowUniversalAccessFromFileURLs(bool);
111     void setAllowFileAccessFromFileURLs(bool);
112     void setNeedsStorageAccessFromFileURLsQuirk(bool);
113     void setPluginsEnabled(bool);
114     void setJavaScriptCanAccessClipboard(bool);
115     void setPrivateBrowsingEnabled(bool);
116     void setUseDashboardCompatibilityMode(bool);
117     void setPopupBlockingEnabled(bool);
118     void setAuthorAndUserStylesEnabled(bool);
119     void setCustomPolicyDelegate(bool enabled, bool permissive = false);
120     void addOriginAccessWhitelistEntry(JSStringRef sourceOrigin, JSStringRef destinationProtocol, JSStringRef destinationHost, bool allowDestinationSubdomains);
121     void removeOriginAccessWhitelistEntry(JSStringRef sourceOrigin, JSStringRef destinationProtocol, JSStringRef destinationHost, bool allowDestinationSubdomains);
122     void setUserStyleSheetEnabled(bool);
123     void setUserStyleSheetLocation(JSStringRef);
124     void setSpatialNavigationEnabled(bool);
125     void setTabKeyCyclesThroughElements(bool);
126     void setSerializeHTTPLoads();
127     void dispatchPendingLoadRequests();
128     void setCacheModel(int);
129     void setAsynchronousSpellCheckingEnabled(bool);
130     void setAllowsAnySSLCertificate(bool);
131     void setEncryptedMediaAPIEnabled(bool);
132     void setMediaDevicesEnabled(bool);
133     void setWebRTCMDNSICECandidatesEnabled(bool);
134     void setWebRTCUnifiedPlanEnabled(bool);
135     void setCustomUserAgent(JSStringRef);
136     void setWebAPIStatisticsEnabled(bool);
137
138     // Special DOM functions.
139     void clearBackForwardList();
140     void execCommand(JSStringRef name, JSStringRef showUI, JSStringRef value);
141     bool isCommandEnabled(JSStringRef name);
142     unsigned windowCount();
143
144     // Repaint testing.
145     void testRepaint() { m_testRepaint = true; }
146     void repaintSweepHorizontally() { m_testRepaintSweepHorizontally = true; }
147     void display();
148     void displayAndTrackRepaints();
149
150     // UserContent testing.
151     void addUserScript(JSStringRef source, bool runAtStart, bool allFrames);
152     void addUserStyleSheet(JSStringRef source, bool allFrames);
153
154     // Text search testing.
155     bool findString(JSStringRef, JSValueRef optionsArray);
156     void findStringMatchesInPage(JSStringRef, JSValueRef optionsArray);
157     void replaceFindMatchesAtIndices(JSValueRef matchIndices, JSStringRef replacementText, bool selectionOnly);
158
159     // Local storage
160     void clearAllDatabases();
161     void setDatabaseQuota(uint64_t);
162     JSRetainPtr<JSStringRef> pathToLocalResource(JSStringRef);
163
164     // Application Cache
165     void clearAllApplicationCaches();
166     void clearApplicationCacheForOrigin(JSStringRef origin);
167     void setAppCacheMaximumSize(uint64_t);
168     long long applicationCacheDiskUsageForOrigin(JSStringRef origin);
169     void disallowIncreaseForApplicationCacheQuota();
170     bool shouldDisallowIncreaseForApplicationCacheQuota() { return m_disallowIncreaseForApplicationCacheQuota; }
171     JSValueRef originsWithApplicationCache();
172
173     void clearDOMCache(JSStringRef origin);
174     void clearDOMCaches();
175     bool hasDOMCache(JSStringRef origin);
176     uint64_t domCacheSize(JSStringRef origin);
177     void setAllowStorageQuotaIncrease(bool);
178
179     // IndexedDB
180     void setIDBPerOriginQuota(uint64_t);
181
182     // Failed load condition testing
183     void forceImmediateCompletion();
184
185     // Printing
186     bool isPageBoxVisible(int pageIndex);
187     bool isPrinting() { return m_isPrinting; }
188     void setPrinting() { m_isPrinting = true; }
189
190     // Authentication
191     void setRejectsProtectionSpaceAndContinueForAuthenticationChallenges(bool);
192     void setHandlesAuthenticationChallenges(bool);
193     void setShouldLogCanAuthenticateAgainstProtectionSpace(bool);
194     void setAuthenticationUsername(JSStringRef);
195     void setAuthenticationPassword(JSStringRef);
196
197     void setValueForUser(JSContextRef, JSValueRef element, JSStringRef value);
198
199     // Audio testing.
200     void setAudioResult(JSContextRef, JSValueRef data);
201
202     void setBlockAllPlugins(bool);
203     void setPluginSupportedMode(JSStringRef);
204
205     WhatToDump whatToDump() const;
206     void setWhatToDump(WhatToDump);
207
208     bool shouldDumpAllFrameScrollPositions() const { return m_shouldDumpAllFrameScrollPositions; }
209     bool shouldDumpBackForwardListsForAllWindows() const { return m_shouldDumpBackForwardListsForAllWindows; }
210     bool shouldDumpEditingCallbacks() const { return m_dumpEditingCallbacks; }
211     bool shouldDumpMainFrameScrollPosition() const { return whatToDump() == WhatToDump::RenderTree; }
212     bool shouldDumpStatusCallbacks() const { return m_dumpStatusCallbacks; }
213     bool shouldDumpTitleChanges() const { return m_dumpTitleChanges; }
214     bool shouldDumpPixels() const;
215     bool shouldDumpFullScreenCallbacks() const { return m_dumpFullScreenCallbacks; }
216     bool shouldDumpFrameLoadCallbacks();
217     bool shouldDumpProgressFinishedCallback() const { return m_dumpProgressFinishedCallback; }
218     bool shouldDumpResourceLoadCallbacks() const { return m_dumpResourceLoadCallbacks; }
219     bool shouldDumpResourceResponseMIMETypes() const { return m_dumpResourceResponseMIMETypes; }
220     bool shouldDumpWillCacheResponse() const { return m_dumpWillCacheResponse; }
221     bool shouldDumpApplicationCacheDelegateCallbacks() const { return m_dumpApplicationCacheDelegateCallbacks; }
222     bool shouldDumpDatabaseCallbacks() const { return m_dumpDatabaseCallbacks; }
223     bool shouldDumpSelectionRect() const { return m_dumpSelectionRect; }
224     bool shouldDumpPolicyCallbacks() const { return m_dumpPolicyCallbacks; }
225
226     bool isPolicyDelegateEnabled() const { return m_policyDelegateEnabled; }
227     bool isPolicyDelegatePermissive() const { return m_policyDelegatePermissive; }
228
229     bool didReceiveServerRedirectForProvisionalNavigation() const;
230     void clearDidReceiveServerRedirectForProvisionalNavigation();
231
232     bool shouldWaitUntilDone() const;
233     void waitToDumpWatchdogTimerFired();
234     void invalidateWaitToDumpWatchdogTimer();
235
236     // Downloads
237     bool shouldFinishAfterDownload() const { return m_shouldFinishAfterDownload; }
238     void setShouldLogDownloadCallbacks(bool);
239
240     bool shouldAllowEditing() const { return m_shouldAllowEditing; }
241
242     bool shouldCloseExtraWindowsAfterRunningTest() const { return m_shouldCloseExtraWindows; }
243
244     void evaluateScriptInIsolatedWorld(JSContextRef, unsigned worldID, JSStringRef script);
245     static unsigned worldIDForWorld(WKBundleScriptWorldRef);
246
247     void showWebInspector();
248     void closeWebInspector();
249     void evaluateInWebInspector(JSStringRef script);
250     JSRetainPtr<JSStringRef> inspectorTestStubURL();
251
252     void setPOSIXLocale(JSStringRef);
253
254     bool willSendRequestReturnsNull() const { return m_willSendRequestReturnsNull; }
255     void setWillSendRequestReturnsNull(bool f) { m_willSendRequestReturnsNull = f; }
256     bool willSendRequestReturnsNullOnRedirect() const { return m_willSendRequestReturnsNullOnRedirect; }
257     void setWillSendRequestReturnsNullOnRedirect(bool f) { m_willSendRequestReturnsNullOnRedirect = f; }
258     void setWillSendRequestAddsHTTPBody(JSStringRef body) { m_willSendRequestHTTPBody = toWTFString(toWK(body)); }
259     String willSendRequestHTTPBody() const { return m_willSendRequestHTTPBody; }
260
261     void setTextDirection(JSStringRef);
262
263     void setShouldStayOnPageAfterHandlingBeforeUnload(bool);
264
265     void setStopProvisionalFrameLoads() { m_shouldStopProvisionalFrameLoads = true; }
266     bool shouldStopProvisionalFrameLoads() const { return m_shouldStopProvisionalFrameLoads; }
267     
268     bool globalFlag() const { return m_globalFlag; }
269     void setGlobalFlag(bool value) { m_globalFlag = value; }
270
271     double databaseDefaultQuota() const { return m_databaseDefaultQuota; }
272     void setDatabaseDefaultQuota(double quota) { m_databaseDefaultQuota = quota; }
273
274     double databaseMaxQuota() const { return m_databaseMaxQuota; }
275     void setDatabaseMaxQuota(double quota) { m_databaseMaxQuota = quota; }
276
277     void addChromeInputField(JSValueRef);
278     void removeChromeInputField(JSValueRef);
279     void focusWebView(JSValueRef);
280     void setBackingScaleFactor(double, JSValueRef);
281
282     void setWindowIsKey(bool);
283
284     void setViewSize(double width, double height);
285
286     void callAddChromeInputFieldCallback();
287     void callRemoveChromeInputFieldCallback();
288     void callFocusWebViewCallback();
289     void callSetBackingScaleFactorCallback();
290
291     void overridePreference(JSStringRef preference, JSStringRef value);
292
293     // Cookies testing
294     void setAlwaysAcceptCookies(bool);
295     void setOnlyAcceptFirstPartyCookies(bool);
296
297     // Custom full screen behavior.
298     void setHasCustomFullScreenBehavior(bool value) { m_customFullScreenBehavior = value; }
299     bool hasCustomFullScreenBehavior() const { return m_customFullScreenBehavior; }
300
301     // Web notifications.
302     static void grantWebNotificationPermission(JSStringRef origin);
303     static void denyWebNotificationPermission(JSStringRef origin);
304     static void removeAllWebNotificationPermissions();
305     static void simulateWebNotificationClick(JSValueRef notification);
306
307     // Geolocation.
308     void setGeolocationPermission(bool);
309     void setMockGeolocationPosition(double latitude, double longitude, double accuracy, JSValueRef altitude, JSValueRef altitudeAccuracy, JSValueRef heading, JSValueRef speed, JSValueRef floorLevel);
310     void setMockGeolocationPositionUnavailableError(JSStringRef message);
311     bool isGeolocationProviderActive();
312
313     // MediaStream
314     void setUserMediaPermission(bool);
315     void resetUserMediaPermission();
316     void setUserMediaPersistentPermissionForOrigin(bool permission, JSStringRef origin, JSStringRef parentOrigin);
317     unsigned userMediaPermissionRequestCountForOrigin(JSStringRef origin, JSStringRef parentOrigin) const;
318     void resetUserMediaPermissionRequestCountForOrigin(JSStringRef origin, JSStringRef parentOrigin);
319     bool isDoingMediaCapture() const;
320
321     void setPageVisibility(JSStringRef state);
322     void resetPageVisibility();
323
324     bool callShouldCloseOnWebView();
325
326     void setCustomTimeout(WTF::Seconds duration) { m_timeout = duration; }
327
328     // Work queue.
329     void queueBackNavigation(unsigned howFarBackward);
330     void queueForwardNavigation(unsigned howFarForward);
331     void queueLoad(JSStringRef url, JSStringRef target, bool shouldOpenExternalURLs);
332     void queueLoadHTMLString(JSStringRef content, JSStringRef baseURL, JSStringRef unreachableURL);
333     void queueReload();
334     void queueLoadingScript(JSStringRef script);
335     void queueNonLoadingScript(JSStringRef script);
336
337     bool secureEventInputIsEnabled() const;
338
339     JSValueRef failNextNewCodeBlock();
340     JSValueRef numberOfDFGCompiles(JSValueRef theFunction);
341     JSValueRef neverInlineFunction(JSValueRef theFunction);
342
343     bool shouldDecideNavigationPolicyAfterDelay() const { return m_shouldDecideNavigationPolicyAfterDelay; }
344     void setShouldDecideNavigationPolicyAfterDelay(bool);
345     bool shouldDecideResponsePolicyAfterDelay() const { return m_shouldDecideResponsePolicyAfterDelay; }
346     void setShouldDecideResponsePolicyAfterDelay(bool);
347     void setNavigationGesturesEnabled(bool);
348     void setIgnoresViewportScaleLimits(bool);
349     void setShouldDownloadUndisplayableMIMETypes(bool);
350     void setShouldAllowDeviceOrientationAndMotionAccess(bool);
351
352     bool didCancelClientRedirect() const { return m_didCancelClientRedirect; }
353     void setDidCancelClientRedirect(bool value) { m_didCancelClientRedirect = value; }
354
355     void runUIScript(JSStringRef script, JSValueRef callback);
356     void runUIScriptCallback(unsigned callbackID, JSStringRef result);
357
358     // Contextual menu actions
359     void setAllowedMenuActions(JSValueRef);
360     void installCustomMenuAction(JSStringRef name, bool dismissesAutomatically, JSValueRef callback);
361     void performCustomMenuAction();
362
363     void installDidBeginSwipeCallback(JSValueRef);
364     void installWillEndSwipeCallback(JSValueRef);
365     void installDidEndSwipeCallback(JSValueRef);
366     void installDidRemoveSwipeSnapshotCallback(JSValueRef);
367     void callDidBeginSwipeCallback();
368     void callWillEndSwipeCallback();
369     void callDidEndSwipeCallback();
370     void callDidRemoveSwipeSnapshotCallback();
371
372     void clearTestRunnerCallbacks();
373
374     void accummulateLogsForChannel(JSStringRef channel);
375
376     unsigned imageCountInGeneralPasteboard() const;
377
378     // Gamepads
379     void connectMockGamepad(unsigned index);
380     void disconnectMockGamepad(unsigned index);
381     void setMockGamepadDetails(unsigned index, JSStringRef gamepadID, unsigned axisCount, unsigned buttonCount);
382     void setMockGamepadAxisValue(unsigned index, unsigned axisIndex, double value);
383     void setMockGamepadButtonValue(unsigned index, unsigned buttonIndex, double value);
384     
385     // Resource Load Statistics
386     void installStatisticsDidModifyDataRecordsCallback(JSValueRef callback);
387     void installStatisticsDidScanDataRecordsCallback(JSValueRef callback);
388     void installStatisticsDidRunTelemetryCallback(JSValueRef callback);
389     void statisticsDidModifyDataRecordsCallback();
390     void statisticsDidScanDataRecordsCallback();
391     void statisticsDidRunTelemetryCallback(unsigned totalPrevalentResources, unsigned totalPrevalentResourcesWithUserInteraction, unsigned top3SubframeUnderTopFrameOrigins);
392     void statisticsNotifyObserver();
393     void statisticsProcessStatisticsAndDataRecords();
394     void statisticsUpdateCookieBlocking(JSValueRef completionHandler);
395     void statisticsCallDidSetBlockCookiesForHostCallback();
396     void statisticsSubmitTelemetry();
397     void setStatisticsDebugMode(bool value, JSValueRef completionHandler);
398     void statisticsCallDidSetDebugModeCallback();
399     void setStatisticsPrevalentResourceForDebugMode(JSStringRef hostName, JSValueRef completionHandler);
400     void statisticsCallDidSetPrevalentResourceForDebugModeCallback();
401     void setStatisticsLastSeen(JSStringRef hostName, double seconds, JSValueRef completionHandler);
402     void statisticsCallDidSetLastSeenCallback();
403     void setStatisticsPrevalentResource(JSStringRef hostName, bool value, JSValueRef completionHandler);
404     void statisticsCallDidSetPrevalentResourceCallback();
405     void setStatisticsVeryPrevalentResource(JSStringRef hostName, bool value, JSValueRef completionHandler);
406     void statisticsCallDidSetVeryPrevalentResourceCallback();
407     bool isStatisticsPrevalentResource(JSStringRef hostName);
408     bool isStatisticsVeryPrevalentResource(JSStringRef hostName);
409     bool isStatisticsRegisteredAsSubresourceUnder(JSStringRef subresourceHost, JSStringRef topFrameHost);
410     bool isStatisticsRegisteredAsSubFrameUnder(JSStringRef subFrameHost, JSStringRef topFrameHost);
411     bool isStatisticsRegisteredAsRedirectingTo(JSStringRef hostRedirectedFrom, JSStringRef hostRedirectedTo);
412     void setStatisticsHasHadUserInteraction(JSStringRef hostName, bool value, JSValueRef completionHandler);
413     void statisticsCallDidSetHasHadUserInteractionCallback();
414     bool isStatisticsHasHadUserInteraction(JSStringRef hostName);
415     void setStatisticsGrandfathered(JSStringRef hostName, bool value);
416     bool isStatisticsGrandfathered(JSStringRef hostName);
417     void setStatisticsSubframeUnderTopFrameOrigin(JSStringRef hostName, JSStringRef topFrameHostName);
418     void setStatisticsSubresourceUnderTopFrameOrigin(JSStringRef hostName, JSStringRef topFrameHostName);
419     void setStatisticsSubresourceUniqueRedirectTo(JSStringRef hostName, JSStringRef hostNameRedirectedTo);
420     void setStatisticsSubresourceUniqueRedirectFrom(JSStringRef hostName, JSStringRef hostNameRedirectedFrom);
421     void setStatisticsTopFrameUniqueRedirectTo(JSStringRef hostName, JSStringRef hostNameRedirectedTo);
422     void setStatisticsTopFrameUniqueRedirectFrom(JSStringRef hostName, JSStringRef hostNameRedirectedFrom);
423     void setStatisticsCrossSiteLoadWithLinkDecoration(JSStringRef fromHost, JSStringRef toHost);
424     void setStatisticsTimeToLiveUserInteraction(double seconds);
425     void setStatisticsNotifyPagesWhenDataRecordsWereScanned(bool);
426     void setStatisticsIsRunningTest(bool);
427     void setStatisticsShouldClassifyResourcesBeforeDataRecordsRemoval(bool);
428     void setStatisticsNotifyPagesWhenTelemetryWasCaptured(bool value);
429     void setStatisticsMinimumTimeBetweenDataRecordsRemoval(double);
430     void setStatisticsGrandfatheringTime(double seconds);
431     void setStatisticsMaxStatisticsEntries(unsigned);
432     void setStatisticsPruneEntriesDownTo(unsigned);
433     void statisticsClearInMemoryAndPersistentStore(JSValueRef callback);
434     void statisticsClearInMemoryAndPersistentStoreModifiedSinceHours(unsigned hours, JSValueRef callback);
435     void statisticsClearThroughWebsiteDataRemoval(JSValueRef callback);
436     void statisticsDeleteCookiesForHost(JSStringRef hostName, bool includeHttpOnlyCookies);
437     void statisticsCallClearThroughWebsiteDataRemovalCallback();
438     bool isStatisticsHasLocalStorage(JSStringRef hostName);
439     void setStatisticsCacheMaxAgeCap(double seconds);
440     void statisticsResetToConsistentState(JSValueRef completionHandler);
441     void statisticsCallDidResetToConsistentStateCallback();
442
443     // Injected bundle form client.
444     void installTextDidChangeInTextFieldCallback(JSValueRef callback);
445     void textDidChangeInTextFieldCallback();
446     void installTextFieldDidBeginEditingCallback(JSValueRef callback);
447     void textFieldDidBeginEditingCallback();
448     void installTextFieldDidEndEditingCallback(JSValueRef callback);
449     void textFieldDidEndEditingCallback();
450
451     // Storage Access API
452     void setStorageAccessAPIEnabled(bool);
453     void getAllStorageAccessEntries(JSValueRef callback);
454     void callDidReceiveAllStorageAccessEntriesCallback(Vector<String>& domains);
455
456     // Open panel
457     void setOpenPanelFiles(JSValueRef);
458     void setOpenPanelFilesMediaIcon(JSValueRef);
459
460     // Modal alerts
461     void setShouldDismissJavaScriptAlertsAsynchronously(bool);
462
463     void terminateNetworkProcess();
464     void terminateServiceWorkerProcess();
465
466     void removeAllSessionCredentials(JSValueRef);
467     void callDidRemoveAllSessionCredentialsCallback();
468     
469     void getApplicationManifestThen(JSValueRef);
470     void didGetApplicationManifest();
471
472     void installFakeHelvetica(JSStringRef configuration);
473
474     void dumpAllHTTPRedirectedResponseHeaders() { m_dumpAllHTTPRedirectedResponseHeaders = true; }
475     bool shouldDumpAllHTTPRedirectedResponseHeaders() const { return m_dumpAllHTTPRedirectedResponseHeaders; }
476
477     void addMockCameraDevice(JSStringRef persistentId, JSStringRef label);
478     void addMockMicrophoneDevice(JSStringRef persistentId, JSStringRef label);
479     void addMockScreenDevice(JSStringRef persistentId, JSStringRef label);
480     void clearMockMediaDevices();
481     void removeMockMediaDevice(JSStringRef persistentId);
482     void resetMockMediaDevices();
483
484     size_t userScriptInjectedCount() const;
485     void injectUserScript(JSStringRef);
486
487     void sendDisplayConfigurationChangedMessageForTesting();
488
489     // WebAuthN
490     void setWebAuthenticationMockConfiguration(JSValueRef);
491     // FIXME(189876)
492     void addTestKeyToKeychain(JSStringRef privateKeyBase64, JSStringRef attrLabel, JSStringRef applicationTagBase64);
493     void cleanUpKeychain(JSStringRef attrLabel);
494     bool keyExistsInKeychain(JSStringRef attrLabel, JSStringRef applicationTagBase64);
495
496     void setCanHandleHTTPSServerTrustEvaluation(bool canHandle);
497     bool canDoServerTrustEvaluationInNetworkProcess();
498     unsigned long serverTrustEvaluationCallbackCallsCount();
499
500     // Ad Click Attribution.
501     void dumpAdClickAttribution();
502     void clearAdClickAttribution();
503     void setAdClickAttributionOverrideTimerForTesting(bool value);
504     void setAdClickAttributionConversionURLForTesting(JSStringRef);
505
506 private:
507     TestRunner();
508
509     void platformInitialize();
510     void initializeWaitToDumpWatchdogTimerIfNeeded();
511
512     void setDumpPixels(bool);
513     void setWaitUntilDone(bool);
514
515     void addMockMediaDevice(JSStringRef persistentId, JSStringRef label, const char* type);
516
517     WKRetainPtr<WKURLRef> m_testURL; // Set by InjectedBundlePage once provisional load starts.
518
519     bool m_shouldDumpAllFrameScrollPositions;
520     bool m_shouldDumpBackForwardListsForAllWindows;
521
522     bool m_shouldAllowEditing;
523     bool m_shouldCloseExtraWindows;
524
525     bool m_dumpEditingCallbacks;
526     bool m_dumpStatusCallbacks;
527     bool m_dumpTitleChanges;
528     bool m_dumpPixels;
529     bool m_dumpSelectionRect;
530     bool m_dumpFullScreenCallbacks;
531     bool m_dumpProgressFinishedCallback;
532     bool m_dumpResourceLoadCallbacks;
533     bool m_dumpResourceResponseMIMETypes;
534     bool m_dumpWillCacheResponse;
535     bool m_dumpApplicationCacheDelegateCallbacks;
536     bool m_dumpDatabaseCallbacks;
537     bool m_dumpPolicyCallbacks { false };
538     bool m_disallowIncreaseForApplicationCacheQuota;
539     bool m_testRepaint;
540     bool m_testRepaintSweepHorizontally;
541     bool m_isPrinting;
542
543     bool m_willSendRequestReturnsNull;
544     bool m_willSendRequestReturnsNullOnRedirect;
545     bool m_shouldStopProvisionalFrameLoads;
546     String m_willSendRequestHTTPBody;
547
548     bool m_policyDelegateEnabled;
549     bool m_policyDelegatePermissive;
550     
551     bool m_globalFlag;
552     bool m_customFullScreenBehavior;
553
554     WTF::Seconds m_timeout;
555
556     double m_databaseDefaultQuota;
557     double m_databaseMaxQuota;
558
559     bool m_shouldDecideNavigationPolicyAfterDelay { false };
560     bool m_shouldDecideResponsePolicyAfterDelay { false };
561     bool m_shouldFinishAfterDownload { false };
562     bool m_didCancelClientRedirect { false };
563
564     bool m_userStyleSheetEnabled;
565     WKRetainPtr<WKStringRef> m_userStyleSheetLocation;
566
567     WKRetainPtr<WKArrayRef> m_allowedHosts;
568
569     size_t m_userMediaPermissionRequestCount { 0 };
570
571     PlatformTimerRef m_waitToDumpWatchdogTimer;
572
573     bool m_dumpAllHTTPRedirectedResponseHeaders { false };
574 };
575
576 } // namespace WTR