Title: [123661] trunk/Tools
Revision
123661
Author
joc...@chromium.org
Date
2012-07-25 14:28:42 -0700 (Wed, 25 Jul 2012)

Log Message

[chromium] don't use webkit_support methods directly from test runners but through the test delegate
https://bugs.webkit.org/show_bug.cgi?id=92256

Reviewed by Adam Barth.

This will allow for the content_shell to provide its own implementation
for setting the Gamepad data instead.

* DumpRenderTree/chromium/TestRunner/GamepadController.cpp:
(GamepadController::setDelegate):
(GamepadController::reset):
(GamepadController::connect):
(GamepadController::disconnect):
(GamepadController::setId):
(GamepadController::setButtonCount):
(GamepadController::setButtonData):
(GamepadController::setAxisCount):
(GamepadController::setAxisData):
* DumpRenderTree/chromium/TestRunner/GamepadController.h:
(GamepadController):
* DumpRenderTree/chromium/TestRunner/TestDelegate.h:
(WebKit):
(TestDelegate):
* DumpRenderTree/chromium/TestRunner/TestInterfaces.cpp:
(TestInterfaces::Internal):
(TestInterfaces::Internal::~Internal):
(TestInterfaces::Internal::setDelegate):
(TestInterfaces::setDelegate):
* DumpRenderTree/chromium/TestRunner/TestInterfaces.h:
(TestInterfaces):
* DumpRenderTree/chromium/TestShell.cpp:
(TestShell::createMainWindow):
(TestShell::~TestShell):
* DumpRenderTree/chromium/WebViewHost.cpp:
(WebViewHost::setGamepadData):
* DumpRenderTree/chromium/WebViewHost.h:
(WebViewHost):

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (123660 => 123661)


--- trunk/Tools/ChangeLog	2012-07-25 21:25:46 UTC (rev 123660)
+++ trunk/Tools/ChangeLog	2012-07-25 21:28:42 UTC (rev 123661)
@@ -1,3 +1,43 @@
+2012-07-25  Jochen Eisinger  <joc...@chromium.org>
+
+        [chromium] don't use webkit_support methods directly from test runners but through the test delegate
+        https://bugs.webkit.org/show_bug.cgi?id=92256
+
+        Reviewed by Adam Barth.
+
+        This will allow for the content_shell to provide its own implementation
+        for setting the Gamepad data instead.
+
+        * DumpRenderTree/chromium/TestRunner/GamepadController.cpp:
+        (GamepadController::setDelegate):
+        (GamepadController::reset):
+        (GamepadController::connect):
+        (GamepadController::disconnect):
+        (GamepadController::setId):
+        (GamepadController::setButtonCount):
+        (GamepadController::setButtonData):
+        (GamepadController::setAxisCount):
+        (GamepadController::setAxisData):
+        * DumpRenderTree/chromium/TestRunner/GamepadController.h:
+        (GamepadController):
+        * DumpRenderTree/chromium/TestRunner/TestDelegate.h:
+        (WebKit):
+        (TestDelegate):
+        * DumpRenderTree/chromium/TestRunner/TestInterfaces.cpp:
+        (TestInterfaces::Internal):
+        (TestInterfaces::Internal::~Internal):
+        (TestInterfaces::Internal::setDelegate):
+        (TestInterfaces::setDelegate):
+        * DumpRenderTree/chromium/TestRunner/TestInterfaces.h:
+        (TestInterfaces):
+        * DumpRenderTree/chromium/TestShell.cpp:
+        (TestShell::createMainWindow):
+        (TestShell::~TestShell):
+        * DumpRenderTree/chromium/WebViewHost.cpp:
+        (WebViewHost::setGamepadData):
+        * DumpRenderTree/chromium/WebViewHost.h:
+        (WebViewHost):
+
 2012-07-25  Christophe Dumez  <christophe.du...@intel.com>
 
         [WK2][WTR] LayoutTestController.sendWebIntentResponse() needs to be implemented

Modified: trunk/Tools/DumpRenderTree/chromium/TestRunner/GamepadController.cpp (123660 => 123661)


