OSDN Git Service

Merge WebKit at r73109: Initial merge by git.
[android-x86/external-webkit.git] / WebKitTools / DumpRenderTree / chromium / LayoutTestController.h
index 22741d5..7581781 100644 (file)
 #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;
 
@@ -55,9 +62,11 @@ public:
     // 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
@@ -77,6 +86,11 @@ public:
     // 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*);
@@ -89,6 +103,16 @@ public:
     // 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().
@@ -109,7 +133,6 @@ public:
     // 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.
@@ -119,6 +142,7 @@ public:
     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++.
@@ -129,6 +153,7 @@ public:
 
     // Shows DevTools window.
     void showWebInspector(const CppArgumentList&, CppVariant*);
+    void closeWebInspector(const CppArgumentList&, CppVariant*);
 
     // Gives focus to the window.
     void setWindowIsKey(const CppArgumentList&, CppVariant*);
@@ -199,23 +224,26 @@ public:
     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*);
@@ -249,6 +277,11 @@ public:
     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*);
     // Sets the default quota for all origins
@@ -281,6 +314,9 @@ public:
     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*);
@@ -289,25 +325,40 @@ public:
     // 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; }
@@ -333,6 +384,8 @@ public:
         virtual bool run(TestShell* shell) = 0;
     };
 
+    TaskList* taskList() { return &m_taskList; }
+
 private:
     friend class WorkItem;
     friend class WorkQueue;
@@ -352,11 +405,17 @@ private:
 
         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;
@@ -369,14 +428,22 @@ private:
 
     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;
@@ -397,9 +464,17 @@ private:
     // 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.
@@ -419,6 +494,9 @@ private:
     // 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.
@@ -451,6 +529,9 @@ private:
     // 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;
@@ -459,6 +540,8 @@ private:
     CppVariant m_webHistoryItemCount;
 
     WebKit::WebURL m_userStyleSheetLocation;
+
+    OwnPtr<WebKit::WebSpeechInputControllerMock> m_speechInputControllerMock;
 };
 
 #endif // LayoutTestController_h