[chromium] move setMockDeviceOrientation to TestRunner library
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 16 Jan 2013 13:50:31 +0000 (13:50 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 16 Jan 2013 13:50:31 +0000 (13:50 +0000)
https://bugs.webkit.org/show_bug.cgi?id=106895

Patch by Dan Carney <dcarney@google.com> on 2013-01-16
Reviewed by Jochen Eisinger.

* DumpRenderTree/chromium/DRTTestRunner.cpp:
(DRTTestRunner::DRTTestRunner):
* DumpRenderTree/chromium/DRTTestRunner.h:
(DRTTestRunner):
* DumpRenderTree/chromium/TestRunner/public/WebTestDelegate.h:
(WebKit):
(WebTestRunner::WebTestDelegate::setDeviceOrientation):
* DumpRenderTree/chromium/TestRunner/src/TestRunner.cpp:
(WebTestRunner::TestRunner::TestRunner):
(WebTestRunner::TestRunner::setMockDeviceOrientation):
(WebTestRunner):
* DumpRenderTree/chromium/TestRunner/src/TestRunner.h:
(TestRunner):
* DumpRenderTree/chromium/WebViewHost.cpp:
(WebViewHost::setDeviceOrientation):
* DumpRenderTree/chromium/WebViewHost.h:
(WebViewHost):

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

Tools/ChangeLog
Tools/DumpRenderTree/chromium/DRTTestRunner.cpp
Tools/DumpRenderTree/chromium/DRTTestRunner.h
Tools/DumpRenderTree/chromium/TestRunner/public/WebTestDelegate.h
Tools/DumpRenderTree/chromium/TestRunner/src/TestRunner.cpp
Tools/DumpRenderTree/chromium/TestRunner/src/TestRunner.h
Tools/DumpRenderTree/chromium/WebViewHost.cpp
Tools/DumpRenderTree/chromium/WebViewHost.h

index c31134b..2e411e3 100644 (file)
@@ -1,3 +1,28 @@
+2013-01-16  Dan Carney  <dcarney@google.com>
+
+        [chromium] move setMockDeviceOrientation to TestRunner library
+        https://bugs.webkit.org/show_bug.cgi?id=106895
+
+        Reviewed by Jochen Eisinger.
+
+        * DumpRenderTree/chromium/DRTTestRunner.cpp:
+        (DRTTestRunner::DRTTestRunner):
+        * DumpRenderTree/chromium/DRTTestRunner.h:
+        (DRTTestRunner):
+        * DumpRenderTree/chromium/TestRunner/public/WebTestDelegate.h:
+        (WebKit):
+        (WebTestRunner::WebTestDelegate::setDeviceOrientation):
+        * DumpRenderTree/chromium/TestRunner/src/TestRunner.cpp:
+        (WebTestRunner::TestRunner::TestRunner):
+        (WebTestRunner::TestRunner::setMockDeviceOrientation):
+        (WebTestRunner):
+        * DumpRenderTree/chromium/TestRunner/src/TestRunner.h:
+        (TestRunner):
+        * DumpRenderTree/chromium/WebViewHost.cpp:
+        (WebViewHost::setDeviceOrientation):
+        * DumpRenderTree/chromium/WebViewHost.h:
+        (WebViewHost):
+
 2013-01-16  Jochen Eisinger  <jochen@chromium.org>
 
         [chromium] route more webkit_support and webviewhost callbacks through WebTestDelegate
index 2190780..9c2367a 100644 (file)
@@ -41,8 +41,6 @@
 #include "WebAnimationController.h"
 #include "WebBindings.h"
 #include "WebConsoleMessage.h"
-#include "WebDeviceOrientation.h"
-#include "WebDeviceOrientationClientMock.h"
 #include "WebDocument.h"
 #include "WebElement.h"
 #include "WebFindOptions.h"
@@ -125,7 +123,6 @@ DRTTestRunner::DRTTestRunner(TestShell* shell)
     bindMethod("setCloseRemainingWindowsWhenComplete", &DRTTestRunner::setCloseRemainingWindowsWhenComplete);
     bindMethod("setCustomPolicyDelegate", &DRTTestRunner::setCustomPolicyDelegate);
     bindMethod("setGeolocationPermission", &DRTTestRunner::setGeolocationPermission);
-    bindMethod("setMockDeviceOrientation", &DRTTestRunner::setMockDeviceOrientation);
     bindMethod("setMockGeolocationPositionUnavailableError", &DRTTestRunner::setMockGeolocationPositionUnavailableError);
     bindMethod("setMockGeolocationPosition", &DRTTestRunner::setMockGeolocationPosition);
 #if ENABLE(POINTER_LOCK)
@@ -525,27 +522,6 @@ void DRTTestRunner::numberOfPendingGeolocationPermissionRequests(const CppArgume
     result->set(numberOfRequests);
 }
 
-void DRTTestRunner::setMockDeviceOrientation(const CppArgumentList& arguments, CppVariant* result)
-{
-    result->setNull();
-    if (arguments.size() < 6 || !arguments[0].isBool() || !arguments[1].isNumber() || !arguments[2].isBool() || !arguments[3].isNumber() || !arguments[4].isBool() || !arguments[5].isNumber())
-        return;
-
-    WebDeviceOrientation orientation;
-    orientation.setNull(false);
-    if (arguments[0].toBoolean())
-        orientation.setAlpha(arguments[1].toDouble());
-    if (arguments[2].toBoolean())
-        orientation.setBeta(arguments[3].toDouble());
-    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
-    // call setOrientation on each DeviceOrientationClientMock.
-    m_shell->webViewHost()->deviceOrientationClientMock()->setOrientation(orientation);
-}
-
 // FIXME: For greater test flexibility, we should be able to set each page's geolocation mock individually.
 // https://bugs.webkit.org/show_bug.cgi?id=52368
 void DRTTestRunner::setGeolocationPermission(const CppArgumentList& arguments, CppVariant* result)
index 5153fa3..303fa3c 100644 (file)
@@ -124,9 +124,6 @@ public:
     // Gets the number of geolocation permissions requests pending.
     void numberOfPendingGeolocationPermissionRequests(const CppArgumentList&, CppVariant*);
 
-    // DeviceOrientation related functions
-    void setMockDeviceOrientation(const CppArgumentList&, CppVariant*);
-
     // Geolocation related functions.
     void setGeolocationPermission(const CppArgumentList&, CppVariant*);
     void setMockGeolocationPosition(const CppArgumentList&, CppVariant*);
index 4f8089c..eca2cd1 100644 (file)
@@ -37,6 +37,7 @@
 #include <string>
 
 namespace WebKit {
+class WebDeviceOrientation;
 class WebGamepads;
 class WebIntentRequest;
 struct WebContextMenuData;
@@ -92,6 +93,7 @@ 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&) { }
 };
 
 }