--- trunk/Tools/DumpRenderTree/chromium/TestRunner/GamepadController.cpp	2012-07-25 21:25:46 UTC (rev 123660)
+++ trunk/Tools/DumpRenderTree/chromium/TestRunner/GamepadController.cpp	2012-07-25 21:28:42 UTC (rev 123661)
@@ -30,6 +30,7 @@
 
 #include "config.h"
 #include "GamepadController.h"
+#include "TestDelegate.h"
 
 using namespace WebKit;
 
@@ -53,9 +54,14 @@
     CppBoundClass::bindToJavascript(frame, classname);
 }
 
+void GamepadController::setDelegate(TestDelegate* delegate)
+{
+    m_delegate = delegate;
+}
+
 void GamepadController::reset()
 {
-    memset(&internalData, 0, sizeof(internalData));
+    memset(&m_gamepads, 0, sizeof(m_gamepads));
 }
 
 void GamepadController::connect(const CppArgumentList& args, CppVariant* result)
@@ -67,12 +73,12 @@
     int index = args[0].toInt32();
     if (index < 0 || index >= static_cast<int>(WebKit::WebGamepads::itemsLengthCap))
         return;
-    internalData.items[index].connected = true;
-    internalData.length = 0;
+    m_gamepads.items[index].connected = true;
+    m_gamepads.length = 0;
     for (unsigned i = 0; i < WebKit::WebGamepads::itemsLengthCap; ++i)
-        if (internalData.items[i].connected)
-            internalData.length = i + 1;
-    webkit_support::SetGamepadData(internalData);
+        if (m_gamepads.items[i].connected)
+            m_gamepads.length = i + 1;
+    m_delegate->setGamepadData(m_gamepads);
     result->setNull();
 }
 
@@ -85,12 +91,12 @@
     int index = args[0].toInt32();
     if (index < 0 || index >= static_cast<int>(WebKit::WebGamepads::itemsLengthCap))
         return;
-    internalData.items[index].connected = false;
-    internalData.length = 0;
+    m_gamepads.items[index].connected = false;
+    m_gamepads.length = 0;
     for (unsigned i = 0; i < WebKit::WebGamepads::itemsLengthCap; ++i)
-        if (internalData.items[i].connected)
-            internalData.length = i + 1;
-    webkit_support::SetGamepadData(internalData);
+        if (m_gamepads.items[i].connected)
+            m_gamepads.length = i + 1;
+    m_delegate->setGamepadData(m_gamepads);
     result->setNull();
 }
 
@@ -105,10 +111,10 @@
         return;
     std::string src = ""
     const char* p = src.c_str();
-    memset(internalData.items[index].id, 0, sizeof(internalData.items[index].id));
+    memset(m_gamepads.items[index].id, 0, sizeof(m_gamepads.items[index].id));
     for (unsigned i = 0; *p && i < WebKit::WebGamepad::idLengthCap - 1; ++i)
-        internalData.items[index].id[i] = *p++;
-    webkit_support::SetGamepadData(internalData);
+        m_gamepads.items[index].id[i] = *p++;
+    m_delegate->setGamepadData(m_gamepads);
     result->setNull();
 }
 
@@ -122,8 +128,8 @@
     if (index < 0 || index >= static_cast<int>(WebKit::WebGamepads::itemsLengthCap))
         return;
     int buttons = args[1].toInt32();
-    internalData.items[index].buttonsLength = buttons;
-    webkit_support::SetGamepadData(internalData);
+    m_gamepads.items[index].buttonsLength = buttons;
+    m_delegate->setGamepadData(m_gamepads);
     result->setNull();
 }
 
@@ -138,8 +144,8 @@
         return;
     int button = args[1].toInt32();
     double data = ""
-    internalData.items[index].buttons[button] = data;
-    webkit_support::SetGamepadData(internalData);
+    m_gamepads.items[index].buttons[button] = data;
+    m_delegate->setGamepadData(m_gamepads);
     result->setNull();
 }
 
@@ -153,8 +159,8 @@
     if (index < 0 || index >= static_cast<int>(WebKit::WebGamepads::itemsLengthCap))
         return;
     int axes = args[1].toInt32();
-    internalData.items[index].axesLength = axes;
-    webkit_support::SetGamepadData(internalData);
+    m_gamepads.items[index].axesLength = axes;
+    m_delegate->setGamepadData(m_gamepads);
     result->setNull();
 }
 
