[Chromium] Introduce TestInterfaces to hold all the JavaScript interfaces needed...
authorabarth@webkit.org <abarth@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 17 Jul 2012 03:20:42 +0000 (03:20 +0000)
committerabarth@webkit.org <abarth@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 17 Jul 2012 03:20:42 +0000 (03:20 +0000)
https://bugs.webkit.org/show_bug.cgi?id=91312

Reviewed by Ryosuke Niwa.

Looking forward to moving more objects into TestRunner.a, we're going
to need an object to own all the interfaces and to put them through
their lifecycle.

* DumpRenderTree/DumpRenderTree.gypi:
* DumpRenderTree/chromium/TestShell.cpp:
(TestShell::initialize):
(TestShell::resetTestController):
(TestShell::bindJSObjectsToWindow):
* DumpRenderTree/chromium/TestShell.h:
(TestShell):
* DumpRenderTree/chromium/TestRunner/TestInterfaces.cpp: Added.
* DumpRenderTree/chromium/TestRunner/TestInterfaces.h: Added.

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

Tools/ChangeLog
Tools/DumpRenderTree/DumpRenderTree.gypi
Tools/DumpRenderTree/chromium/TestRunner/TestInterfaces.cpp [new file with mode: 0644]
Tools/DumpRenderTree/chromium/TestRunner/TestInterfaces.h [new file with mode: 0644]
Tools/DumpRenderTree/chromium/TestShell.cpp
Tools/DumpRenderTree/chromium/TestShell.h

index 5d989e7..a473001 100644 (file)
@@ -1,3 +1,24 @@
+2012-07-16  Adam Barth  <abarth@webkit.org>
+
+        [Chromium] Introduce TestInterfaces to hold all the JavaScript interfaces needed for LayoutTests
+        https://bugs.webkit.org/show_bug.cgi?id=91312
+
+        Reviewed by Ryosuke Niwa.
+
+        Looking forward to moving more objects into TestRunner.a, we're going
+        to need an object to own all the interfaces and to put them through
+        their lifecycle.
+
+        * DumpRenderTree/DumpRenderTree.gypi:
+        * DumpRenderTree/chromium/TestShell.cpp:
+        (TestShell::initialize):
+        (TestShell::resetTestController):
+        (TestShell::bindJSObjectsToWindow):
+        * DumpRenderTree/chromium/TestShell.h:
+        (TestShell):
+        * DumpRenderTree/chromium/TestRunner/TestInterfaces.cpp: Added.
+        * DumpRenderTree/chromium/TestRunner/TestInterfaces.h: Added.
+
 2012-07-16  Ryuan Choi  <ryuan.choi@samsung.com>
 
         [EFL][WK2] Add APIs to support theme.
index 47df2b6..7cca63d 100644 (file)
@@ -64,6 +64,8 @@
             'chromium/TestRunner/CppBoundClass.h',
             'chromium/TestRunner/CppVariant.cpp',
             'chromium/TestRunner/CppVariant.h',
+            'chromium/TestRunner/TestInterfaces.cpp',
+            'chromium/TestRunner/TestInterfaces.h',
             'chromium/TestRunner/GamepadController.cpp',
             'chromium/TestRunner/GamepadController.h',
         ],
