[chromium] move most of the remaining mocks to TestRunner library
authorjochen@chromium.org <jochen@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 20 Feb 2013 14:10:05 +0000 (14:10 +0000)
committerjochen@chromium.org <jochen@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 20 Feb 2013 14:10:05 +0000 (14:10 +0000)
https://bugs.webkit.org/show_bug.cgi?id=110217

Reviewed by Nico Weber.

While most of the functionality provided by these mocks is also
available in the content module, there is no straight forward way to
inject the mock results required for layout tests.

* DumpRenderTree/DumpRenderTree.gypi:
* DumpRenderTree/chromium/TestRunner/public/WebTestDelegate.h:
* DumpRenderTree/chromium/TestRunner/public/WebTestProxy.h:
(WebKit):
(WebTestRunner):
(WebTestRunner::WebTestProxy::geolocationClient):
(WebTestRunner::WebTestProxy::speechInputController):
(WebTestRunner::WebTestProxy::speechRecognizer):
(WebTestRunner::WebTestProxy::deviceOrientationClient):
(WebTestRunner::WebTestProxy::requestPointerLock):
(WebTestRunner::WebTestProxy::requestPointerUnlock):
(WebTestRunner::WebTestProxy::isPointerLocked):
* DumpRenderTree/chromium/TestRunner/src/MockWebSpeechInputController.cpp: Renamed from Tools/DumpRenderTree/chromium/MockWebSpeechInputController.cpp.
(WebTestRunner::MockWebSpeechInputController::MockWebSpeechInputController):
(WebTestRunner):
(WebTestRunner::MockWebSpeechInputController::~MockWebSpeechInputController):
(WebTestRunner::MockWebSpeechInputController::setDelegate):
(WebTestRunner::MockWebSpeechInputController::addMockRecognitionResult):
(WebTestRunner::MockWebSpeechInputController::setDumpRect):
(WebTestRunner::MockWebSpeechInputController::clearResults):
(WebTestRunner::MockWebSpeechInputController::startRecognition):
(WebTestRunner::MockWebSpeechInputController::cancelRecognition):
(WebTestRunner::MockWebSpeechInputController::stopRecording):
(WebTestRunner::MockWebSpeechInputController::speechTaskFired):
(WebTestRunner::MockWebSpeechInputController::SpeechTask::SpeechTask):
(WebTestRunner::MockWebSpeechInputController::SpeechTask::stop):
(WebTestRunner::MockWebSpeechInputController::SpeechTask::runIfValid):
* DumpRenderTree/chromium/TestRunner/src/MockWebSpeechInputController.h: Renamed from Tools/DumpRenderTree/chromium/MockWebSpeechInputController.h.
(WebKit):
(WebTestRunner):
(MockWebSpeechInputController):
(WebTestRunner::MockWebSpeechInputController::taskList):
(SpeechTask):
* DumpRenderTree/chromium/TestRunner/src/MockWebSpeechRecognizer.cpp: Renamed from Tools/DumpRenderTree/chromium/MockWebSpeechRecognizer.cpp.
(WebTestRunner::MockWebSpeechRecognizer::MockWebSpeechRecognizer):
(WebTestRunner):
(WebTestRunner::MockWebSpeechRecognizer::~MockWebSpeechRecognizer):
(WebTestRunner::MockWebSpeechRecognizer::setDelegate):
(WebTestRunner::MockWebSpeechRecognizer::start):
(WebTestRunner::MockWebSpeechRecognizer::stop):
(WebTestRunner::MockWebSpeechRecognizer::abort):
(WebTestRunner::MockWebSpeechRecognizer::addMockResult):
(WebTestRunner::MockWebSpeechRecognizer::setError):
(WebTestRunner::MockWebSpeechRecognizer::startTaskQueue):
(WebTestRunner::MockWebSpeechRecognizer::clearTaskQueue):
(WebTestRunner::MockWebSpeechRecognizer::StepTask::runIfValid):
* DumpRenderTree/chromium/TestRunner/src/MockWebSpeechRecognizer.h: Renamed from Tools/DumpRenderTree/chromium/MockWebSpeechRecognizer.h.
(WebKit):
(WebTestRunner):
(MockWebSpeechRecognizer):
(WebTestRunner::MockWebSpeechRecognizer::wasAborted):
(WebTestRunner::MockWebSpeechRecognizer::client):
(WebTestRunner::MockWebSpeechRecognizer::handle):
(WebTestRunner::MockWebSpeechRecognizer::taskList):
(Task):
(WebTestRunner::MockWebSpeechRecognizer::Task::Task):
(WebTestRunner::MockWebSpeechRecognizer::Task::~Task):
(StepTask):
(WebTestRunner::MockWebSpeechRecognizer::StepTask::StepTask):
* DumpRenderTree/chromium/TestRunner/src/TestInterfaces.cpp:
(WebTestRunner::TestInterfaces::TestInterfaces):
(WebTestRunner::TestInterfaces::windowOpened):
(WebTestRunner):
(WebTestRunner::TestInterfaces::windowClosed):
(WebTestRunner::TestInterfaces::windowList):
* DumpRenderTree/chromium/TestRunner/src/TestInterfaces.h:
(TestInterfaces):
* DumpRenderTree/chromium/TestRunner/src/TestRunner.cpp:
(WebTestRunner::TestRunner::TestRunner):
(WebTestRunner::TestRunner::reset):
(WebTestRunner::TestRunner::requestPointerLock):
(WebTestRunner):
(WebTestRunner::TestRunner::requestPointerUnlock):
(WebTestRunner::TestRunner::isPointerLocked):
(WebTestRunner::TestRunner::didAcquirePointerLockInternal):
(WebTestRunner::TestRunner::didNotAcquirePointerLockInternal):
(WebTestRunner::TestRunner::didLosePointerLockInternal):
(WebTestRunner::TestRunner::windowCount):
(WebTestRunner::TestRunner::setMockDeviceOrientation):
(WebTestRunner::TestRunner::numberOfPendingGeolocationPermissionRequests):
(WebTestRunner::TestRunner::setGeolocationPermission):
(WebTestRunner::TestRunner::setMockGeolocationPosition):
(WebTestRunner::TestRunner::setMockGeolocationPositionUnavailableError):
(WebTestRunner::TestRunner::addMockSpeechInputResult):
(WebTestRunner::TestRunner::setMockSpeechInputDumpRect):
(WebTestRunner::TestRunner::addMockSpeechRecognitionResult):
(WebTestRunner::TestRunner::setMockSpeechRecognitionError):
(WebTestRunner::TestRunner::wasMockSpeechRecognitionAborted):
(WebTestRunner::TestRunner::didAcquirePointerLock):
(WebTestRunner::TestRunner::didNotAcquirePointerLock):
(WebTestRunner::TestRunner::didLosePointerLock):
(WebTestRunner::TestRunner::setPointerLockWillRespondAsynchronously):
(WebTestRunner::TestRunner::setPointerLockWillFailSynchronously):
* DumpRenderTree/chromium/TestRunner/src/TestRunner.h:
(WebTestRunner):
(TestRunner):
(HostMethodTask):
(WebTestRunner::TestRunner::HostMethodTask::HostMethodTask):
(WebTestRunner::TestRunner::HostMethodTask::runIfValid):
* DumpRenderTree/chromium/TestRunner/src/WebTestProxy.cpp:
(WebTestRunner::WebTestProxyBase::~WebTestProxyBase):
(WebTestRunner::WebTestProxyBase::setInterfaces):
(WebTestRunner::WebTestProxyBase::setDelegate):
(WebTestRunner::WebTestProxyBase::reset):
(WebTestRunner::WebTestProxyBase::captureTree):
(WebTestRunner::WebTestProxyBase::geolocationClientMock):
(WebTestRunner):
(WebTestRunner::WebTestProxyBase::deviceOrientationClientMock):
(WebTestRunner::WebTestProxyBase::speechInputControllerMock):
(WebTestRunner::WebTestProxyBase::speechRecognizerMock):
(WebTestRunner::WebTestProxyBase::geolocationClient):
(WebTestRunner::WebTestProxyBase::speechInputController):
(WebTestRunner::WebTestProxyBase::speechRecognizer):
(WebTestRunner::WebTestProxyBase::deviceOrientationClient):
(WebTestRunner::WebTestProxyBase::requestPointerLock):
(WebTestRunner::WebTestProxyBase::requestPointerUnlock):
(WebTestRunner::WebTestProxyBase::isPointerLocked):
* DumpRenderTree/chromium/WebViewHost.cpp:
(WebViewHost::reset):
* DumpRenderTree/chromium/WebViewHost.h:
(WebKit):
(WebViewHost):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@143457 268f45cc-cd09-0410-ab3c-d52691b4dbfc

15 files changed:
Tools/ChangeLog
Tools/DumpRenderTree/DumpRenderTree.gypi
Tools/DumpRenderTree/chromium/TestRunner/public/WebTestDelegate.h
Tools/DumpRenderTree/chromium/TestRunner/public/WebTestProxy.h
Tools/DumpRenderTree/chromium/TestRunner/src/MockWebSpeechInputController.cpp [moved from Tools/DumpRenderTree/chromium/MockWebSpeechInputController.cpp with 75% similarity]
Tools/DumpRenderTree/chromium/TestRunner/src/MockWebSpeechInputController.h [moved from Tools/DumpRenderTree/chromium/MockWebSpeechInputController.h with 77% similarity]
Tools/DumpRenderTree/chromium/TestRunner/src/MockWebSpeechRecognizer.cpp [moved from Tools/DumpRenderTree/chromium/MockWebSpeechRecognizer.cpp with 78% similarity]
Tools/DumpRenderTree/chromium/TestRunner/src/MockWebSpeechRecognizer.h [moved from Tools/DumpRenderTree/chromium/MockWebSpeechRecognizer.h with 83% similarity]
Tools/DumpRenderTree/chromium/TestRunner/src/TestInterfaces.cpp
Tools/DumpRenderTree/chromium/TestRunner/src/TestInterfaces.h
Tools/DumpRenderTree/chromium/TestRunner/src/TestRunner.cpp
Tools/DumpRenderTree/chromium/TestRunner/src/TestRunner.h
Tools/DumpRenderTree/chromium/TestRunner/src/WebTestProxy.cpp
Tools/DumpRenderTree/chromium/WebViewHost.cpp
Tools/DumpRenderTree/chromium/WebViewHost.h

