OSDN Git Service

Merge WebKit at r73109: Initial merge by git.
[android-x86/external-webkit.git] / WebKitTools / DumpRenderTree / chromium / LayoutTestController.h
index fb91544..7581781 100644 (file)
@@ -42,9 +42,9 @@
 #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>
 
@@ -62,6 +62,8 @@ 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 an optional argument, whether to dump pixels results or not.
@@ -84,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*);
@@ -96,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().
@@ -116,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.
@@ -126,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++.
@@ -207,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*);
@@ -306,7 +326,12 @@ public:
     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.
@@ -317,7 +342,11 @@ public:
     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; }
@@ -329,6 +358,7 @@ public:
     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; }
@@ -354,6 +384,8 @@ public:
         virtual bool run(TestShell* shell) = 0;
     };
 
+    TaskList* taskList() { return &m_taskList; }
+
 private:
     friend class WorkItem;
     friend class WorkQueue;
@@ -373,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;
@@ -390,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;
@@ -418,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.
@@ -475,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;