Home | History | Annotate | Download | only in chromium
      1 /*
      2  * Copyright (C) 2010 Google Inc. All rights reserved.
      3  * Copyright (C) 2010 Pawel Hajdan (phajdan.jr (at) chromium.org)
      4  *
      5  * Redistribution and use in source and binary forms, with or without
      6  * modification, are permitted provided that the following conditions are
      7  * met:
      8  *
      9  *     * Redistributions of source code must retain the above copyright
     10  * notice, this list of conditions and the following disclaimer.
     11  *     * Redistributions in binary form must reproduce the above
     12  * copyright notice, this list of conditions and the following disclaimer
     13  * in the documentation and/or other materials provided with the
     14  * distribution.
     15  *     * Neither the name of Google Inc. nor the names of its
     16  * contributors may be used to endorse or promote products derived from
     17  * this software without specific prior written permission.
     18  *
     19  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
     20  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
     21  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
     22  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
     23  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
     24  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
     25  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
     26  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     27  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     28  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
     29  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     30  */
     31 
     32 /*
     33   LayoutTestController class:
     34   Bound to a JavaScript window.layoutTestController object using the
     35   CppBoundClass::bindToJavascript(), this allows layout tests that are run in
     36   the test_shell (or, in principle, any web page loaded into a client app built
     37   with this class) to control various aspects of how the tests are run and what
     38   sort of output they produce.
     39 */
     40 
     41 #ifndef LayoutTestController_h
     42 #define LayoutTestController_h
     43 
     44 #include "CppBoundClass.h"
     45 #include "Task.h"
     46 #include "WebString.h"
     47 #include "WebTextDirection.h"
     48 #include "WebURL.h"
     49 #include <wtf/Deque.h>
     50 #include <wtf/OwnPtr.h>
     51 
     52 namespace WebKit {
     53 class WebGeolocationClientMock;
     54 class WebSpeechInputController;
     55 class WebSpeechInputControllerMock;
     56 class WebSpeechInputListener;
     57 }
     58 
     59 class TestShell;
     60 
     61 class LayoutTestController : public CppBoundClass {
     62 public:
     63     // Builds the property and method lists needed to bind this class to a JS
     64     // object.
     65     LayoutTestController(TestShell*);
     66 
     67     ~LayoutTestController();
     68 
     69     // This function sets a flag that tells the test_shell to dump pages as
     70     // plain text, rather than as a text representation of the renderer's state.
     71     // It takes an optional argument, whether to dump pixels results or not.
     72     void dumpAsText(const CppArgumentList&, CppVariant*);
     73 
     74     // This function should set a flag that tells the test_shell to print a line
     75     // of descriptive text for each database command.  It should take no
     76     // arguments, and ignore any that may be present. However, at the moment, we
     77     // don't have any DB function that prints messages, so for now this function
     78     // doesn't do anything.
     79     void dumpDatabaseCallbacks(const CppArgumentList&, CppVariant*);
     80 
     81     // This function sets a flag that tells the test_shell to print a line of
     82     // descriptive text for each editing command.  It takes no arguments, and
     83     // ignores any that may be present.
     84     void dumpEditingCallbacks(const CppArgumentList&, CppVariant*);
     85 
     86     // This function sets a flag that tells the test_shell to print a line of
     87     // descriptive text for each frame load callback.  It takes no arguments, and
     88     // ignores any that may be present.
     89     void dumpFrameLoadCallbacks(const CppArgumentList&, CppVariant*);
     90 
     91     // This function sets a flag that tells the test_shell to print a line of
     92     // user gesture status text for some frame load callbacks.  It takes no
     93     // arguments, and ignores any that may be present.
     94     void dumpUserGestureInFrameLoadCallbacks(const CppArgumentList&, CppVariant*);
     95 
     96     // This function sets a flag that tells the test_shell to print out a text
     97     // representation of the back/forward list.  It ignores all arguments.
     98     void dumpBackForwardList(const CppArgumentList&, CppVariant*);
     99 
    100     // This function sets a flag that tells the test_shell to print out the
    101     // scroll offsets of the child frames.  It ignores all.
    102     void dumpChildFrameScrollPositions(const CppArgumentList&, CppVariant*);
    103 
    104     // This function sets a flag that tells the test_shell to recursively
    105     // dump all frames as plain text if the dumpAsText flag is set.
    106     // It takes no arguments, and ignores any that may be present.
    107     void dumpChildFramesAsText(const CppArgumentList&, CppVariant*);
    108 
    109     // This function sets a flag that tells the test_shell to dump a descriptive
    110     // line for each resource load callback. It takes no arguments, and ignores
    111     // any that may be present.
    112     void dumpResourceLoadCallbacks(const CppArgumentList&, CppVariant*);
    113 
    114     // This function sets a flag that tells the test_shell to dump the MIME type
    115     // for each resource that was loaded. It takes no arguments, and ignores any
    116     // that may be present.
    117     void dumpResourceResponseMIMETypes(const CppArgumentList&, CppVariant*);
    118 
    119     // This function sets a flag that tells the test_shell to dump all calls
    120     // to window.status().
    121     // It takes no arguments, and ignores any that may be present.
    122     void dumpWindowStatusChanges(const CppArgumentList&, CppVariant*);
    123 
    124     // When called with a boolean argument, this sets a flag that controls
    125     // whether content-editable elements accept editing focus when an editing
    126     // attempt is made. It ignores any additional arguments.
    127     void setAcceptsEditing(const CppArgumentList&, CppVariant*);
    128 
    129     // Functions for dealing with windows.  By default we block all new windows.
    130     void windowCount(const CppArgumentList&, CppVariant*);
    131     void setCanOpenWindows(const CppArgumentList&, CppVariant*);
    132     void setCloseRemainingWindowsWhenComplete(const CppArgumentList&, CppVariant*);
    133 
    134     // By default, tests end when page load is complete.  These methods are used
    135     // to delay the completion of the test until notifyDone is called.
    136     void waitUntilDone(const CppArgumentList&, CppVariant*);
    137     void notifyDone(const CppArgumentList&, CppVariant*);
    138 
    139     // Methods for adding actions to the work queue.  Used in conjunction with
    140     // waitUntilDone/notifyDone above.
    141     void queueBackNavigation(const CppArgumentList&, CppVariant*);
    142     void queueForwardNavigation(const CppArgumentList&, CppVariant*);
    143     void queueReload(const CppArgumentList&, CppVariant*);
    144     void queueLoadingScript(const CppArgumentList&, CppVariant*);
    145     void queueNonLoadingScript(const CppArgumentList&, CppVariant*);
    146     void queueLoad(const CppArgumentList&, CppVariant*);
    147     void queueLoadHTMLString(const CppArgumentList&, CppVariant*);
    148 
    149     // Although this is named "objC" to match the Mac version, it actually tests
    150     // the identity of its two arguments in C++.
    151     void objCIdentityIsEqual(const CppArgumentList&, CppVariant*);
    152 
    153     // Changes the cookie policy from the default to allow all cookies.
    154     void setAlwaysAcceptCookies(const CppArgumentList&, CppVariant*);
    155 
    156     // Changes asynchronous spellchecking flag on the settings.
    157     void setAsynchronousSpellCheckingEnabled(const CppArgumentList&, CppVariant*);
    158 
    159     // Shows DevTools window.
    160     void showWebInspector(const CppArgumentList&, CppVariant*);
    161     void closeWebInspector(const CppArgumentList&, CppVariant*);
    162 
    163     // Gives focus to the window.
    164     void setWindowIsKey(const CppArgumentList&, CppVariant*);
    165 
    166     // Method that controls whether pressing Tab key cycles through page elements
    167     // or inserts a '\t' char in text area
    168     void setTabKeyCyclesThroughElements(const CppArgumentList&, CppVariant*);
    169 
    170     // Passes through to WebPreferences which allows the user to have a custom
    171     // style sheet.
    172     void setUserStyleSheetEnabled(const CppArgumentList&, CppVariant*);
    173     void setUserStyleSheetLocation(const CppArgumentList&, CppVariant*);
    174 
    175     // Passes this preference through to WebSettings.
    176     void setAuthorAndUserStylesEnabled(const CppArgumentList&, CppVariant*);
    177 
    178     // Puts Webkit in "dashboard compatibility mode", which is used in obscure
    179     // Mac-only circumstances. It's not really necessary, and will most likely
    180     // never be used by Chrome, but some layout tests depend on its presence.
    181     void setUseDashboardCompatibilityMode(const CppArgumentList&, CppVariant*);
    182 
    183     void setScrollbarPolicy(const CppArgumentList&, CppVariant*);
    184 
    185     // Causes navigation actions just printout the intended navigation instead
    186     // of taking you to the page. This is used for cases like mailto, where you
    187     // don't actually want to open the mail program.
    188     void setCustomPolicyDelegate(const CppArgumentList&, CppVariant*);
    189 
    190     // Delays completion of the test until the policy delegate runs.
    191     void waitForPolicyDelegate(const CppArgumentList&, CppVariant*);
    192 
    193     // Causes WillSendRequest to clear certain headers.
    194     void setWillSendRequestClearHeader(const CppArgumentList&, CppVariant*);
    195 
    196     // Causes WillSendRequest to block redirects.
    197     void setWillSendRequestReturnsNullOnRedirect(const CppArgumentList&, CppVariant*);
    198 
    199     // Causes WillSendRequest to return an empty request.
    200     void setWillSendRequestReturnsNull(const CppArgumentList&, CppVariant*);
    201 
    202     // Converts a URL starting with file:///tmp/ to the local mapping.
    203     void pathToLocalResource(const CppArgumentList&, CppVariant*);
    204 
    205     // Sets a bool such that when a drag is started, we fill the drag clipboard
    206     // with a fake file object.
    207     void addFileToPasteboardOnDrag(const CppArgumentList&, CppVariant*);
    208 
    209     // Executes an internal command (superset of document.execCommand() commands).
    210     void execCommand(const CppArgumentList&, CppVariant*);
    211 
    212     // Checks if an internal command is currently available.
    213     void isCommandEnabled(const CppArgumentList&, CppVariant*);
    214 
    215     // Set the WebPreference that controls webkit's popup blocking.
    216     void setPopupBlockingEnabled(const CppArgumentList&, CppVariant*);
    217 
    218     // If true, causes provisional frame loads to be stopped for the remainder of
    219     // the test.
    220     void setStopProvisionalFrameLoads(const CppArgumentList&, CppVariant*);
    221 
    222     // Enable or disable smart insert/delete.  This is enabled by default.
    223     void setSmartInsertDeleteEnabled(const CppArgumentList&, CppVariant*);
    224 
    225     // Enable or disable trailing whitespace selection on double click.
    226     void setSelectTrailingWhitespaceEnabled(const CppArgumentList&, CppVariant*);
    227 
    228     void pauseAnimationAtTimeOnElementWithId(const CppArgumentList&, CppVariant*);
    229     void pauseTransitionAtTimeOnElementWithId(const CppArgumentList&, CppVariant*);
    230     void elementDoesAutoCompleteForElementWithId(const CppArgumentList&, CppVariant*);
    231     void numberOfActiveAnimations(const CppArgumentList&, CppVariant*);
    232     void suspendAnimations(const CppArgumentList&, CppVariant*);
    233     void resumeAnimations(const CppArgumentList&, CppVariant*);
    234     void sampleSVGAnimationForElementAtTime(const CppArgumentList&, CppVariant*);
    235     void disableImageLoading(const CppArgumentList&, CppVariant*);
    236     void setIconDatabaseEnabled(const CppArgumentList&, CppVariant*);
    237     void dumpSelectionRect(const CppArgumentList&, CppVariant*);
    238 
    239     // Grants permission for desktop notifications to an origin
    240     void grantDesktopNotificationPermission(const CppArgumentList&, CppVariant*);
    241     // Simulates a click on a desktop notification.
    242     void simulateDesktopNotificationClick(const CppArgumentList&, CppVariant*);
    243 
    244     void setDomainRelaxationForbiddenForURLScheme(const CppArgumentList&, CppVariant*);
    245     void setDeferMainResourceDataLoad(const CppArgumentList&, CppVariant*);
    246     void setEditingBehavior(const CppArgumentList&, CppVariant*);
    247 
    248     // The following are only stubs.  TODO(pamg): Implement any of these that
    249     // are needed to pass the layout tests.
    250     void dumpAsWebArchive(const CppArgumentList&, CppVariant*);
    251     void dumpTitleChanges(const CppArgumentList&, CppVariant*);
    252     void setMainFrameIsFirstResponder(const CppArgumentList&, CppVariant*);
    253     void display(const CppArgumentList&, CppVariant*);
    254     void displayInvalidatedRegion(const CppArgumentList&, CppVariant*);
    255     void testRepaint(const CppArgumentList&, CppVariant*);
    256     void repaintSweepHorizontally(const CppArgumentList&, CppVariant*);
    257     void clearBackForwardList(const CppArgumentList&, CppVariant*);
    258     void keepWebHistory(const CppArgumentList&, CppVariant*);
    259     void storeWebScriptObject(const CppArgumentList&, CppVariant*);
    260     void accessStoredWebScriptObject(const CppArgumentList&, CppVariant*);
    261     void objCClassNameOf(const CppArgumentList&, CppVariant*);
    262     void addDisallowedURL(const CppArgumentList&, CppVariant*);
    263     void callShouldCloseOnWebView(const CppArgumentList&, CppVariant*);
    264     void setCallCloseOnWebViews(const CppArgumentList&, CppVariant*);
    265     void setPrivateBrowsingEnabled(const CppArgumentList&, CppVariant*);
    266 
    267     void setJavaScriptCanAccessClipboard(const CppArgumentList&, CppVariant*);
    268     void setXSSAuditorEnabled(const CppArgumentList&, CppVariant*);
    269     void evaluateScriptInIsolatedWorld(const CppArgumentList&, CppVariant*);
    270     void overridePreference(const CppArgumentList&, CppVariant*);
    271     void setAllowUniversalAccessFromFileURLs(const CppArgumentList&, CppVariant*);
    272     void setAllowFileAccessFromFileURLs(const CppArgumentList&, CppVariant*);
    273 
    274     void shadowRoot(const CppArgumentList&, CppVariant*);
    275 
    276     // The fallback method is called when a nonexistent method is called on
    277     // the layout test controller object.
    278     // It is usefull to catch typos in the JavaScript code (a few layout tests
    279     // do have typos in them) and it allows the script to continue running in
    280     // that case (as the Mac does).
    281     void fallbackMethod(const CppArgumentList&, CppVariant*);
    282 
    283     // Allows layout tests to manage origins' whitelisting.
    284     void addOriginAccessWhitelistEntry(const CppArgumentList&, CppVariant*);
    285     void removeOriginAccessWhitelistEntry(const CppArgumentList&, CppVariant*);
    286 
    287     // Clears all application caches.
    288     void clearAllApplicationCaches(const CppArgumentList&, CppVariant*);
    289     // Clears an application cache for an origin.
    290     void clearApplicationCacheForOrigin(const CppArgumentList&, CppVariant*);
    291     // Returns origins that have application caches.
    292     void originsWithApplicationCache(const CppArgumentList&, CppVariant*);
    293     // Sets the application cache quota for the localhost origin.
    294     void setApplicationCacheOriginQuota(const CppArgumentList&, CppVariant*);
    295 
    296     // Clears all databases.
    297     void clearAllDatabases(const CppArgumentList&, CppVariant*);
    298     // Sets the default quota for all origins
    299     void setDatabaseQuota(const CppArgumentList&, CppVariant*);
    300 
    301     // Calls setlocale(LC_ALL, ...) for a specified locale.
    302     // Resets between tests.
    303     void setPOSIXLocale(const CppArgumentList&, CppVariant*);
    304 
    305     // Gets the value of the counter in the element specified by its ID.
    306     void counterValueForElementById(const CppArgumentList&, CppVariant*);
    307 
    308     // Gets the number of page where the specified element will be put.
    309     void pageNumberForElementById(const CppArgumentList&, CppVariant*);
    310 
    311     // Gets the number of pages to be printed.
    312     void numberOfPages(const CppArgumentList&, CppVariant*);
    313 
    314     // Gets the number of geolocation permissions requests pending.
    315     void numberOfPendingGeolocationPermissionRequests(const CppArgumentList&, CppVariant*);
    316 
    317     // Allows layout tests to start Timeline profiling.
    318     void setTimelineProfilingEnabled(const CppArgumentList&, CppVariant*);
    319 
    320     // Allows layout tests to exec scripts at WebInspector side.
    321     void evaluateInWebInspector(const CppArgumentList&, CppVariant*);
    322 
    323     // Adds a user script or user style sheet to be injected into new documents.
    324     void addUserScript(const CppArgumentList&, CppVariant*);
    325     void addUserStyleSheet(const CppArgumentList&, CppVariant*);
    326 
    327     // DeviceOrientation related functions
    328     void setMockDeviceOrientation(const CppArgumentList&, CppVariant*);
    329 
    330     // Geolocation related functions.
    331     void setGeolocationPermission(const CppArgumentList&, CppVariant*);
    332     void setMockGeolocationPosition(const CppArgumentList&, CppVariant*);
    333     void setMockGeolocationError(const CppArgumentList&, CppVariant*);
    334 
    335     // Empty stub method to keep parity with object model exposed by global LayoutTestController.
    336     void abortModal(const CppArgumentList&, CppVariant*);
    337 
    338     // Speech input related functions.
    339     void addMockSpeechInputResult(const CppArgumentList&, CppVariant*);
    340 
    341     void layerTreeAsText(const CppArgumentList& args, CppVariant* result);
    342 
    343     void markerTextForListItem(const CppArgumentList&, CppVariant*);
    344     void hasSpellingMarker(const CppArgumentList&, CppVariant*);
    345 
    346     void setMinimumTimerInterval(const CppArgumentList&, CppVariant*);
    347 
    348     // Expects the first argument to be an input element and the second argument to be a boolean.
    349     // Forwards the setAutofilled() call to the element.
    350     void setAutofilled(const CppArgumentList&, CppVariant*);
    351 
    352     // Expects the first argument to be an input element and the second argument to be a string value.
    353     // Forwards the setValueForUser() call to the element.
    354     void setValueForUser(const CppArgumentList&, CppVariant*);
    355 
    356     // LocalStorage origin-related
    357     void deleteAllLocalStorage(const CppArgumentList&, CppVariant*);
    358     void originsWithLocalStorage(const CppArgumentList&, CppVariant*);
    359     void deleteLocalStorageForOrigin(const CppArgumentList&, CppVariant*);
    360     void observeStorageTrackerNotifications(const CppArgumentList&, CppVariant*);
    361     void syncLocalStorage(const CppArgumentList&, CppVariant*);
    362 
    363     // Enable or disable plugins.
    364     void setPluginsEnabled(const CppArgumentList&, CppVariant*);
    365 
    366 public:
    367     // The following methods are not exposed to JavaScript.
    368     void setWorkQueueFrozen(bool frozen) { m_workQueue.setFrozen(frozen); }
    369 
    370     WebKit::WebSpeechInputController* speechInputController(WebKit::WebSpeechInputListener*);
    371     bool shouldDumpAsText() { return m_dumpAsText; }
    372     void setShouldDumpAsText(bool value) { m_dumpAsText = value; }
    373     bool shouldDumpEditingCallbacks() { return m_dumpEditingCallbacks; }
    374     bool shouldDumpFrameLoadCallbacks() { return m_dumpFrameLoadCallbacks; }
    375     void setShouldDumpFrameLoadCallbacks(bool value) { m_dumpFrameLoadCallbacks = value; }
    376     bool shouldDumpUserGestureInFrameLoadCallbacks() { return m_dumpUserGestureInFrameLoadCallbacks; }
    377     void setShouldDumpUserGestureInFrameLoadCallbacks(bool value) { m_dumpUserGestureInFrameLoadCallbacks = value; }
    378     bool shouldDumpResourceLoadCallbacks() {return m_dumpResourceLoadCallbacks; }
    379     void setShouldDumpResourceResponseMIMETypes(bool value) { m_dumpResourceResponseMIMETypes = value; }
    380     bool shouldDumpResourceResponseMIMETypes() {return m_dumpResourceResponseMIMETypes; }
    381     bool shouldDumpStatusCallbacks() { return m_dumpWindowStatusChanges; }
    382     bool shouldDumpSelectionRect() { return m_dumpSelectionRect; }
    383     bool shouldDumpBackForwardList() { return m_dumpBackForwardList; }
    384     bool shouldDumpTitleChanges() { return m_dumpTitleChanges; }
    385     bool shouldDumpChildFrameScrollPositions() { return m_dumpChildFrameScrollPositions; }
    386     bool shouldDumpChildFramesAsText() { return m_dumpChildFramesAsText; }
    387     bool shouldGeneratePixelResults() { return m_generatePixelResults; }
    388     void setShouldGeneratePixelResults(bool value) { m_generatePixelResults = value; }
    389     bool acceptsEditing() { return m_acceptsEditing; }
    390     bool canOpenWindows() { return m_canOpenWindows; }
    391     bool shouldAddFileToPasteboard() { return m_shouldAddFileToPasteboard; }
    392     bool stopProvisionalFrameLoads() { return m_stopProvisionalFrameLoads; }
    393     bool deferMainResourceDataLoad() { return m_deferMainResourceDataLoad; }
    394     void setShowDebugLayerTree(bool value) { m_showDebugLayerTree = value; }
    395     void setTitleTextDirection(WebKit::WebTextDirection dir)
    396     {
    397         m_titleTextDirection.set(dir == WebKit::WebTextDirectionLeftToRight ? "ltr" : "rtl");
    398     }
    399 
    400     bool testRepaint() const { return m_testRepaint; }
    401     bool sweepHorizontally() const { return m_sweepHorizontally; }
    402 
    403     // Called by the webview delegate when the toplevel frame load is done.
    404     void locationChangeDone();
    405 
    406     // Called by the webview delegate when the policy delegate runs if the
    407     // waitForPolicyDelegate was called.
    408     void policyDelegateDone();
    409 
    410     // Reinitializes all static values.  The reset() method should be called
    411     // before the start of each test (currently from
    412     // TestShell::runFileTest).
    413     void reset();
    414 
    415     // A single item in the work queue.
    416     class WorkItem {
    417     public:
    418         virtual ~WorkItem() {}
    419 
    420         // Returns true if this started a load.
    421         virtual bool run(TestShell* shell) = 0;
    422     };
    423 
    424     TaskList* taskList() { return &m_taskList; }
    425 
    426 private:
    427     friend class WorkItem;
    428     friend class WorkQueue;
    429 
    430     // Helper class for managing events queued by methods like queueLoad or
    431     // queueScript.
    432     class WorkQueue {
    433     public:
    434         WorkQueue(LayoutTestController* controller) : m_frozen(false), m_controller(controller) {}
    435         virtual ~WorkQueue();
    436         void processWorkSoon();
    437 
    438         // Reset the state of the class between tests.
    439         void reset();
    440 
    441         void addWork(WorkItem* work);
    442 
    443         void setFrozen(bool frozen) { m_frozen = frozen; }
    444         bool isEmpty() { return m_queue.isEmpty(); }
    445         TaskList* taskList() { return &m_taskList; }
    446 
    447     private:
    448         void processWork();
    449         class WorkQueueTask: public MethodTask<WorkQueue> {
    450         public:
    451             WorkQueueTask(WorkQueue* object): MethodTask<WorkQueue>(object) {}
    452             virtual void runIfValid() { m_object->processWork(); }
    453         };
    454 
    455         TaskList m_taskList;
    456         Deque<WorkItem*> m_queue;
    457         bool m_frozen;
    458         LayoutTestController* m_controller;
    459     };
    460 
    461     // Support for overridePreference.
    462     bool cppVariantToBool(const CppVariant&);
    463     int32_t cppVariantToInt32(const CppVariant&);
    464     WebKit::WebString cppVariantToWebString(const CppVariant&);
    465 
    466     void logErrorToConsole(const std::string&);
    467     void completeNotifyDone(bool isTimeout);
    468     class NotifyDoneTimedOutTask: public MethodTask<LayoutTestController> {
    469     public:
    470         NotifyDoneTimedOutTask(LayoutTestController* object): MethodTask<LayoutTestController>(object) {}
    471         virtual void runIfValid() { m_object->completeNotifyDone(true); }
    472     };
    473 
    474 
    475     bool pauseAnimationAtTimeOnElementWithId(const WebKit::WebString& animationName, double time, const WebKit::WebString& elementId);
    476     bool pauseTransitionAtTimeOnElementWithId(const WebKit::WebString& propertyName, double time, const WebKit::WebString& elementId);
    477     bool elementDoesAutoCompleteForElementWithId(const WebKit::WebString&);
    478     int numberOfActiveAnimations();
    479     void suspendAnimations();
    480     void resumeAnimations();
    481 
    482     // Used for test timeouts.
    483     TaskList m_taskList;
    484 
    485     // Non-owning pointer.  The LayoutTestController is owned by the host.
    486     TestShell* m_shell;
    487 
    488     // If true, the test_shell will produce a plain text dump rather than a
    489     // text representation of the renderer.
    490     bool m_dumpAsText;
    491 
    492     // If true, the test_shell will write a descriptive line for each editing
    493     // command.
    494     bool m_dumpEditingCallbacks;
    495 
    496     // If true, the test_shell will draw the bounds of the current selection rect
    497     // taking possible transforms of the selection rect into account.
    498     bool m_dumpSelectionRect;
    499 
    500     // If true, the test_shell will output a descriptive line for each frame
    501     // load callback.
    502     bool m_dumpFrameLoadCallbacks;
    503 
    504     // If true, the test_shell will output a line of the user gesture status
    505     // text for some frame load callbacks.
    506     bool m_dumpUserGestureInFrameLoadCallbacks;
    507 
    508     // If true, the test_shell will output a descriptive line for each resource
    509     // load callback.
    510     bool m_dumpResourceLoadCallbacks;
    511 
    512     // If true, the test_shell will output the MIME type for each resource that
    513     // was loaded.
    514     bool m_dumpResourceResponseMIMETypes;
    515 
    516     // If true, the test_shell will produce a dump of the back forward list as
    517     // well.
    518     bool m_dumpBackForwardList;
    519 
    520     // If true, the test_shell will print out the child frame scroll offsets as
    521     // well.
    522     bool m_dumpChildFrameScrollPositions;
    523 
    524     // If true and if dump_as_text_ is true, the test_shell will recursively
    525     // dump all frames as plain text.
    526     bool m_dumpChildFramesAsText;
    527 
    528     // If true, the test_shell will dump all changes to window.status.
    529     bool m_dumpWindowStatusChanges;
    530 
    531     // If true, output a message when the page title is changed.
    532     bool m_dumpTitleChanges;
    533 
    534     // If true, the test_shell will generate pixel results in dumpAsText mode
    535     bool m_generatePixelResults;
    536 
    537     // If true, the element will be treated as editable.  This value is returned
    538     // from various editing callbacks that are called just before edit operations
    539     // are allowed.
    540     bool m_acceptsEditing;
    541 
    542     // If true, new windows can be opened via javascript or by plugins.  By
    543     // default, set to false and can be toggled to true using
    544     // setCanOpenWindows().
    545     bool m_canOpenWindows;
    546 
    547     // When reset is called, go through and close all but the main test shell
    548     // window.  By default, set to true but toggled to false using
    549     // setCloseRemainingWindowsWhenComplete().
    550     bool m_closeRemainingWindows;
    551 
    552     // If true, pixel dump will be produced as a series of 1px-tall, view-wide
    553     // individual paints over the height of the view.
    554     bool m_testRepaint;
    555     // If true and test_repaint_ is true as well, pixel dump will be produced as
    556     // a series of 1px-wide, view-tall paints across the width of the view.
    557     bool m_sweepHorizontally;
    558 
    559     // If true and a drag starts, adds a file to the drag&drop clipboard.
    560     bool m_shouldAddFileToPasteboard;
    561 
    562     // If true, stops provisional frame loads during the
    563     // DidStartProvisionalLoadForFrame callback.
    564     bool m_stopProvisionalFrameLoads;
    565 
    566     // If true, don't dump output until notifyDone is called.
    567     bool m_waitUntilDone;
    568 
    569     // If false, all new requests will not defer the main resource data load.
    570     bool m_deferMainResourceDataLoad;
    571 
    572     // If true, we will show extended information in the graphics layer tree.
    573     bool m_showDebugLayerTree;
    574 
    575     WorkQueue m_workQueue;
    576 
    577     CppVariant m_globalFlag;
    578 
    579     // Bound variable counting the number of top URLs visited.
    580     CppVariant m_webHistoryItemCount;
    581 
    582     // Bound variable tracking the directionality of the <title> tag.
    583     CppVariant m_titleTextDirection;
    584 
    585     WebKit::WebURL m_userStyleSheetLocation;
    586 
    587     OwnPtr<WebKit::WebSpeechInputControllerMock> m_speechInputControllerMock;
    588 };
    589 
    590 #endif // LayoutTestController_h
    591