Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1847)

Unified Diff: content/renderer/renderer_webkitplatformsupport_impl.cc

Issue 14682023: Add plumbing for testing API for MockWebDeviceMotionHandler injection. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: plumbing without the WebDeviceMotionProvider Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/renderer/renderer_webkitplatformsupport_impl.h ('k') | content/shell/renderer/webkit_test_runner.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/renderer_webkitplatformsupport_impl.cc
diff --git a/content/renderer/renderer_webkitplatformsupport_impl.cc b/content/renderer/renderer_webkitplatformsupport_impl.cc
index 12dfa0a49a0bd9006dbbc43eddd3eb8abdd55620..e8e578b28b981b284266f17b7fdf93d4b603d510 100644
--- a/content/renderer/renderer_webkitplatformsupport_impl.cc
+++ b/content/renderer/renderer_webkitplatformsupport_impl.cc
@@ -39,6 +39,7 @@
#include "media/audio/audio_output_device.h"
#include "media/base/audio_hardware_config.h"
#include "third_party/WebKit/Source/Platform/chromium/public/WebBlobRegistry.h"
+#include "third_party/WebKit/Source/Platform/chromium/public/WebDeviceMotionListener.h"
#include "third_party/WebKit/Source/Platform/chromium/public/WebFileInfo.h"
#include "third_party/WebKit/Source/Platform/chromium/public/WebGamepads.h"
#include "third_party/WebKit/Source/Platform/chromium/public/WebHyphenator.h"
@@ -82,6 +83,7 @@
using WebKit::WebAudioDevice;
using WebKit::WebBlobRegistry;
+using WebKit::WebDeviceMotionListener;
using WebKit::WebFileInfo;
using WebKit::WebFileSystem;
using WebKit::WebFrame;
@@ -103,6 +105,9 @@ static bool g_sandbox_enabled = true;
base::LazyInstance<WebGamepads>::Leaky g_test_gamepads =
LAZY_INSTANCE_INITIALIZER;
+base::LazyInstance<scoped_ptr<WebDeviceMotionListener> > g_test_device_motion =
+ LAZY_INSTANCE_INITIALIZER;
+
//------------------------------------------------------------------------------
class RendererWebKitPlatformSupportImpl::MimeRegistry
@@ -923,4 +928,22 @@ WebKit::WebGraphicsContext3DProvider* RendererWebKitPlatformSupportImpl::
shared_offscreen_context_);
}
+//------------------------------------------------------------------------------
+
+void RendererWebKitPlatformSupportImpl::setDeviceMotionListener(
+ WebKit::WebDeviceMotionListener* listener) {
+ if (g_test_device_motion.Get().get() == 0) {
+ // TODO(timvolodine) provide implementation and instantiation of the
+ // event pump.
+ } else {
+ g_test_device_motion.Get()->setListener(listener);
+ }
+}
+
+// static
+void RendererWebKitPlatformSupportImpl::SetMockDeviceMotionListenerForTesting(
+ WebDeviceMotionListener* listener) {
+ g_test_device_motion.Get().reset(listener);
+}
+
} // namespace content
« no previous file with comments | « content/renderer/renderer_webkitplatformsupport_impl.h ('k') | content/shell/renderer/webkit_test_runner.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698