#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>
// 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 an optional argument, whether to dump pixels results or not.
// 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++.
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 abortModal(const CppArgumentList&, CppVariant*);
// Speech input related functions.
- void setMockSpeechInputResult(const CppArgumentList&, CppVariant*);
+ 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.
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 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;
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);
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, don't dump output until notifyDone is called.
bool m_waitUntilDone;
+ // If false, all new requests will not defer the main resource data load.
+ bool m_deferMainResourceDataLoad;
+
WorkQueue m_workQueue;
CppVariant m_globalFlag;