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