summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorb.kelemen@samsung.com <b.kelemen@samsung.com@0039d316-1c4b-4281-b951-d872f2087c98>2014-06-20 16:57:06 +0000
committerb.kelemen@samsung.com <b.kelemen@samsung.com@0039d316-1c4b-4281-b951-d872f2087c98>2014-06-20 16:57:06 +0000
commit078780b963c47f9b3863f14c169f779d073e6267 (patch)
tree67de0bd472fa4d1f56d191fbb0523d35fd912cdd
parent332d17d2d2889750fd87da90c2d9a796163e981c (diff)
downloadchromium_src-078780b963c47f9b3863f14c169f779d073e6267.zip
chromium_src-078780b963c47f9b3863f14c169f779d073e6267.tar.gz
chromium_src-078780b963c47f9b3863f14c169f779d073e6267.tar.bz2
Gamepad: make page visibility behavior layout testable
This CL refactors testing infrastructure for gamepad so that we can actually write a layout test that would fail if Blink doesn't honor visibility state. Now Platform::setGamepadListener is now hooked to GamepadController. BUG=344556 Review URL: https://codereview.chromium.org/304403002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@278723 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--content/public/renderer/renderer_gamepad_provider.h30
-rw-r--r--content/public/test/layouttest_support.h12
-rw-r--r--content/renderer/gamepad_shared_memory_reader.cc7
-rw-r--r--content/renderer/gamepad_shared_memory_reader.h18
-rw-r--r--content/renderer/render_thread_impl.cc7
-rw-r--r--content/renderer/render_thread_impl.h5
-rw-r--r--content/renderer/renderer_webkitplatformsupport_impl.cc41
-rw-r--r--content/renderer/renderer_webkitplatformsupport_impl.h18
-rw-r--r--content/shell/renderer/test_runner/WebTestDelegate.h11
-rw-r--r--content/shell/renderer/test_runner/gamepad_controller.cc41
-rw-r--r--content/shell/renderer/test_runner/gamepad_controller.h21
-rw-r--r--content/shell/renderer/webkit_test_runner.cc17
-rw-r--r--content/shell/renderer/webkit_test_runner.h6
-rw-r--r--content/test/layouttest_support.cc13
14 files changed, 120 insertions, 127 deletions
diff --git a/content/public/renderer/renderer_gamepad_provider.h b/content/public/renderer/renderer_gamepad_provider.h
new file mode 100644
index 0000000..ba6ec9f
--- /dev/null
+++ b/content/public/renderer/renderer_gamepad_provider.h
@@ -0,0 +1,30 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CONTENT_GAMEPAD_RENDERER_PROVIDER_H_
+#define CONTENT_GAMEPAD_RENDERER_PROVIDER_H_
+
+namespace blink {
+class WebGamepadListener;
+class WebGamepads;
+}
+
+namespace content {
+
+// Provides gamepad data and events for blink.
+class RendererGamepadProvider {
+ public:
+ // Provides latest snapshot of gamepads.
+ virtual void SampleGamepads(blink::WebGamepads& gamepads) = 0;
+
+ // Registers listener for be notified of events.
+ virtual void SetGamepadListener(blink::WebGamepadListener* listener) = 0;
+
+ protected:
+ virtual ~RendererGamepadProvider() {}
+};
+
+} // namespace content
+
+#endif
diff --git a/content/public/test/layouttest_support.h b/content/public/test/layouttest_support.h
index f374bdd..db751c8 100644
--- a/content/public/test/layouttest_support.h
+++ b/content/public/test/layouttest_support.h
@@ -26,6 +26,7 @@ namespace content {
class PageState;
class RenderFrame;
+class RendererGamepadProvider;
class RenderView;
class WebTestProxyBase;
@@ -44,15 +45,8 @@ void EnableRendererLayoutTestMode();
void EnableWebTestProxyCreation(
const base::Callback<void(RenderView*, WebTestProxyBase*)>& callback);
-// Sets the WebGamepads that should be returned by
-// WebKitPlatformSupport::sampleGamepads().
-void SetMockGamepads(const blink::WebGamepads& pads);
-
-// Notifies blink about a new gamepad.
-void MockGamepadConnected(int index, const blink::WebGamepad& pad);
-
-// Notifies blink that a gamepad has been disconnected.
-void MockGamepadDisconnected(int index, const blink::WebGamepad& pad);
+// Sets gamepad provider to be used for layout tests.
+void SetMockGamepadProvider(RendererGamepadProvider* provider);
// Sets WebDeviceMotionData that should be used when registering
// a listener through WebKitPlatformSupport::setDeviceMotionListener().
diff --git a/content/renderer/gamepad_shared_memory_reader.cc b/content/renderer/gamepad_shared_memory_reader.cc
index 3bfe0d0..e74f025 100644
--- a/content/renderer/gamepad_shared_memory_reader.cc
+++ b/content/renderer/gamepad_shared_memory_reader.cc
@@ -6,19 +6,22 @@
#include "base/debug/trace_event.h"
#include "base/metrics/histogram.h"
+#include "content/common/gamepad_hardware_buffer.h"
#include "content/common/gamepad_user_gesture.h"
#include "content/public/renderer/render_thread.h"
-#include "content/common/gamepad_hardware_buffer.h"
+#include "content/renderer/renderer_webkitplatformsupport_impl.h"
#include "ipc/ipc_sync_message_filter.h"
#include "third_party/WebKit/public/platform/WebGamepadListener.h"
namespace content {
-GamepadSharedMemoryReader::GamepadSharedMemoryReader()
+GamepadSharedMemoryReader::GamepadSharedMemoryReader(
+ RendererWebKitPlatformSupportImpl* webkit_platform_support)
: gamepad_hardware_buffer_(NULL),
gamepad_listener_(NULL),
is_polling_(false),
ever_interacted_with_(false) {
+ webkit_platform_support->set_gamepad_provider(this);
}
void GamepadSharedMemoryReader::StartPollingIfNecessary() {
diff --git a/content/renderer/gamepad_shared_memory_reader.h b/content/renderer/gamepad_shared_memory_reader.h
index 3846176..eb63867 100644
--- a/content/renderer/gamepad_shared_memory_reader.h
+++ b/content/renderer/gamepad_shared_memory_reader.h
@@ -9,21 +9,27 @@
#include "base/memory/shared_memory.h"
#include "content/common/gamepad_messages.h"
#include "content/public/renderer/render_process_observer.h"
+#include "content/public/renderer/renderer_gamepad_provider.h"
#include "third_party/WebKit/public/platform/WebGamepads.h"
-namespace blink { class WebGamepadListener; }
-
namespace content {
struct GamepadHardwareBuffer;
+class RendererWebKitPlatformSupportImpl;
-class GamepadSharedMemoryReader : public RenderProcessObserver {
+class GamepadSharedMemoryReader
+ : public RenderProcessObserver,
+ public RendererGamepadProvider {
public:
- GamepadSharedMemoryReader();
+ GamepadSharedMemoryReader(
+ RendererWebKitPlatformSupportImpl* webkit_platform_support);
virtual ~GamepadSharedMemoryReader();
- void SampleGamepads(blink::WebGamepads& gamepads);
- void SetGamepadListener(blink::WebGamepadListener* listener);
+ // RendererGamepadProvider implementation.
+ virtual void SampleGamepads(
+ blink::WebGamepads& gamepads) OVERRIDE;
+ virtual void SetGamepadListener(
+ blink::WebGamepadListener* listener) OVERRIDE;
// RenderProcessObserver implementation.
virtual bool OnControlMessageReceived(const IPC::Message& message) OVERRIDE;
diff --git a/content/renderer/render_thread_impl.cc b/content/renderer/render_thread_impl.cc
index 8934a31..6e124b3 100644
--- a/content/renderer/render_thread_impl.cc
+++ b/content/renderer/render_thread_impl.cc
@@ -405,9 +405,6 @@ void RenderThreadImpl::Init() {
AddFilter((new EmbeddedWorkerContextMessageFilter())->GetFilter());
- gamepad_shared_memory_reader_.reset(new GamepadSharedMemoryReader());
- AddObserver(gamepad_shared_memory_reader_.get());
-
GetContentClient()->renderer()->RenderThreadStarted();
InitSkiaEventTracer();
@@ -792,6 +789,10 @@ void RenderThreadImpl::EnsureWebKitInitialized() {
CompositorOutputSurface::CreateFilter(output_surface_loop.get());
AddFilter(compositor_output_surface_filter_.get());
+ gamepad_shared_memory_reader_.reset(
+ new GamepadSharedMemoryReader(webkit_platform_support_.get()));
+ AddObserver(gamepad_shared_memory_reader_.get());
+
RenderThreadImpl::RegisterSchemes();
EnableBlinkPlatformLogChannels(
diff --git a/content/renderer/render_thread_impl.h b/content/renderer/render_thread_impl.h
index 4afe3ed..d8d50c8 100644
--- a/content/renderer/render_thread_impl.h
+++ b/content/renderer/render_thread_impl.h
@@ -192,6 +192,11 @@ class CONTENT_EXPORT RenderThreadImpl : public RenderThread,
layout_test_mode_ = layout_test_mode;
}
+ RendererWebKitPlatformSupportImpl* webkit_platform_support() const {
+ DCHECK(webkit_platform_support_);
+ return webkit_platform_support_.get();
+ }
+
IPC::ForwardingMessageFilter* compositor_output_surface_filter() const {
return compositor_output_surface_filter_.get();
}
diff --git a/content/renderer/renderer_webkitplatformsupport_impl.cc b/content/renderer/renderer_webkitplatformsupport_impl.cc
index fd13072..33fa336 100644
--- a/content/renderer/renderer_webkitplatformsupport_impl.cc
+++ b/content/renderer/renderer_webkitplatformsupport_impl.cc
@@ -141,9 +141,6 @@ namespace content {
namespace {
static bool g_sandbox_enabled = true;
-static blink::WebGamepadListener* web_gamepad_listener = NULL;
-base::LazyInstance<WebGamepads>::Leaky g_test_gamepads =
- LAZY_INSTANCE_INITIALIZER;
base::LazyInstance<blink::WebDeviceMotionData>::Leaky
g_test_device_motion_data = LAZY_INSTANCE_INITIALIZER;
base::LazyInstance<blink::WebDeviceOrientationData>::Leaky
@@ -231,7 +228,8 @@ RendererWebKitPlatformSupportImpl::RendererWebKitPlatformSupportImpl()
sudden_termination_disables_(0),
plugin_refresh_allowed_(true),
child_thread_loop_(base::MessageLoopProxy::current()),
- web_scrollbar_behavior_(new WebScrollbarBehaviorImpl) {
+ web_scrollbar_behavior_(new WebScrollbarBehaviorImpl),
+ gamepad_provider_(NULL) {
if (g_sandbox_enabled && sandboxEnabled()) {
sandbox_support_.reset(
new RendererWebKitPlatformSupportImpl::SandboxSupport);
@@ -885,19 +883,14 @@ WebBlobRegistry* RendererWebKitPlatformSupportImpl::blobRegistry() {
//------------------------------------------------------------------------------
void RendererWebKitPlatformSupportImpl::sampleGamepads(WebGamepads& gamepads) {
- if (g_test_gamepads == 0) {
- RenderThreadImpl::current()->gamepad_shared_memory_reader()->
- SampleGamepads(gamepads);
- } else {
- gamepads = g_test_gamepads.Get();
- }
+ DCHECK(gamepad_provider_);
+ gamepad_provider_->SampleGamepads(gamepads);
}
void RendererWebKitPlatformSupportImpl::setGamepadListener(
blink::WebGamepadListener* listener) {
- web_gamepad_listener = listener;
- RenderThreadImpl::current()->gamepad_shared_memory_reader()->
- SetGamepadListener(listener);
+ DCHECK(gamepad_provider_);
+ gamepad_provider_->SetGamepadListener(listener);
}
//------------------------------------------------------------------------------
@@ -945,28 +938,6 @@ bool RendererWebKitPlatformSupportImpl::SetSandboxEnabledForTesting(
return was_enabled;
}
-// static
-void RendererWebKitPlatformSupportImpl::SetMockGamepadsForTesting(
- const WebGamepads& pads) {
- g_test_gamepads.Get() = pads;
-}
-
-// static
-void RendererWebKitPlatformSupportImpl::MockGamepadConnected(
- int index,
- const WebGamepad& pad) {
- if (web_gamepad_listener)
- web_gamepad_listener->didConnectGamepad(index, pad);
-}
-
-// static
-void RendererWebKitPlatformSupportImpl::MockGamepadDisconnected(
- int index,
- const WebGamepad& pad) {
- if (web_gamepad_listener)
- web_gamepad_listener->didDisconnectGamepad(index, pad);
-}
-
//------------------------------------------------------------------------------
blink::WebSpeechSynthesizer*
diff --git a/content/renderer/renderer_webkitplatformsupport_impl.h b/content/renderer/renderer_webkitplatformsupport_impl.h
index ee0ccb1..66b269a 100644
--- a/content/renderer/renderer_webkitplatformsupport_impl.h
+++ b/content/renderer/renderer_webkitplatformsupport_impl.h
@@ -41,6 +41,7 @@ class DeviceOrientationEventPump;
class QuotaMessageFilter;
class RendererClipboardClient;
class RenderView;
+class RendererGamepadProvider;
class ThreadSafeSender;
class WebClipboardImpl;
class WebDatabaseObserverImpl;
@@ -148,6 +149,10 @@ class CONTENT_EXPORT RendererWebKitPlatformSupportImpl
virtual void setBatteryStatusListener(
blink::WebBatteryStatusListener* listener);
+ void set_gamepad_provider(RendererGamepadProvider* provider) {
+ gamepad_provider_ = provider;
+ }
+
// Disables the WebSandboxSupport implementation for testing.
// Tests that do not set up a full sandbox environment should call
// SetSandboxEnabledForTesting(false) _before_ creating any instances
@@ -157,17 +162,6 @@ class CONTENT_EXPORT RendererWebKitPlatformSupportImpl
// Returns the previous |enable| value.
static bool SetSandboxEnabledForTesting(bool enable);
- // Set WebGamepads to return when sampleGamepads() is invoked.
- static void SetMockGamepadsForTesting(const blink::WebGamepads& pads);
-
- // Notifies blink::WebGamepadListener about a new gamepad if a listener
- // has been set via setGamepadListener.
- static void MockGamepadConnected(int index, const blink::WebGamepad& pad);
-
- // Notifies blink::WebGamepadListener that a gamepad has been disconnected if
- // a listener has been set via setGamepadListener.
- static void MockGamepadDisconnected(int index, const blink::WebGamepad& pad);
-
// Set WebDeviceMotionData to return when setDeviceMotionListener is invoked.
static void SetMockDeviceMotionDataForTesting(
const blink::WebDeviceMotionData& data);
@@ -236,6 +230,8 @@ class CONTENT_EXPORT RendererWebKitPlatformSupportImpl
scoped_ptr<BatteryStatusDispatcher> battery_status_dispatcher_;
+ RendererGamepadProvider* gamepad_provider_;
+
DISALLOW_COPY_AND_ASSIGN(RendererWebKitPlatformSupportImpl);
};
diff --git a/content/shell/renderer/test_runner/WebTestDelegate.h b/content/shell/renderer/test_runner/WebTestDelegate.h
index 31a9ad7..8d9f004 100644
--- a/content/shell/renderer/test_runner/WebTestDelegate.h
+++ b/content/shell/renderer/test_runner/WebTestDelegate.h
@@ -29,6 +29,7 @@ struct WebURLError;
namespace content {
+class RendererGamepadProvider;
class WebTask;
class WebTestProxyBase;
struct TestPreferences;
@@ -40,14 +41,8 @@ public:
virtual void clearEditCommand() = 0;
virtual void setEditCommand(const std::string& name, const std::string& value) = 0;
- // Set the gamepads to return from Platform::sampleGamepads().
- virtual void setGamepadData(const blink::WebGamepads&) = 0;
-
- // Notifies blink about a new gamepad.
- virtual void didConnectGamepad(int index, const blink::WebGamepad&) = 0;
-
- // Notifies blink that a gamepad has been disconnected.
- virtual void didDisconnectGamepad(int index, const blink::WebGamepad&) = 0;
+ // Sets gamepad provider to be used for tests.
+ virtual void setGamepadProvider(RendererGamepadProvider*) = 0;
// Set data to return when registering via Platform::setDeviceMotionListener().
virtual void setDeviceMotionData(const blink::WebDeviceMotionData&) = 0;
diff --git a/content/shell/renderer/test_runner/gamepad_controller.cc b/content/shell/renderer/test_runner/gamepad_controller.cc
index 7efe712..bbf648c 100644
--- a/content/shell/renderer/test_runner/gamepad_controller.cc
+++ b/content/shell/renderer/test_runner/gamepad_controller.cc
@@ -10,6 +10,7 @@
#include "gin/handle.h"
#include "gin/object_template_builder.h"
#include "gin/wrappable.h"
+#include "third_party/WebKit/public/platform/WebGamepadListener.h"
#include "third_party/WebKit/public/web/WebFrame.h"
#include "third_party/WebKit/public/web/WebKit.h"
#include "v8/include/v8.h"
@@ -136,7 +137,9 @@ void GamepadControllerBindings::SetAxisData(int index, int axis, double data) {
controller_->SetAxisData(index, axis, data);
}
-GamepadController::GamepadController() : delegate_(NULL), weak_factory_(this) {
+GamepadController::GamepadController()
+ : listener_(NULL),
+ weak_factory_(this) {
Reset();
}
@@ -151,7 +154,16 @@ void GamepadController::Install(WebFrame* frame) {
}
void GamepadController::SetDelegate(WebTestDelegate* delegate) {
- delegate_ = delegate;
+ delegate->setGamepadProvider(this);
+}
+
+void GamepadController::SampleGamepads(blink::WebGamepads& gamepads) {
+ memcpy(&gamepads, &gamepads_, sizeof(blink::WebGamepads));
+}
+
+void GamepadController::SetGamepadListener(
+ blink::WebGamepadListener* listener) {
+ listener_ = listener;
}
void GamepadController::Connect(int index) {
@@ -163,16 +175,15 @@ void GamepadController::Connect(int index) {
if (gamepads_.items[i].connected)
gamepads_.length = i + 1;
}
- if (delegate_)
- delegate_->setGamepadData(gamepads_);
}
void GamepadController::DispatchConnected(int index) {
- if (index < 0 || index >= static_cast<int>(WebGamepads::itemsLengthCap))
+ if (index < 0 || index >= static_cast<int>(WebGamepads::itemsLengthCap)
+ || !gamepads_.items[index].connected)
return;
const WebGamepad& pad = gamepads_.items[index];
- if (pad.connected && delegate_)
- delegate_->didConnectGamepad(index, pad);
+ if (listener_)
+ listener_->didConnectGamepad(index, pad);
}
void GamepadController::Disconnect(int index) {
@@ -185,10 +196,8 @@ void GamepadController::Disconnect(int index) {
if (gamepads_.items[i].connected)
gamepads_.length = i + 1;
}
- if (delegate_) {
- delegate_->setGamepadData(gamepads_);
- delegate_->didDisconnectGamepad(index, pad);
- }
+ if (listener_)
+ listener_->didDisconnectGamepad(index, pad);
}
void GamepadController::SetId(int index, const std::string& src) {
@@ -198,8 +207,6 @@ void GamepadController::SetId(int index, const std::string& src) {
memset(gamepads_.items[index].id, 0, sizeof(gamepads_.items[index].id));
for (unsigned i = 0; *p && i < WebGamepad::idLengthCap - 1; ++i)
gamepads_.items[index].id[i] = *p++;
- if (delegate_)
- delegate_->setGamepadData(gamepads_);
}
void GamepadController::SetButtonCount(int index, int buttons) {
@@ -208,8 +215,6 @@ void GamepadController::SetButtonCount(int index, int buttons) {
if (buttons < 0 || buttons >= static_cast<int>(WebGamepad::buttonsLengthCap))
return;
gamepads_.items[index].buttonsLength = buttons;
- if (delegate_)
- delegate_->setGamepadData(gamepads_);
}
void GamepadController::SetButtonData(int index, int button, double data) {
@@ -219,8 +224,6 @@ void GamepadController::SetButtonData(int index, int button, double data) {
return;
gamepads_.items[index].buttons[button].value = data;
gamepads_.items[index].buttons[button].pressed = data > 0.1f;
- if (delegate_)
- delegate_->setGamepadData(gamepads_);
}
void GamepadController::SetAxisCount(int index, int axes) {
@@ -229,8 +232,6 @@ void GamepadController::SetAxisCount(int index, int axes) {
if (axes < 0 || axes >= static_cast<int>(WebGamepad::axesLengthCap))
return;
gamepads_.items[index].axesLength = axes;
- if (delegate_)
- delegate_->setGamepadData(gamepads_);
}
void GamepadController::SetAxisData(int index, int axis, double data) {
@@ -239,8 +240,6 @@ void GamepadController::SetAxisData(int index, int axis, double data) {
if (axis < 0 || axis >= static_cast<int>(WebGamepad::axesLengthCap))
return;
gamepads_.items[index].axes[axis] = data;
- if (delegate_)
- delegate_->setGamepadData(gamepads_);
}
} // namespace content
diff --git a/content/shell/renderer/test_runner/gamepad_controller.h b/content/shell/renderer/test_runner/gamepad_controller.h
index b648fd0..99b7efc 100644
--- a/content/shell/renderer/test_runner/gamepad_controller.h
+++ b/content/shell/renderer/test_runner/gamepad_controller.h
@@ -5,26 +5,38 @@
#ifndef CONTENT_SHELL_RENDERER_TEST_RUNNER_GAMEPAD_CONTROLLER_H_
#define CONTENT_SHELL_RENDERER_TEST_RUNNER_GAMEPAD_CONTROLLER_H_
+#include <map>
+
#include "base/memory/weak_ptr.h"
+#include "content/public/renderer/renderer_gamepad_provider.h"
#include "third_party/WebKit/public/platform/WebGamepads.h"
namespace blink {
class WebFrame;
+class WebGamepadListener;
}
namespace content {
class WebTestDelegate;
-class GamepadController : public base::SupportsWeakPtr<GamepadController> {
+class GamepadController
+ : public base::SupportsWeakPtr<GamepadController>,
+ public RendererGamepadProvider {
public:
GamepadController();
- ~GamepadController();
+ virtual ~GamepadController();
void Reset();
void Install(blink::WebFrame* frame);
void SetDelegate(WebTestDelegate* delegate);
+ // RendererGamepadProvider implementation.
+ virtual void SampleGamepads(
+ blink::WebGamepads& gamepads) OVERRIDE;
+ virtual void SetGamepadListener(
+ blink::WebGamepadListener* listener) OVERRIDE;
+
private:
friend class GamepadControllerBindings;
@@ -46,7 +58,10 @@ class GamepadController : public base::SupportsWeakPtr<GamepadController> {
blink::WebGamepads gamepads_;
- WebTestDelegate* delegate_;
+ blink::WebGamepadListener* listener_;
+
+ // Mapping from gamepad index to connection state.
+ std::map<int, bool> pending_changes_;
base::WeakPtrFactory<GamepadController> weak_factory_;
diff --git a/content/shell/renderer/webkit_test_runner.cc b/content/shell/renderer/webkit_test_runner.cc
index b251935..f6247ba 100644
--- a/content/shell/renderer/webkit_test_runner.cc
+++ b/content/shell/renderer/webkit_test_runner.cc
@@ -201,20 +201,9 @@ void WebKitTestRunner::setEditCommand(const std::string& name,
render_view()->SetEditCommandForNextKeyEvent(name, value);
}
-void WebKitTestRunner::setGamepadData(const WebGamepads& gamepads) {
- SetMockGamepads(gamepads);
-}
-
-void WebKitTestRunner::didConnectGamepad(
- int index,
- const blink::WebGamepad& gamepad) {
- MockGamepadConnected(index, gamepad);
-}
-
-void WebKitTestRunner::didDisconnectGamepad(
- int index,
- const blink::WebGamepad& gamepad) {
- MockGamepadDisconnected(index, gamepad);
+void WebKitTestRunner::setGamepadProvider(
+ RendererGamepadProvider* provider) {
+ SetMockGamepadProvider(provider);
}
void WebKitTestRunner::setDeviceMotionData(const WebDeviceMotionData& data) {
diff --git a/content/shell/renderer/webkit_test_runner.h b/content/shell/renderer/webkit_test_runner.h
index 6ed22a2..9cd1941 100644
--- a/content/shell/renderer/webkit_test_runner.h
+++ b/content/shell/renderer/webkit_test_runner.h
@@ -55,11 +55,7 @@ class WebKitTestRunner : public RenderViewObserver,
virtual void clearEditCommand() OVERRIDE;
virtual void setEditCommand(const std::string& name,
const std::string& value) OVERRIDE;
- virtual void setGamepadData(const blink::WebGamepads& gamepads) OVERRIDE;
- virtual void didConnectGamepad(int index,
- const blink::WebGamepad& gamepad) OVERRIDE;
- virtual void didDisconnectGamepad(int index,
- const blink::WebGamepad& gamepad) OVERRIDE;
+ virtual void setGamepadProvider(RendererGamepadProvider*) OVERRIDE;
virtual void setDeviceMotionData(
const blink::WebDeviceMotionData& data) OVERRIDE;
virtual void setDeviceOrientationData(
diff --git a/content/test/layouttest_support.cc b/content/test/layouttest_support.cc
index 3c43e8b..7e87254 100644
--- a/content/test/layouttest_support.cc
+++ b/content/test/layouttest_support.cc
@@ -81,16 +81,9 @@ void EnableWebTestProxyCreation(
RenderFrameImpl::InstallCreateHook(CreateWebFrameTestProxy);
}
-void SetMockGamepads(const WebGamepads& pads) {
- RendererWebKitPlatformSupportImpl::SetMockGamepadsForTesting(pads);
-}
-
-void MockGamepadConnected(int index, const WebGamepad& pad) {
- RendererWebKitPlatformSupportImpl::MockGamepadConnected(index, pad);
-}
-
-void MockGamepadDisconnected(int index, const WebGamepad& pad) {
- RendererWebKitPlatformSupportImpl::MockGamepadDisconnected(index, pad);
+void SetMockGamepadProvider(RendererGamepadProvider* provider) {
+ RenderThreadImpl::current()->webkit_platform_support()->
+ set_gamepad_provider(provider);
}
void SetMockDeviceMotionData(const WebDeviceMotionData& data) {