Commit 1fbbf963 authored by scottmg@chromium.org's avatar scottmg@chromium.org

Support setting fake gamepad data from WebKit. In support of DRT code to be...

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
parent 333808db
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
#include "third_party/WebKit/Source/WebKit/chromium/public/WebData.h" #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/WebDatabase.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebFileSystem.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/WebIDBFactory.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBKey.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBKey.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBKeyPath.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBKeyPath.h"
...@@ -84,6 +85,7 @@ TestWebKitPlatformSupport::TestWebKitPlatformSupport(bool unit_test_mode) ...@@ -84,6 +85,7 @@ TestWebKitPlatformSupport::TestWebKitPlatformSupport(bool unit_test_mode)
WebKit::WebRuntimeFeatures::enablePushState(true); WebKit::WebRuntimeFeatures::enablePushState(true);
WebKit::WebRuntimeFeatures::enableNotifications(true); WebKit::WebRuntimeFeatures::enableNotifications(true);
WebKit::WebRuntimeFeatures::enableTouch(true); WebKit::WebRuntimeFeatures::enableTouch(true);
WebKit::WebRuntimeFeatures::enableGamepad(true);
// Load libraries for media and enable the media player. // Load libraries for media and enable the media player.
bool enable_media = false; bool enable_media = false;
...@@ -396,3 +398,12 @@ WebKit::WebAudioDevice* TestWebKitPlatformSupport::createAudioDevice( ...@@ -396,3 +398,12 @@ WebKit::WebAudioDevice* TestWebKitPlatformSupport::createAudioDevice(
WebKit::WebAudioDevice::RenderCallback*) { WebKit::WebAudioDevice::RenderCallback*) {
return new WebAudioDeviceMock(sampleRate); return new WebAudioDeviceMock(sampleRate);
} }
void TestWebKitPlatformSupport::sampleGamepads(WebKit::WebGamepads& data) {
data = gamepad_data_;
}
void TestWebKitPlatformSupport::setGamepadData(
const WebKit::WebGamepads& data) {
gamepad_data_ = data;
}
// 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 // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#ifndef WEBKIT_SUPPORT_TEST_WEBKIT_PLATFORM_SUPPORT_H_ #ifndef WEBKIT_SUPPORT_TEST_WEBKIT_PLATFORM_SUPPORT_H_
#define 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/webfileutilities_impl.h"
#include "webkit/glue/webkitplatformsupport_impl.h" #include "webkit/glue/webkitplatformsupport_impl.h"
#include "webkit/support/simple_database_system.h" #include "webkit/support/simple_database_system.h"
...@@ -103,6 +104,9 @@ class TestWebKitPlatformSupport : ...@@ -103,6 +104,9 @@ class TestWebKitPlatformSupport :
unsigned numberOfChannels, double sampleRate, unsigned numberOfChannels, double sampleRate,
WebKit::WebAudioDevice::RenderCallback*); WebKit::WebAudioDevice::RenderCallback*);
virtual void sampleGamepads(WebKit::WebGamepads& data);
void setGamepadData(const WebKit::WebGamepads& data);
private: private:
TestShellWebMimeRegistryImpl mime_registry_; TestShellWebMimeRegistryImpl mime_registry_;
MockWebClipboardImpl mock_clipboard_; MockWebClipboardImpl mock_clipboard_;
...@@ -116,6 +120,7 @@ class TestWebKitPlatformSupport : ...@@ -116,6 +120,7 @@ class TestWebKitPlatformSupport :
ScopedTempDir file_system_root_; ScopedTempDir file_system_root_;
WebURLLoaderMockFactory url_loader_factory_; WebURLLoaderMockFactory url_loader_factory_;
bool unit_test_mode_; bool unit_test_mode_;
WebKit::WebGamepads gamepad_data_;
#if defined(OS_WIN) || defined(OS_MACOSX) #if defined(OS_WIN) || defined(OS_MACOSX)
WebKit::WebThemeEngine* active_theme_engine_; WebKit::WebThemeEngine* active_theme_engine_;
......
...@@ -646,4 +646,8 @@ void EnableWebCoreLogChannels(const std::string& channels) { ...@@ -646,4 +646,8 @@ void EnableWebCoreLogChannels(const std::string& channels) {
webkit_glue::EnableWebCoreLogChannels(channels); webkit_glue::EnableWebCoreLogChannels(channels);
} }
void SetGamepadData(const WebKit::WebGamepads& pads) {
test_environment->webkit_platform_support()->setGamepadData(pads);
}
} // namespace webkit_support } // namespace webkit_support
...@@ -18,6 +18,7 @@ class WebApplicationCacheHost; ...@@ -18,6 +18,7 @@ class WebApplicationCacheHost;
class WebApplicationCacheHostClient; class WebApplicationCacheHostClient;
class WebFileSystemCallbacks; class WebFileSystemCallbacks;
class WebFrame; class WebFrame;
class WebGamepads;
class WebKitPlatformSupport; class WebKitPlatformSupport;
class WebMediaPlayer; class WebMediaPlayer;
class WebMediaPlayerClient; class WebMediaPlayerClient;
...@@ -221,6 +222,10 @@ double GetForegroundTabTimerInterval(); ...@@ -221,6 +222,10 @@ double GetForegroundTabTimerInterval();
void EnableWebCoreLogChannels(const std::string& channels); void EnableWebCoreLogChannels(const std::string& channels);
// - Gamepad
void SetGamepadData(const WebKit::WebGamepads& pads);
} // namespace webkit_support } // namespace webkit_support
#endif // WEBKIT_SUPPORT_WEBKIT_SUPPORT_H_ #endif // WEBKIT_SUPPORT_WEBKIT_SUPPORT_H_
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment