Add completion handlers to TestRunner functions setStatisticsLastSeen(), setStatistic...
[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/text/WTFString.h>
37
38 #if PLATFORM(COCOA)
39 #include <wtf/RetainPtr.h>
40 #include <CoreFoundation/CFRunLoop.h>
41 typedef RetainPtr<CFRunLoopTimerRef> PlatformTimerRef;
42 #elif PLATFORM(GTK) || PLATFORM(WPE)
43 #include <wtf/RunLoop.h>
44 namespace WTR {
45 class TestRunner;
46 typedef RunLoop::Timer<TestRunner> PlatformTimerRef;
47 }
48 #endif
49
50 namespace WTR {
51
52 class TestRunner : public JSWrappable {
53 public:
54     static Ref<TestRunner> create();
55     virtual ~TestRunner();
56
57     // JSWrappable
58     virtual JSClassRef wrapperClass();
59
60     void makeWindowObject(JSContextRef, JSObjectRef windowObject, JSValueRef* exception);
61
62     bool isWebKit2() const { return true; }
63
64     // The basics.
65     WKURLRef testURL() const { return m_testURL.get(); }
66     void setTestURL(WKURLRef url) { m_testURL = url; }
67     void dumpAsText(bool dumpPixels);
68     void waitForPolicyDelegate();
69     void dumpChildFramesAsText() { setWhatToDump(WhatToDump::AllFramesText); }
70     void waitUntilDownloadFinished();
71     void waitUntilDone();
72     void notifyDone();
73     double preciseTime();
74     double timeout() { return m_timeout; }
75
76     // Other dumping.
77     void dumpBackForwardList() { m_shouldDumpBackForwardListsForAllWindows = true; }
78     void dumpChildFrameScrollPositions() { m_shouldDumpAllFrameScrollPositions = true; }
79     void dumpEditingCallbacks() { m_dumpEditingCallbacks = true; }
80     void dumpSelectionRect() { m_dumpSelectionRect = true; }
81     void dumpStatusCallbacks() { m_dumpStatusCallbacks = true; }
82     void dumpTitleChanges() { m_dumpTitleChanges = true; }
83     void dumpFullScreenCallbacks() { m_dumpFullScreenCallbacks = true; }
84     void dumpFrameLoadCallbacks() { setShouldDumpFrameLoadCallbacks(true); }
85     void dumpProgressFinishedCallback() { setShouldDumpProgressFinishedCallback(true); }
86     void dumpResourceLoadCallbacks() { m_dumpResourceLoadCallbacks = true; }
87     void dumpResourceResponseMIMETypes() { m_dumpResourceResponseMIMETypes = true; }
88     void dumpWillCacheResponse() { m_dumpWillCacheResponse = true; }
89     void dumpApplicationCacheDelegateCallbacks() { m_dumpApplicationCacheDelegateCallbacks = true; }
90     void dumpDatabaseCallbacks() { m_dumpDatabaseCallbacks = true; }
91     void dumpDOMAsWebArchive() { setWhatToDump(WhatToDump::DOMAsWebArchive); }
92     void dumpPolicyDelegateCallbacks() { m_dumpPolicyCallbacks = true; }
93
94     void setShouldDumpFrameLoadCallbacks(bool value);
95     void setShouldDumpProgressFinishedCallback(bool value) { m_dumpProgressFinishedCallback = value; }
96
97     // Special options.
98     void keepWebHistory();
99     void setAcceptsEditing(bool value) { m_shouldAllowEditing = value; }
100     void setCanOpenWindows(bool);
101     void setCloseRemainingWindowsWhenComplete(bool value) { m_shouldCloseExtraWindows = value; }
102     void setXSSAuditorEnabled(bool);
103     void setModernMediaControlsEnabled(bool);
104     void setWebGL2Enabled(bool);
105     void setWebGPUEnabled(bool);
106     void setWritableStreamAPIEnabled(bool);
107     void setReadableByteStreamAPIEnabled(bool);
108
109     void setAllowUniversalAccessFromFileURLs(bool);
110     void setAllowFileAccessFromFileURLs(bool);
111     void setNeedsStorageAccessFromFileURLsQuirk(bool);
112     void setPluginsEnabled(bool);
113     void setJavaScriptCanAccessClipboard(bool);
114     void setPrivateBrowsingEnabled(bool);
115     void setUseDashboardCompatibilityMode(bool);
116     void setPopupBlockingEnabled(bool);
117     void setAuthorAndUserStylesEnabled(bool);
118     void setCustomPolicyDelegate(bool enabled, bool permissive = false);
119     void addOriginAccessWhitelistEntry(JSStringRef sourceOrigin, JSStringRef destinationProtocol, JSStringRef destinationHost, bool allowDestinationSubdomains);
120     void removeOriginAccessWhitelistEntry(JSStringRef sourceOrigin, JSStringRef destinationProtocol, JSStringRef destinationHost, bool allowDestinationSubdomains);
121     void setUserStyleSheetEnabled(bool);
122     void setUserStyleSheetLocation(JSStringRef);
123     void setSpatialNavigationEnabled(bool);
124     void setTabKeyCyclesThroughElements(bool);
125     void setSerializeHTTPLoads();
126     void dispatchPendingLoadRequests();
127     void setCacheModel(int);
128     void setAsynchronousSpellCheckingEnabled(bool);
129     void setAllowsAnySSLCertificate(bool);
130     void setEncryptedMediaAPIEnabled(bool);
131     void setMediaDevicesEnabled(bool);
132     void setWebRTCLegacyAPIEnabled(bool);
133     void setMDNSICECandidatesEnabled(bool);
134     void setCustomUserAgent(JSStringRef);
135
136     // Special DOM functions.
137     void clearBackForwardList();
138     void execCommand(JSStringRef name, JSStringRef argument);
139     bool isCommandEnabled(JSStringRef name);
140     unsigned windowCount();
141
142     // Repaint testing.
143     void testRepaint() { m_testRepaint = true; }
144     void repaintSweepHorizontally() { m_testRepaintSweepHorizontally = true; }
145     void display();
146     void displayAndTrackRepaints();
147
148     // UserContent testing.
149     void addUserScript(JSStringRef source, bool runAtStart, bool allFrames);
150     void addUserStyleSheet(JSStringRef source, bool allFrames);
151
152     // Text search testing.
153     bool findString(JSStringRef, JSValueRef optionsArray);
154
155     // Local storage
156     void clearAllDatabases();
157     void setDatabaseQuota(uint64_t);
158     JSRetainPtr<JSStringRef> pathToLocalResource(JSStringRef);
159
160     // Application Cache
161     void clearAllApplicationCaches();
162     void clearApplicationCacheForOrigin(JSStringRef origin);
163     void setAppCacheMaximumSize(uint64_t);
164     long long applicationCacheDiskUsageForOrigin(JSStringRef origin);
165     void disallowIncreaseForApplicationCacheQuota();
166     bool shouldDisallowIncreaseForApplicationCacheQuota() { return m_disallowIncreaseForApplicationCacheQuota; }
167     JSValueRef originsWithApplicationCache();
168
169     void clearDOMCache(JSStringRef origin);
170     void clearDOMCaches();
171     bool hasDOMCache(JSStringRef origin);
172     uint64_t domCacheSize(JSStringRef origin);
173
174     // Failed load condition testing
175     void forceImmediateCompletion();
176
177     // Printing
178     bool isPageBoxVisible(int pageIndex);
179     bool isPrinting() { return m_isPrinting; }
180     void setPrinting() { m_isPrinting = true; }
181
182     // Authentication
183     void setRejectsProtectionSpaceAndContinueForAuthenticationChallenges(bool);
184     void setHandlesAuthenticationChallenges(bool);
185     void setShouldLogCanAuthenticateAgainstProtectionSpace(bool);
186     void setAuthenticationUsername(JSStringRef);
187     void setAuthenticationPassword(JSStringRef);
188
189     void setValueForUser(JSContextRef, JSValueRef element, JSStringRef value);
190
191     // Audio testing.
192     void setAudioResult(JSContextRef, JSValueRef data);
193
194     void setBlockAllPlugins(bool);
195     void setPluginSupportedMode(JSStringRef);
196
197     WhatToDump whatToDump() const;
198     void setWhatToDump(WhatToDump);
199
200     bool shouldDumpAllFrameScrollPositions() const { return m_shouldDumpAllFrameScrollPositions; }
201     bool shouldDumpBackForwardListsForAllWindows() const { return m_shouldDumpBackForwardListsForAllWindows; }
202     bool shouldDumpEditingCallbacks() const { return m_dumpEditingCallbacks; }
203     bool shouldDumpMainFrameScrollPosition() const { return whatToDump() == WhatToDump::RenderTree; }
204     bool shouldDumpStatusCallbacks() const { return m_dumpStatusCallbacks; }
205     bool shouldDumpTitleChanges() const { return m_dumpTitleChanges; }
206     bool shouldDumpPixels() const;
207     bool shouldDumpFullScreenCallbacks() const { return m_dumpFullScreenCallbacks; }
208     bool shouldDumpFrameLoadCallbacks();
209     bool shouldDumpProgressFinishedCallback() const { return m_dumpProgressFinishedCallback; }
210     bool shouldDumpResourceLoadCallbacks() const { return m_dumpResourceLoadCallbacks; }
211     bool shouldDumpResourceResponseMIMETypes() const { return m_dumpResourceResponseMIMETypes; }
212     bool shouldDumpWillCacheResponse() const { return m_dumpWillCacheResponse; }
213     bool shouldDumpApplicationCacheDelegateCallbacks() const { return m_dumpApplicationCacheDelegateCallbacks; }
214     bool shouldDumpDatabaseCallbacks() const { return m_dumpDatabaseCallbacks; }
215     bool shouldDumpSelectionRect() const { return m_dumpSelectionRect; }
216     bool shouldDumpPolicyCallbacks() const { return m_dumpPolicyCallbacks; }
217
218     bool isPolicyDelegateEnabled() const { return m_policyDelegateEnabled; }
219     bool isPolicyDelegatePermissive() const { return m_policyDelegatePermissive; }
220
221     bool didReceiveServerRedirectForProvisionalNavigation() const;
222     void clearDidReceiveServerRedirectForProvisionalNavigation();
223
224     bool shouldWaitUntilDone() const;
225     void waitToDumpWatchdogTimerFired();
226     void invalidateWaitToDumpWatchdogTimer();
227
228     // Downloads
229     bool shouldFinishAfterDownload() const { return m_shouldFinishAfterDownload; }
230     void setShouldLogDownloadCallbacks(bool);
231
232     bool shouldAllowEditing() const { return m_shouldAllowEditing; }
233
234     bool shouldCloseExtraWindowsAfterRunningTest() const { return m_shouldCloseExtraWindows; }
235
236     void evaluateScriptInIsolatedWorld(JSContextRef, unsigned worldID, JSStringRef script);
237     static unsigned worldIDForWorld(WKBundleScriptWorldRef);
238
239     void showWebInspector();
240     void closeWebInspector();
241     void evaluateInWebInspector(JSStringRef script);
242     JSRetainPtr<JSStringRef> inspectorTestStubURL();
243
244     void setPOSIXLocale(JSStringRef);
245
246     bool willSendRequestReturnsNull() const { return m_willSendRequestReturnsNull; }
247     void setWillSendRequestReturnsNull(bool f) { m_willSendRequestReturnsNull = f; }
248     bool willSendRequestReturnsNullOnRedirect() const { return m_willSendRequestReturnsNullOnRedirect; }
249     void setWillSendRequestReturnsNullOnRedirect(bool f) { m_willSendRequestReturnsNullOnRedirect = f; }
250     void setWillSendRequestAddsHTTPBody(JSStringRef body) { m_willSendRequestHTTPBody = toWTFString(toWK(body)); }
251     String willSendRequestHTTPBody() const { return m_willSendRequestHTTPBody; }
252
253     void setTextDirection(JSStringRef);
254
255     void setShouldStayOnPageAfterHandlingBeforeUnload(bool);
256
257     void setDefersLoading(bool);
258
259     void setStopProvisionalFrameLoads() { m_shouldStopProvisionalFrameLoads = true; }
260     bool shouldStopProvisionalFrameLoads() const { return m_shouldStopProvisionalFrameLoads; }
261     
262     bool globalFlag() const { return m_globalFlag; }
263     void setGlobalFlag(bool value) { m_globalFlag = value; }
264
265     double databaseDefaultQuota() const { return m_databaseDefaultQuota; }
266     void setDatabaseDefaultQuota(double quota) { m_databaseDefaultQuota = quota; }
267
268     double databaseMaxQuota() const { return m_databaseMaxQuota; }
269     void setDatabaseMaxQuota(double quota) { m_databaseMaxQuota = quota; }
270
271     void addChromeInputField(JSValueRef);
272     void removeChromeInputField(JSValueRef);
273     void focusWebView(JSValueRef);
274     void setBackingScaleFactor(double, JSValueRef);
275
276     void setWindowIsKey(bool);
277
278     void setViewSize(double width, double height);
279
280     void callAddChromeInputFieldCallback();
281     void callRemoveChromeInputFieldCallback();
282     void callFocusWebViewCallback();
283     void callSetBackingScaleFactorCallback();
284
285     void overridePreference(JSStringRef preference, JSStringRef value);
286
287     // Cookies testing
288     void setAlwaysAcceptCookies(bool);
289     void setCookieStoragePartitioningEnabled(bool);
290
291     // Custom full screen behavior.
292     void setHasCustomFullScreenBehavior(bool value) { m_customFullScreenBehavior = value; }
293     bool hasCustomFullScreenBehavior() const { return m_customFullScreenBehavior; }
294
295     // Web notifications.
296     static void grantWebNotificationPermission(JSStringRef origin);
297     static void denyWebNotificationPermission(JSStringRef origin);
298     static void removeAllWebNotificationPermissions();
299     static void simulateWebNotificationClick(JSValueRef notification);
300
301     // Geolocation.
302     void setGeolocationPermission(bool);
303     void setMockGeolocationPosition(double latitude, double longitude, double accuracy, JSValueRef altitude, JSValueRef altitudeAccuracy, JSValueRef heading, JSValueRef speed, JSValueRef floorLevel);
304     void setMockGeolocationPositionUnavailableError(JSStringRef message);
305     bool isGeolocationProviderActive();
306
307     // MediaStream
308     void setUserMediaPermission(bool);
309     void resetUserMediaPermission();
310     void setUserMediaPersistentPermissionForOrigin(bool permission, JSStringRef origin, JSStringRef parentOrigin);
311     unsigned userMediaPermissionRequestCountForOrigin(JSStringRef origin, JSStringRef parentOrigin) const;
312     void resetUserMediaPermissionRequestCountForOrigin(JSStringRef origin, JSStringRef parentOrigin);
313
314     void setPageVisibility(JSStringRef state);
315     void resetPageVisibility();
316
317     bool callShouldCloseOnWebView();
318
319     void setCustomTimeout(int duration) { m_timeout = duration; }
320
321     // Work queue.
322     void queueBackNavigation(unsigned howFarBackward);
323     void queueForwardNavigation(unsigned howFarForward);
324     void queueLoad(JSStringRef url, JSStringRef target, bool shouldOpenExternalURLs);
325     void queueLoadHTMLString(JSStringRef content, JSStringRef baseURL, JSStringRef unreachableURL);
326     void queueReload();
327     void queueLoadingScript(JSStringRef script);
328     void queueNonLoadingScript(JSStringRef script);
329
330     bool secureEventInputIsEnabled() const;
331
332     JSValueRef failNextNewCodeBlock();
333     JSValueRef numberOfDFGCompiles(JSValueRef theFunction);
334     JSValueRef neverInlineFunction(JSValueRef theFunction);
335
336     bool shouldDecideNavigationPolicyAfterDelay() const { return m_shouldDecideNavigationPolicyAfterDelay; }
337     void setShouldDecideNavigationPolicyAfterDelay(bool);
338     bool shouldDecideResponsePolicyAfterDelay() const { return m_shouldDecideResponsePolicyAfterDelay; }
339     void setShouldDecideResponsePolicyAfterDelay(bool);
340     void setNavigationGesturesEnabled(bool);
341     void setIgnoresViewportScaleLimits(bool);
342     void setShouldDownloadUndisplayableMIMETypes(bool);
343
344     bool didCancelClientRedirect() const { return m_didCancelClientRedirect; }
345     void setDidCancelClientRedirect(bool value) { m_didCancelClientRedirect = value; }
346
347     void runUIScript(JSStringRef script, JSValueRef callback);
348     void runUIScriptCallback(unsigned callbackID, JSStringRef result);
349
350     void installDidBeginSwipeCallback(JSValueRef);
351     void installWillEndSwipeCallback(JSValueRef);
352     void installDidEndSwipeCallback(JSValueRef);
353     void installDidRemoveSwipeSnapshotCallback(JSValueRef);
354     void callDidBeginSwipeCallback();
355     void callWillEndSwipeCallback();
356     void callDidEndSwipeCallback();
357     void callDidRemoveSwipeSnapshotCallback();
358
359     void clearTestRunnerCallbacks();
360
361     void accummulateLogsForChannel(JSStringRef channel);
362
363     unsigned imageCountInGeneralPasteboard() const;
364
365     // Gamepads
366     void connectMockGamepad(unsigned index);
367     void disconnectMockGamepad(unsigned index);
368     void setMockGamepadDetails(unsigned index, JSStringRef gamepadID, unsigned axisCount, unsigned buttonCount);
369     void setMockGamepadAxisValue(unsigned index, unsigned axisIndex, double value);
370     void setMockGamepadButtonValue(unsigned index, unsigned buttonIndex, double value);
371     
372     // Resource Load Statistics
373     void installStatisticsDidModifyDataRecordsCallback(JSValueRef callback);
374     void installStatisticsDidScanDataRecordsCallback(JSValueRef callback);
375     void installStatisticsDidRunTelemetryCallback(JSValueRef callback);
376     void statisticsDidModifyDataRecordsCallback();
377     void statisticsDidScanDataRecordsCallback();
378     void statisticsDidRunTelemetryCallback(unsigned totalPrevalentResources, unsigned totalPrevalentResourcesWithUserInteraction, unsigned top3SubframeUnderTopFrameOrigins);
379     void statisticsNotifyObserver();
380     void statisticsProcessStatisticsAndDataRecords();
381     void statisticsUpdateCookiePartitioning(JSValueRef callback);
382     void statisticsSetShouldPartitionCookiesForHost(JSStringRef hostName, bool value, JSValueRef callback);
383     void statisticsCallDidSetPartitionOrBlockCookiesForHostCallback();
384     void statisticsSubmitTelemetry();
385     void setStatisticsLastSeen(JSStringRef hostName, double seconds, JSValueRef completionHandler);
386     void statisticsCallDidSetLastSeenCallback();
387     void setStatisticsPrevalentResource(JSStringRef hostName, bool value, JSValueRef completionHandler);
388     void statisticsCallDidSetPrevalentResourceCallback();
389     void setStatisticsVeryPrevalentResource(JSStringRef hostName, bool value, JSValueRef completionHandler);
390     void statisticsCallDidSetVeryPrevalentResourceCallback();
391     bool isStatisticsPrevalentResource(JSStringRef hostName);
392     bool isStatisticsVeryPrevalentResource(JSStringRef hostName);
393     bool isStatisticsRegisteredAsSubFrameUnder(JSStringRef subFrameHost, JSStringRef topFrameHost);
394     bool isStatisticsRegisteredAsRedirectingTo(JSStringRef hostRedirectedFrom, JSStringRef hostRedirectedTo);
395     void setStatisticsHasHadUserInteraction(JSStringRef hostName, bool value, JSValueRef completionHandler);
396     void setStatisticsHasHadNonRecentUserInteraction(JSStringRef hostName, JSValueRef completionHandler);
397     void statisticsCallDidSetHasHadUserInteractionCallback();
398     bool isStatisticsHasHadUserInteraction(JSStringRef hostName);
399     void setStatisticsGrandfathered(JSStringRef hostName, bool value);
400     bool isStatisticsGrandfathered(JSStringRef hostName);
401     void setStatisticsSubframeUnderTopFrameOrigin(JSStringRef hostName, JSStringRef topFrameHostName);
402     void setStatisticsSubresourceUnderTopFrameOrigin(JSStringRef hostName, JSStringRef topFrameHostName);
403     void setStatisticsSubresourceUniqueRedirectTo(JSStringRef hostName, JSStringRef hostNameRedirectedTo);
404     void setStatisticsSubresourceUniqueRedirectFrom(JSStringRef hostName, JSStringRef hostNameRedirectedFrom);
405     void setStatisticsTopFrameUniqueRedirectTo(JSStringRef hostName, JSStringRef hostNameRedirectedTo);
406     void setStatisticsTopFrameUniqueRedirectFrom(JSStringRef hostName, JSStringRef hostNameRedirectedFrom);
407     void setStatisticsTimeToLiveUserInteraction(double seconds);
408     void setStatisticsTimeToLiveCookiePartitionFree(double seconds);
409     void setStatisticsNotifyPagesWhenDataRecordsWereScanned(bool);
410     void setStatisticsShouldClassifyResourcesBeforeDataRecordsRemoval(bool);
411     void setStatisticsNotifyPagesWhenTelemetryWasCaptured(bool value);
412     void setStatisticsMinimumTimeBetweenDataRecordsRemoval(double);
413     void setStatisticsGrandfatheringTime(double seconds);
414     void setStatisticsMaxStatisticsEntries(unsigned);
415     void setStatisticsPruneEntriesDownTo(unsigned);
416     void statisticsClearInMemoryAndPersistentStore(JSValueRef callback);
417     void statisticsClearInMemoryAndPersistentStoreModifiedSinceHours(unsigned hours, JSValueRef callback);
418     void statisticsClearThroughWebsiteDataRemoval(JSValueRef callback);
419     void statisticsCallClearThroughWebsiteDataRemovalCallback();
420     void statisticsResetToConsistentState(JSValueRef completionHandler);
421     void statisticsCallDidResetToConsistentStateCallback();
422
423     // Injected bundle form client.
424     void installTextDidChangeInTextFieldCallback(JSValueRef callback);
425     void textDidChangeInTextFieldCallback();
426     void installTextFieldDidBeginEditingCallback(JSValueRef callback);
427     void textFieldDidBeginEditingCallback();
428     void installTextFieldDidEndEditingCallback(JSValueRef callback);
429     void textFieldDidEndEditingCallback();
430
431     // Storage Access API
432     void setStorageAccessAPIEnabled(bool);
433     void getAllStorageAccessEntries(JSValueRef callback);
434     void callDidReceiveAllStorageAccessEntriesCallback(Vector<String>& domains);
435
436     // Open panel
437     void setOpenPanelFiles(JSValueRef);
438
439     void terminateNetworkProcess();
440     void terminateServiceWorkerProcess();
441     void terminateStorageProcess();
442
443     void removeAllSessionCredentials(JSValueRef);
444     void callDidRemoveAllSessionCredentialsCallback();
445     
446     void getApplicationManifestThen(JSValueRef);
447     void didGetApplicationManifest();
448
449     void installFakeHelvetica(JSStringRef configuration);
450
451     void dumpAllHTTPRedirectedResponseHeaders() { m_dumpAllHTTPRedirectedResponseHeaders = true; }
452     bool shouldDumpAllHTTPRedirectedResponseHeaders() const { return m_dumpAllHTTPRedirectedResponseHeaders; }
453
454     void addMockCameraDevice(JSStringRef persistentId, JSStringRef label);
455     void addMockMicrophoneDevice(JSStringRef persistentId, JSStringRef label);
456     void addMockScreenDevice(JSStringRef persistentId, JSStringRef label);
457     void clearMockMediaDevices();
458     void removeMockMediaDevice(JSStringRef persistentId);
459     void resetMockMediaDevices();
460
461     size_t userScriptInjectedCount() const;
462     void injectUserScript(JSStringRef);
463
464 private:
465     TestRunner();
466
467     void platformInitialize();
468     void initializeWaitToDumpWatchdogTimerIfNeeded();
469
470     void setDumpPixels(bool);
471     void setWaitUntilDone(bool);
472
473     void addMockMediaDevice(JSStringRef persistentId, JSStringRef label, const char* type);
474
475     WKRetainPtr<WKURLRef> m_testURL; // Set by InjectedBundlePage once provisional load starts.
476
477     bool m_shouldDumpAllFrameScrollPositions;
478     bool m_shouldDumpBackForwardListsForAllWindows;
479
480     bool m_shouldAllowEditing;
481     bool m_shouldCloseExtraWindows;
482
483     bool m_dumpEditingCallbacks;
484     bool m_dumpStatusCallbacks;
485     bool m_dumpTitleChanges;
486     bool m_dumpPixels;
487     bool m_dumpSelectionRect;
488     bool m_dumpFullScreenCallbacks;
489     bool m_dumpProgressFinishedCallback;
490     bool m_dumpResourceLoadCallbacks;
491     bool m_dumpResourceResponseMIMETypes;
492     bool m_dumpWillCacheResponse;
493     bool m_dumpApplicationCacheDelegateCallbacks;
494     bool m_dumpDatabaseCallbacks;
495     bool m_dumpPolicyCallbacks { false };
496     bool m_disallowIncreaseForApplicationCacheQuota;
497     bool m_testRepaint;
498     bool m_testRepaintSweepHorizontally;
499     bool m_isPrinting;
500
501     bool m_willSendRequestReturnsNull;
502     bool m_willSendRequestReturnsNullOnRedirect;
503     bool m_shouldStopProvisionalFrameLoads;
504     String m_willSendRequestHTTPBody;
505
506     bool m_policyDelegateEnabled;
507     bool m_policyDelegatePermissive;
508     
509     bool m_globalFlag;
510     bool m_customFullScreenBehavior;
511
512     int m_timeout;
513
514     double m_databaseDefaultQuota;
515     double m_databaseMaxQuota;
516
517     bool m_shouldDecideNavigationPolicyAfterDelay { false };
518     bool m_shouldDecideResponsePolicyAfterDelay { false };
519     bool m_shouldFinishAfterDownload { false };
520     bool m_didCancelClientRedirect { false };
521
522     bool m_userStyleSheetEnabled;
523     WKRetainPtr<WKStringRef> m_userStyleSheetLocation;
524
525     WKRetainPtr<WKArrayRef> m_allowedHosts;
526
527     size_t m_userMediaPermissionRequestCount { 0 };
528
529     PlatformTimerRef m_waitToDumpWatchdogTimer;
530
531     bool m_dumpAllHTTPRedirectedResponseHeaders { false };
532 };
533
534 } // namespace WTR