2 * Copyright (C) 2007 Apple Inc. All rights reserved.
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
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.
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.
29 #ifndef LayoutTestController_h
30 #define LayoutTestController_h
32 #include <JavaScriptCore/JSObjectRef.h>
34 class LayoutTestController {
36 LayoutTestController(bool testRepaintDefault, bool testRepaintSweepHorizontallyDefault);
37 ~LayoutTestController();
39 void makeWindowObject(JSContextRef context, JSObjectRef windowObject, JSValueRef* exception);
41 // Controller Methods - platfrom independant implementations
42 void addDisallowedURL(JSStringRef url);
43 void clearBackForwardList();
44 JSStringRef copyDecodedHostName(JSStringRef name);
45 JSStringRef copyEncodedHostName(JSStringRef name);
47 void keepWebHistory();
49 JSStringRef pathToLocalResource(JSContextRef, JSStringRef url);
50 void queueBackNavigation(int howFarBackward);
51 void queueForwardNavigation(int howFarForward);
52 void queueLoad(JSStringRef url, JSStringRef target);
54 void queueScript(JSStringRef url);
55 void setAcceptsEditing(bool acceptsEditing);
56 void setAuthorAndUserStylesEnabled(bool);
57 void setCustomPolicyDelegate(bool setDelegate);
58 void setMainFrameIsFirstResponder(bool flag);
59 void setPrivateBrowsingEnabled(bool flag);
60 void setTabKeyCyclesThroughElements(bool cycles);
61 void setUseDashboardCompatibilityMode(bool flag);
62 void setUserStyleSheetEnabled(bool flag);
63 void setUserStyleSheetLocation(JSStringRef path);
66 bool dumpAsText() const { return m_dumpAsText; }
67 void setDumpAsText(bool dumpAsText) { m_dumpAsText = dumpAsText; }
69 bool dumpBackForwardList() const { return m_dumpBackForwardList; }
70 void setDumpBackForwardList(bool dumpBackForwardList) { m_dumpBackForwardList = dumpBackForwardList; }
72 bool dumpChildFrameScrollPositions() const { return m_dumpChildFrameScrollPositions; }
73 void setDumpChildFrameScrollPositions(bool dumpChildFrameScrollPositions) { m_dumpChildFrameScrollPositions = dumpChildFrameScrollPositions; }
75 bool dumpChildFramesAsText() const { return m_dumpChildFramesAsText; }
76 void setDumpChildFramesAsText(bool dumpChildFramesAsText) { m_dumpChildFramesAsText = dumpChildFramesAsText; }
78 bool dumpDOMAsWebArchive() const { return m_dumpDOMAsWebArchive; }
79 void setDumpDOMAsWebArchive(bool dumpDOMAsWebArchive) { m_dumpDOMAsWebArchive = dumpDOMAsWebArchive; }
81 bool dumpSelectionRect() const { return m_dumpSelectionRect; }
82 void setDumpSelectionRect(bool dumpSelectionRect) { m_dumpSelectionRect = dumpSelectionRect; }
84 bool dumpSourceAsWebArchive() const { return m_dumpSourceAsWebArchive; }
85 void setDumpSourceAsWebArchive(bool dumpSourceAsWebArchive) { m_dumpSourceAsWebArchive = dumpSourceAsWebArchive; }
87 bool dumpTitleChanges() const { return m_dumpTitleChanges; }
88 void setDumpTitleChanges(bool dumpTitleChanges) { m_dumpTitleChanges = dumpTitleChanges; }
90 bool dumpEditingCallbacks() const { return m_dumpEditingCallbacks; }
91 void setDumpEditingCallbacks(bool dumpEditingCallbacks) { m_dumpEditingCallbacks = dumpEditingCallbacks; }
93 bool dumpResourceLoadCallbacks() const { return m_dumpResourceLoadCallbacks; }
94 void setDumpResourceLoadCallbacks(bool dumpResourceLoadCallbacks) { m_dumpResourceLoadCallbacks = dumpResourceLoadCallbacks; }
96 bool dumpFrameLoadCallbacks() const { return m_dumpFrameLoadCallbacks; }
97 void setDumpFrameLoadCallbacks(bool dumpFrameLoadCallbacks) { m_dumpFrameLoadCallbacks = dumpFrameLoadCallbacks; }
99 bool addFileToPasteboardOnDrag() const { return m_addFileToPasteboardOnDrag; }
100 void setAddFileToPasteboardOnDrag(bool addFileToPasteboardOnDrag) { m_addFileToPasteboardOnDrag = addFileToPasteboardOnDrag; }
102 bool callCloseOnWebViews() const { return m_callCloseOnWebViews; }
103 void setCallCloseOnWebViews(bool callCloseOnWebViews) { m_callCloseOnWebViews = callCloseOnWebViews; }
105 bool canOpenWindows() const { return m_canOpenWindows; }
106 void setCanOpenWindows(bool canOpenWindows) { m_canOpenWindows = canOpenWindows; }
108 bool closeRemainingWindowsWhenComplete() const { return m_closeRemainingWindowsWhenComplete; }
109 void setCloseRemainingWindowsWhenComplete(bool closeRemainingWindowsWhenComplete) { m_closeRemainingWindowsWhenComplete = closeRemainingWindowsWhenComplete; }
111 bool testRepaint() const { return m_testRepaint; }
112 void setTestRepaint(bool testRepaint) { m_testRepaint = testRepaint; }
114 bool testRepaintSweepHorizontally() const { return m_testRepaintSweepHorizontally; }
115 void setTestRepaintSweepHorizontally(bool testRepaintSweepHorizontally) { m_testRepaintSweepHorizontally = testRepaintSweepHorizontally; }
117 bool waitToDump() const { return m_waitToDump; }
118 void setWaitToDump(bool waitToDump);
120 bool windowIsKey() const { return m_windowIsKey; }
121 void setWindowIsKey(bool windowIsKey);
123 bool globalFlag() const { return m_globalFlag; }
124 void setGlobalFlag(bool globalFlag) { m_globalFlag = globalFlag; }
128 bool m_dumpBackForwardList;
129 bool m_dumpChildFrameScrollPositions;
130 bool m_dumpChildFramesAsText;
131 bool m_dumpDOMAsWebArchive;
132 bool m_dumpSelectionRect;
133 bool m_dumpSourceAsWebArchive;
134 bool m_dumpTitleChanges;
135 bool m_dumpEditingCallbacks;
136 bool m_dumpResourceLoadCallbacks;
137 bool m_dumpFrameLoadCallbacks;
138 bool m_addFileToPasteboardOnDrag;
139 bool m_callCloseOnWebViews;
140 bool m_canOpenWindows;
141 bool m_closeRemainingWindowsWhenComplete;
143 bool m_testRepaintSweepHorizontally;
144 bool m_waitToDump; // True if waitUntilDone() has been called, but notifyDone() has not yet been called.
149 static JSClassRef getJSClass();
150 static JSStaticValue* staticValues();
151 static JSStaticFunction* staticFunctions();
154 #endif // LayoutTestController_h