index 14f807eac2ea40fe2a2594766f494ef57f50861a..fe0d9a58d74675aae6a2d9397c6028f491c845ef 100644 (file)
@@ -1,3 +1,137 @@
+2013-02-20  Jochen Eisinger  <jochen@chromium.org>
+
+        [chromium] move most of the remaining mocks to TestRunner library
+        https://bugs.webkit.org/show_bug.cgi?id=110217
+
+        Reviewed by Nico Weber.
+
+        While most of the functionality provided by these mocks is also
+        available in the content module, there is no straight forward way to
+        inject the mock results required for layout tests.
+
+        * DumpRenderTree/DumpRenderTree.gypi:
+        * DumpRenderTree/chromium/TestRunner/public/WebTestDelegate.h:
+        * DumpRenderTree/chromium/TestRunner/public/WebTestProxy.h:
+        (WebKit):
+        (WebTestRunner):
+        (WebTestRunner::WebTestProxy::geolocationClient):
+        (WebTestRunner::WebTestProxy::speechInputController):
+        (WebTestRunner::WebTestProxy::speechRecognizer):
+        (WebTestRunner::WebTestProxy::deviceOrientationClient):
+        (WebTestRunner::WebTestProxy::requestPointerLock):
+        (WebTestRunner::WebTestProxy::requestPointerUnlock):
+        (WebTestRunner::WebTestProxy::isPointerLocked):
+        * DumpRenderTree/chromium/TestRunner/src/MockWebSpeechInputController.cpp: Renamed from Tools/DumpRenderTree/chromium/MockWebSpeechInputController.cpp.
+        (WebTestRunner::MockWebSpeechInputController::MockWebSpeechInputController):
+        (WebTestRunner):
+        (WebTestRunner::MockWebSpeechInputController::~MockWebSpeechInputController):
+        (WebTestRunner::MockWebSpeechInputController::setDelegate):
+        (WebTestRunner::MockWebSpeechInputController::addMockRecognitionResult):
+        (WebTestRunner::MockWebSpeechInputController::setDumpRect):
+        (WebTestRunner::MockWebSpeechInputController::clearResults):
+        (WebTestRunner::MockWebSpeechInputController::startRecognition):
+        (WebTestRunner::MockWebSpeechInputController::cancelRecognition):
+        (WebTestRunner::MockWebSpeechInputController::stopRecording):
+        (WebTestRunner::MockWebSpeechInputController::speechTaskFired):
+        (WebTestRunner::MockWebSpeechInputController::SpeechTask::SpeechTask):
+        (WebTestRunner::MockWebSpeechInputController::SpeechTask::stop):
+        (WebTestRunner::MockWebSpeechInputController::SpeechTask::runIfValid):
+        * DumpRenderTree/chromium/TestRunner/src/MockWebSpeechInputController.h: Renamed from Tools/DumpRenderTree/chromium/MockWebSpeechInputController.h.
+        (WebKit):
+        (WebTestRunner):
+        (MockWebSpeechInputController):
+        (WebTestRunner::MockWebSpeechInputController::taskList):
+        (SpeechTask):
+        * DumpRenderTree/chromium/TestRunner/src/MockWebSpeechRecognizer.cpp: Renamed from Tools/DumpRenderTree/chromium/MockWebSpeechRecognizer.cpp.
+        (WebTestRunner::MockWebSpeechRecognizer::MockWebSpeechRecognizer):
+        (WebTestRunner):
+        (WebTestRunner::MockWebSpeechRecognizer::~MockWebSpeechRecognizer):
+        (WebTestRunner::MockWebSpeechRecognizer::setDelegate):
+        (WebTestRunner::MockWebSpeechRecognizer::start):
+        (WebTestRunner::MockWebSpeechRecognizer::stop):
+        (WebTestRunner::MockWebSpeechRecognizer::abort):
+        (WebTestRunner::MockWebSpeechRecognizer::addMockResult):
+        (WebTestRunner::MockWebSpeechRecognizer::setError):
+        (WebTestRunner::MockWebSpeechRecognizer::startTaskQueue):
+        (WebTestRunner::MockWebSpeechRecognizer::clearTaskQueue):
+        (WebTestRunner::MockWebSpeechRecognizer::StepTask::runIfValid):
+        * DumpRenderTree/chromium/TestRunner/src/MockWebSpeechRecognizer.h: Renamed from Tools/DumpRenderTree/chromium/MockWebSpeechRecognizer.h.
+        (WebKit):
+        (WebTestRunner):
+        (MockWebSpeechRecognizer):
+        (WebTestRunner::MockWebSpeechRecognizer::wasAborted):
+        (WebTestRunner::MockWebSpeechRecognizer::client):
+        (WebTestRunner::MockWebSpeechRecognizer::handle):
+        (WebTestRunner::MockWebSpeechRecognizer::taskList):
+        (Task):
+        (WebTestRunner::MockWebSpeechRecognizer::Task::Task):
+        (WebTestRunner::MockWebSpeechRecognizer::Task::~Task):
+        (StepTask):
+        (WebTestRunner::MockWebSpeechRecognizer::StepTask::StepTask):
+        * DumpRenderTree/chromium/TestRunner/src/TestInterfaces.cpp:
+        (WebTestRunner::TestInterfaces::TestInterfaces):
+        (WebTestRunner::TestInterfaces::windowOpened):
+        (WebTestRunner):
+        (WebTestRunner::TestInterfaces::windowClosed):
+        (WebTestRunner::TestInterfaces::windowList):
+        * DumpRenderTree/chromium/TestRunner/src/TestInterfaces.h:
+        (TestInterfaces):
+        * DumpRenderTree/chromium/TestRunner/src/TestRunner.cpp:
+        (WebTestRunner::TestRunner::TestRunner):
+        (WebTestRunner::TestRunner::reset):
+        (WebTestRunner::TestRunner::requestPointerLock):
+        (WebTestRunner):
+        (WebTestRunner::TestRunner::requestPointerUnlock):
+        (WebTestRunner::TestRunner::isPointerLocked):
+        (WebTestRunner::TestRunner::didAcquirePointerLockInternal):
+        (WebTestRunner::TestRunner::didNotAcquirePointerLockInternal):
+        (WebTestRunner::TestRunner::didLosePointerLockInternal):
+        (WebTestRunner::TestRunner::windowCount):
+        (WebTestRunner::TestRunner::setMockDeviceOrientation):
+        (WebTestRunner::TestRunner::numberOfPendingGeolocationPermissionRequests):
+        (WebTestRunner::TestRunner::setGeolocationPermission):
+        (WebTestRunner::TestRunner::setMockGeolocationPosition):
+        (WebTestRunner::TestRunner::setMockGeolocationPositionUnavailableError):
+        (WebTestRunner::TestRunner::addMockSpeechInputResult):
+        (WebTestRunner::TestRunner::setMockSpeechInputDumpRect):
+        (WebTestRunner::TestRunner::addMockSpeechRecognitionResult):
+        (WebTestRunner::TestRunner::setMockSpeechRecognitionError):
+        (WebTestRunner::TestRunner::wasMockSpeechRecognitionAborted):
+        (WebTestRunner::TestRunner::didAcquirePointerLock):
+        (WebTestRunner::TestRunner::didNotAcquirePointerLock):
+        (WebTestRunner::TestRunner::didLosePointerLock):
+        (WebTestRunner::TestRunner::setPointerLockWillRespondAsynchronously):
+        (WebTestRunner::TestRunner::setPointerLockWillFailSynchronously):
+        * DumpRenderTree/chromium/TestRunner/src/TestRunner.h:
+        (WebTestRunner):
+        (TestRunner):
+        (HostMethodTask):
+        (WebTestRunner::TestRunner::HostMethodTask::HostMethodTask):
+        (WebTestRunner::TestRunner::HostMethodTask::runIfValid):
+        * DumpRenderTree/chromium/TestRunner/src/WebTestProxy.cpp:
+        (WebTestRunner::WebTestProxyBase::~WebTestProxyBase):
+        (WebTestRunner::WebTestProxyBase::setInterfaces):
+        (WebTestRunner::WebTestProxyBase::setDelegate):
+        (WebTestRunner::WebTestProxyBase::reset):
+        (WebTestRunner::WebTestProxyBase::captureTree):
+        (WebTestRunner::WebTestProxyBase::geolocationClientMock):
+        (WebTestRunner):
+        (WebTestRunner::WebTestProxyBase::deviceOrientationClientMock):
+        (WebTestRunner::WebTestProxyBase::speechInputControllerMock):
+        (WebTestRunner::WebTestProxyBase::speechRecognizerMock):
+        (WebTestRunner::WebTestProxyBase::geolocationClient):
+        (WebTestRunner::WebTestProxyBase::speechInputController):
+        (WebTestRunner::WebTestProxyBase::speechRecognizer):
+        (WebTestRunner::WebTestProxyBase::deviceOrientationClient):
+        (WebTestRunner::WebTestProxyBase::requestPointerLock):
+        (WebTestRunner::WebTestProxyBase::requestPointerUnlock):
+        (WebTestRunner::WebTestProxyBase::isPointerLocked):
+        * DumpRenderTree/chromium/WebViewHost.cpp:
+        (WebViewHost::reset):
+        * DumpRenderTree/chromium/WebViewHost.h:
+        (WebKit):
+        (WebViewHost):
+
 2013-02-20  Andras Becsi  <andras.becsi@digia.com>
 
         [Qt] Make debug builds possible on 32bit Linux
index 0b9ce350ec395bbde049de13cb24657d23d5a8df..3f71da1c9bedf022f1f3f2b3024e3fa7b35b7441 100644 (file)
             'chromium/MockWebKitPlatformSupport.h',
             'chromium/MockWebPrerenderingSupport.cpp',
             'chromium/MockWebPrerenderingSupport.h',
-            'chromium/MockWebSpeechInputController.cpp',
-            'chromium/MockWebSpeechInputController.h',
-            'chromium/MockWebSpeechRecognizer.cpp',
-            'chromium/MockWebSpeechRecognizer.h',
             'chromium/Task.h',
             'chromium/Task.cpp',
             'chromium/TestEventPrinter.h',
             'chromium/TestRunner/src/MockWebRTCDTMFSenderHandler.h',
             'chromium/TestRunner/src/MockWebRTCPeerConnectionHandler.cpp',
             'chromium/TestRunner/src/MockWebRTCPeerConnectionHandler.h',
+            'chromium/TestRunner/src/MockWebSpeechInputController.cpp',
+            'chromium/TestRunner/src/MockWebSpeechInputController.h',
+            'chromium/TestRunner/src/MockWebSpeechRecognizer.cpp',
+            'chromium/TestRunner/src/MockWebSpeechRecognizer.h',
             'chromium/TestRunner/src/NotificationPresenter.h',
             'chromium/TestRunner/src/NotificationPresenter.cpp',
             'chromium/TestRunner/src/SpellCheckClient.cpp',