@@ -169,8 +175,8 @@
         return;
     int axis = args[1].toInt32();
     double data = ""
-    internalData.items[index].axes[axis] = data;
-    webkit_support::SetGamepadData(internalData);
+    m_gamepads.items[index].axes[axis] = data;
+    m_delegate->setGamepadData(m_gamepads);
     result->setNull();
 }
 

Modified: trunk/Tools/DumpRenderTree/chromium/TestRunner/GamepadController.h (123660 => 123661)


--- trunk/Tools/DumpRenderTree/chromium/TestRunner/GamepadController.h	2012-07-25 21:25:46 UTC (rev 123660)
+++ trunk/Tools/DumpRenderTree/chromium/TestRunner/GamepadController.h	2012-07-25 21:28:42 UTC (rev 123661)
@@ -34,6 +34,8 @@
 #include "CppBoundClass.h"
 #include "platform/WebGamepads.h"
 
+class TestDelegate;
+
 namespace WebKit {
 class WebGamepads;
 class WebFrame;
@@ -44,6 +46,7 @@
     GamepadController();
 
     void bindToJavascript(WebKit::WebFrame*, const WebKit::WebString& classname);
+    void setDelegate(TestDelegate*);
     void reset();
 
 private:
@@ -57,7 +60,9 @@
     void setAxisData(const CppArgumentList&, CppVariant*);
     void fallbackCallback(const CppArgumentList&, CppVariant*);
 
-    WebKit::WebGamepads internalData;
+    WebKit::WebGamepads m_gamepads;
+
+    TestDelegate* m_delegate;
 };
 
 #endif // GamepadController_h

Modified: trunk/Tools/DumpRenderTree/chromium/TestRunner/TestDelegate.h (123660 => 123661)


--- trunk/Tools/DumpRenderTree/chromium/TestRunner/TestDelegate.h	2012-07-25 21:25:46 UTC (rev 123660)
+++ trunk/Tools/DumpRenderTree/chromium/TestRunner/TestDelegate.h	2012-07-25 21:28:42 UTC (rev 123661)
@@ -36,6 +36,7 @@
 
 namespace WebKit {
 struct WebContextMenuData;
+class WebGamepads;
 }
 
 class TestDelegate {
@@ -45,6 +46,7 @@
     virtual void fillSpellingSuggestionList(const WebKit::WebString& word, Vector<WebKit::WebString>* suggestions) = 0;
     virtual void setEditCommand(const std::string& name, const std::string& value) = 0;
     virtual WebKit::WebContextMenuData* lastContextMenuData() const = 0;
+    virtual void setGamepadData(const WebKit::WebGamepads&) = 0;
 };
 
 #endif // TestDelegate_h

Modified: trunk/Tools/DumpRenderTree/chromium/TestRunner/TestInterfaces.cpp (123660 => 123661)


--- trunk/Tools/DumpRenderTree/chromium/TestRunner/TestInterfaces.cpp	2012-07-25 21:25:46 UTC (rev 123660)
+++ trunk/Tools/DumpRenderTree/chromium/TestRunner/TestInterfaces.cpp	2012-07-25 21:28:42 UTC (rev 123661)
@@ -47,7 +47,8 @@
     Internal();
     ~Internal();
 
-    void setWebView(WebView* webView);
+    void setWebView(WebView*);
+    void setDelegate(TestDelegate*);
     void bindTo(WebFrame*);
     void resetAll();
 
@@ -71,6 +72,10 @@
     m_accessibilityController->setWebView(0);
     // m_gamepadController doesn't depend on WebView.
     m_textInputController->setWebView(0);
+
+    // m_accessibilityController doesn't depend on TestDelegate.
+    m_gamepadController->setDelegate(0);
+    // m_textInputController doesn't depend on TestDelegate.
 }
 
 void TestInterfaces::Internal::setWebView(WebView* webView)
@@ -80,6 +85,13 @@
     m_textInputController->setWebView(webView);
 }
 
