• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2007, 2008, 2009 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  *
8  * 1.  Redistributions of source code must retain the above copyright
9  *     notice, this list of conditions and the following disclaimer.
10  * 2.  Redistributions in binary form must reproduce the above copyright
11  *     notice, this list of conditions and the following disclaimer in the
12  *     documentation and/or other materials provided with the distribution.
13  * 3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of
14  *     its contributors may be used to endorse or promote products derived
15  *     from this software without specific prior written permission.
16  *
17  * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
18  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20  * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
21  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27  */
28 
29 #ifndef LayoutTestController_h
30 #define LayoutTestController_h
31 
32 #include <JavaScriptCore/JSObjectRef.h>
33 #include <JavaScriptCore/JSRetainPtr.h>
34 #include <map>
35 #include <set>
36 #include <string>
37 #include <vector>
38 #include <wtf/PassRefPtr.h>
39 #include <wtf/RefCounted.h>
40 
41 class LayoutTestController : public RefCounted<LayoutTestController> {
42 public:
43     static PassRefPtr<LayoutTestController> create(const std::string& testPathOrURL, const std::string& expectedPixelHash);
44     ~LayoutTestController();
45 
46     void makeWindowObject(JSContextRef context, JSObjectRef windowObject, JSValueRef* exception);
47 
48     void addDisallowedURL(JSStringRef url);
49     void addURLToRedirect(std::string origin, std::string destination);
50     const std::string& redirectionDestinationForURL(std::string);
51     void clearAllApplicationCaches();
52     void clearAllDatabases();
53     void clearApplicationCacheForOrigin(JSStringRef name);
54     void clearBackForwardList();
55     void clearPersistentUserStyleSheet();
56     bool callShouldCloseOnWebView();
57     JSStringRef copyDecodedHostName(JSStringRef name);
58     JSStringRef copyEncodedHostName(JSStringRef name);
59     JSRetainPtr<JSStringRef> counterValueForElementById(JSStringRef id);
60     void disableImageLoading();
61     void dispatchPendingLoadRequests();
62     void display();
63     void displayInvalidatedRegion();
64     void execCommand(JSStringRef name, JSStringRef value);
65     bool findString(JSContextRef, JSStringRef, JSObjectRef optionsArray);
66     JSValueRef originsWithApplicationCache(JSContextRef);
67     bool isCommandEnabled(JSStringRef name);
68     void keepWebHistory();
69     JSValueRef computedStyleIncludingVisitedInfo(JSContextRef, JSValueRef);
70     JSValueRef nodesFromRect(JSContextRef, JSValueRef, int x, int y, unsigned top, unsigned right, unsigned bottom, unsigned left, bool ignoreClipping);
71     void notifyDone();
72     int numberOfPages(float pageWidthInPixels, float pageHeightInPixels);
73     int numberOfPendingGeolocationPermissionRequests();
74     void overridePreference(JSStringRef key, JSStringRef value);
75     int pageNumberForElementById(JSStringRef id, float pageWidthInPixels, float pageHeightInPixels);
76     JSRetainPtr<JSStringRef> pageProperty(const char* propertyName, int pageNumber) const;
77     JSRetainPtr<JSStringRef> pageSizeAndMarginsInPixels(int pageNumber, int width, int height, int marginTop, int marginRight, int marginBottom, int marginLeft) const;
78     bool isPageBoxVisible(int pageNumber) const;
79     JSStringRef pathToLocalResource(JSContextRef, JSStringRef url);
80     void queueBackNavigation(int howFarBackward);
81     void queueForwardNavigation(int howFarForward);
82     void queueLoad(JSStringRef url, JSStringRef target);
83     void queueLoadHTMLString(JSStringRef content, JSStringRef baseURL);
84     void queueLoadAlternateHTMLString(JSStringRef content, JSStringRef baseURL, JSStringRef unreachableURL);
85     void queueLoadingScript(JSStringRef script);
86     void queueNonLoadingScript(JSStringRef script);
87     void queueReload();
88     void removeAllVisitedLinks();
89     void setAcceptsEditing(bool acceptsEditing);
90     void setAllowUniversalAccessFromFileURLs(bool);
91     void setAllowFileAccessFromFileURLs(bool);
92     void setAppCacheMaximumSize(unsigned long long quota);
93     void setApplicationCacheOriginQuota(unsigned long long quota);
94     void setAuthorAndUserStylesEnabled(bool);
95     void setAutofilled(JSContextRef, JSValueRef nodeObject, bool autofilled);
96     void setCacheModel(int);
97     void setCustomPolicyDelegate(bool setDelegate, bool permissive);
98     void setDatabaseQuota(unsigned long long quota);
99     void setDomainRelaxationForbiddenForURLScheme(bool forbidden, JSStringRef scheme);
100     void setIconDatabaseEnabled(bool iconDatabaseEnabled);
101     void setJavaScriptProfilingEnabled(bool profilingEnabled);
102     void setJavaScriptCanAccessClipboard(bool flag);
103     void setMainFrameIsFirstResponder(bool flag);
104     void setMockDeviceOrientation(bool canProvideAlpha, double alpha, bool canProvideBeta, double beta, bool canProvideGamma, double gamma);
105     void setMockGeolocationError(int code, JSStringRef message);
106     void setMockGeolocationPosition(double latitude, double longitude, double accuracy);
107     void addMockSpeechInputResult(JSStringRef result, double confidence, JSStringRef language);
108     void setPersistentUserStyleSheetLocation(JSStringRef path);
109     void setPluginsEnabled(bool flag);
110     void setPopupBlockingEnabled(bool flag);
111     void setPrivateBrowsingEnabled(bool flag);
112     void setSelectTrailingWhitespaceEnabled(bool flag);
113     void setSmartInsertDeleteEnabled(bool flag);
114     void setTabKeyCyclesThroughElements(bool cycles);
115     void setUseDashboardCompatibilityMode(bool flag);
116     void setUserStyleSheetEnabled(bool flag);
117     void setUserStyleSheetLocation(JSStringRef path);
118     void setValueForUser(JSContextRef, JSValueRef nodeObject, JSStringRef value);
119     void setViewModeMediaFeature(JSStringRef mode);
120     void setXSSAuditorEnabled(bool flag);
121     void setFrameFlatteningEnabled(bool enable);
122     void setSpatialNavigationEnabled(bool enable);
123     void setScrollbarPolicy(JSStringRef orientation, JSStringRef policy);
124     void setEditingBehavior(const char* editingBehavior);
125     JSValueRef shadowRoot(JSContextRef, JSValueRef);
126 
127     void waitForPolicyDelegate();
128     size_t webHistoryItemCount();
129     unsigned workerThreadCount() const;
130     int windowCount();
131 
132     void grantDesktopNotificationPermission(JSStringRef origin);
133     bool checkDesktopNotificationPermission(JSStringRef origin);
134 
135     bool elementDoesAutoCompleteForElementWithId(JSStringRef id);
136 
dumpAsAudio()137     bool dumpAsAudio() const { return m_dumpAsAudio; }
setDumpAsAudio(bool dumpAsAudio)138     void setDumpAsAudio(bool dumpAsAudio) { m_dumpAsAudio = dumpAsAudio; }
139 
dumpAsPDF()140     bool dumpAsPDF() const { return m_dumpAsPDF; }
setDumpAsPDF(bool dumpAsPDF)141     void setDumpAsPDF(bool dumpAsPDF) { m_dumpAsPDF = dumpAsPDF; }
142 
dumpAsText()143     bool dumpAsText() const { return m_dumpAsText; }
setDumpAsText(bool dumpAsText)144     void setDumpAsText(bool dumpAsText) { m_dumpAsText = dumpAsText; }
145 
generatePixelResults()146     bool generatePixelResults() const { return m_generatePixelResults; }
setGeneratePixelResults(bool generatePixelResults)147     void setGeneratePixelResults(bool generatePixelResults) { m_generatePixelResults = generatePixelResults; }
148 
dumpApplicationCacheDelegateCallbacks()149     bool dumpApplicationCacheDelegateCallbacks() const { return m_dumpApplicationCacheDelegateCallbacks; }
setDumpApplicationCacheDelegateCallbacks(bool dumpCallbacks)150     void setDumpApplicationCacheDelegateCallbacks(bool dumpCallbacks) { m_dumpApplicationCacheDelegateCallbacks = dumpCallbacks; }
151 
dumpBackForwardList()152     bool dumpBackForwardList() const { return m_dumpBackForwardList; }
setDumpBackForwardList(bool dumpBackForwardList)153     void setDumpBackForwardList(bool dumpBackForwardList) { m_dumpBackForwardList = dumpBackForwardList; }
154 
dumpChildFrameScrollPositions()155     bool dumpChildFrameScrollPositions() const { return m_dumpChildFrameScrollPositions; }
setDumpChildFrameScrollPositions(bool dumpChildFrameScrollPositions)156     void setDumpChildFrameScrollPositions(bool dumpChildFrameScrollPositions) { m_dumpChildFrameScrollPositions = dumpChildFrameScrollPositions; }
157 
dumpChildFramesAsText()158     bool dumpChildFramesAsText() const { return m_dumpChildFramesAsText; }
setDumpChildFramesAsText(bool dumpChildFramesAsText)159     void setDumpChildFramesAsText(bool dumpChildFramesAsText) { m_dumpChildFramesAsText = dumpChildFramesAsText; }
160 
dumpDatabaseCallbacks()161     bool dumpDatabaseCallbacks() const { return m_dumpDatabaseCallbacks; }
setDumpDatabaseCallbacks(bool dumpDatabaseCallbacks)162     void setDumpDatabaseCallbacks(bool dumpDatabaseCallbacks) { m_dumpDatabaseCallbacks = dumpDatabaseCallbacks; }
163 
dumpDOMAsWebArchive()164     bool dumpDOMAsWebArchive() const { return m_dumpDOMAsWebArchive; }
setDumpDOMAsWebArchive(bool dumpDOMAsWebArchive)165     void setDumpDOMAsWebArchive(bool dumpDOMAsWebArchive) { m_dumpDOMAsWebArchive = dumpDOMAsWebArchive; }
166 
dumpEditingCallbacks()167     bool dumpEditingCallbacks() const { return m_dumpEditingCallbacks; }
setDumpEditingCallbacks(bool dumpEditingCallbacks)168     void setDumpEditingCallbacks(bool dumpEditingCallbacks) { m_dumpEditingCallbacks = dumpEditingCallbacks; }
169 
dumpFrameLoadCallbacks()170     bool dumpFrameLoadCallbacks() const { return m_dumpFrameLoadCallbacks; }
setDumpFrameLoadCallbacks(bool dumpFrameLoadCallbacks)171     void setDumpFrameLoadCallbacks(bool dumpFrameLoadCallbacks) { m_dumpFrameLoadCallbacks = dumpFrameLoadCallbacks; }
172 
dumpUserGestureInFrameLoadCallbacks()173     bool dumpUserGestureInFrameLoadCallbacks() const { return m_dumpUserGestureInFrameLoadCallbacks; }
setDumpUserGestureInFrameLoadCallbacks(bool dumpUserGestureInFrameLoadCallbacks)174     void setDumpUserGestureInFrameLoadCallbacks(bool dumpUserGestureInFrameLoadCallbacks) { m_dumpUserGestureInFrameLoadCallbacks = dumpUserGestureInFrameLoadCallbacks; }
175 
dumpHistoryDelegateCallbacks()176     bool dumpHistoryDelegateCallbacks() const { return m_dumpHistoryDelegateCallbacks; }
setDumpHistoryDelegateCallbacks(bool dumpHistoryDelegateCallbacks)177     void setDumpHistoryDelegateCallbacks(bool dumpHistoryDelegateCallbacks) { m_dumpHistoryDelegateCallbacks = dumpHistoryDelegateCallbacks; }
178 
dumpResourceLoadCallbacks()179     bool dumpResourceLoadCallbacks() const { return m_dumpResourceLoadCallbacks; }
setDumpResourceLoadCallbacks(bool dumpResourceLoadCallbacks)180     void setDumpResourceLoadCallbacks(bool dumpResourceLoadCallbacks) { m_dumpResourceLoadCallbacks = dumpResourceLoadCallbacks; }
181 
dumpResourceResponseMIMETypes()182     bool dumpResourceResponseMIMETypes() const { return m_dumpResourceResponseMIMETypes; }
setDumpResourceResponseMIMETypes(bool dumpResourceResponseMIMETypes)183     void setDumpResourceResponseMIMETypes(bool dumpResourceResponseMIMETypes) { m_dumpResourceResponseMIMETypes = dumpResourceResponseMIMETypes; }
184 
dumpSelectionRect()185     bool dumpSelectionRect() const { return m_dumpSelectionRect; }
setDumpSelectionRect(bool dumpSelectionRect)186     void setDumpSelectionRect(bool dumpSelectionRect) { m_dumpSelectionRect = dumpSelectionRect; }
187 
dumpSourceAsWebArchive()188     bool dumpSourceAsWebArchive() const { return m_dumpSourceAsWebArchive; }
setDumpSourceAsWebArchive(bool dumpSourceAsWebArchive)189     void setDumpSourceAsWebArchive(bool dumpSourceAsWebArchive) { m_dumpSourceAsWebArchive = dumpSourceAsWebArchive; }
190 
dumpStatusCallbacks()191     bool dumpStatusCallbacks() const { return m_dumpStatusCallbacks; }
setDumpStatusCallbacks(bool dumpStatusCallbacks)192     void setDumpStatusCallbacks(bool dumpStatusCallbacks) { m_dumpStatusCallbacks = dumpStatusCallbacks; }
193 
dumpTitleChanges()194     bool dumpTitleChanges() const { return m_dumpTitleChanges; }
setDumpTitleChanges(bool dumpTitleChanges)195     void setDumpTitleChanges(bool dumpTitleChanges) { m_dumpTitleChanges = dumpTitleChanges; }
196 
dumpIconChanges()197     bool dumpIconChanges() const { return m_dumpIconChanges; }
setDumpIconChanges(bool dumpIconChanges)198     void setDumpIconChanges(bool dumpIconChanges) { m_dumpIconChanges = dumpIconChanges; }
199 
dumpVisitedLinksCallback()200     bool dumpVisitedLinksCallback() const { return m_dumpVisitedLinksCallback; }
setDumpVisitedLinksCallback(bool dumpVisitedLinksCallback)201     void setDumpVisitedLinksCallback(bool dumpVisitedLinksCallback) { m_dumpVisitedLinksCallback = dumpVisitedLinksCallback; }
202 
dumpWillCacheResponse()203     bool dumpWillCacheResponse() const { return m_dumpWillCacheResponse; }
setDumpWillCacheResponse(bool dumpWillCacheResponse)204     void setDumpWillCacheResponse(bool dumpWillCacheResponse) { m_dumpWillCacheResponse = dumpWillCacheResponse; }
205 
callCloseOnWebViews()206     bool callCloseOnWebViews() const { return m_callCloseOnWebViews; }
setCallCloseOnWebViews(bool callCloseOnWebViews)207     void setCallCloseOnWebViews(bool callCloseOnWebViews) { m_callCloseOnWebViews = callCloseOnWebViews; }
208 
canOpenWindows()209     bool canOpenWindows() const { return m_canOpenWindows; }
setCanOpenWindows(bool canOpenWindows)210     void setCanOpenWindows(bool canOpenWindows) { m_canOpenWindows = canOpenWindows; }
211 
closeRemainingWindowsWhenComplete()212     bool closeRemainingWindowsWhenComplete() const { return m_closeRemainingWindowsWhenComplete; }
setCloseRemainingWindowsWhenComplete(bool closeRemainingWindowsWhenComplete)213     void setCloseRemainingWindowsWhenComplete(bool closeRemainingWindowsWhenComplete) { m_closeRemainingWindowsWhenComplete = closeRemainingWindowsWhenComplete; }
214 
newWindowsCopyBackForwardList()215     bool newWindowsCopyBackForwardList() const { return m_newWindowsCopyBackForwardList; }
setNewWindowsCopyBackForwardList(bool newWindowsCopyBackForwardList)216     void setNewWindowsCopyBackForwardList(bool newWindowsCopyBackForwardList) { m_newWindowsCopyBackForwardList = newWindowsCopyBackForwardList; }
217 
stopProvisionalFrameLoads()218     bool stopProvisionalFrameLoads() const { return m_stopProvisionalFrameLoads; }
setStopProvisionalFrameLoads(bool stopProvisionalFrameLoads)219     void setStopProvisionalFrameLoads(bool stopProvisionalFrameLoads) { m_stopProvisionalFrameLoads = stopProvisionalFrameLoads; }
220 
testOnscreen()221     bool testOnscreen() const { return m_testOnscreen; }
setTestOnscreen(bool testOnscreen)222     void setTestOnscreen(bool testOnscreen) { m_testOnscreen = testOnscreen; }
223 
testRepaint()224     bool testRepaint() const { return m_testRepaint; }
setTestRepaint(bool testRepaint)225     void setTestRepaint(bool testRepaint) { m_testRepaint = testRepaint; }
226 
testRepaintSweepHorizontally()227     bool testRepaintSweepHorizontally() const { return m_testRepaintSweepHorizontally; }
setTestRepaintSweepHorizontally(bool testRepaintSweepHorizontally)228     void setTestRepaintSweepHorizontally(bool testRepaintSweepHorizontally) { m_testRepaintSweepHorizontally = testRepaintSweepHorizontally; }
229 
waitToDump()230     bool waitToDump() const { return m_waitToDump; }
231     void setWaitToDump(bool waitToDump);
232     void waitToDumpWatchdogTimerFired();
233 
willSendRequestClearHeaders()234     const std::set<std::string>& willSendRequestClearHeaders() const { return m_willSendRequestClearHeaders; }
setWillSendRequestClearHeader(std::string header)235     void setWillSendRequestClearHeader(std::string header) { m_willSendRequestClearHeaders.insert(header); }
236 
willSendRequestReturnsNull()237     bool willSendRequestReturnsNull() const { return m_willSendRequestReturnsNull; }
setWillSendRequestReturnsNull(bool returnsNull)238     void setWillSendRequestReturnsNull(bool returnsNull) { m_willSendRequestReturnsNull = returnsNull; }
239 
willSendRequestReturnsNullOnRedirect()240     bool willSendRequestReturnsNullOnRedirect() const { return m_willSendRequestReturnsNullOnRedirect; }
setWillSendRequestReturnsNullOnRedirect(bool returnsNull)241     void setWillSendRequestReturnsNullOnRedirect(bool returnsNull) { m_willSendRequestReturnsNullOnRedirect = returnsNull; }
242 
windowIsKey()243     bool windowIsKey() const { return m_windowIsKey; }
244     void setWindowIsKey(bool windowIsKey);
245 
alwaysAcceptCookies()246     bool alwaysAcceptCookies() const { return m_alwaysAcceptCookies; }
247     void setAlwaysAcceptCookies(bool alwaysAcceptCookies);
248 
handlesAuthenticationChallenges()249     bool handlesAuthenticationChallenges() const { return m_handlesAuthenticationChallenges; }
setHandlesAuthenticationChallenges(bool handlesAuthenticationChallenges)250     void setHandlesAuthenticationChallenges(bool handlesAuthenticationChallenges) { m_handlesAuthenticationChallenges = handlesAuthenticationChallenges; }
251 
isPrinting()252     bool isPrinting() const { return m_isPrinting; }
setIsPrinting(bool isPrinting)253     void setIsPrinting(bool isPrinting) { m_isPrinting = isPrinting; }
254 
authenticationUsername()255     const std::string& authenticationUsername() const { return m_authenticationUsername; }
setAuthenticationUsername(std::string username)256     void setAuthenticationUsername(std::string username) { m_authenticationUsername = username; }
257 
authenticationPassword()258     const std::string& authenticationPassword() const { return m_authenticationPassword; }
setAuthenticationPassword(std::string password)259     void setAuthenticationPassword(std::string password) { m_authenticationPassword = password; }
260 
globalFlag()261     bool globalFlag() const { return m_globalFlag; }
setGlobalFlag(bool globalFlag)262     void setGlobalFlag(bool globalFlag) { m_globalFlag = globalFlag; }
263 
deferMainResourceDataLoad()264     bool deferMainResourceDataLoad() const { return m_deferMainResourceDataLoad; }
setDeferMainResourceDataLoad(bool flag)265     void setDeferMainResourceDataLoad(bool flag) { m_deferMainResourceDataLoad = flag; }
266 
testPathOrURL()267     const std::string& testPathOrURL() const { return m_testPathOrURL; }
expectedPixelHash()268     const std::string& expectedPixelHash() const { return m_expectedPixelHash; }
269 
encodedAudioData()270     const std::string& encodedAudioData() const { return m_encodedAudioData; }
setEncodedAudioData(const std::string & encodedAudioData)271     void setEncodedAudioData(const std::string& encodedAudioData) { m_encodedAudioData = encodedAudioData; }
272 
273     bool pauseAnimationAtTimeOnElementWithId(JSStringRef animationName, double time, JSStringRef elementId);
274     bool pauseTransitionAtTimeOnElementWithId(JSStringRef propertyName, double time, JSStringRef elementId);
275     bool sampleSVGAnimationForElementAtTime(JSStringRef animationId, double time, JSStringRef elementId);
276     unsigned numberOfActiveAnimations() const;
277     void suspendAnimations() const;
278     void resumeAnimations() const;
279 
280     void addOriginAccessWhitelistEntry(JSStringRef sourceOrigin, JSStringRef destinationProtocol, JSStringRef destinationHost, bool allowDestinationSubdomains);
281     void removeOriginAccessWhitelistEntry(JSStringRef sourceOrigin, JSStringRef destinationProtocol, JSStringRef destinationHost, bool allowDestinationSubdomains);
282 
283     void addUserScript(JSStringRef source, bool runAtStart, bool allFrames);
284     void addUserStyleSheet(JSStringRef source, bool allFrames);
285 
286     void setGeolocationPermission(bool allow);
isGeolocationPermissionSet()287     bool isGeolocationPermissionSet() const { return m_isGeolocationPermissionSet; }
geolocationPermission()288     bool geolocationPermission() const { return m_geolocationPermission; }
289 
290     void setDeveloperExtrasEnabled(bool);
291     void setAsynchronousSpellCheckingEnabled(bool);
292     void showWebInspector();
293     void closeWebInspector();
294     void setTimelineProfilingEnabled(bool enabled);
295     void evaluateInWebInspector(long callId, JSStringRef script);
296     void evaluateScriptInIsolatedWorld(unsigned worldId, JSObjectRef globalObject, JSStringRef script);
297 
298     void setPOSIXLocale(JSStringRef locale);
299 
300     void setWebViewEditable(bool);
301 
302     void abortModal();
303 
304     bool hasSpellingMarker(int from, int length);
305     bool hasGrammarMarker(int from, int length);
306 
307     void dumpConfigurationForViewport(int deviceDPI, int deviceWidth, int deviceHeight, int availableWidth, int availableHeight);
308 
309     static void setSerializeHTTPLoads(bool serialize);
310 
311     // The following API test functions should probably be moved to platform-specific
312     // unit tests outside of DRT once they exist.
313     void apiTestNewWindowDataLoadBaseURL(JSStringRef utf8Data, JSStringRef baseURL);
314     void apiTestGoToCurrentBackForwardItem();
315 
316     // Simulate a request an embedding application could make, populating per-session credential storage.
317     void authenticateSession(JSStringRef url, JSStringRef username, JSStringRef password);
318 
319     JSRetainPtr<JSStringRef> layerTreeAsText() const;
320 
321     JSRetainPtr<JSStringRef> markerTextForListItem(JSContextRef context, JSValueRef nodeObject) const;
322 
323     JSValueRef originsWithLocalStorage(JSContextRef);
324     void deleteAllLocalStorage();
325     void deleteLocalStorageForOrigin(JSStringRef originIdentifier);
326     void observeStorageTrackerNotifications(unsigned number);
327     void syncLocalStorage();
328 
329     void setShouldPaintBrokenImage(bool);
shouldPaintBrokenImage()330     bool shouldPaintBrokenImage() const { return m_shouldPaintBrokenImage; }
331 
332     static const unsigned maxViewWidth;
333     static const unsigned maxViewHeight;
334 
335     void setMinimumTimerInterval(double);
336 
337 private:
338     LayoutTestController(const std::string& testPathOrURL, const std::string& expectedPixelHash);
339 
340     void setGeolocationPermissionCommon(bool allow);
341 
342     bool m_dumpApplicationCacheDelegateCallbacks;
343     bool m_dumpAsAudio;
344     bool m_dumpAsPDF;
345     bool m_dumpAsText;
346     bool m_dumpBackForwardList;
347     bool m_dumpChildFrameScrollPositions;
348     bool m_dumpChildFramesAsText;
349     bool m_dumpDOMAsWebArchive;
350     bool m_dumpDatabaseCallbacks;
351     bool m_dumpEditingCallbacks;
352     bool m_dumpFrameLoadCallbacks;
353     bool m_dumpUserGestureInFrameLoadCallbacks;
354     bool m_dumpHistoryDelegateCallbacks;
355     bool m_dumpResourceLoadCallbacks;
356     bool m_dumpResourceResponseMIMETypes;
357     bool m_dumpSelectionRect;
358     bool m_dumpSourceAsWebArchive;
359     bool m_dumpStatusCallbacks;
360     bool m_dumpTitleChanges;
361     bool m_dumpIconChanges;
362     bool m_dumpVisitedLinksCallback;
363     bool m_dumpWillCacheResponse;
364     bool m_generatePixelResults;
365     bool m_callCloseOnWebViews;
366     bool m_canOpenWindows;
367     bool m_closeRemainingWindowsWhenComplete;
368     bool m_newWindowsCopyBackForwardList;
369     bool m_stopProvisionalFrameLoads;
370     bool m_testOnscreen;
371     bool m_testRepaint;
372     bool m_testRepaintSweepHorizontally;
373     bool m_waitToDump; // True if waitUntilDone() has been called, but notifyDone() has not yet been called.
374     bool m_willSendRequestReturnsNull;
375     bool m_willSendRequestReturnsNullOnRedirect;
376     bool m_windowIsKey;
377     bool m_alwaysAcceptCookies;
378     bool m_globalFlag;
379     bool m_isGeolocationPermissionSet;
380     bool m_geolocationPermission;
381     bool m_handlesAuthenticationChallenges;
382     bool m_isPrinting;
383     bool m_deferMainResourceDataLoad;
384     bool m_shouldPaintBrokenImage;
385 
386     std::string m_authenticationUsername;
387     std::string m_authenticationPassword;
388     std::string m_testPathOrURL;
389     std::string m_expectedPixelHash;    // empty string if no hash
390 
391     std::set<std::string> m_willSendRequestClearHeaders;
392 
393     // base64 encoded WAV audio data is stored here.
394     std::string m_encodedAudioData;
395 
396     // origins which have been granted desktop notification access
397     std::vector<JSStringRef> m_desktopNotificationAllowedOrigins;
398 
399     std::map<std::string, std::string> m_URLsToRedirect;
400 
401     static JSClassRef getJSClass();
402     static JSStaticValue* staticValues();
403     static JSStaticFunction* staticFunctions();
404 };
405 
406 #endif // LayoutTestController_h
407