index db379b7..56cf967 100644 (file)
@@ -34,6 +34,7 @@
 
 #include "WebAnimationController.h"
 #include "WebBindings.h"
+#include "WebDeviceOrientation.h"
 #include "WebDocument.h"
 #include "WebElement.h"
 #include "WebFindOptions.h"
@@ -144,6 +145,7 @@ TestRunner::TestRunner()
     bindMethod("enableAutoResizeMode", &TestRunner::enableAutoResizeMode);
     bindMethod("setSmartInsertDeleteEnabled", &TestRunner::setSmartInsertDeleteEnabled);
     bindMethod("setSelectTrailingWhitespaceEnabled", &TestRunner::setSelectTrailingWhitespaceEnabled);
+    bindMethod("setMockDeviceOrientation", &TestRunner::setMockDeviceOrientation);
 
     // The following modify WebPreferences.
     bindMethod("setUserStyleSheetEnabled", &TestRunner::setUserStyleSheetEnabled);
@@ -1106,6 +1108,27 @@ void TestRunner::disableAutoResizeMode(const CppArgumentList& arguments, CppVari
     result->set(true);
 }
 
+void TestRunner::setMockDeviceOrientation(const CppArgumentList& arguments, CppVariant* result)
+{
+    result->setNull();
+    if (arguments.size() < 6 || !arguments[0].isBool() || !arguments[1].isNumber() || !arguments[2].isBool() || !arguments[3].isNumber() || !arguments[4].isBool() || !arguments[5].isNumber())
+        return;
+
+    WebDeviceOrientation orientation;
+    orientation.setNull(false);
+    if (arguments[0].toBoolean())
+        orientation.setAlpha(arguments[1].toDouble());
+    if (arguments[2].toBoolean())
+        orientation.setBeta(arguments[3].toDouble());
+    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
+    // call setOrientation on each DeviceOrientationClientMock.
+    m_delegate->setDeviceOrientation(orientation);
+}
+
 void TestRunner::setUserStyleSheetEnabled(const CppArgumentList& arguments, CppVariant* result)
 {
     if (arguments.size() > 0 && arguments[0].isBool()) {
index 7bda7be..874ea60 100644 (file)
@@ -190,6 +190,9 @@ private:
     void enableAutoResizeMode(const CppArgumentList&, CppVariant*);
     void disableAutoResizeMode(const CppArgumentList&, CppVariant*);
 
+    // DeviceOrientation related functions
+    void setMockDeviceOrientation(const CppArgumentList&, CppVariant*);
+
     ///////////////////////////////////////////////////////////////////////////
     // Methods modifying WebPreferences.
 
index 376fc63..4511271 100644 (file)
@@ -1135,6 +1135,11 @@ void WebViewHost::setLocale(const std::string& locale)
     setlocale(LC_ALL, locale.c_str());
 }
 
+void WebViewHost::setDeviceOrientation(WebKit::WebDeviceOrientation& orientation)
+{
+    deviceOrientationClientMock()->setOrientation(orientation);
+}
+
 // Public functions -----------------------------------------------------------
 
 WebViewHost::WebViewHost(TestShell* shell)
index 5d11199..e748c8a 100644 (file)
@@ -160,6 +160,7 @@ 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;
 
     // NavigationHost
     virtual bool navigate(const TestNavigationEntry&, bool reload);