|         |      1 /* | 
|         |      2  * Copyright (C) 2007 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  | 
|         |     34 class LayoutTestController { | 
|         |     35 public: | 
|         |     36     LayoutTestController(bool testRepaintDefault, bool testRepaintSweepHorizontallyDefault); | 
|         |     37     ~LayoutTestController(); | 
|         |     38  | 
|         |     39     void makeWindowObject(JSContextRef context, JSObjectRef windowObject, JSValueRef* exception); | 
|         |     40  | 
|         |     41     // Controller Methods - platfrom independant implementations | 
|         |     42     void addDisallowedURL(JSStringRef url); | 
|         |     43     void clearBackForwardList(); | 
|         |     44     JSStringRef copyDecodedHostName(JSStringRef name); | 
|         |     45     JSStringRef copyEncodedHostName(JSStringRef name); | 
|         |     46     void display(); | 
|         |     47     void keepWebHistory(); | 
|         |     48     void notifyDone(); | 
|         |     49     void queueBackNavigation(int howFarBackward); | 
|         |     50     void queueForwardNavigation(int howFarForward); | 
|         |     51     void queueLoad(JSStringRef url, JSStringRef target); | 
|         |     52     void queueReload(); | 
|         |     53     void queueScript(JSStringRef url); | 
|         |     54     void setAcceptsEditing(bool acceptsEditing); | 
|         |     55     void setCustomPolicyDelegate(bool setDelegate); | 
|         |     56     void setMainFrameIsFirstResponder(bool flag); | 
|         |     57     void setTabKeyCyclesThroughElements(bool cycles); | 
|         |     58     void setUseDashboardCompatibilityMode(bool flag); | 
|         |     59     void setUserStyleSheetEnabled(bool flag); | 
|         |     60     void setUserStyleSheetLocation(JSStringRef path); | 
|         |     61     int windowCount(); | 
|         |     62  | 
|         |     63     bool dumpAsText() const { return m_dumpAsText; } | 
|         |     64     void setDumpAsText(bool dumpAsText) { m_dumpAsText = dumpAsText; } | 
|         |     65  | 
|         |     66     bool dumpBackForwardList() const { return m_dumpBackForwardList; } | 
|         |     67     void setDumpBackForwardList(bool dumpBackForwardList) { m_dumpBackForwardList = dumpBackForwardList; } | 
|         |     68  | 
|         |     69     bool dumpChildFrameScrollPositions() const { return m_dumpChildFrameScrollPositions; } | 
|         |     70     void setDumpChildFrameScrollPositions(bool dumpChildFrameScrollPositions) { m_dumpChildFrameScrollPositions = dumpChildFrameScrollPositions; } | 
|         |     71  | 
|         |     72     bool dumpChildFramesAsText() const { return m_dumpChildFramesAsText; } | 
|         |     73     void setDumpChildFramesAsText(bool dumpChildFramesAsText) { m_dumpChildFramesAsText = dumpChildFramesAsText; } | 
|         |     74  | 
|         |     75     bool dumpDOMAsWebArchive() const { return m_dumpDOMAsWebArchive; } | 
|         |     76     void setDumpDOMAsWebArchive(bool dumpDOMAsWebArchive) { m_dumpDOMAsWebArchive = dumpDOMAsWebArchive; } | 
|         |     77  | 
|         |     78     bool dumpSelectionRect() const { return m_dumpSelectionRect; } | 
|         |     79     void setDumpSelectionRect(bool dumpSelectionRect) { m_dumpSelectionRect = dumpSelectionRect; } | 
|         |     80  | 
|         |     81     bool dumpSourceAsWebArchive() const { return m_dumpSourceAsWebArchive; } | 
|         |     82     void setDumpSourceAsWebArchive(bool dumpSourceAsWebArchive) { m_dumpSourceAsWebArchive = dumpSourceAsWebArchive; } | 
|         |     83  | 
|         |     84     bool dumpTitleChanges() const { return m_dumpTitleChanges; } | 
|         |     85     void setDumpTitleChanges(bool dumpTitleChanges) { m_dumpTitleChanges = dumpTitleChanges; } | 
|         |     86  | 
|         |     87     bool dumpEditingCallbacks() const { return m_dumpEditingCallbacks; } | 
|         |     88     void setDumpEditingCallbacks(bool dumpEditingCallbacks) { m_dumpEditingCallbacks = dumpEditingCallbacks; } | 
|         |     89  | 
|         |     90     bool dumpResourceLoadCallbacks() const { return m_dumpResourceLoadCallbacks; } | 
|         |     91     void setDumpResourceLoadCallbacks(bool dumpResourceLoadCallbacks) { m_dumpResourceLoadCallbacks = dumpResourceLoadCallbacks; } | 
|         |     92  | 
|         |     93     bool dumpFrameLoadCallbacks() const { return m_dumpFrameLoadCallbacks; } | 
|         |     94     void setDumpFrameLoadCallbacks(bool dumpFrameLoadCallbacks) { m_dumpFrameLoadCallbacks = dumpFrameLoadCallbacks; } | 
|         |     95  | 
|         |     96     bool addFileToPasteboardOnDrag() const { return m_addFileToPasteboardOnDrag; } | 
|         |     97     void setAddFileToPasteboardOnDrag(bool addFileToPasteboardOnDrag) { m_addFileToPasteboardOnDrag = addFileToPasteboardOnDrag; } | 
|         |     98  | 
|         |     99     bool callCloseOnWebViews() const { return m_callCloseOnWebViews; } | 
|         |    100     void setCallCloseOnWebViews(bool callCloseOnWebViews) { m_callCloseOnWebViews = callCloseOnWebViews; } | 
|         |    101  | 
|         |    102     bool canOpenWindows() const { return m_canOpenWindows; } | 
|         |    103     void setCanOpenWindows(bool canOpenWindows) { m_canOpenWindows = canOpenWindows; } | 
|         |    104  | 
|         |    105     bool closeRemainingWindowsWhenComplete() const { return m_closeRemainingWindowsWhenComplete; } | 
|         |    106     void setCloseRemainingWindowsWhenComplete(bool closeRemainingWindowsWhenComplete) { m_closeRemainingWindowsWhenComplete = closeRemainingWindowsWhenComplete; } | 
|         |    107  | 
|         |    108     bool testRepaint() const { return m_testRepaint; } | 
|         |    109     void setTestRepaint(bool testRepaint) { m_testRepaint = testRepaint; } | 
|         |    110  | 
|         |    111     bool testRepaintSweepHorizontally() const { return m_testRepaintSweepHorizontally; } | 
|         |    112     void setTestRepaintSweepHorizontally(bool testRepaintSweepHorizontally) { m_testRepaintSweepHorizontally = testRepaintSweepHorizontally; } | 
|         |    113  | 
|         |    114     bool waitToDump() const { return m_waitToDump; } | 
|         |    115     void setWaitToDump(bool waitToDump); | 
|         |    116  | 
|         |    117     bool windowIsKey() const { return m_windowIsKey; } | 
|         |    118     void setWindowIsKey(bool windowIsKey); | 
|         |    119  | 
|         |    120 private: | 
|         |    121     bool m_dumpAsText; | 
|         |    122     bool m_dumpBackForwardList; | 
|         |    123     bool m_dumpChildFrameScrollPositions; | 
|         |    124     bool m_dumpChildFramesAsText; | 
|         |    125     bool m_dumpDOMAsWebArchive; | 
|         |    126     bool m_dumpSelectionRect; | 
|         |    127     bool m_dumpSourceAsWebArchive; | 
|         |    128     bool m_dumpTitleChanges; | 
|         |    129     bool m_dumpEditingCallbacks; | 
|         |    130     bool m_dumpResourceLoadCallbacks; | 
|         |    131     bool m_dumpFrameLoadCallbacks; | 
|         |    132     bool m_addFileToPasteboardOnDrag; | 
|         |    133     bool m_callCloseOnWebViews; | 
|         |    134     bool m_canOpenWindows; | 
|         |    135     bool m_closeRemainingWindowsWhenComplete; | 
|         |    136     bool m_testRepaint; | 
|         |    137     bool m_testRepaintSweepHorizontally; | 
|         |    138     bool m_waitToDump; // True if waitUntilDone() has been called, but notifyDone() has not yet been called. | 
|         |    139     bool m_windowIsKey; | 
|         |    140  | 
|         |    141     static JSClassRef getJSClass(); | 
|         |    142     static JSStaticFunction* staticFunctions(); | 
|         |    143 }; | 
|         |    144  | 
|         |    145 #endif // LayoutTestController_h |