#define LayoutTestController_h
#include "CppBoundClass.h"
-#include "base/timer.h" // FIXME: Remove this.
-#include "public/WebString.h"
-#include "public/WebURL.h"
+#include "Task.h"
+#include "WebString.h"
+#include "WebURL.h"
#include <wtf/Deque.h>
+#include <wtf/OwnPtr.h>
+
+namespace WebKit {
+class WebSpeechInputController;
+class WebSpeechInputControllerMock;
+class WebSpeechInputListener;
+}
class TestShell;
// object.
LayoutTestController(TestShell*);
+ ~LayoutTestController();
+
// This function sets a flag that tells the test_shell to dump pages as
// plain text, rather than as a text representation of the renderer's state.
- // It takes no arguments, and ignores any that may be present.
+ // It takes an optional argument, whether to dump pixels results or not.
void dumpAsText(const CppArgumentList&, CppVariant*);
// This function should set a flag that tells the test_shell to print a line
// ignores any that may be present.
void dumpFrameLoadCallbacks(const CppArgumentList&, CppVariant*);
+ // This function sets a flag that tells the test_shell to print a line of
+ // user gesture status text for some frame load callbacks. It takes no
+ // arguments, and ignores any that may be present.
+ void dumpUserGestureInFrameLoadCallbacks(const CppArgumentList&, CppVariant*);
+
// This function sets a flag that tells the test_shell to print out a text
// representation of the back/forward list. It ignores all arguments.
void dumpBackForwardList(const CppArgumentList&, CppVariant*);
// dump all frames as plain text if the dumpAsText flag is set.
// It takes no arguments, and ignores any that may be present.
void dumpChildFramesAsText(const CppArgumentList&, CppVariant*);
+
+ // This function sets a flag that tells the test_shell to dump a descriptive
+ // line for each resource load callback. It takes no arguments, and ignores
+ // any that may be present.
+ void dumpResourceLoadCallbacks(const CppArgumentList&, CppVariant*);
+
+ // This function sets a flag that tells the test_shell to dump the MIME type
+ // for each resource that was loaded. It takes no arguments, and ignores any
+ // that may be present.
+ void dumpResourceResponseMIMETypes(const CppArgumentList&, CppVariant*);
// This function sets a flag that tells the test_shell to dump all calls
// to window.status().
// to delay the completion of the test until notifyDone is called.
void waitUntilDone(const CppArgumentList&, CppVariant*);
void notifyDone(const CppArgumentList&, CppVariant*);
- void notifyDoneTimedOut();
// Methods for adding actions to the work queue. Used in conjunction with
// waitUntilDone/notifyDone above.
void queueLoadingScript(const CppArgumentList&, CppVariant*);
void queueNonLoadingScript(const CppArgumentList&, CppVariant*);
void queueLoad(const CppArgumentList&, CppVariant*);
+ void queueLoadHTMLString(const CppArgumentList&, CppVariant*);
// Although this is named "objC" to match the Mac version, it actually tests
// the identity of its two arguments in C++.
// Changes the cookie policy from the default to allow all cookies.
void setAlwaysAcceptCookies(const CppArgumentList&, CppVariant*);
+ // Shows DevTools window.
+ void showWebInspector(const CppArgumentList&, CppVariant*);
+ void closeWebInspector(const CppArgumentList&, CppVariant*);
+
// Gives focus to the window.
void setWindowIsKey(const CppArgumentList&, CppVariant*);
void setUserStyleSheetEnabled(const CppArgumentList&, CppVariant*);
void setUserStyleSheetLocation(const CppArgumentList&, CppVariant*);
+ // Passes this preference through to WebSettings.
+ void setAuthorAndUserStylesEnabled(const CppArgumentList&, CppVariant*);
+
// Puts Webkit in "dashboard compatibility mode", which is used in obscure
// Mac-only circumstances. It's not really necessary, and will most likely
// never be used by Chrome, but some layout tests depend on its presence.
void setUseDashboardCompatibilityMode(const CppArgumentList&, CppVariant*);
+ void setScrollbarPolicy(const CppArgumentList&, CppVariant*);
+
// Causes navigation actions just printout the intended navigation instead
// of taking you to the page. This is used for cases like mailto, where you
// don't actually want to open the mail program.
// Delays completion of the test until the policy delegate runs.
void waitForPolicyDelegate(const CppArgumentList&, CppVariant*);
+ // Causes WillSendRequest to clear certain headers.
+ void setWillSendRequestClearHeader(const CppArgumentList&, CppVariant*);
+
// Causes WillSendRequest to block redirects.
void setWillSendRequestReturnsNullOnRedirect(const CppArgumentList&, CppVariant*);
void pauseTransitionAtTimeOnElementWithId(const CppArgumentList&, CppVariant*);
void elementDoesAutoCompleteForElementWithId(const CppArgumentList&, CppVariant*);
void numberOfActiveAnimations(const CppArgumentList&, CppVariant*);
-
+ void suspendAnimations(const CppArgumentList&, CppVariant*);
+ void resumeAnimations(const CppArgumentList&, CppVariant*);
+ void sampleSVGAnimationForElementAtTime(const CppArgumentList&, CppVariant*);
void disableImageLoading(const CppArgumentList&, CppVariant*);
-
void setIconDatabaseEnabled(const CppArgumentList&, CppVariant*);
-
void dumpSelectionRect(const CppArgumentList&, CppVariant*);
+ // Grants permission for desktop notifications to an origin
+ void grantDesktopNotificationPermission(const CppArgumentList&, CppVariant*);
+ // Simulates a click on a desktop notification.
+ void simulateDesktopNotificationClick(const CppArgumentList&, CppVariant*);
+
+ void setDomainRelaxationForbiddenForURLScheme(const CppArgumentList&, CppVariant*);
+ void setDeferMainResourceDataLoad(const CppArgumentList&, CppVariant*);
+ void setEditingBehavior(const CppArgumentList&, CppVariant*);
+
// The following are only stubs. TODO(pamg): Implement any of these that
// are needed to pass the layout tests.
void dumpAsWebArchive(const CppArgumentList&, CppVariant*);
void dumpTitleChanges(const CppArgumentList&, CppVariant*);
- void dumpResourceLoadCallbacks(const CppArgumentList&, CppVariant*);
void setMainFrameIsFirstResponder(const CppArgumentList&, CppVariant*);
void display(const CppArgumentList&, CppVariant*);
void testRepaint(const CppArgumentList&, CppVariant*);
void accessStoredWebScriptObject(const CppArgumentList&, CppVariant*);
void objCClassNameOf(const CppArgumentList&, CppVariant*);
void addDisallowedURL(const CppArgumentList&, CppVariant*);
+ void callShouldCloseOnWebView(const CppArgumentList&, CppVariant*);
void setCallCloseOnWebViews(const CppArgumentList&, CppVariant*);
void setPrivateBrowsingEnabled(const CppArgumentList&, CppVariant*);
+ void setJavaScriptCanAccessClipboard(const CppArgumentList&, CppVariant*);
void setXSSAuditorEnabled(const CppArgumentList&, CppVariant*);
void evaluateScriptInIsolatedWorld(const CppArgumentList&, CppVariant*);
void overridePreference(const CppArgumentList&, CppVariant*);
// that case (as the Mac does).
void fallbackMethod(const CppArgumentList&, CppVariant*);
- // Allows layout tests to call SecurityOrigin::addOriginAccessWhitelistEntry().
+ // Allows layout tests to manage origins' whitelisting.
void addOriginAccessWhitelistEntry(const CppArgumentList&, CppVariant*);
+ void removeOriginAccessWhitelistEntry(const CppArgumentList&, CppVariant*);
+
+ // Clears all Application Caches.
+ void clearAllApplicationCaches(const CppArgumentList&, CppVariant*);
+ // Sets the Application Quota for the localhost origin.
+ void setApplicationCacheOriginQuota(const CppArgumentList&, CppVariant*);
// Clears all databases.
void clearAllDatabases(const CppArgumentList&, CppVariant*);
// Forces the selection colors for testing under Linux.
void forceRedSelectionColors(const CppArgumentList&, CppVariant*);
- // Adds a user script to be injected into new documents.
+ // Adds a user script or user style sheet to be injected into new documents.
void addUserScript(const CppArgumentList&, CppVariant*);
+ void addUserStyleSheet(const CppArgumentList&, CppVariant*);
+
+ // DeviceOrientation related functions
+ void setMockDeviceOrientation(const CppArgumentList&, CppVariant*);
+
+ // Geolocation related functions.
+ void setGeolocationPermission(const CppArgumentList&, CppVariant*);
+ void setMockGeolocationPosition(const CppArgumentList&, CppVariant*);
+ void setMockGeolocationError(const CppArgumentList&, CppVariant*);
+
+ // Empty stub method to keep parity with object model exposed by global LayoutTestController.
+ void abortModal(const CppArgumentList&, CppVariant*);
+
+ // Speech input related functions.
+ void addMockSpeechInputResult(const CppArgumentList&, CppVariant*);
+
+ void layerTreeAsText(const CppArgumentList& args, CppVariant* result);
+
+ void markerTextForListItem(const CppArgumentList&, CppVariant*);
+ void hasSpellingMarker(const CppArgumentList&, CppVariant*);
public:
// The following methods are not exposed to JavaScript.
void setWorkQueueFrozen(bool frozen) { m_workQueue.setFrozen(frozen); }
+ WebKit::WebSpeechInputController* speechInputController(WebKit::WebSpeechInputListener*);
bool shouldDumpAsText() { return m_dumpAsText; }
bool shouldDumpEditingCallbacks() { return m_dumpEditingCallbacks; }
bool shouldDumpFrameLoadCallbacks() { return m_dumpFrameLoadCallbacks; }
void setShouldDumpFrameLoadCallbacks(bool value) { m_dumpFrameLoadCallbacks = value; }
+ bool shouldDumpUserGestureInFrameLoadCallbacks() { return m_dumpUserGestureInFrameLoadCallbacks; }
+ void setShouldDumpUserGestureInFrameLoadCallbacks(bool value) { m_dumpUserGestureInFrameLoadCallbacks = value; }
bool shouldDumpResourceLoadCallbacks() {return m_dumpResourceLoadCallbacks; }
+ void setShouldDumpResourceResponseMIMETypes(bool value) { m_dumpResourceResponseMIMETypes = value; }
+ bool shouldDumpResourceResponseMIMETypes() {return m_dumpResourceResponseMIMETypes; }
bool shouldDumpStatusCallbacks() { return m_dumpWindowStatusChanges; }
bool shouldDumpSelectionRect() { return m_dumpSelectionRect; }
bool shouldDumpBackForwardList() { return m_dumpBackForwardList; }
bool shouldDumpTitleChanges() { return m_dumpTitleChanges; }
bool shouldDumpChildFrameScrollPositions() { return m_dumpChildFrameScrollPositions; }
bool shouldDumpChildFramesAsText() { return m_dumpChildFramesAsText; }
+ bool shouldGeneratePixelResults() { return m_generatePixelResults; }
bool acceptsEditing() { return m_acceptsEditing; }
bool canOpenWindows() { return m_canOpenWindows; }
bool shouldAddFileToPasteboard() { return m_shouldAddFileToPasteboard; }
bool stopProvisionalFrameLoads() { return m_stopProvisionalFrameLoads; }
+ bool deferMainResourceDataLoad() { return m_deferMainResourceDataLoad; }
bool testRepaint() const { return m_testRepaint; }
bool sweepHorizontally() const { return m_sweepHorizontally; }
virtual bool run(TestShell* shell) = 0;
};
+ TaskList* taskList() { return &m_taskList; }
+
private:
friend class WorkItem;
friend class WorkQueue;
// queueScript.
class WorkQueue {
public:
- WorkQueue(LayoutTestController* controller) : m_controller(controller) {}
+ WorkQueue(LayoutTestController* controller) : m_frozen(false), m_controller(controller) {}
virtual ~WorkQueue();
void processWorkSoon();
void setFrozen(bool frozen) { m_frozen = frozen; }
bool isEmpty() { return m_queue.isEmpty(); }
+ TaskList* taskList() { return &m_taskList; }
private:
void processWork();
+ class WorkQueueTask: public MethodTask<WorkQueue> {
+ public:
+ WorkQueueTask(WorkQueue* object): MethodTask<WorkQueue>(object) {}
+ virtual void runIfValid() { m_object->processWork(); }
+ };
- base::OneShotTimer<WorkQueue> m_timer;
+ TaskList m_taskList;
Deque<WorkItem*> m_queue;
bool m_frozen;
LayoutTestController* m_controller;
void logErrorToConsole(const std::string&);
void completeNotifyDone(bool isTimeout);
+ class NotifyDoneTimedOutTask: public MethodTask<LayoutTestController> {
+ public:
+ NotifyDoneTimedOutTask(LayoutTestController* object): MethodTask<LayoutTestController>(object) {}
+ virtual void runIfValid() { m_object->completeNotifyDone(true); }
+ };
+
bool pauseAnimationAtTimeOnElementWithId(const WebKit::WebString& animationName, double time, const WebKit::WebString& elementId);
bool pauseTransitionAtTimeOnElementWithId(const WebKit::WebString& propertyName, double time, const WebKit::WebString& elementId);
bool elementDoesAutoCompleteForElementWithId(const WebKit::WebString&);
int numberOfActiveAnimations();
+ void suspendAnimations();
+ void resumeAnimations();
// Used for test timeouts.
- ScopedRunnableMethodFactory<LayoutTestController> m_timeoutFactory;
+ TaskList m_taskList;
// Non-owning pointer. The LayoutTestController is owned by the host.
TestShell* m_shell;
// load callback.
bool m_dumpFrameLoadCallbacks;
+ // If true, the test_shell will output a line of the user gesture status
+ // text for some frame load callbacks.
+ bool m_dumpUserGestureInFrameLoadCallbacks;
+
// If true, the test_shell will output a descriptive line for each resource
// load callback.
bool m_dumpResourceLoadCallbacks;
+
+ // If true, the test_shell will output the MIME type for each resource that
+ // was loaded.
+ bool m_dumpResourceResponseMIMETypes;
// If true, the test_shell will produce a dump of the back forward list as
// well.
// If true, output a message when the page title is changed.
bool m_dumpTitleChanges;
+ // If true, the test_shell will generate pixel results in dumpAsText mode
+ bool m_generatePixelResults;
+
// If true, the element will be treated as editable. This value is returned
// from various editing callbacks that are called just before edit operations
// are allowed.
// If true, don't dump output until notifyDone is called.
bool m_waitUntilDone;
- // To prevent infinite loops, only the first page of a test can add to a
- // work queue (since we may well come back to that same page).
- bool m_workQueueFrozen;
+ // If false, all new requests will not defer the main resource data load.
+ bool m_deferMainResourceDataLoad;
WorkQueue m_workQueue;
CppVariant m_webHistoryItemCount;
WebKit::WebURL m_userStyleSheetLocation;
+
+ OwnPtr<WebKit::WebSpeechInputControllerMock> m_speechInputControllerMock;
};
#endif // LayoutTestController_h