summaryrefslogtreecommitdiffstats
path: root/webkit/support
diff options
context:
space:
mode:
authorscottmg@chromium.org <scottmg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-11-21 19:20:10 +0000
committerscottmg@chromium.org <scottmg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-11-21 19:20:10 +0000
commit1fbbf963079bc977ea041b7e50ddf4666f6fec38 (patch)
tree38aefec59ccc937b701dbb594a4d0d40ad919b4f /webkit/support
parent333808db24d63a9a52532eddd295a1c38261b067 (diff)
downloadchromium_src-1fbbf963079bc977ea041b7e50ddf4666f6fec38.zip
chromium_src-1fbbf963079bc977ea041b7e50ddf4666f6fec38.tar.gz
chromium_src-1fbbf963079bc977ea041b7e50ddf4666f6fec38.tar.bz2
Support setting fake gamepad data from WebKit. In support of DRT code to be added to WebKit here https://bugs.webkit.org/show_bug.cgi?id=69451
BUG=79050 Review URL: http://codereview.chromium.org/8561021 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@110974 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/support')
-rw-r--r--webkit/support/test_webkit_platform_support.cc11
-rw-r--r--webkit/support/test_webkit_platform_support.h7
-rw-r--r--webkit/support/webkit_support.cc4
-rw-r--r--webkit/support/webkit_support.h5
4 files changed, 26 insertions, 1 deletions
diff --git a/webkit/support/test_webkit_platform_support.cc b/webkit/support/test_webkit_platform_support.cc
index 8db2e94..5067681 100644
--- a/webkit/support/test_webkit_platform_support.cc
+++ b/webkit/support/test_webkit_platform_support.cc
@@ -19,6 +19,7 @@
#include "third_party/WebKit/Source/WebKit/chromium/public/WebData.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebDatabase.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebFileSystem.h"
+#include "third_party/WebKit/Source/WebKit/chromium/public/WebGamepads.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBFactory.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBKey.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBKeyPath.h"
@@ -84,6 +85,7 @@ TestWebKitPlatformSupport::TestWebKitPlatformSupport(bool unit_test_mode)
WebKit::WebRuntimeFeatures::enablePushState(true);
WebKit::WebRuntimeFeatures::enableNotifications(true);
WebKit::WebRuntimeFeatures::enableTouch(true);
+ WebKit::WebRuntimeFeatures::enableGamepad(true);
// Load libraries for media and enable the media player.
bool enable_media = false;
@@ -396,3 +398,12 @@ WebKit::WebAudioDevice* TestWebKitPlatformSupport::createAudioDevice(
WebKit::WebAudioDevice::RenderCallback*) {
return new WebAudioDeviceMock(sampleRate);
}
+
+void TestWebKitPlatformSupport::sampleGamepads(WebKit::WebGamepads& data) {
+ data = gamepad_data_;
+}
+
+void TestWebKitPlatformSupport::setGamepadData(
+ const WebKit::WebGamepads& data) {
+ gamepad_data_ = data;
+}
diff --git a/webkit/support/test_webkit_platform_support.h b/webkit/support/test_webkit_platform_support.h
index b774afb..ab6fedf 100644
--- a/webkit/support/test_webkit_platform_support.h
+++ b/webkit/support/test_webkit_platform_support.h
@@ -1,10 +1,11 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 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 WEBKIT_SUPPORT_TEST_WEBKIT_PLATFORM_SUPPORT_H_
#define WEBKIT_SUPPORT_TEST_WEBKIT_PLATFORM_SUPPORT_H_
+#include "third_party/WebKit/Source/WebKit/chromium/public/WebGamepads.h"
#include "webkit/glue/webfileutilities_impl.h"
#include "webkit/glue/webkitplatformsupport_impl.h"
#include "webkit/support/simple_database_system.h"
@@ -103,6 +104,9 @@ class TestWebKitPlatformSupport :
unsigned numberOfChannels, double sampleRate,
WebKit::WebAudioDevice::RenderCallback*);
+ virtual void sampleGamepads(WebKit::WebGamepads& data);
+ void setGamepadData(const WebKit::WebGamepads& data);
+
private:
TestShellWebMimeRegistryImpl mime_registry_;
MockWebClipboardImpl mock_clipboard_;
@@ -116,6 +120,7 @@ class TestWebKitPlatformSupport :
ScopedTempDir file_system_root_;
WebURLLoaderMockFactory url_loader_factory_;
bool unit_test_mode_;
+ WebKit::WebGamepads gamepad_data_;
#if defined(OS_WIN) || defined(OS_MACOSX)
WebKit::WebThemeEngine* active_theme_engine_;
diff --git a/webkit/support/webkit_support.cc b/webkit/support/webkit_support.cc
index ae33a1c..e83a935 100644
--- a/webkit/support/webkit_support.cc
+++ b/webkit/support/webkit_support.cc
@@ -646,4 +646,8 @@ void EnableWebCoreLogChannels(const std::string& channels) {
webkit_glue::EnableWebCoreLogChannels(channels);
}
+void SetGamepadData(const WebKit::WebGamepads& pads) {
+ test_environment->webkit_platform_support()->setGamepadData(pads);
+}
+
} // namespace webkit_support
diff --git a/webkit/support/webkit_support.h b/webkit/support/webkit_support.h
index 50462f2..e9a7c59 100644
--- a/webkit/support/webkit_support.h
+++ b/webkit/support/webkit_support.h
@@ -18,6 +18,7 @@ class WebApplicationCacheHost;
class WebApplicationCacheHostClient;
class WebFileSystemCallbacks;
class WebFrame;
+class WebGamepads;
class WebKitPlatformSupport;
class WebMediaPlayer;
class WebMediaPlayerClient;
@@ -221,6 +222,10 @@ double GetForegroundTabTimerInterval();
void EnableWebCoreLogChannels(const std::string& channels);
+// - Gamepad
+
+void SetGamepadData(const WebKit::WebGamepads& pads);
+
} // namespace webkit_support
#endif // WEBKIT_SUPPORT_WEBKIT_SUPPORT_H_