+void TestInterfaces::Internal::setDelegate(TestDelegate* delegate)
+{
+    // m_accessibilityController doesn't depend on TestDelegate.
+    m_gamepadController->setDelegate(delegate);
+    // m_textInputController doesn't depend on TestDelegate.
+}
+
 void TestInterfaces::Internal::bindTo(WebFrame* frame)
 {
     m_accessibilityController->bindToJavascript(frame, WebString::fromUTF8("accessibilityController"));
@@ -109,6 +121,11 @@
     m_internal->setWebView(webView);
 }
 
+void TestInterfaces::setDelegate(TestDelegate* delegate)
+{
+    m_internal->setDelegate(delegate);
+}
+
 void TestInterfaces::bindTo(WebFrame* frame)
 {
     m_internal->bindTo(frame);

Modified: trunk/Tools/DumpRenderTree/chromium/TestRunner/TestInterfaces.h (123660 => 123661)


--- trunk/Tools/DumpRenderTree/chromium/TestRunner/TestInterfaces.h	2012-07-25 21:25:46 UTC (rev 123660)
+++ trunk/Tools/DumpRenderTree/chromium/TestRunner/TestInterfaces.h	2012-07-25 21:28:42 UTC (rev 123661)
@@ -37,13 +37,15 @@
 }
 
 class AccessibilityController;
+class TestDelegate;
 
 class TestInterfaces {
 public:
     TestInterfaces();
     ~TestInterfaces();
 
-    void setWebView(WebKit::WebView* webView);
+    void setWebView(WebKit::WebView*);
+    void setDelegate(TestDelegate*);
     void bindTo(WebKit::WebFrame*);
     void resetAll();
 

Modified: trunk/Tools/DumpRenderTree/chromium/TestShell.cpp (123660 => 123661)


--- trunk/Tools/DumpRenderTree/chromium/TestShell.cpp	2012-07-25 21:25:46 UTC (rev 123660)
+++ trunk/Tools/DumpRenderTree/chromium/TestShell.cpp	2012-07-25 21:28:42 UTC (rev 123661)
@@ -171,6 +171,7 @@
     m_drtDevToolsAgent = adoptPtr(new DRTDevToolsAgent);
     m_webViewHost = adoptPtr(createNewWindow(WebURL(), m_drtDevToolsAgent.get()));
     m_webView = m_webViewHost->webView();
+    m_testInterfaces->setDelegate(m_webViewHost.get());
     m_testInterfaces->setWebView(m_webView);
     m_eventSender->setDelegate(m_webViewHost.get());
     m_eventSender->setWebView(m_webView);
@@ -179,6 +180,7 @@
 
 TestShell::~TestShell()
 {
+    m_testInterfaces->setDelegate(0);
     m_testInterfaces->setWebView(0);
     m_eventSender->setDelegate(0);
     m_eventSender->setWebView(0);

Modified: trunk/Tools/DumpRenderTree/chromium/WebViewHost.cpp (123660 => 123661)


--- trunk/Tools/DumpRenderTree/chromium/WebViewHost.cpp	2012-07-25 21:25:46 UTC (rev 123660)
+++ trunk/Tools/DumpRenderTree/chromium/WebViewHost.cpp	2012-07-25 21:28:42 UTC (rev 123661)
@@ -1762,6 +1762,11 @@
     m_pendingExtraData = extraData;
 }
 
+void WebViewHost::setGamepadData(const WebGamepads& pads)
+{
+    webkit_support::SetGamepadData(pads);
+}
+
 void WebViewHost::setPageTitle(const WebString&)
 {
     // Nothing to do in layout test.

Modified: trunk/Tools/DumpRenderTree/chromium/WebViewHost.h (123660 => 123661)


--- trunk/Tools/DumpRenderTree/chromium/WebViewHost.h	2012-07-25 21:25:46 UTC (rev 123660)
+++ trunk/Tools/DumpRenderTree/chromium/WebViewHost.h	2012-07-25 21:28:42 UTC (rev 123661)
@@ -99,6 +99,8 @@
     virtual void clearEditCommand() OVERRIDE;
     void setPendingExtraData(PassOwnPtr<TestShellExtraData>);
 
+    virtual void setGamepadData(const WebKit::WebGamepads&);
+
     void paintRect(const WebKit::WebRect&);
     void updatePaintRect(const WebKit::WebRect&);
     void paintInvalidatedRegion();
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to