diff --git a/Tools/DumpRenderTree/chromium/TestRunner/TestInterfaces.cpp b/Tools/DumpRenderTree/chromium/TestRunner/TestInterfaces.cpp
new file mode 100644 (file)
index 0000000..5cfb2c2
--- /dev/null
@@ -0,0 +1,57 @@
+/*
+ * Copyright (C) 2012 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *     * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "TestInterfaces.h"
+
+#include "GamepadController.h"
+#include "platform/WebString.h"
+
+using WebKit::WebFrame;
+using WebKit::WebString;
+
+TestInterfaces::TestInterfaces()
+{
+    m_gamepadController = adoptPtr(new GamepadController());
+}
+
+TestInterfaces::~TestInterfaces()
+{
+}
+
+void TestInterfaces::bindTo(WebFrame* frame)
+{
+    m_gamepadController->bindToJavascript(frame, WebString::fromUTF8("gamepadController"));
+}
+
+void TestInterfaces::resetAll()
+{
+    m_gamepadController->reset();
+}
diff --git a/Tools/DumpRenderTree/chromium/TestRunner/TestInterfaces.h b/Tools/DumpRenderTree/chromium/TestRunner/TestInterfaces.h
new file mode 100644 (file)
index 0000000..e2404ad
--- /dev/null
@@ -0,0 +1,54 @@
+/*
+ * Copyright (C) 2012 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *     * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef TestInterfaces_h
+#define TestInterfaces_h
+
+#include <wtf/OwnPtr.h>
+
+namespace WebKit {
+class WebFrame;
+}
+
+class GamepadController;
+
+class TestInterfaces {
+public:
+    TestInterfaces();
+    ~TestInterfaces();
+
+    void bindTo(WebKit::WebFrame*);
+    void resetAll();
+
+private:
+    OwnPtr<GamepadController> m_gamepadController;
+};
+
+#endif // TestInterfaces_h
index 1ecf296..a3df8d4 100644 (file)
@@ -147,8 +147,7 @@ void TestShell::initialize()
 {
     m_webPermissions = adoptPtr(new WebPermissions(this));
     m_accessibilityController = adoptPtr(new AccessibilityController(this));
-    m_gamepadController = adoptPtr(new GamepadController());
-
+    m_testInterfaces = adoptPtr(new TestInterfaces());
     m_layoutTestController = adoptPtr(new LayoutTestController(this));
     m_eventSender = adoptPtr(new EventSender(this));
     m_textInputController = adoptPtr(new TextInputController(this));
@@ -296,7 +295,7 @@ void TestShell::resetTestController()
     resetWebSettings(*webView());
     m_webPermissions->reset();
     m_accessibilityController->reset();
-    m_gamepadController->reset();
+    m_testInterfaces->resetAll();
     m_layoutTestController->reset();
     m_eventSender->reset();
     m_webViewHost->reset();
@@ -730,7 +729,7 @@ void TestShell::bindJSObjectsToWindow(WebFrame* frame)
 {
     WebTestingSupport::injectInternalsObject(frame);
     m_accessibilityController->bindToJavascript(frame, WebString::fromUTF8("accessibilityController"));
-    m_gamepadController->bindToJavascript(frame, WebString::fromUTF8("gamepadController"));
+    m_testInterfaces->bindTo(frame);
     m_layoutTestController->bindToJavascript(frame, WebString::fromUTF8("layoutTestController"));
     m_layoutTestController->bindToJavascript(frame, WebString::fromUTF8("testRunner"));
     m_eventSender->bindToJavascript(frame, WebString::fromUTF8("eventSender"));
index 8ae0c24..10d1ed3 100644 (file)
@@ -37,6 +37,7 @@
 #include "LayoutTestController.h"
 #include "NotificationPresenter.h"
 #include "TestEventPrinter.h"
+#include "TestInterfaces.h"
 #include "TextInputController.h"
 #include "WebPreferences.h"
 #include "WebViewHost.h"
@@ -95,7 +96,6 @@ public:
     LayoutTestController* layoutTestController() const { return m_layoutTestController.get(); }
     EventSender* eventSender() const { return m_eventSender.get(); }
     AccessibilityController* accessibilityController() const { return m_accessibilityController.get(); }
-    GamepadController* gamepadController() const { return m_gamepadController.get(); }
 #if ENABLE(NOTIFICATIONS)
     NotificationPresenter* notificationPresenter() const { return m_notificationPresenter.get(); }
 #endif
@@ -216,7 +216,7 @@ private:
     OwnPtr<DRTDevToolsAgent> m_drtDevToolsAgent;
     OwnPtr<DRTDevToolsClient> m_drtDevToolsClient;
     OwnPtr<AccessibilityController> m_accessibilityController;
-    OwnPtr<GamepadController> m_gamepadController;
+    OwnPtr<TestInterfaces> m_testInterfaces;
     OwnPtr<EventSender> m_eventSender;
     OwnPtr<LayoutTestController> m_layoutTestController;
     OwnPtr<TextInputController> m_textInputController;