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"
472daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch#include "WebTextDirection.h"
48a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch#include "WebURL.h"
49dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block#include <wtf/Deque.h>
50dd8bb3de4f353a81954234999f1fea748aee2ea9Ben Murdoch#include <wtf/OwnPtr.h>
51dd8bb3de4f353a81954234999f1fea748aee2ea9Ben Murdoch
52dd8bb3de4f353a81954234999f1fea748aee2ea9Ben Murdochnamespace WebKit {
53f05b935882198ccf7d81675736e3aeb089c5113aBen Murdochclass WebGeolocationClientMock;
54dd8bb3de4f353a81954234999f1fea748aee2ea9Ben Murdochclass WebSpeechInputController;
55dd8bb3de4f353a81954234999f1fea748aee2ea9Ben Murdochclass WebSpeechInputControllerMock;
56dd8bb3de4f353a81954234999f1fea748aee2ea9Ben Murdochclass WebSpeechInputListener;
57dd8bb3de4f353a81954234999f1fea748aee2ea9Ben Murdoch}
58dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block
59dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Blockclass TestShell;
60dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block
61dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Blockclass LayoutTestController : public CppBoundClass {
62dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Blockpublic:
63dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    // Builds the property and method lists needed to bind this class to a JS
64dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    // object.
65dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    LayoutTestController(TestShell*);
66dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block
675abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306Iain Merrick    ~LayoutTestController();
685abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306Iain Merrick
69dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    // This function sets a flag that tells the test_shell to dump pages as
70dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    // plain text, rather than as a text representation of the renderer's state.
71967717af5423377c967781471ee106e2bb4e11c8Ben Murdoch    // It takes an optional argument, whether to dump pixels results or not.
72dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    void dumpAsText(const CppArgumentList&, CppVariant*);
73dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block
74dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    // This function should set a flag that tells the test_shell to print a line
75dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    // of descriptive text for each database command.  It should take no
76dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    // arguments, and ignore any that may be present. However, at the moment, we
77dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    // don't have any DB function that prints messages, so for now this function
78dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    // doesn't do anything.
79dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    void dumpDatabaseCallbacks(const CppArgumentList&, CppVariant*);
80dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block
81dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    // This function sets a flag that tells the test_shell to print a line of
82dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    // descriptive text for each editing command.  It takes no arguments, and
83dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    // ignores any that may be present.
84dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    void dumpEditingCallbacks(const CppArgumentList&, CppVariant*);
85dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block
86dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    // This function sets a flag that tells the test_shell to print a line of
87dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    // descriptive text for each frame load callback.  It takes no arguments, and
88dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    // ignores any that may be present.
89dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    void dumpFrameLoadCallbacks(const CppArgumentList&, CppVariant*);
90dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block
91e14391e94c850b8bd03680c23b38978db68687a8John Reck    // This function sets a flag that tells the test_shell to print a line of
92e14391e94c850b8bd03680c23b38978db68687a8John Reck    // user gesture status text for some frame load callbacks.  It takes no
93e14391e94c850b8bd03680c23b38978db68687a8John Reck    // arguments, and ignores any that may be present.
94e14391e94c850b8bd03680c23b38978db68687a8John Reck    void dumpUserGestureInFrameLoadCallbacks(const CppArgumentList&, CppVariant*);
95e14391e94c850b8bd03680c23b38978db68687a8John Reck
96dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    // This function sets a flag that tells the test_shell to print out a text
97dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    // representation of the back/forward list.  It ignores all arguments.
98dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    void dumpBackForwardList(const CppArgumentList&, CppVariant*);
99dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block
100dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    // This function sets a flag that tells the test_shell to print out the
101dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    // scroll offsets of the child frames.  It ignores all.
102dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    void dumpChildFrameScrollPositions(const CppArgumentList&, CppVariant*);
103dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block
104dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    // This function sets a flag that tells the test_shell to recursively
105dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    // dump all frames as plain text if the dumpAsText flag is set.
106dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    // It takes no arguments, and ignores any that may be present.
107dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    void dumpChildFramesAsText(const CppArgumentList&, CppVariant*);
10868513a70bcd92384395513322f1b801e7bf9c729Steve Block
10968513a70bcd92384395513322f1b801e7bf9c729Steve Block    // This function sets a flag that tells the test_shell to dump a descriptive
11068513a70bcd92384395513322f1b801e7bf9c729Steve Block    // line for each resource load callback. It takes no arguments, and ignores
11168513a70bcd92384395513322f1b801e7bf9c729Steve Block    // any that may be present.
11268513a70bcd92384395513322f1b801e7bf9c729Steve Block    void dumpResourceLoadCallbacks(const CppArgumentList&, CppVariant*);
11368513a70bcd92384395513322f1b801e7bf9c729Steve Block
11468513a70bcd92384395513322f1b801e7bf9c729Steve Block    // This function sets a flag that tells the test_shell to dump the MIME type
11568513a70bcd92384395513322f1b801e7bf9c729Steve Block    // for each resource that was loaded. It takes no arguments, and ignores any
11668513a70bcd92384395513322f1b801e7bf9c729Steve Block    // that may be present.
11768513a70bcd92384395513322f1b801e7bf9c729Steve Block    void dumpResourceResponseMIMETypes(const CppArgumentList&, CppVariant*);
118dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block
119dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    // This function sets a flag that tells the test_shell to dump all calls
120dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    // to window.status().
121dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    // It takes no arguments, and ignores any that may be present.
122dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    void dumpWindowStatusChanges(const CppArgumentList&, CppVariant*);
123dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block
124dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    // When called with a boolean argument, this sets a flag that controls
125dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    // whether content-editable elements accept editing focus when an editing
126dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    // attempt is made. It ignores any additional arguments.
127dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    void setAcceptsEditing(const CppArgumentList&, CppVariant*);
128dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block
129dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    // Functions for dealing with windows.  By default we block all new windows.
130dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    void windowCount(const CppArgumentList&, CppVariant*);
131dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    void setCanOpenWindows(const CppArgumentList&, CppVariant*);
132dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    void setCloseRemainingWindowsWhenComplete(const CppArgumentList&, CppVariant*);
133dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block
134dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    // By default, tests end when page load is complete.  These methods are used
135dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    // to delay the completion of the test until notifyDone is called.
136dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    void waitUntilDone(const CppArgumentList&, CppVariant*);
137dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    void notifyDone(const CppArgumentList&, CppVariant*);
138dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block
139dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    // Methods for adding actions to the work queue.  Used in conjunction with
140dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    // waitUntilDone/notifyDone above.
141dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    void queueBackNavigation(const CppArgumentList&, CppVariant*);
142dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    void queueForwardNavigation(const CppArgumentList&, CppVariant*);
143dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    void queueReload(const CppArgumentList&, CppVariant*);
144dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    void queueLoadingScript(const CppArgumentList&, CppVariant*);
145dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    void queueNonLoadingScript(const CppArgumentList&, CppVariant*);
146dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    void queueLoad(const CppArgumentList&, CppVariant*);
14768513a70bcd92384395513322f1b801e7bf9c729Steve Block    void queueLoadHTMLString(const CppArgumentList&, CppVariant*);
148dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block
149dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    // Although this is named "objC" to match the Mac version, it actually tests
150dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    // the identity of its two arguments in C++.
151dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    void objCIdentityIsEqual(const CppArgumentList&, CppVariant*);
152dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block
153dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    // Changes the cookie policy from the default to allow all cookies.
154dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    void setAlwaysAcceptCookies(const CppArgumentList&, CppVariant*);
155dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block
156f05b935882198ccf7d81675736e3aeb089c5113aBen Murdoch    // Changes asynchronous spellchecking flag on the settings.
157f05b935882198ccf7d81675736e3aeb089c5113aBen Murdoch    void setAsynchronousSpellCheckingEnabled(const CppArgumentList&, CppVariant*);
158f05b935882198ccf7d81675736e3aeb089c5113aBen Murdoch
1596c2af9490927c3c5959b5cb07461b646f8b32f6cKristian Monsen    // Shows DevTools window.
1606c2af9490927c3c5959b5cb07461b646f8b32f6cKristian Monsen    void showWebInspector(const CppArgumentList&, CppVariant*);
161e458d70a0d18538346f41b503114c9ebe6b2ce12Leon Clarke    void closeWebInspector(const CppArgumentList&, CppVariant*);
1626c2af9490927c3c5959b5cb07461b646f8b32f6cKristian Monsen
163dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    // Gives focus to the window.
164dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    void setWindowIsKey(const CppArgumentList&, CppVariant*);
165dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block
166dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    // Method that controls whether pressing Tab key cycles through page elements
167dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    // or inserts a '\t' char in text area
168dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    void setTabKeyCyclesThroughElements(const CppArgumentList&, CppVariant*);
169dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block
170dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    // Passes through to WebPreferences which allows the user to have a custom
171dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    // style sheet.
172dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    void setUserStyleSheetEnabled(const CppArgumentList&, CppVariant*);
173dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    void setUserStyleSheetLocation(const CppArgumentList&, CppVariant*);
174dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block
1756c2af9490927c3c5959b5cb07461b646f8b32f6cKristian Monsen    // Passes this preference through to WebSettings.
1766c2af9490927c3c5959b5cb07461b646f8b32f6cKristian Monsen    void setAuthorAndUserStylesEnabled(const CppArgumentList&, CppVariant*);
1776c2af9490927c3c5959b5cb07461b646f8b32f6cKristian Monsen
178dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    // Puts Webkit in "dashboard compatibility mode", which is used in obscure
179dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    // Mac-only circumstances. It's not really necessary, and will most likely
180dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    // never be used by Chrome, but some layout tests depend on its presence.
181dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    void setUseDashboardCompatibilityMode(const CppArgumentList&, CppVariant*);
182dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block
1836c2af9490927c3c5959b5cb07461b646f8b32f6cKristian Monsen    void setScrollbarPolicy(const CppArgumentList&, CppVariant*);
1846c2af9490927c3c5959b5cb07461b646f8b32f6cKristian Monsen
185dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    // Causes navigation actions just printout the intended navigation instead
186dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    // of taking you to the page. This is used for cases like mailto, where you
187dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    // don't actually want to open the mail program.
188dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    void setCustomPolicyDelegate(const CppArgumentList&, CppVariant*);
189dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block
190dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    // Delays completion of the test until the policy delegate runs.
191dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    void waitForPolicyDelegate(const CppArgumentList&, CppVariant*);
192dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block
1936c2af9490927c3c5959b5cb07461b646f8b32f6cKristian Monsen    // Causes WillSendRequest to clear certain headers.
1946c2af9490927c3c5959b5cb07461b646f8b32f6cKristian Monsen    void setWillSendRequestClearHeader(const CppArgumentList&, CppVariant*);
1956c2af9490927c3c5959b5cb07461b646f8b32f6cKristian Monsen
196dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    // Causes WillSendRequest to block redirects.
197dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    void setWillSendRequestReturnsNullOnRedirect(const CppArgumentList&, CppVariant*);
198dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block
199dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    // Causes WillSendRequest to return an empty request.
200dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    void setWillSendRequestReturnsNull(const CppArgumentList&, CppVariant*);
201dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block
202dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    // Converts a URL starting with file:///tmp/ to the local mapping.
203dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    void pathToLocalResource(const CppArgumentList&, CppVariant*);
204dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block
205dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    // Sets a bool such that when a drag is started, we fill the drag clipboard
206dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    // with a fake file object.
207dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    void addFileToPasteboardOnDrag(const CppArgumentList&, CppVariant*);
208dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block
209dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    // Executes an internal command (superset of document.execCommand() commands).
210dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    void execCommand(const CppArgumentList&, CppVariant*);
211dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block
212dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    // Checks if an internal command is currently available.
213dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    void isCommandEnabled(const CppArgumentList&, CppVariant*);
214dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block
215dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    // Set the WebPreference that controls webkit's popup blocking.
216dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    void setPopupBlockingEnabled(const CppArgumentList&, CppVariant*);
217dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block
218dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    // If true, causes provisional frame loads to be stopped for the remainder of
219dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    // the test.
220dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    void setStopProvisionalFrameLoads(const CppArgumentList&, CppVariant*);
221dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block
222dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    // Enable or disable smart insert/delete.  This is enabled by default.
223dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    void setSmartInsertDeleteEnabled(const CppArgumentList&, CppVariant*);
224dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block
225dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    // Enable or disable trailing whitespace selection on double click.
226dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    void setSelectTrailingWhitespaceEnabled(const CppArgumentList&, CppVariant*);
227dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block
228dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    void pauseAnimationAtTimeOnElementWithId(const CppArgumentList&, CppVariant*);
229dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    void pauseTransitionAtTimeOnElementWithId(const CppArgumentList&, CppVariant*);
230dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    void elementDoesAutoCompleteForElementWithId(const CppArgumentList&, CppVariant*);
231dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    void numberOfActiveAnimations(const CppArgumentList&, CppVariant*);
232f486d19d62f1bc33246748b14b14a9dfa617b57fIain Merrick    void suspendAnimations(const CppArgumentList&, CppVariant*);
233f486d19d62f1bc33246748b14b14a9dfa617b57fIain Merrick    void resumeAnimations(const CppArgumentList&, CppVariant*);
234bec39347bb3bb5bf1187ccaf471d26247f28b585Kristian Monsen    void sampleSVGAnimationForElementAtTime(const CppArgumentList&, CppVariant*);
235dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    void disableImageLoading(const CppArgumentList&, CppVariant*);
236dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    void setIconDatabaseEnabled(const CppArgumentList&, CppVariant*);
237dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    void dumpSelectionRect(const CppArgumentList&, CppVariant*);
238dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block
2396c2af9490927c3c5959b5cb07461b646f8b32f6cKristian Monsen    // Grants permission for desktop notifications to an origin
2406c2af9490927c3c5959b5cb07461b646f8b32f6cKristian Monsen    void grantDesktopNotificationPermission(const CppArgumentList&, CppVariant*);
2415ddde30071f639962dd557c453f2ad01f8f0fd00Kristian Monsen    // Simulates a click on a desktop notification.
2425ddde30071f639962dd557c453f2ad01f8f0fd00Kristian Monsen    void simulateDesktopNotificationClick(const CppArgumentList&, CppVariant*);
2436c2af9490927c3c5959b5cb07461b646f8b32f6cKristian Monsen
24468513a70bcd92384395513322f1b801e7bf9c729Steve Block    void setDomainRelaxationForbiddenForURLScheme(const CppArgumentList&, CppVariant*);
24568513a70bcd92384395513322f1b801e7bf9c729Steve Block    void setDeferMainResourceDataLoad(const CppArgumentList&, CppVariant*);
246e78cbe89e6f337f2f1fe40315be88f742b547151Steve Block    void setEditingBehavior(const CppArgumentList&, CppVariant*);
247e78cbe89e6f337f2f1fe40315be88f742b547151Steve Block
248dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    // The following are only stubs.  TODO(pamg): Implement any of these that
249dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    // are needed to pass the layout tests.
250dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    void dumpAsWebArchive(const CppArgumentList&, CppVariant*);
251dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    void dumpTitleChanges(const CppArgumentList&, CppVariant*);
252dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    void setMainFrameIsFirstResponder(const CppArgumentList&, CppVariant*);
253dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    void display(const CppArgumentList&, CppVariant*);
2542fc2651226baac27029e38c9d6ef883fa32084dbSteve Block    void displayInvalidatedRegion(const CppArgumentList&, CppVariant*);
255dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    void testRepaint(const CppArgumentList&, CppVariant*);
256dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    void repaintSweepHorizontally(const CppArgumentList&, CppVariant*);
257dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    void clearBackForwardList(const CppArgumentList&, CppVariant*);
258dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    void keepWebHistory(const CppArgumentList&, CppVariant*);
259dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    void storeWebScriptObject(const CppArgumentList&, CppVariant*);
260dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    void accessStoredWebScriptObject(const CppArgumentList&, CppVariant*);
261dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    void objCClassNameOf(const CppArgumentList&, CppVariant*);
262dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    void addDisallowedURL(const CppArgumentList&, CppVariant*);
2636c2af9490927c3c5959b5cb07461b646f8b32f6cKristian Monsen    void callShouldCloseOnWebView(const CppArgumentList&, CppVariant*);
264dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    void setCallCloseOnWebViews(const CppArgumentList&, CppVariant*);
265dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    void setPrivateBrowsingEnabled(const CppArgumentList&, CppVariant*);
266dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block
26721939df44de1705786c545cd1bf519d47250322dBen Murdoch    void setJavaScriptCanAccessClipboard(const CppArgumentList&, CppVariant*);
268dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    void setXSSAuditorEnabled(const CppArgumentList&, CppVariant*);
269dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    void evaluateScriptInIsolatedWorld(const CppArgumentList&, CppVariant*);
270dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    void overridePreference(const CppArgumentList&, CppVariant*);
271dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    void setAllowUniversalAccessFromFileURLs(const CppArgumentList&, CppVariant*);
272dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    void setAllowFileAccessFromFileURLs(const CppArgumentList&, CppVariant*);
273dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block
2742bde8e466a4451c7319e3a072d118917957d6554Steve Block    void shadowRoot(const CppArgumentList&, CppVariant*);
275dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block
276dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    // The fallback method is called when a nonexistent method is called on
277dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    // the layout test controller object.
278dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    // It is usefull to catch typos in the JavaScript code (a few layout tests
279dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    // do have typos in them) and it allows the script to continue running in
280dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    // that case (as the Mac does).
281dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    void fallbackMethod(const CppArgumentList&, CppVariant*);
282dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block
2836c2af9490927c3c5959b5cb07461b646f8b32f6cKristian Monsen    // Allows layout tests to manage origins' whitelisting.
284dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    void addOriginAccessWhitelistEntry(const CppArgumentList&, CppVariant*);
2856c2af9490927c3c5959b5cb07461b646f8b32f6cKristian Monsen    void removeOriginAccessWhitelistEntry(const CppArgumentList&, CppVariant*);
286dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block
2872bde8e466a4451c7319e3a072d118917957d6554Steve Block    // Clears all application caches.
288dd8bb3de4f353a81954234999f1fea748aee2ea9Ben Murdoch    void clearAllApplicationCaches(const CppArgumentList&, CppVariant*);
2892bde8e466a4451c7319e3a072d118917957d6554Steve Block    // Clears an application cache for an origin.
2902bde8e466a4451c7319e3a072d118917957d6554Steve Block    void clearApplicationCacheForOrigin(const CppArgumentList&, CppVariant*);
2912bde8e466a4451c7319e3a072d118917957d6554Steve Block    // Returns origins that have application caches.
2922bde8e466a4451c7319e3a072d118917957d6554Steve Block    void originsWithApplicationCache(const CppArgumentList&, CppVariant*);
2932bde8e466a4451c7319e3a072d118917957d6554Steve Block    // Sets the application cache quota for the localhost origin.
294dd8bb3de4f353a81954234999f1fea748aee2ea9Ben Murdoch    void setApplicationCacheOriginQuota(const CppArgumentList&, CppVariant*);
295dd8bb3de4f353a81954234999f1fea748aee2ea9Ben Murdoch
296dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    // Clears all databases.
297dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    void clearAllDatabases(const CppArgumentList&, CppVariant*);
298dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    // Sets the default quota for all origins
299dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    void setDatabaseQuota(const CppArgumentList&, CppVariant*);
300dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block
301dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    // Calls setlocale(LC_ALL, ...) for a specified locale.
302dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    // Resets between tests.
303dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    void setPOSIXLocale(const CppArgumentList&, CppVariant*);
304dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block
305dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    // Gets the value of the counter in the element specified by its ID.
306dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    void counterValueForElementById(const CppArgumentList&, CppVariant*);
307dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block
308dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    // Gets the number of page where the specified element will be put.
309dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    void pageNumberForElementById(const CppArgumentList&, CppVariant*);
310dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block
311dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    // Gets the number of pages to be printed.
312dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    void numberOfPages(const CppArgumentList&, CppVariant*);
313dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block
3142bde8e466a4451c7319e3a072d118917957d6554Steve Block    // Gets the number of geolocation permissions requests pending.
3152bde8e466a4451c7319e3a072d118917957d6554Steve Block    void numberOfPendingGeolocationPermissionRequests(const CppArgumentList&, CppVariant*);
316dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block
317dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    // Allows layout tests to start Timeline profiling.
318dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    void setTimelineProfilingEnabled(const CppArgumentList&, CppVariant*);
319dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block
320dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    // Allows layout tests to exec scripts at WebInspector side.
321dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    void evaluateInWebInspector(const CppArgumentList&, CppVariant*);
322dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block
3236c2af9490927c3c5959b5cb07461b646f8b32f6cKristian Monsen    // Adds a user script or user style sheet to be injected into new documents.
324dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    void addUserScript(const CppArgumentList&, CppVariant*);
3256c2af9490927c3c5959b5cb07461b646f8b32f6cKristian Monsen    void addUserStyleSheet(const CppArgumentList&, CppVariant*);
326dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block
327db14019a23d96bc8a444b6576a5da8bd1cfbc8b0Steve Block    // DeviceOrientation related functions
328db14019a23d96bc8a444b6576a5da8bd1cfbc8b0Steve Block    void setMockDeviceOrientation(const CppArgumentList&, CppVariant*);
329db14019a23d96bc8a444b6576a5da8bd1cfbc8b0Steve Block
330e78cbe89e6f337f2f1fe40315be88f742b547151Steve Block    // Geolocation related functions.
331e78cbe89e6f337f2f1fe40315be88f742b547151Steve Block    void setGeolocationPermission(const CppArgumentList&, CppVariant*);
332e78cbe89e6f337f2f1fe40315be88f742b547151Steve Block    void setMockGeolocationPosition(const CppArgumentList&, CppVariant*);
333e78cbe89e6f337f2f1fe40315be88f742b547151Steve Block    void setMockGeolocationError(const CppArgumentList&, CppVariant*);
334e78cbe89e6f337f2f1fe40315be88f742b547151Steve Block
335ca9cb53ed1119a3fd98fafa0972ffeb56dee1c24Steve Block    // Empty stub method to keep parity with object model exposed by global LayoutTestController.
336ca9cb53ed1119a3fd98fafa0972ffeb56dee1c24Steve Block    void abortModal(const CppArgumentList&, CppVariant*);
337ca9cb53ed1119a3fd98fafa0972ffeb56dee1c24Steve Block
338dd8bb3de4f353a81954234999f1fea748aee2ea9Ben Murdoch    // Speech input related functions.
3394576aa36e9a9671459299c7963ac95aa94beaea9Shimeng (Simon) Wang    void addMockSpeechInputResult(const CppArgumentList&, CppVariant*);
340dd8bb3de4f353a81954234999f1fea748aee2ea9Ben Murdoch
341a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch    void layerTreeAsText(const CppArgumentList& args, CppVariant* result);
342a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch
3435ddde30071f639962dd557c453f2ad01f8f0fd00Kristian Monsen    void markerTextForListItem(const CppArgumentList&, CppVariant*);
344a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch    void hasSpellingMarker(const CppArgumentList&, CppVariant*);
3455ddde30071f639962dd557c453f2ad01f8f0fd00Kristian Monsen
34681bc750723a18f21cd17d1b173cd2a4dda9cea6eBen Murdoch    void setMinimumTimerInterval(const CppArgumentList&, CppVariant*);
34781bc750723a18f21cd17d1b173cd2a4dda9cea6eBen Murdoch
3482bde8e466a4451c7319e3a072d118917957d6554Steve Block    // Expects the first argument to be an input element and the second argument to be a boolean.
3492bde8e466a4451c7319e3a072d118917957d6554Steve Block    // Forwards the setAutofilled() call to the element.
3502bde8e466a4451c7319e3a072d118917957d6554Steve Block    void setAutofilled(const CppArgumentList&, CppVariant*);
3512bde8e466a4451c7319e3a072d118917957d6554Steve Block
3522bde8e466a4451c7319e3a072d118917957d6554Steve Block    // Expects the first argument to be an input element and the second argument to be a string value.
3532bde8e466a4451c7319e3a072d118917957d6554Steve Block    // Forwards the setValueForUser() call to the element.
3542bde8e466a4451c7319e3a072d118917957d6554Steve Block    void setValueForUser(const CppArgumentList&, CppVariant*);
3552bde8e466a4451c7319e3a072d118917957d6554Steve Block
3562bde8e466a4451c7319e3a072d118917957d6554Steve Block    // LocalStorage origin-related
3572bde8e466a4451c7319e3a072d118917957d6554Steve Block    void deleteAllLocalStorage(const CppArgumentList&, CppVariant*);
3582bde8e466a4451c7319e3a072d118917957d6554Steve Block    void originsWithLocalStorage(const CppArgumentList&, CppVariant*);
3592bde8e466a4451c7319e3a072d118917957d6554Steve Block    void deleteLocalStorageForOrigin(const CppArgumentList&, CppVariant*);
3602bde8e466a4451c7319e3a072d118917957d6554Steve Block    void observeStorageTrackerNotifications(const CppArgumentList&, CppVariant*);
3612bde8e466a4451c7319e3a072d118917957d6554Steve Block    void syncLocalStorage(const CppArgumentList&, CppVariant*);
3622bde8e466a4451c7319e3a072d118917957d6554Steve Block
3632bde8e466a4451c7319e3a072d118917957d6554Steve Block    // Enable or disable plugins.
3642bde8e466a4451c7319e3a072d118917957d6554Steve Block    void setPluginsEnabled(const CppArgumentList&, CppVariant*);
3652bde8e466a4451c7319e3a072d118917957d6554Steve Block
366dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Blockpublic:
367dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    // The following methods are not exposed to JavaScript.
368dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    void setWorkQueueFrozen(bool frozen) { m_workQueue.setFrozen(frozen); }
369dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block
370dd8bb3de4f353a81954234999f1fea748aee2ea9Ben Murdoch    WebKit::WebSpeechInputController* speechInputController(WebKit::WebSpeechInputListener*);
371dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    bool shouldDumpAsText() { return m_dumpAsText; }
37281bc750723a18f21cd17d1b173cd2a4dda9cea6eBen Murdoch    void setShouldDumpAsText(bool value) { m_dumpAsText = value; }
373dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    bool shouldDumpEditingCallbacks() { return m_dumpEditingCallbacks; }
374dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    bool shouldDumpFrameLoadCallbacks() { return m_dumpFrameLoadCallbacks; }
375dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    void setShouldDumpFrameLoadCallbacks(bool value) { m_dumpFrameLoadCallbacks = value; }
376e14391e94c850b8bd03680c23b38978db68687a8John Reck    bool shouldDumpUserGestureInFrameLoadCallbacks() { return m_dumpUserGestureInFrameLoadCallbacks; }
377e14391e94c850b8bd03680c23b38978db68687a8John Reck    void setShouldDumpUserGestureInFrameLoadCallbacks(bool value) { m_dumpUserGestureInFrameLoadCallbacks = value; }
378dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    bool shouldDumpResourceLoadCallbacks() {return m_dumpResourceLoadCallbacks; }
37968513a70bcd92384395513322f1b801e7bf9c729Steve Block    void setShouldDumpResourceResponseMIMETypes(bool value) { m_dumpResourceResponseMIMETypes = value; }
38068513a70bcd92384395513322f1b801e7bf9c729Steve Block    bool shouldDumpResourceResponseMIMETypes() {return m_dumpResourceResponseMIMETypes; }
381dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    bool shouldDumpStatusCallbacks() { return m_dumpWindowStatusChanges; }
382dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    bool shouldDumpSelectionRect() { return m_dumpSelectionRect; }
383dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    bool shouldDumpBackForwardList() { return m_dumpBackForwardList; }
384dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    bool shouldDumpTitleChanges() { return m_dumpTitleChanges; }
385dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    bool shouldDumpChildFrameScrollPositions() { return m_dumpChildFrameScrollPositions; }
386dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    bool shouldDumpChildFramesAsText() { return m_dumpChildFramesAsText; }
387967717af5423377c967781471ee106e2bb4e11c8Ben Murdoch    bool shouldGeneratePixelResults() { return m_generatePixelResults; }
38881bc750723a18f21cd17d1b173cd2a4dda9cea6eBen Murdoch    void setShouldGeneratePixelResults(bool value) { m_generatePixelResults = value; }
389dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    bool acceptsEditing() { return m_acceptsEditing; }
390dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    bool canOpenWindows() { return m_canOpenWindows; }
391dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    bool shouldAddFileToPasteboard() { return m_shouldAddFileToPasteboard; }
392dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    bool stopProvisionalFrameLoads() { return m_stopProvisionalFrameLoads; }
39368513a70bcd92384395513322f1b801e7bf9c729Steve Block    bool deferMainResourceDataLoad() { return m_deferMainResourceDataLoad; }
3942bde8e466a4451c7319e3a072d118917957d6554Steve Block    void setShowDebugLayerTree(bool value) { m_showDebugLayerTree = value; }
3952daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch    void setTitleTextDirection(WebKit::WebTextDirection dir)
3962daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch    {
3972daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch        m_titleTextDirection.set(dir == WebKit::WebTextDirectionLeftToRight ? "ltr" : "rtl");
3982daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch    }
399dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block
400dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    bool testRepaint() const { return m_testRepaint; }
401dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    bool sweepHorizontally() const { return m_sweepHorizontally; }
402dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block
403dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    // Called by the webview delegate when the toplevel frame load is done.
404dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    void locationChangeDone();
405dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block
406dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    // Called by the webview delegate when the policy delegate runs if the
407dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    // waitForPolicyDelegate was called.
408dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    void policyDelegateDone();
409dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block
410dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    // Reinitializes all static values.  The reset() method should be called
411dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    // before the start of each test (currently from
412dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    // TestShell::runFileTest).
413dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    void reset();
414dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block
415dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    // A single item in the work queue.
416dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    class WorkItem {
417dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    public:
418dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block        virtual ~WorkItem() {}
419dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block
420dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block        // Returns true if this started a load.
421dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block        virtual bool run(TestShell* shell) = 0;
422dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    };
423dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block
4245abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306Iain Merrick    TaskList* taskList() { return &m_taskList; }
4255abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306Iain Merrick
426dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Blockprivate:
427dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    friend class WorkItem;
428dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    friend class WorkQueue;
429dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block
430dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    // Helper class for managing events queued by methods like queueLoad or
431dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    // queueScript.
432dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    class WorkQueue {
433dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    public:
434e78cbe89e6f337f2f1fe40315be88f742b547151Steve Block        WorkQueue(LayoutTestController* controller) : m_frozen(false), m_controller(controller) {}
435dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block        virtual ~WorkQueue();
436dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block        void processWorkSoon();
437dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block
438dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block        // Reset the state of the class between tests.
439dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block        void reset();
440dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block
441dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block        void addWork(WorkItem* work);
442dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block
443dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block        void setFrozen(bool frozen) { m_frozen = frozen; }
444dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block        bool isEmpty() { return m_queue.isEmpty(); }
4455abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306Iain Merrick        TaskList* taskList() { return &m_taskList; }
446dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block
447dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    private:
448dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block        void processWork();
4495abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306Iain Merrick        class WorkQueueTask: public MethodTask<WorkQueue> {
4505abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306Iain Merrick        public:
4515abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306Iain Merrick            WorkQueueTask(WorkQueue* object): MethodTask<WorkQueue>(object) {}
4525abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306Iain Merrick            virtual void runIfValid() { m_object->processWork(); }
4535abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306Iain Merrick        };
454dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block
4555abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306Iain Merrick        TaskList m_taskList;
456dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block        Deque<WorkItem*> m_queue;
457dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block        bool m_frozen;
458dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block        LayoutTestController* m_controller;
459dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    };
460dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block
461dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    // Support for overridePreference.
462dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    bool cppVariantToBool(const CppVariant&);
463dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    int32_t cppVariantToInt32(const CppVariant&);
464dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    WebKit::WebString cppVariantToWebString(const CppVariant&);
465dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block
466dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    void logErrorToConsole(const std::string&);
467dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    void completeNotifyDone(bool isTimeout);
4685abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306Iain Merrick    class NotifyDoneTimedOutTask: public MethodTask<LayoutTestController> {
4695abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306Iain Merrick    public:
4705abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306Iain Merrick        NotifyDoneTimedOutTask(LayoutTestController* object): MethodTask<LayoutTestController>(object) {}
4715abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306Iain Merrick        virtual void runIfValid() { m_object->completeNotifyDone(true); }
4725abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306Iain Merrick    };
4735abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306Iain Merrick
474dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block
475dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    bool pauseAnimationAtTimeOnElementWithId(const WebKit::WebString& animationName, double time, const WebKit::WebString& elementId);
476dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    bool pauseTransitionAtTimeOnElementWithId(const WebKit::WebString& propertyName, double time, const WebKit::WebString& elementId);
477dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    bool elementDoesAutoCompleteForElementWithId(const WebKit::WebString&);
478dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    int numberOfActiveAnimations();
479f486d19d62f1bc33246748b14b14a9dfa617b57fIain Merrick    void suspendAnimations();
480f486d19d62f1bc33246748b14b14a9dfa617b57fIain Merrick    void resumeAnimations();
481dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block
482dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    // Used for test timeouts.
4835abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306Iain Merrick    TaskList m_taskList;
484dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block
485dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    // Non-owning pointer.  The LayoutTestController is owned by the host.
486dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    TestShell* m_shell;
487dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block
488dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    // If true, the test_shell will produce a plain text dump rather than a
489dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    // text representation of the renderer.
490dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    bool m_dumpAsText;
491dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block
492dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    // If true, the test_shell will write a descriptive line for each editing
493dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    // command.
494dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    bool m_dumpEditingCallbacks;
495dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block
496dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    // If true, the test_shell will draw the bounds of the current selection rect
497dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    // taking possible transforms of the selection rect into account.
498dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    bool m_dumpSelectionRect;
499dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block
500dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    // If true, the test_shell will output a descriptive line for each frame
501dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    // load callback.
502dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    bool m_dumpFrameLoadCallbacks;
503dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block
504e14391e94c850b8bd03680c23b38978db68687a8John Reck    // If true, the test_shell will output a line of the user gesture status
505e14391e94c850b8bd03680c23b38978db68687a8John Reck    // text for some frame load callbacks.
506e14391e94c850b8bd03680c23b38978db68687a8John Reck    bool m_dumpUserGestureInFrameLoadCallbacks;
507e14391e94c850b8bd03680c23b38978db68687a8John Reck
508dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    // If true, the test_shell will output a descriptive line for each resource
509dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    // load callback.
510dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    bool m_dumpResourceLoadCallbacks;
51168513a70bcd92384395513322f1b801e7bf9c729Steve Block
51268513a70bcd92384395513322f1b801e7bf9c729Steve Block    // If true, the test_shell will output the MIME type for each resource that
51368513a70bcd92384395513322f1b801e7bf9c729Steve Block    // was loaded.
51468513a70bcd92384395513322f1b801e7bf9c729Steve Block    bool m_dumpResourceResponseMIMETypes;
515dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block
516dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    // If true, the test_shell will produce a dump of the back forward list as
517dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    // well.
518dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    bool m_dumpBackForwardList;
519dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block
520dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    // If true, the test_shell will print out the child frame scroll offsets as
521dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    // well.
522dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    bool m_dumpChildFrameScrollPositions;
523dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block
524dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    // If true and if dump_as_text_ is true, the test_shell will recursively
525dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    // dump all frames as plain text.
526dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    bool m_dumpChildFramesAsText;
527dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block
528dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    // If true, the test_shell will dump all changes to window.status.
529dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    bool m_dumpWindowStatusChanges;
530dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block
531dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    // If true, output a message when the page title is changed.
532dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    bool m_dumpTitleChanges;
533dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block
534967717af5423377c967781471ee106e2bb4e11c8Ben Murdoch    // If true, the test_shell will generate pixel results in dumpAsText mode
535967717af5423377c967781471ee106e2bb4e11c8Ben Murdoch    bool m_generatePixelResults;
536967717af5423377c967781471ee106e2bb4e11c8Ben Murdoch
537dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    // If true, the element will be treated as editable.  This value is returned
538dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    // from various editing callbacks that are called just before edit operations
539dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    // are allowed.
540dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    bool m_acceptsEditing;
541dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block
542dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    // If true, new windows can be opened via javascript or by plugins.  By
543dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    // default, set to false and can be toggled to true using
544dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    // setCanOpenWindows().
545dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    bool m_canOpenWindows;
546dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block
547dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    // When reset is called, go through and close all but the main test shell
548dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    // window.  By default, set to true but toggled to false using
549dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    // setCloseRemainingWindowsWhenComplete().
550dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    bool m_closeRemainingWindows;
551dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block
552dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    // If true, pixel dump will be produced as a series of 1px-tall, view-wide
553dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    // individual paints over the height of the view.
554dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    bool m_testRepaint;
555dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    // If true and test_repaint_ is true as well, pixel dump will be produced as
556dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    // a series of 1px-wide, view-tall paints across the width of the view.
557dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    bool m_sweepHorizontally;
558dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block
559dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    // If true and a drag starts, adds a file to the drag&drop clipboard.
560dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    bool m_shouldAddFileToPasteboard;
561dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block
562dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    // If true, stops provisional frame loads during the
563dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    // DidStartProvisionalLoadForFrame callback.
564dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    bool m_stopProvisionalFrameLoads;
565dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block
566dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    // If true, don't dump output until notifyDone is called.
567dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    bool m_waitUntilDone;
568dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block
56968513a70bcd92384395513322f1b801e7bf9c729Steve Block    // If false, all new requests will not defer the main resource data load.
57068513a70bcd92384395513322f1b801e7bf9c729Steve Block    bool m_deferMainResourceDataLoad;
57168513a70bcd92384395513322f1b801e7bf9c729Steve Block
5722bde8e466a4451c7319e3a072d118917957d6554Steve Block    // If true, we will show extended information in the graphics layer tree.
5732bde8e466a4451c7319e3a072d118917957d6554Steve Block    bool m_showDebugLayerTree;
5742bde8e466a4451c7319e3a072d118917957d6554Steve Block
575dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    WorkQueue m_workQueue;
576dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block
577dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    CppVariant m_globalFlag;
578dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block
579dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    // Bound variable counting the number of top URLs visited.
580dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    CppVariant m_webHistoryItemCount;
581dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block
5822daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch    // Bound variable tracking the directionality of the <title> tag.
5832daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch    CppVariant m_titleTextDirection;
5842daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch
585dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    WebKit::WebURL m_userStyleSheetLocation;
586dd8bb3de4f353a81954234999f1fea748aee2ea9Ben Murdoch
587dd8bb3de4f353a81954234999f1fea748aee2ea9Ben Murdoch    OwnPtr<WebKit::WebSpeechInputControllerMock> m_speechInputControllerMock;
588dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block};
589dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block
590dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block#endif // LayoutTestController_h
591