index 0778ec1fd5827cc11c2d1eea4523b164b7cb7a73..5d7b8da75590ecff5c1f7b305dd8b74105751a6e 100644 (file)
@@ -37,7 +37,6 @@
 #include <string>
 
 namespace WebKit {
-class WebDeviceOrientation;
 class WebGamepads;
 class WebHistoryItem;
 struct WebRect;
@@ -84,28 +83,12 @@ public:
     virtual void setAcceptAllCookies(bool) { }
     virtual std::string pathToLocalResource(const std::string& resource) { return std::string(); }
     virtual void setLocale(const std::string&) { }
-    virtual void setDeviceOrientation(WebKit::WebDeviceOrientation&) { }
-    virtual void didAcquirePointerLock() { }
-    virtual void didNotAcquirePointerLock() { }
-    virtual void didLosePointerLock() { }
-    virtual void setPointerLockWillRespondAsynchronously() { }
-    virtual void setPointerLockWillFailSynchronously() { }
-    virtual int numberOfPendingGeolocationPermissionRequests() { return 0; }
-    virtual void setGeolocationPermission(bool) { }
-    virtual void setMockGeolocationPosition(double, double, double) { }
-    virtual void setMockGeolocationPositionUnavailableError(const std::string&) { }
-    virtual void addMockSpeechInputResult(const std::string&, double, const std::string&) { }
-    virtual void setMockSpeechInputDumpRect(bool) { }
-    virtual void addMockSpeechRecognitionResult(const std::string&, double) { }
-    virtual void setMockSpeechRecognitionError(const std::string&, const std::string&) { }
-    virtual bool wasMockSpeechRecognitionAborted() { return false; }
     virtual void testFinished() { }
     virtual void testTimedOut() { }
     virtual bool isBeingDebugged() { return false; }
     virtual int layoutTestTimeout() { return 30 * 1000; }
     virtual void closeRemainingWindows() { }
     virtual int navigationEntryCount() { return 0; }
-    virtual int windowCount() { return 0; }
     virtual void goToOffset(int) { }
     virtual void reload() { }
     virtual void loadURLForFrame(const WebKit::WebURL&, const std::string&) { }
index 5f81c32360662d2e5ce599bf42a6c22218bad276..cb4067257d2efea6bfe859e9896e5e81dafe242b 100644 (file)
@@ -51,14 +51,21 @@ namespace WebKit {
 class WebAccessibilityObject;
 class WebCachedURLRequest;
 class WebDataSource;
+class WebDeviceOrientationClient;
+class WebDeviceOrientationClientMock;
 class WebDragData;
 class WebFrame;
+class WebGeolocationClient;
+class WebGeolocationClientMock;
 class WebImage;
 class WebNode;
 class WebNotificationPresenter;
 class WebPlugin;
 class WebRange;
 class WebSerializedScriptValue;
+class WebSpeechInputController;
+class WebSpeechInputListener;
+class WebSpeechRecognizer;
 class WebSpellCheckClient;
 class WebString;
 class WebURL;
@@ -78,6 +85,8 @@ class SkCanvas;
 
 namespace WebTestRunner {
 
+class MockWebSpeechInputController;
+class MockWebSpeechRecognizer;
 class SpellCheckClient;
 class TestInterfaces;
 class WebTestDelegate;
@@ -99,10 +108,17 @@ public:
 
     void setLogConsoleOutput(bool enabled);
 
+#if WEBTESTRUNNER_IMPLEMENTATION
     void display();
     void displayInvalidatedRegion();
     void discardBackingStore();
 
+    WebKit::WebDeviceOrientationClientMock* deviceOrientationClientMock();
+    WebKit::WebGeolocationClientMock* geolocationClientMock();
+    MockWebSpeechInputController* speechInputControllerMock();
+    MockWebSpeechRecognizer* speechRecognizerMock();
+#endif
+
 protected:
     WebTestProxyBase();
     ~WebTestProxyBase();
@@ -137,6 +153,13 @@ protected:
     WebKit::WebUserMediaClient* userMediaClient();
     void printPage(WebKit::WebFrame*);
     WebKit::WebNotificationPresenter* notificationPresenter();
+    WebKit::WebGeolocationClient* geolocationClient();
+    WebKit::WebSpeechInputController* speechInputController(WebKit::WebSpeechInputListener*);
+    WebKit::WebSpeechRecognizer* speechRecognizer();
+    WebKit::WebDeviceOrientationClient* deviceOrientationClient();
+    bool requestPointerLock();
+    void requestPointerUnlock();
+    bool isPointerLocked();
 
     void willPerformClientRedirect(WebKit::WebFrame*, const WebKit::WebURL& from, const WebKit::WebURL& to, double interval, double fire_time);
     void didCancelClientRedirect(WebKit::WebFrame*);
@@ -192,6 +215,12 @@ private:
     std::map<unsigned, std::string> m_resourceIdentifierMap;
 
     bool m_logConsoleOutput;
+
+    std::auto_ptr<WebKit::WebGeolocationClientMock> m_geolocationClient;
+    std::auto_ptr<WebKit::WebDeviceOrientationClientMock> m_deviceOrientationClient;
+    std::auto_ptr<MockWebSpeechRecognizer> m_speechRecognizer;
+    std::auto_ptr<MockWebSpeechInputController> m_speechInputController;
+
 private:
     WebTestProxyBase(WebTestProxyBase&);
     WebTestProxyBase& operator=(const WebTestProxyBase&);
@@ -358,6 +387,34 @@ public:
     {
         return WebTestProxyBase::notificationPresenter();
     }
+    virtual WebKit::WebGeolocationClient* geolocationClient()
+    {
+        return WebTestProxyBase::geolocationClient();
+    }
+    virtual WebKit::WebSpeechInputController* speechInputController(WebKit::WebSpeechInputListener* listener)
+    {
+        return WebTestProxyBase::speechInputController(listener);
+    }
+    virtual WebKit::WebSpeechRecognizer* speechRecognizer()
+    {
+        return WebTestProxyBase::speechRecognizer();
+    }
+    virtual WebKit::WebDeviceOrientationClient* deviceOrientationClient()
+    {
+        return WebTestProxyBase::deviceOrientationClient();
+    }
+    virtual bool requestPointerLock()
+    {
+        return WebTestProxyBase::requestPointerLock();
+    }
+    virtual void requestPointerUnlock()
+    {
+        WebTestProxyBase::requestPointerUnlock();
+    }
+    virtual bool isPointerLocked()
+    {
+        return WebTestProxyBase::isPointerLocked();
+    }
 
     // WebFrameClient implementation.
     virtual void willPerformClientRedirect(WebKit::WebFrame* frame, const WebKit::WebURL& from, const WebKit::WebURL& to, double interval, double fireTime)
similarity index 75%
rename from Tools/DumpRenderTree/chromium/MockWebSpeechInputController.cpp
rename to Tools/DumpRenderTree/chromium/TestRunner/src/MockWebSpeechInputController.cpp
index 5b576c7e636bbe41e77739c4de28764b2dd57caf..c4df32a82c74d76dd0ce160740b2dfad9b1de6bd 100644 (file)
 #include "config.h"
 #include "MockWebSpeechInputController.h"
 
-#include "Task.h"
 #include "WebSpeechInputListener.h"
+#include "WebTestDelegate.h"
 #include <public/WebCString.h>
 #include <public/WebVector.h>
-#include <wtf/text/CString.h>
-#include <wtf/text/StringBuilder.h>
 
-#if ENABLE(INPUT_SPEECH)
+#if ENABLE_INPUT_SPEECH
 
 using namespace WebKit;
-using namespace WebTestRunner;
+using namespace std;
 
-PassOwnPtr<MockWebSpeechInputController> MockWebSpeechInputController::create(WebSpeechInputListener* listener)
+namespace WebTestRunner {
+
+namespace {
+
+WebSpeechInputResultArray makeRectResult(const WebRect& rect)
 {
-    return adoptPtr(new MockWebSpeechInputController(listener));
+    char buffer[100];
+    snprintf(buffer, sizeof(buffer), "%d,%d,%d,%d", rect.x, rect.y, rect.width, rect.height);
+
+    WebSpeechInputResult res;
+    res.assign(WebString::fromUTF8(static_cast<const char*>(buffer)), 1.0);
+
+    WebSpeechInputResultArray results;
+    results.assign(&res, 1);
+    return results;
+}
+
+}
+
+MockWebSpeechInputController::MockWebSpeechInputController(WebSpeechInputListener* listener)
+    : m_listener(listener)
+    , m_speechTask(0)
+    , m_recording(false)
+    , m_requestId(-1)
+    , m_dumpRect(false)
+    , m_delegate(0)
+{
+}
+
+MockWebSpeechInputController::~MockWebSpeechInputController()
+{
+}
+
+void MockWebSpeechInputController::setDelegate(WebTestDelegate* delegate)
+{
+    m_delegate = delegate;
 }
 
 void MockWebSpeechInputController::addMockRecognitionResult(const WebString& result, double confidence, const WebString& language)
@@ -49,12 +80,12 @@ void MockWebSpeechInputController::addMockRecognitionResult(const WebString& res
     res.assign(result, confidence);
 
     if (language.isEmpty())
-        m_resultsForEmptyLanguage.append(res);
+        m_resultsForEmptyLanguage.push_back(res);
     else {
-        String langString = String::fromUTF8(language.utf8().data());
-        if (!m_recognitionResults.contains(langString))
-            m_recognitionResults.set(langString, Vector<WebSpeechInputResult>());
-        m_recognitionResults.find(langString)->value.append(res);
+        string langString = language.utf8();
+        if (m_recognitionResults.find(langString) == m_recognitionResults.end())
+            m_recognitionResults[langString] = vector<WebSpeechInputResult>();
+        m_recognitionResults[langString].push_back(res);
     }
 }
 
@@ -78,10 +109,10 @@ bool MockWebSpeechInputController::startRecognition(int requestId, const WebRect
     m_requestId = requestId;
     m_requestRect = elementRect;
     m_recording = true;
-    m_language = String::fromUTF8(language.utf8().data());
+    m_language = language.utf8();
 
     m_speechTask = new SpeechTask(this);
-    postTask(m_speechTask);
+    m_delegate->postTask(m_speechTask);
 
     return true;
 }
@@ -89,7 +120,7 @@ bool MockWebSpeechInputController::startRecognition(int requestId, const WebRect
 void MockWebSpeechInputController::cancelRecognition(int requestId)
 {
     if (m_speechTask) {
-        ASSERT(requestId == m_requestId);
+        WEBKIT_ASSERT(requestId == m_requestId);
 
         m_speechTask->stop();
         m_recording = false;
@@ -100,41 +131,13 @@ void MockWebSpeechInputController::cancelRecognition(int requestId)
 
 void MockWebSpeechInputController::stopRecording(int requestId)
 {
-    ASSERT(requestId == m_requestId);
+    WEBKIT_ASSERT(requestId == m_requestId);
     if (m_speechTask && m_recording) {
         m_speechTask->stop();
         speechTaskFired();
     }
 }
 
-MockWebSpeechInputController::MockWebSpeechInputController(WebSpeechInputListener* listener)
-    : m_listener(listener)
-    , m_speechTask(0)
-    , m_recording(false)
-    , m_requestId(-1)
-    , m_dumpRect(false)
-{
-}
-
-static WebSpeechInputResultArray makeRectResult(const WebRect& rect)
-{
-    StringBuilder sb;
-    sb.append(String::number(rect.x));
-    sb.append(",");
-    sb.append(String::number(rect.y));
-    sb.append(",");
-    sb.append(String::number(rect.width));
-    sb.append(",");
-    sb.append(String::number(rect.height));
-
-    WebSpeechInputResult res;
-    res.assign(WebString(sb.characters(), sb.length()), 1.0);
-
-    WebSpeechInputResultArray results;
-    results.assign(&res, 1);
-    return results;
-}
-
 void MockWebSpeechInputController::speechTaskFired()
 {
     if (m_recording) {
@@ -142,7 +145,7 @@ void MockWebSpeechInputController::speechTaskFired()
         m_listener->didCompleteRecording(m_requestId);
 
         m_speechTask = new SpeechTask(this);
-        postTask(m_speechTask);
+        m_delegate->postTask(m_speechTask);
     } else {
         bool noResultsFound = false;
         // We take a copy of the requestId here so that if scripts destroyed the input element
@@ -152,15 +155,15 @@ void MockWebSpeechInputController::speechTaskFired()
 
         if (m_dumpRect) {
             m_listener->setRecognitionResult(requestId, makeRectResult(m_requestRect));
-        } else if (m_language.isEmpty()) {
+        } else if (m_language.empty()) {
             // Empty language case must be handled separately to avoid problems with HashMap and empty keys.
-            if (!m_resultsForEmptyLanguage.isEmpty())
+            if (!m_resultsForEmptyLanguage.empty())
                 m_listener->setRecognitionResult(requestId, m_resultsForEmptyLanguage);
             else
                 noResultsFound = true;
         } else {
-            if (m_recognitionResults.contains(m_language))
-                m_listener->setRecognitionResult(requestId, m_recognitionResults.get(m_language));
+            if (m_recognitionResults.find(m_language) != m_recognitionResults.end())
+                m_listener->setRecognitionResult(requestId, m_recognitionResults[m_language]);
             else
                 noResultsFound = true;
         }
@@ -168,15 +171,15 @@ void MockWebSpeechInputController::speechTaskFired()
         if (noResultsFound) {
             // Can't avoid setting a result even if no result was set for the given language.
             // This would avoid generating the events used to check the results and the test would timeout.
-            String error("error: no result found for language '");
+            string error("error: no result found for language '");
             error.append(m_language);
             error.append("'");
 
             WebSpeechInputResult res;
-            res.assign(WebString::fromUTF8(error.utf8().data()), 1.0);
+            res.assign(WebString::fromUTF8(error), 1.0);
 
-            Vector<WebSpeechInputResult> results;
-            results.append(res);
+            vector<WebSpeechInputResult> results;
+            results.push_back(res);
 
             m_listener->setRecognitionResult(requestId, results);
         }
@@ -192,7 +195,7 @@ void MockWebSpeechInputController::SpeechTask::stop()
 {
     m_object->m_speechTask = 0;
     cancel();
-    delete(this);
+    delete this;
 }
 
 void MockWebSpeechInputController::SpeechTask::runIfValid()
@@ -201,4 +204,6 @@ void MockWebSpeechInputController::SpeechTask::runIfValid()
     m_object->speechTaskFired();
 }
 
+}
+
 #endif
similarity index 77%
rename from Tools/DumpRenderTree/chromium/MockWebSpeechInputController.h
rename to Tools/DumpRenderTree/chromium/TestRunner/src/MockWebSpeechInputController.h
index c93f0bf67a5d5ed0aea212af4c55989cfe7ccf9a..84034e367ea467de84b77a855a583319cb5092ce 100644 (file)
 #ifndef MockWebSpeechInputController_h
 #define MockWebSpeechInputController_h
 
-#if ENABLE(INPUT_SPEECH)
-
-#include "WebTask.h"
+#include "TestCommon.h"
 #include "WebSpeechInputController.h"
 #include "WebSpeechInputResult.h"
+#include "WebTask.h"
+#include <map>
 #include <public/WebRect.h>
-#include <wtf/Compiler.h>
-#include <wtf/HashMap.h>
-#include <wtf/PassOwnPtr.h>
-#include <wtf/Vector.h>
-#include <wtf/text/AtomicString.h>
-#include <wtf/text/StringHash.h>
+#include <string>
+#include <vector>
 
 namespace WebKit {
 class WebSecurityOrigin;
@@ -45,26 +41,31 @@ class WebSpeechInputListener;
 class WebString;
 }
 
+namespace WebTestRunner {
+
+class WebTestDelegate;
+
 class MockWebSpeechInputController : public WebKit::WebSpeechInputController {
 public:
-    static PassOwnPtr<MockWebSpeechInputController> create(WebKit::WebSpeechInputListener*);
+    explicit MockWebSpeechInputController(WebKit::WebSpeechInputListener*);
+    ~MockWebSpeechInputController();
 
     void addMockRecognitionResult(const WebKit::WebString& result, double confidence, const WebKit::WebString& language);
     void setDumpRect(bool);
     void clearResults();
+    void setDelegate(WebTestDelegate*);
 
     // WebSpeechInputController implementation:
     virtual bool startRecognition(int requestId, const WebKit::WebRect& elementRect, const WebKit::WebString& language, const WebKit::WebString& grammar, const WebKit::WebSecurityOrigin&) OVERRIDE;
     virtual void cancelRecognition(int requestId) OVERRIDE;
     virtual void stopRecording(int requestId) OVERRIDE;
 
-    WebTestRunner::WebTaskList* taskList() { return &m_taskList; }
+    WebTaskList* taskList() { return &m_taskList; }
 
 private:
-    MockWebSpeechInputController(WebKit::WebSpeechInputListener*);
     void speechTaskFired();
 
-    class SpeechTask : public WebTestRunner::WebMethodTask<MockWebSpeechInputController> {
+    class SpeechTask : public WebMethodTask<MockWebSpeechInputController> {
     public:
         SpeechTask(MockWebSpeechInputController*);
         void stop();
@@ -75,19 +76,21 @@ private:
 
     WebKit::WebSpeechInputListener* m_listener;
 
-    WebTestRunner::WebTaskList m_taskList;
+    WebTaskList m_taskList;
     SpeechTask* m_speechTask;
 
     bool m_recording;
     int m_requestId;
     WebKit::WebRect m_requestRect;
-    String m_language;
+    std::string m_language;
 
-    HashMap<String, Vector<WebKit::WebSpeechInputResult> > m_recognitionResults;
-    Vector<WebKit::WebSpeechInputResult> m_resultsForEmptyLanguage;
+    std::map<std::string, std::vector<WebKit::WebSpeechInputResult> > m_recognitionResults;
+    std::vector<WebKit::WebSpeechInputResult> m_resultsForEmptyLanguage;
     bool m_dumpRect;
+
+    WebTestDelegate* m_delegate;
 };
 
-#endif // ENABLE(INPUT_SPEECH)
+}
 
 #endif // MockWebSpeechInputController_h
similarity index 78%
rename from Tools/DumpRenderTree/chromium/MockWebSpeechRecognizer.cpp
rename to Tools/DumpRenderTree/chromium/TestRunner/src/MockWebSpeechRecognizer.cpp
index 3c360e0ce29669b3e07816dbf79d7d767e9efdc6..86608121382d79a576714513c242cc40b1e0e448 100644 (file)
 #include "config.h"
 #include "MockWebSpeechRecognizer.h"
 
-#if ENABLE(SCRIPTED_SPEECH)
-
-#include "Task.h"
 #include "WebSpeechRecognitionResult.h"
 #include "WebSpeechRecognizerClient.h"
+#include "WebTestDelegate.h"
 
 using namespace WebKit;
-using namespace WebTestRunner;
+using namespace std;
+
+namespace WebTestRunner {
 
 namespace {
 
@@ -107,9 +107,21 @@ private:
 
 } // namespace
 
-PassOwnPtr<MockWebSpeechRecognizer> MockWebSpeechRecognizer::create()
+MockWebSpeechRecognizer::MockWebSpeechRecognizer()
+    : m_wasAborted(false)
+    , m_taskQueueRunning(false)
+    , m_delegate(0)
+{
+}
+
+MockWebSpeechRecognizer::~MockWebSpeechRecognizer()
+{
+    clearTaskQueue();
+}
+
+void MockWebSpeechRecognizer::setDelegate(WebTestDelegate* delegate)
 {
-    return adoptPtr(new MockWebSpeechRecognizer());
+    m_delegate = delegate;
 }
 
 void MockWebSpeechRecognizer::start(const WebSpeechRecognitionHandle& handle, const WebSpeechRecognitionParams& params, WebSpeechRecognizerClient* client)
@@ -118,24 +130,24 @@ void MockWebSpeechRecognizer::start(const WebSpeechRecognitionHandle& handle, co
     m_handle = handle;
     m_client = client;
 
-    m_taskQueue.append(adoptPtr(new ClientCallTask(this, &WebSpeechRecognizerClient::didStart)));
-    m_taskQueue.append(adoptPtr(new ClientCallTask(this, &WebSpeechRecognizerClient::didStartAudio)));
-    m_taskQueue.append(adoptPtr(new ClientCallTask(this, &WebSpeechRecognizerClient::didStartSound)));
+    m_taskQueue.push_back(new ClientCallTask(this, &WebSpeechRecognizerClient::didStart));
+    m_taskQueue.push_back(new ClientCallTask(this, &WebSpeechRecognizerClient::didStartAudio));
+    m_taskQueue.push_back(new ClientCallTask(this, &WebSpeechRecognizerClient::didStartSound));
 
-    if (!m_mockTranscripts.isEmpty()) {
-        ASSERT(m_mockTranscripts.size() == m_mockConfidences.size());
+    if (!m_mockTranscripts.empty()) {
+        WEBKIT_ASSERT(m_mockTranscripts.size() == m_mockConfidences.size());
 
         for (size_t i = 0; i < m_mockTranscripts.size(); ++i)
-            m_taskQueue.append(adoptPtr(new ResultTask(this, m_mockTranscripts[i], m_mockConfidences[i])));
+            m_taskQueue.push_back(new ResultTask(this, m_mockTranscripts[i], m_mockConfidences[i]));
 
         m_mockTranscripts.clear();
         m_mockConfidences.clear();
     } else
-        m_taskQueue.append(adoptPtr(new NoMatchTask(this)));
+        m_taskQueue.push_back(new NoMatchTask(this));
 
-    m_taskQueue.append(adoptPtr(new ClientCallTask(this, &WebSpeechRecognizerClient::didEndSound)));
-    m_taskQueue.append(adoptPtr(new ClientCallTask(this, &WebSpeechRecognizerClient::didEndAudio)));
-    m_taskQueue.append(adoptPtr(new ClientCallTask(this, &WebSpeechRecognizerClient::didEnd)));
+    m_taskQueue.push_back(new ClientCallTask(this, &WebSpeechRecognizerClient::didEndSound));
+    m_taskQueue.push_back(new ClientCallTask(this, &WebSpeechRecognizerClient::didEndAudio));
+    m_taskQueue.push_back(new ClientCallTask(this, &WebSpeechRecognizerClient::didEnd));
 
     startTaskQueue();
 }
@@ -146,7 +158,7 @@ void MockWebSpeechRecognizer::stop(const WebSpeechRecognitionHandle& handle, Web
     m_client = client;
 
     // FIXME: Implement.
-    ASSERT_NOT_REACHED();
+    WEBKIT_ASSERT_NOT_REACHED();
 }
 
 void MockWebSpeechRecognizer::abort(const WebSpeechRecognitionHandle& handle, WebSpeechRecognizerClient* client)
@@ -156,14 +168,14 @@ void MockWebSpeechRecognizer::abort(const WebSpeechRecognitionHandle& handle, We
 
     clearTaskQueue();
     m_wasAborted = true;
-    m_taskQueue.append(adoptPtr(new ClientCallTask(this, &WebSpeechRecognizerClient::didEnd)));
+    m_taskQueue.push_back(new ClientCallTask(this, &WebSpeechRecognizerClient::didEnd));
     startTaskQueue();
 }
 
 void MockWebSpeechRecognizer::addMockResult(const WebString& transcript, float confidence)
 {
-    m_mockTranscripts.append(transcript);
-    m_mockConfidences.append(confidence);
+    m_mockTranscripts.push_back(transcript);
+    m_mockConfidences.push_back(confidence);
 }
 
 void MockWebSpeechRecognizer::setError(const WebString& error, const WebString& message)
@@ -191,52 +203,46 @@ void MockWebSpeechRecognizer::setError(const WebString& error, const WebString&
         return;
 
     clearTaskQueue();
-    m_taskQueue.append(adoptPtr(new ErrorTask(this, code, message)));
-    m_taskQueue.append(adoptPtr(new ClientCallTask(this, &WebSpeechRecognizerClient::didEnd)));
+    m_taskQueue.push_back(new ErrorTask(this, code, message));
+    m_taskQueue.push_back(new ClientCallTask(this, &WebSpeechRecognizerClient::didEnd));
     startTaskQueue();
 }
 
-MockWebSpeechRecognizer::MockWebSpeechRecognizer()
-    : m_wasAborted(false)
-    , m_taskQueueRunning(false)
-{
-}
-
-MockWebSpeechRecognizer::~MockWebSpeechRecognizer()
-{
-}
-
 void MockWebSpeechRecognizer::startTaskQueue()
 {
     if (m_taskQueueRunning)
         return;
-    postTask(new StepTask(this));
+    m_delegate->postTask(new StepTask(this));
     m_taskQueueRunning = true;
 }
 
 void MockWebSpeechRecognizer::clearTaskQueue()
 {
-    m_taskQueue.clear();
+    while (!m_taskQueue.empty()) {
+        delete m_taskQueue.front();
+        m_taskQueue.pop_front();
+    }
     m_taskQueueRunning = false;
 }
 
 void MockWebSpeechRecognizer::StepTask::runIfValid()
 {
-    if (m_object->m_taskQueue.isEmpty()) {
+    if (m_object->m_taskQueue.empty()) {
         m_object->m_taskQueueRunning = false;
         return;
     }
 
-    OwnPtr<Task> task = m_object->m_taskQueue[0].release();
-    m_object->m_taskQueue.remove(0);
+    Task* task = m_object->m_taskQueue.front();
+    m_object->m_taskQueue.pop_front();
     task->run();
+    delete task;
 
-    if (m_object->m_taskQueue.isEmpty()) {
+    if (m_object->m_taskQueue.empty()) {
         m_object->m_taskQueueRunning = false;
         return;
     }
 
-    postTask(new StepTask(m_object));
+    m_object->m_delegate->postTask(new StepTask(m_object));
 }
 
-#endif // ENABLE(SCRIPTED_SPEECH)
+}
similarity index 83%
rename from Tools/DumpRenderTree/chromium/MockWebSpeechRecognizer.h
rename to Tools/DumpRenderTree/chromium/TestRunner/src/MockWebSpeechRecognizer.h
index 5c6534b4c6c2b293b6d430031ff02d3270489265..689bc26c173d09b1b1f53de4f312c2be792bbdeb 100644 (file)
 #ifndef MockWebSpeechRecognizer_h
 #define MockWebSpeechRecognizer_h
 
-#if ENABLE(SCRIPTED_SPEECH)
-
+#include "TestCommon.h"
 #include "WebSpeechRecognizer.h"
 #include "WebTask.h"
-#include <wtf/Compiler.h>
-#include <wtf/PassOwnPtr.h>
-#include <wtf/Vector.h>
+#include <deque>
+#include <vector>
 
 namespace WebKit {
 class WebSpeechRecognitionHandle;
@@ -40,11 +38,17 @@ class WebSpeechRecognitionParams;
 class WebSpeechRecognizerClient;
 }
 
+namespace WebTestRunner {
+
+class WebTestDelegate;
+
 class MockWebSpeechRecognizer : public WebKit::WebSpeechRecognizer {
 public:
-    static PassOwnPtr<MockWebSpeechRecognizer> create();
+    MockWebSpeechRecognizer();
     ~MockWebSpeechRecognizer();
 
+    void setDelegate(WebTestDelegate*);
+
     // WebSpeechRecognizer implementation:
     virtual void start(const WebKit::WebSpeechRecognitionHandle&, const WebKit::WebSpeechRecognitionParams&, WebKit::WebSpeechRecognizerClient*) OVERRIDE;
     virtual void stop(const WebKit::WebSpeechRecognitionHandle&, WebKit::WebSpeechRecognizerClient*) OVERRIDE;
@@ -58,7 +62,7 @@ public:
     // Methods accessed from Task objects:
     WebKit::WebSpeechRecognizerClient* client() { return m_client; }
     WebKit::WebSpeechRecognitionHandle& handle() { return m_handle; }
-    WebTestRunner::WebTaskList* taskList() { return &m_taskList; }
+    WebTaskList* taskList() { return &m_taskList; }
 
     class Task {
     public:
@@ -70,29 +74,30 @@ public:
     };
 
 private:
-    MockWebSpeechRecognizer();
     void startTaskQueue();
     void clearTaskQueue();
 
-    WebTestRunner::WebTaskList m_taskList;
+    WebTaskList m_taskList;
     WebKit::WebSpeechRecognitionHandle m_handle;
     WebKit::WebSpeechRecognizerClient* m_client;
-    Vector<WebKit::WebString> m_mockTranscripts;
-    Vector<float> m_mockConfidences;
+    std::vector<WebKit::WebString> m_mockTranscripts;
+    std::vector<float> m_mockConfidences;
     bool m_wasAborted;
 
     // Queue of tasks to be run.
-    Vector<OwnPtr<Task> > m_taskQueue;
+    std::deque<Task*> m_taskQueue;
     bool m_taskQueueRunning;
 
+    WebTestDelegate* m_delegate;
+
     // Task for stepping the queue.
-    class StepTask : public WebTestRunner::WebMethodTask<MockWebSpeechRecognizer> {
+    class StepTask : public WebMethodTask<MockWebSpeechRecognizer> {
     public:
-        StepTask(MockWebSpeechRecognizer* object) : WebTestRunner::WebMethodTask<MockWebSpeechRecognizer>(object) { }
+        StepTask(MockWebSpeechRecognizer* object) : WebMethodTask<MockWebSpeechRecognizer>(object) { }
         virtual void runIfValid() OVERRIDE;
     };
 };
 
-#endif // ENABLE(SCRIPTED_SPEECH)
+}
 
 #endif // MockWebSpeechRecognizer_h
index 1b1f9b0baccf9637a72585420229708934d26f45..d297e2f675dc4ff00a910e2a5436456417247b54 100644 (file)
@@ -51,7 +51,7 @@ TestInterfaces::TestInterfaces()
     , m_eventSender(new EventSender())
     , m_gamepadController(new GamepadController())
     , m_textInputController(new TextInputController())
-    , m_testRunner(new TestRunner())
+    , m_testRunner(new TestRunner(this))
     , m_webView(0)
     , m_delegate(0)
 {
@@ -133,6 +133,21 @@ void TestInterfaces::configureForTestWithURL(const WebURL& testURL, bool generat
         m_testRunner->showDevTools();
 }
 
+void TestInterfaces::windowOpened(WebTestProxyBase* proxy)
+{
+    m_windowList.push_back(proxy);
+}
+
+void TestInterfaces::windowClosed(WebTestProxyBase* proxy)
+{
+    vector<WebTestProxyBase*>::iterator pos = find(m_windowList.begin(), m_windowList.end(), proxy);
+    if (pos == m_windowList.end()) {
+        WEBKIT_ASSERT_NOT_REACHED();
+        return;
+    }
+    m_windowList.erase(pos);
+}
+
 AccessibilityController* TestInterfaces::accessibilityController()
 {
     return m_accessibilityController.get();
@@ -163,4 +178,9 @@ WebTestProxyBase* TestInterfaces::proxy()
     return m_proxy;
 }
 
+const vector<WebTestProxyBase*>& TestInterfaces::windowList()
+{
+    return m_windowList;
+}
+
 }
index 9d2e8c31730a4006b57c122cd6342630fa84a2eb..b6b301a790c34dc1288a05bee9e364eabcfe129d 100644 (file)
@@ -32,6 +32,7 @@
 #define TestInterfaces_h
 
 #include <memory>
+#include <vector>
 
 namespace WebKit {
 class WebFrame;
@@ -61,13 +62,16 @@ public:
     void setTestIsRunning(bool);
     void configureForTestWithURL(const WebKit::WebURL&, bool generatePixels);
 
+    void windowOpened(WebTestProxyBase*);
+    void windowClosed(WebTestProxyBase*);
+
     AccessibilityController* accessibilityController();
     EventSender* eventSender();
     TestRunner* testRunner();
     WebKit::WebView* webView();
     WebTestDelegate* delegate();
     WebTestProxyBase* proxy();
-
+    const std::vector<WebTestProxyBase*>& windowList();
 
 private:
     std::auto_ptr<AccessibilityController> m_accessibilityController;
@@ -78,6 +82,8 @@ private:
     WebKit::WebView* m_webView;
     WebTestDelegate* m_delegate;
     WebTestProxyBase* m_proxy;
+
+    std::vector<WebTestProxyBase*> m_windowList;
 };
 
 }
index d79ed3fe0cae7526ae7e4d3311910141ca2919e9..2ab9a3089c3b10ab910281d19c63d421cc069ca8 100644 (file)
 #include "config.h"
 #include "TestRunner.h"
 
+#include "MockWebSpeechInputController.h"
+#include "MockWebSpeechRecognizer.h"
 #include "NotificationPresenter.h"
+#include "TestInterfaces.h"
 #include "WebBindings.h"
 #include "WebDataSource.h"
 #include "WebDeviceOrientation.h"
+#include "WebDeviceOrientationClientMock.h"
 #include "WebDocument.h"
 #include "WebElement.h"
 #include "WebFindOptions.h"
 #include "WebFrame.h"
+#include "WebGeolocationClientMock.h"
 #include "WebInputElement.h"
 #include "WebPermissions.h"
 #include "WebPreferences.h"
@@ -142,10 +147,11 @@ void TestRunner::WorkQueue::addWork(WorkItem* work)
 }
 
 
-TestRunner::TestRunner()
+TestRunner::TestRunner(TestInterfaces* interfaces)
     : m_testIsRunning(false)
     , m_closeRemainingWindows(false)
     , m_workQueue(this)
+    , m_testInterfaces(interfaces)
     , m_delegate(0)
     , m_webView(0)
     , m_webPermissions(new WebPermissions)
@@ -427,6 +433,8 @@ void TestRunner::reset()
 #if ENABLE_NOTIFICATIONS
     m_notificationPresenter->reset();
 #endif
+    m_pointerLocked = false;
+    m_pointerLockPlannedResult = PointerLockWillSucceed;
 
     m_taskList.revokeAll();
     m_workQueue.reset();
@@ -683,6 +691,61 @@ WebNotificationPresenter* TestRunner::notificationPresenter() const
 }
 #endif
 
+bool TestRunner::requestPointerLock()
+{
+    switch (m_pointerLockPlannedResult) {
+    case PointerLockWillSucceed:
+        m_delegate->postDelayedTask(new HostMethodTask(this, &TestRunner::didAcquirePointerLockInternal), 0);
+        return true;
+    case PointerLockWillRespondAsync:
+        WEBKIT_ASSERT(!m_pointerLocked);
+        return true;
+    case PointerLockWillFailSync:
+        WEBKIT_ASSERT(!m_pointerLocked);
+        return false;
+    default:
+        WEBKIT_ASSERT_NOT_REACHED();
+        return false;
+    }
+}
+
+void TestRunner::requestPointerUnlock()
+{
+    m_delegate->postDelayedTask(new HostMethodTask(this, &TestRunner::didLosePointerLockInternal), 0);
+}
+
+bool TestRunner::isPointerLocked()
+{
+    return m_pointerLocked;
+}
+
+void TestRunner::didAcquirePointerLockInternal()
+{
+    m_pointerLocked = true;
+    m_webView->didAcquirePointerLock();
+
+    // Reset planned result to default.
+    m_pointerLockPlannedResult = PointerLockWillSucceed;
+}
+
+void TestRunner::didNotAcquirePointerLockInternal()
+{
+    WEBKIT_ASSERT(!m_pointerLocked);
+    m_pointerLocked = false;
+    m_webView->didNotAcquirePointerLock();
+
+    // Reset planned result to default.
+    m_pointerLockPlannedResult = PointerLockWillSucceed;
+}
+
+void TestRunner::didLosePointerLockInternal()
+{
+    bool wasLocked = m_pointerLocked;
+    m_pointerLocked = false;
+    if (wasLocked)
+        m_webView->didLosePointerLock();
+}
+
 void TestRunner::showDevTools()
 {
     m_delegate->showDevTools();
@@ -880,7 +943,7 @@ void TestRunner::locationChangeDone()
 
 void TestRunner::windowCount(const CppArgumentList&, CppVariant* result)
 {
-    result->set(static_cast<int>(m_delegate->windowCount()));
+    result->set(static_cast<int>(m_testInterfaces->windowList().size()));
 }
 
 void TestRunner::setCloseRemainingWindowsWhenComplete(const CppArgumentList& arguments, CppVariant* result)
@@ -1511,10 +1574,10 @@ void TestRunner::setMockDeviceOrientation(const CppArgumentList& arguments, CppV
     if (arguments[4].toBoolean())
         orientation.setGamma(arguments[5].toDouble());
 
-    // Note that we only call setOrientation on the main page's mock since this is all that the
-    // tests require. If necessary, we could get a list of WebViewHosts from the TestShell and
+    // Note that we only call setOrientation on the main page's mock since this
+    // tests require. If necessary, we could get a list of WebViewHosts from th
     // call setOrientation on each DeviceOrientationClientMock.
-    m_delegate->setDeviceOrientation(orientation);
+    m_proxy->deviceOrientationClientMock()->setOrientation(orientation);
 }
 
 void TestRunner::setUserStyleSheetEnabled(const CppArgumentList& arguments, CppVariant* result)
@@ -1759,7 +1822,7 @@ void TestRunner::setPOSIXLocale(const CppArgumentList& arguments, CppVariant* re
 
 void TestRunner::numberOfPendingGeolocationPermissionRequests(const CppArgumentList& arguments, CppVariant* result)
 {
-    result->set(m_delegate->numberOfPendingGeolocationPermissionRequests());
+    result->set(m_proxy->geolocationClientMock()->numberOfPendingPermissionRequests());
 }
 
 // FIXME: For greater test flexibility, we should be able to set each page's geolocation mock individually.
@@ -1769,7 +1832,9 @@ void TestRunner::setGeolocationPermission(const CppArgumentList& arguments, CppV
     result->setNull();
     if (arguments.size() < 1 || !arguments[0].isBool())
         return;
-    m_delegate->setGeolocationPermission(arguments[0].toBoolean());
+    const vector<WebTestProxyBase*>& windowList = m_testInterfaces->windowList();
+    for (unsigned i = 0; i < windowList.size(); ++i)
+        windowList.at(i)->geolocationClientMock()->setPermission(arguments[0].toBoolean());
 }
 
 void TestRunner::setMockGeolocationPosition(const CppArgumentList& arguments, CppVariant* result)
@@ -1777,7 +1842,9 @@ void TestRunner::setMockGeolocationPosition(const CppArgumentList& arguments, Cp
     result->setNull();
     if (arguments.size() < 3 || !arguments[0].isNumber() || !arguments[1].isNumber() || !arguments[2].isNumber())
         return;
-    m_delegate->setMockGeolocationPosition(arguments[0].toDouble(), arguments[1].toDouble(), arguments[2].toDouble());
+    const vector<WebTestProxyBase*>& windowList = m_testInterfaces->windowList();
+    for (unsigned i = 0; i < windowList.size(); ++i)
+        windowList.at(i)->geolocationClientMock()->setPosition(arguments[0].toDouble(), arguments[1].toDouble(), arguments[2].toDouble());
 }
 
 void TestRunner::setMockGeolocationPositionUnavailableError(const CppArgumentList& arguments, CppVariant* result)
@@ -1785,7 +1852,9 @@ void TestRunner::setMockGeolocationPositionUnavailableError(const CppArgumentLis
     result->setNull();
     if (arguments.size() != 1 || !arguments[0].isString())
         return;
-    m_delegate->setMockGeolocationPositionUnavailableError(arguments[0].toString());
+    const vector<WebTestProxyBase*>& windowList = m_testInterfaces->windowList();
+    for (unsigned i = 0; i < windowList.size(); ++i)
+        windowList.at(i)->geolocationClientMock()->setPositionUnavailableError(WebString::fromUTF8(arguments[0].toString()));
 }
 
 #if ENABLE_NOTIFICATIONS
@@ -1815,7 +1884,9 @@ void TestRunner::addMockSpeechInputResult(const CppArgumentList& arguments, CppV
     if (arguments.size() < 3 || !arguments[0].isString() || !arguments[1].isNumber() || !arguments[2].isString())
         return;
 
-    m_delegate->addMockSpeechInputResult(arguments[0].toString(), arguments[1].toDouble(), arguments[2].toString());
+#if ENABLE_INPUT_SPEECH
+    m_proxy->speechInputControllerMock()->addMockRecognitionResult(WebString::fromUTF8(arguments[0].toString()), arguments[1].toDouble(), WebString::fromUTF8(arguments[2].toString()));
+#endif
 }
 
 void TestRunner::setMockSpeechInputDumpRect(const CppArgumentList& arguments, CppVariant* result)
@@ -1824,7 +1895,9 @@ void TestRunner::setMockSpeechInputDumpRect(const CppArgumentList& arguments, Cp
     if (arguments.size() < 1 || !arguments[0].isBool())
         return;
 
-    m_delegate->setMockSpeechInputDumpRect(arguments[0].toBoolean());
+#if ENABLE_INPUT_SPEECH
+    m_proxy->speechInputControllerMock()->setDumpRect(arguments[0].toBoolean());
+#endif
 }
 
 void TestRunner::addMockSpeechRecognitionResult(const CppArgumentList& arguments, CppVariant* result)
@@ -1833,7 +1906,7 @@ void TestRunner::addMockSpeechRecognitionResult(const CppArgumentList& arguments
     if (arguments.size() < 2 || !arguments[0].isString() || !arguments[1].isNumber())
         return;
 
-    m_delegate->addMockSpeechRecognitionResult(arguments[0].toString(), arguments[1].toDouble());
+    m_proxy->speechRecognizerMock()->addMockResult(WebString::fromUTF8(arguments[0].toString()), arguments[1].toDouble());
 }
 
 void TestRunner::setMockSpeechRecognitionError(const CppArgumentList& arguments, CppVariant* result)
@@ -1842,12 +1915,12 @@ void TestRunner::setMockSpeechRecognitionError(const CppArgumentList& arguments,
     if (arguments.size() != 2 || !arguments[0].isString() || !arguments[1].isString())
         return;
 
-    m_delegate->setMockSpeechRecognitionError(arguments[0].toString(), arguments[1].toString());
+    m_proxy->speechRecognizerMock()->setError(WebString::fromUTF8(arguments[0].toString()), WebString::fromUTF8(arguments[1].toString()));
 }
 
 void TestRunner::wasMockSpeechRecognitionAborted(const CppArgumentList&, CppVariant* result)
 {
-    result->set(m_delegate->wasMockSpeechRecognitionAborted());
+    result->set(m_proxy->speechRecognizerMock()->wasAborted());
 }
 
 void TestRunner::display(const CppArgumentList& arguments, CppVariant* result)
@@ -2025,31 +2098,31 @@ void TestRunner::notImplemented(const CppArgumentList&, CppVariant* result)
 
 void TestRunner::didAcquirePointerLock(const CppArgumentList&, CppVariant* result)
 {
-    m_delegate->didAcquirePointerLock();
+    didAcquirePointerLockInternal();
     result->setNull();
 }
 
 void TestRunner::didNotAcquirePointerLock(const CppArgumentList&, CppVariant* result)
 {
-    m_delegate->didNotAcquirePointerLock();
+    didNotAcquirePointerLockInternal();
     result->setNull();
 }
 
 void TestRunner::didLosePointerLock(const CppArgumentList&, CppVariant* result)
 {
-    m_delegate->didLosePointerLock();
+    didLosePointerLockInternal();
     result->setNull();
 }
 
 void TestRunner::setPointerLockWillRespondAsynchronously(const CppArgumentList&, CppVariant* result)
 {
-    m_delegate->setPointerLockWillRespondAsynchronously();
+    m_pointerLockPlannedResult = PointerLockWillRespondAsync;
     result->setNull();
 }
 
 void TestRunner::setPointerLockWillFailSynchronously(const CppArgumentList&, CppVariant* result)
 {
-    m_delegate->setPointerLockWillFailSynchronously();
+    m_pointerLockPlannedResult = PointerLockWillFailSync;
     result->setNull();
 }
 
index 462794af7d329fb87054f8ada4a173709a76b44e..fb65f17cf07871a0539c857fae74781267db0d3e 100644 (file)
@@ -55,13 +55,14 @@ class WebView;
 namespace WebTestRunner {
 
 class NotificationPresenter;
+class TestInterfaces;
 class WebPermissions;
 class WebTestDelegate;
 class WebTestProxyBase;
 
 class TestRunner : public WebTestRunner, public CppBoundClass {
 public:
-    TestRunner();
+    explicit TestRunner(TestInterfaces*);
     virtual ~TestRunner();
 
     void setDelegate(WebTestDelegate*);
@@ -122,6 +123,9 @@ public:
 #if ENABLE_NOTIFICATIONS
     WebKit::WebNotificationPresenter* notificationPresenter() const;
 #endif
+    bool requestPointerLock();
+    void requestPointerUnlock();
+    bool isPointerLocked();
 
     // A single item in the work queue.
     class WorkItem {
@@ -502,6 +506,23 @@ private:
         virtual void runIfValid() { m_object->completeNotifyDone(true); }
     };
 
+    class HostMethodTask : public WebMethodTask<TestRunner> {
+    public:
+        typedef void (TestRunner::*CallbackMethodType)();
+        HostMethodTask(TestRunner* object, CallbackMethodType callback)
+            : WebMethodTask<TestRunner>(object)
+            , m_callback(callback)
+        { }
+
+        virtual void runIfValid() { (m_object->*m_callback)(); }
+
+    private:
+        CallbackMethodType m_callback;
+    };
+    void didAcquirePointerLockInternal();
+    void didNotAcquirePointerLockInternal();
+    void didLosePointerLockInternal();
+
     bool elementDoesAutoCompleteForElementWithId(const WebKit::WebString&);
     bool cppVariantToBool(const CppVariant&);
     int32_t cppVariantToInt32(const CppVariant&);
@@ -660,6 +681,7 @@ private:
     // Used for test timeouts.
     WebTaskList m_taskList;
 
+    TestInterfaces* m_testInterfaces;
     WebTestDelegate* m_delegate;
     WebKit::WebView* m_webView;
     WebTestProxyBase* m_proxy;
@@ -673,6 +695,13 @@ private:
 #if ENABLE_NOTIFICATIONS
     std::auto_ptr<NotificationPresenter> m_notificationPresenter;
 #endif
+
+    bool m_pointerLocked;
+    enum {
+        PointerLockWillSucceed,
+        PointerLockWillRespondAsync,
+        PointerLockWillFailSync,
+    } m_pointerLockPlannedResult;
 };
 
 }
index 70d3923bcda19cb2f2fce17051580ac57b8d62fc..d45b337038a577289b61e7464ae76dcc01b2a267 100644 (file)
@@ -33,6 +33,8 @@
 
 #include "AccessibilityControllerChromium.h"
 #include "EventSender.h"
+#include "MockWebSpeechInputController.h"
+#include "MockWebSpeechRecognizer.h"
 #include "SpellCheckClient.h"
 #include "TestCommon.h"
 #include "TestInterfaces.h"
 #include "WebCachedURLRequest.h"
 #include "WebConsoleMessage.h"
 #include "WebDataSource.h"
+#include "WebDeviceOrientationClientMock.h"
 #include "WebDocument.h"
 #include "WebElement.h"
 #include "WebFrame.h"
+#include "WebGeolocationClientMock.h"
 #include "WebHistoryItem.h"
 #include "WebNode.h"
 #include "WebPluginParams.h"
@@ -396,10 +400,9 @@ void dumpBackForwardList(const WebVector<WebHistoryItem>& history, size_t curren
     result.append("===============================================\n");
 }
 
-string dumpAllBackForwardLists(WebTestDelegate* delegate)
+string dumpAllBackForwardLists(WebTestDelegate* delegate, unsigned windowCount)
 {
     string result;
-    unsigned windowCount = delegate->windowCount();
     for (unsigned i = 0; i < windowCount; ++i) {
         size_t currentEntryIndex = 0;
         WebVector<WebHistoryItem> history;
@@ -421,17 +424,25 @@ WebTestProxyBase::WebTestProxyBase()
 
 WebTestProxyBase::~WebTestProxyBase()
 {
+    m_testInterfaces->windowClosed(this);
 }
 
 void WebTestProxyBase::setInterfaces(WebTestInterfaces* interfaces)
 {
     m_testInterfaces = interfaces->testInterfaces();
+    m_testInterfaces->windowOpened(this);
 }
 
 void WebTestProxyBase::setDelegate(WebTestDelegate* delegate)
 {
     m_delegate = delegate;
     m_spellcheck->setDelegate(delegate);
+#if ENABLE_INPUT_SPEECH
+    if (m_speechInputController.get())
+        m_speechInputController->setDelegate(delegate);
+#endif
+    if (m_speechRecognizer.get())
+        m_speechRecognizer->setDelegate(delegate);
 }
 
 void WebTestProxyBase::reset()
@@ -441,6 +452,12 @@ void WebTestProxyBase::reset()
     m_isPainting = false;
     m_resourceIdentifierMap.clear();
     m_logConsoleOutput = true;
+    if (m_geolocationClient.get())
+        m_geolocationClient->resetMock();
+#if ENABLE_INPUT_SPEECH
+    if (m_speechInputController.get())
+        m_speechInputController->clearResults();
+#endif
 }
 
 WebSpellCheckClient* WebTestProxyBase::spellCheckClient() const
@@ -471,7 +488,7 @@ string WebTestProxyBase::captureTree(bool debugRenderTree)
     }
 
     if (m_testInterfaces->testRunner()->shouldDumpBackForwardList())
-        dataUtf8 += dumpAllBackForwardLists(m_delegate);
+        dataUtf8 += dumpAllBackForwardLists(m_delegate, m_testInterfaces->windowList().size());
 
     return dataUtf8;
 }
@@ -634,6 +651,37 @@ void WebTestProxyBase::discardBackingStore()
     m_canvas.reset();
 }
 
+WebGeolocationClientMock* WebTestProxyBase::geolocationClientMock()
+{
+    if (!m_geolocationClient.get())
+        m_geolocationClient.reset(WebGeolocationClientMock::create());
+    return m_geolocationClient.get();
+}
+
+WebDeviceOrientationClientMock* WebTestProxyBase::deviceOrientationClientMock()
+{
+    if (!m_deviceOrientationClient.get())
+        m_deviceOrientationClient.reset(WebDeviceOrientationClientMock::create());
+    return m_deviceOrientationClient.get();
+}
+
+#if ENABLE_INPUT_SPEECH
+MockWebSpeechInputController* WebTestProxyBase::speechInputControllerMock()
+{
+    WEBKIT_ASSERT(m_speechInputController.get());
+    return m_speechInputController.get();
+}
+#endif
+
+MockWebSpeechRecognizer* WebTestProxyBase::speechRecognizerMock()
+{
+    if (!m_speechRecognizer.get()) {
+        m_speechRecognizer.reset(new MockWebSpeechRecognizer());
+        m_speechRecognizer->setDelegate(m_delegate);
+    }
+    return m_speechRecognizer.get();
+}
+
 void WebTestProxyBase::didInvalidateRect(const WebRect& rect)
 {
     // m_paintRect = m_paintRect U rect
@@ -954,6 +1002,50 @@ WebNotificationPresenter* WebTestProxyBase::notificationPresenter()
 #endif
 }
 
+WebGeolocationClient* WebTestProxyBase::geolocationClient()
+{
+    return geolocationClientMock();
+}
+
+WebSpeechInputController* WebTestProxyBase::speechInputController(WebSpeechInputListener* listener)
+{
+#if ENABLE_INPUT_SPEECH
+    if (!m_speechInputController.get()) {
+        m_speechInputController.reset(new MockWebSpeechInputController(listener));
+        m_speechInputController->setDelegate(m_delegate);
+    }
+    return m_speechInputController.get();
+#else
+    WEBKIT_ASSERT(listener);
+    return 0;
+#endif
+}
+
+WebSpeechRecognizer* WebTestProxyBase::speechRecognizer()
+{
+    return speechRecognizerMock();
+}
+
+WebDeviceOrientationClient* WebTestProxyBase::deviceOrientationClient()
+{
+    return deviceOrientationClientMock();
+}
+
+bool WebTestProxyBase::requestPointerLock()
+{
+    return m_testInterfaces->testRunner()->requestPointerLock();
+}
+
+void WebTestProxyBase::requestPointerUnlock()
+{
+    m_testInterfaces->testRunner()->requestPointerUnlock();
+}
+
+bool WebTestProxyBase::isPointerLocked()
+{
+    return m_testInterfaces->testRunner()->isPointerLocked();
+}
+
 void WebTestProxyBase::willPerformClientRedirect(WebFrame* frame, const WebURL&, const WebURL& to, double, double)
 {
     if (m_testInterfaces->testRunner()->shouldDumpFrameLoadCallbacks()) {
index c4c962dbf9c63e84a8c43d75181e95cdd8c271ac..b439483655014f0125a539aa73dd9e1152c1d78a 100644 (file)
@@ -32,8 +32,6 @@
 #include "WebViewHost.h"
 
 #include "DRTDevToolsAgent.h"
-#include "MockWebSpeechInputController.h"
-#include "MockWebSpeechRecognizer.h"
 #include "Task.h"
 #include "TestNavigationController.h"
 #include "TestShell.h"
 #include "WebContextMenuData.h"
 #include "WebDOMMessageEvent.h"
 #include "WebDataSource.h"
-#include "WebDeviceOrientationClientMock.h"
 #include "WebDocument.h"
 #include "WebElement.h"
 #include "WebFrame.h"
-#include "WebGeolocationClientMock.h"
 #include "WebHistoryItem.h"
 #include "WebKit.h"
 #include "WebNode.h"
@@ -269,48 +265,6 @@ int WebViewHost::historyForwardListCount()
     return navigationController()->entryCount() - currentIndex - 1;
 }
 
-WebKit::WebGeolocationClient* WebViewHost::geolocationClient()
-{
-    return geolocationClientMock();
-}
-
-WebKit::WebGeolocationClientMock* WebViewHost::geolocationClientMock()
-{
-    if (!m_geolocationClientMock)
-        m_geolocationClientMock = adoptPtr(WebGeolocationClientMock::create());
-    return m_geolocationClientMock.get();
-}
-
-#if ENABLE(INPUT_SPEECH)
-WebSpeechInputController* WebViewHost::speechInputController(WebKit::WebSpeechInputListener* listener)
-{
-    if (!m_speechInputControllerMock)
-        m_speechInputControllerMock = MockWebSpeechInputController::create(listener);
-    return m_speechInputControllerMock.get();
-}
-#endif
-
-#if ENABLE(SCRIPTED_SPEECH)
-WebSpeechRecognizer* WebViewHost::speechRecognizer()
-{
-    if (!m_mockSpeechRecognizer)
-        m_mockSpeechRecognizer = MockWebSpeechRecognizer::create();
-    return m_mockSpeechRecognizer.get();
-}
-#endif
-
-WebDeviceOrientationClientMock* WebViewHost::deviceOrientationClientMock()
-{
-    if (!m_deviceOrientationClientMock.get())
-        m_deviceOrientationClientMock = adoptPtr(WebDeviceOrientationClientMock::create());
-    return m_deviceOrientationClientMock.get();
-}
-
-WebDeviceOrientationClient* WebViewHost::deviceOrientationClient()
-{
-    return deviceOrientationClientMock();
-}
-
 // WebWidgetClient -----------------------------------------------------------
 
 void WebViewHost::didAutoResize(const WebSize& newSize)
@@ -363,63 +317,6 @@ WebScreenInfo WebViewHost::screenInfo()
     return info;
 }
 
-#if ENABLE(POINTER_LOCK)
-bool WebViewHost::requestPointerLock()
-{
-    switch (m_pointerLockPlannedResult) {
-    case PointerLockWillSucceed:
-        postDelayedTask(new HostMethodTask(this, &WebViewHost::didAcquirePointerLock), 0);
-        return true;
-    case PointerLockWillRespondAsync:
-        ASSERT(!m_pointerLocked);
-        return true;
-    case PointerLockWillFailSync:
-        ASSERT(!m_pointerLocked);
-        return false;
-    default:
-        ASSERT_NOT_REACHED();
-        return false;
-    }
-}
-
-void WebViewHost::requestPointerUnlock()
-{
-    postDelayedTask(new HostMethodTask(this, &WebViewHost::didLosePointerLock), 0);
-}
-
-bool WebViewHost::isPointerLocked()
-{
-    return m_pointerLocked;
-}
-
-void WebViewHost::didAcquirePointerLock()
-{
-    m_pointerLocked = true;
-    webWidget()->didAcquirePointerLock();
-
-    // Reset planned result to default.
-    m_pointerLockPlannedResult = PointerLockWillSucceed;
-}
-
-void WebViewHost::didNotAcquirePointerLock()
-{
-    ASSERT(!m_pointerLocked);
-    m_pointerLocked = false;
-    webWidget()->didNotAcquirePointerLock();
-
-    // Reset planned result to default.
-    m_pointerLockPlannedResult = PointerLockWillSucceed;
-}
-
-void WebViewHost::didLosePointerLock()
-{
-    bool wasLocked = m_pointerLocked;
-    m_pointerLocked = false;
-    if (wasLocked)
-        webWidget()->didLosePointerLock();
-}
-#endif
-
 void WebViewHost::show(WebNavigationPolicy)
 {
     m_hasWindow = true;
@@ -763,71 +660,6 @@ void WebViewHost::setLocale(const std::string& locale)
     setlocale(LC_ALL, locale.c_str());
 }
 
-void WebViewHost::setDeviceOrientation(WebKit::WebDeviceOrientation& orientation)
-{
-    deviceOrientationClientMock()->setOrientation(orientation);
-}
-
-int WebViewHost::numberOfPendingGeolocationPermissionRequests()
-{
-    Vector<WebViewHost*> windowList = m_shell->windowList();
-    int numberOfRequests = 0;
-    for (size_t i = 0; i < windowList.size(); i++)
-        numberOfRequests += windowList[i]->geolocationClientMock()->numberOfPendingPermissionRequests();
-    return numberOfRequests;
-}
-
-void WebViewHost::setGeolocationPermission(bool allowed)
-{
-    Vector<WebViewHost*> windowList = m_shell->windowList();
-    for (size_t i = 0; i < windowList.size(); i++)
-        windowList[i]->geolocationClientMock()->setPermission(allowed);
-}
-
-void WebViewHost::setMockGeolocationPosition(double latitude, double longitude, double accuracy)
-{
-    Vector<WebViewHost*> windowList = m_shell->windowList();
-    for (size_t i = 0; i < windowList.size(); i++)
-        windowList[i]->geolocationClientMock()->setPosition(latitude, longitude, accuracy);
-}
-
-void WebViewHost::setMockGeolocationPositionUnavailableError(const std::string& message)
-{
-    Vector<WebViewHost*> windowList = m_shell->windowList();
-    // FIXME: Benjamin
-    for (size_t i = 0; i < windowList.size(); i++)
-        windowList[i]->geolocationClientMock()->setPositionUnavailableError(WebString::fromUTF8(message));
-}
-
-#if ENABLE(INPUT_SPEECH)
-void WebViewHost::addMockSpeechInputResult(const std::string& result, double confidence, const std::string& language)
-{
-    m_speechInputControllerMock->addMockRecognitionResult(WebString::fromUTF8(result), confidence, WebString::fromUTF8(language));
-}
-
-void WebViewHost::setMockSpeechInputDumpRect(bool dumpRect)
-{
-    m_speechInputControllerMock->setDumpRect(dumpRect);
-}
-#endif
-
-#if ENABLE(SCRIPTED_SPEECH)
-void WebViewHost::addMockSpeechRecognitionResult(const std::string& transcript, double confidence)
-{
-    m_mockSpeechRecognizer->addMockResult(WebString::fromUTF8(transcript), confidence);
-}
-
-void WebViewHost::setMockSpeechRecognitionError(const std::string& error, const std::string& message)
-{
-    m_mockSpeechRecognizer->setError(WebString::fromUTF8(error), WebString::fromUTF8(message));
-}
-
-bool WebViewHost::wasMockSpeechRecognitionAborted()
-{
-    return m_mockSpeechRecognizer->wasAborted();
-}
-#endif
-
 void WebViewHost::testFinished()
 {
     m_shell->testFinished(this);
@@ -858,11 +690,6 @@ int WebViewHost::navigationEntryCount()
     return m_shell->navigationEntryCount();
 }
 
-int WebViewHost::windowCount()
-{
-    return m_shell->windowCount();
-}
-
 void WebViewHost::goToOffset(int offset)
 {
     m_shell->goToOffset(offset);
@@ -971,10 +798,6 @@ void WebViewHost::reset()
     m_lastPageIdUpdated = -1;
     m_hasWindow = false;
     m_inModalLoop = false;
-#if ENABLE(POINTER_LOCK)
-    m_pointerLocked = false;
-    m_pointerLockPlannedResult = PointerLockWillSucceed;
-#endif
 
     m_navigationController = adoptPtr(new TestNavigationController(this));
 
@@ -982,14 +805,6 @@ void WebViewHost::reset()
     m_editCommandName.clear();
     m_editCommandValue.clear();
 
-    if (m_geolocationClientMock.get())
-        m_geolocationClientMock->resetMock();
-
-#if ENABLE(INPUT_SPEECH)
-    if (m_speechInputControllerMock.get())
-        m_speechInputControllerMock->clearResults();
-#endif
-
     m_currentCursor = WebCursorInfo();
     m_windowRect = WebRect();
     // m_proxy is not set when reset() is invoked from the constructor.
index 4f9c7c922405f5046d191ebdb0bc01256d1d369d..abf6d63e46e83e112adcb9229c4bb15358f7b127 100644 (file)
 #include <wtf/Vector.h>
 #include <wtf/text/WTFString.h>
 
-class MockWebSpeechInputController;
-class MockWebSpeechRecognizer;
 class SkCanvas;
 class TestShell;
 
 namespace WebKit {
 class WebFrame;
-class WebDeviceOrientationClient;
-class WebDeviceOrientationClientMock;
-class WebGeolocationClient;
-class WebGeolocationClientMock;
-class WebGeolocationServiceMock;
 class WebSerializedScriptValue;
 class WebSharedWorkerClient;
-class WebSpeechInputController;
-class WebSpeechInputListener;
 class WebURL;
 struct WebRect;
 struct WebURLError;
@@ -92,14 +83,6 @@ class WebViewHost : public WebKit::WebViewClient, public WebKit::WebFrameClient,
 
     void closeWidget();
 
-#if ENABLE(INPUT_SPEECH)
-    MockWebSpeechInputController* speechInputControllerMock() { return m_speechInputControllerMock.get(); }
-#endif
-
-#if ENABLE(SCRIPTED_SPEECH)
-    MockWebSpeechRecognizer* mockSpeechRecognizer() { return m_mockSpeechRecognizer.get(); }
-#endif
-
     // WebTestDelegate.
     virtual void setEditCommand(const std::string& name, const std::string& value) OVERRIDE;
     virtual void clearEditCommand() OVERRIDE;
@@ -126,34 +109,12 @@ class WebViewHost : public WebKit::WebViewClient, public WebKit::WebFrameClient,
     virtual void setAcceptAllCookies(bool) OVERRIDE;
     virtual std::string pathToLocalResource(const std::string& url) OVERRIDE;
     virtual void setLocale(const std::string&) OVERRIDE;
-    virtual void setDeviceOrientation(WebKit::WebDeviceOrientation&) OVERRIDE;
-#if ENABLE(POINTER_LOCK)
-    virtual void didAcquirePointerLock() OVERRIDE;
-    virtual void didNotAcquirePointerLock() OVERRIDE;
-    virtual void didLosePointerLock() OVERRIDE;
-    virtual void setPointerLockWillRespondAsynchronously() OVERRIDE { m_pointerLockPlannedResult = PointerLockWillRespondAsync; }
-    virtual void setPointerLockWillFailSynchronously() OVERRIDE { m_pointerLockPlannedResult = PointerLockWillFailSync; }
-#endif
-    virtual int numberOfPendingGeolocationPermissionRequests() OVERRIDE;
-    virtual void setGeolocationPermission(bool) OVERRIDE;
-    virtual void setMockGeolocationPosition(double, double, double) OVERRIDE;
-    virtual void setMockGeolocationPositionUnavailableError(const std::string&) OVERRIDE;
-#if ENABLE(INPUT_SPEECH)
-    virtual void addMockSpeechInputResult(const std::string&, double, const std::string&) OVERRIDE;
-    virtual void setMockSpeechInputDumpRect(bool) OVERRIDE;
-#endif
-#if ENABLE(SCRIPTED_SPEECH)
-    virtual void addMockSpeechRecognitionResult(const std::string&, double) OVERRIDE;
-    virtual void setMockSpeechRecognitionError(const std::string&, const std::string&) OVERRIDE;
-    virtual bool wasMockSpeechRecognitionAborted() OVERRIDE;
-#endif
     virtual void testFinished() OVERRIDE;
     virtual void testTimedOut() OVERRIDE;
     virtual bool isBeingDebugged() OVERRIDE;
     virtual int layoutTestTimeout() OVERRIDE;
     virtual void closeRemainingWindows() OVERRIDE;
     virtual int navigationEntryCount() OVERRIDE;
-    virtual int windowCount() OVERRIDE;
     virtual void goToOffset(int) OVERRIDE;
     virtual void reload() OVERRIDE;
     virtual void loadURLForFrame(const WebKit::WebURL&, const std::string& frameName) OVERRIDE;
@@ -193,14 +154,6 @@ class WebViewHost : public WebKit::WebViewClient, public WebKit::WebFrameClient,
     virtual void navigateBackForwardSoon(int offset);
     virtual int historyBackListCount();
     virtual int historyForwardListCount();
-    virtual WebKit::WebGeolocationClient* geolocationClient();
-#if ENABLE(INPUT_SPEECH)
-    virtual WebKit::WebSpeechInputController* speechInputController(WebKit::WebSpeechInputListener*);
-#endif
-#if ENABLE(SCRIPTED_SPEECH)
-    virtual WebKit::WebSpeechRecognizer* speechRecognizer() OVERRIDE;
-#endif
-    virtual WebKit::WebDeviceOrientationClient* deviceOrientationClient() OVERRIDE;
 
     // WebKit::WebWidgetClient
     virtual void didAutoResize(const WebKit::WebSize& newSize);
@@ -220,11 +173,6 @@ class WebViewHost : public WebKit::WebViewClient, public WebKit::WebFrameClient,
     virtual WebKit::WebRect rootWindowRect();
     virtual WebKit::WebRect windowResizerRect();
     virtual WebKit::WebScreenInfo screenInfo();
-#if ENABLE(POINTER_LOCK)
-    virtual bool requestPointerLock();
-    virtual void requestPointerUnlock();
-    virtual bool isPointerLocked();
-#endif
 
     // WebKit::WebFrameClient
     virtual WebKit::WebPlugin* createPlugin(WebKit::WebFrame*, const WebKit::WebPluginParams&);
@@ -251,11 +199,6 @@ class WebViewHost : public WebKit::WebViewClient, public WebKit::WebFrameClient,
         WebKit::WebFrame* sourceFrame, WebKit::WebFrame* targetFrame, 
         WebKit::WebSecurityOrigin target, WebKit::WebDOMMessageEvent);
 
-    WebKit::WebDeviceOrientationClientMock* deviceOrientationClientMock();
-
-    // Geolocation client mocks for DRTTestRunner
-    WebKit::WebGeolocationClientMock* geolocationClientMock();
-
     // Pending task list, Note taht the method is referred from WebMethodTask class.
     WebTestRunner::WebTaskList* taskList() { return &m_taskList; }
 
@@ -326,17 +269,6 @@ private:
 
     OwnPtr<WebKit::WebContextMenuData> m_lastContextMenuData;
 
-    // Geolocation
-    OwnPtr<WebKit::WebGeolocationClientMock> m_geolocationClientMock;
-
-    OwnPtr<WebKit::WebDeviceOrientationClientMock> m_deviceOrientationClientMock;
-#if ENABLE(INPUT_SPEECH)
-    OwnPtr<MockWebSpeechInputController> m_speechInputControllerMock;
-#endif
-
-#if ENABLE(SCRIPTED_SPEECH)
-    OwnPtr<MockWebSpeechRecognizer> m_mockSpeechRecognizer;
-#endif
 
 #if ENABLE(MEDIA_STREAM)
     OwnPtr<webkit_support::TestMediaStreamClient> m_testMediaStreamClient;
@@ -347,15 +279,6 @@ private:
     WebTestRunner::WebTaskList m_taskList;
     Vector<WebKit::WebWidget*> m_popupmenus;
 
-#if ENABLE(POINTER_LOCK)
-    bool m_pointerLocked;
-    enum {
-        PointerLockWillSucceed,
-        PointerLockWillRespondAsync,
-        PointerLockWillFailSync
-    } m_pointerLockPlannedResult;
-#endif
-
     OwnPtr<WebKit::WebLayerTreeView> m_layerTreeView;
 };