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

Side by Side Diff: content/test/layouttest_support.cc

Issue 207323002: Gamepad API: add test support for gamepad events (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 9 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/public/test/layouttest_support.h" 5 #include "content/public/test/layouttest_support.h"
6 6
7 #include "base/callback.h" 7 #include "base/callback.h"
8 #include "base/lazy_instance.h" 8 #include "base/lazy_instance.h"
9 #include "content/browser/renderer_host/render_widget_host_impl.h" 9 #include "content/browser/renderer_host/render_widget_host_impl.h"
10 #include "content/common/gpu/image_transport_surface.h" 10 #include "content/common/gpu/image_transport_surface.h"
11 #include "content/renderer/render_thread_impl.h" 11 #include "content/renderer/render_thread_impl.h"
12 #include "content/renderer/render_view_impl.h" 12 #include "content/renderer/render_view_impl.h"
13 #include "content/renderer/renderer_webkitplatformsupport_impl.h" 13 #include "content/renderer/renderer_webkitplatformsupport_impl.h"
14 #include "content/shell/renderer/test_runner/WebFrameTestProxy.h" 14 #include "content/shell/renderer/test_runner/WebFrameTestProxy.h"
15 #include "content/shell/renderer/test_runner/WebTestProxy.h" 15 #include "content/shell/renderer/test_runner/WebTestProxy.h"
16 #include "content/test/test_media_stream_client.h" 16 #include "content/test/test_media_stream_client.h"
17 #include "third_party/WebKit/public/platform/WebDeviceMotionData.h" 17 #include "third_party/WebKit/public/platform/WebDeviceMotionData.h"
18 #include "third_party/WebKit/public/platform/WebDeviceOrientationData.h" 18 #include "third_party/WebKit/public/platform/WebDeviceOrientationData.h"
19 #include "third_party/WebKit/public/platform/WebGamepads.h" 19 #include "third_party/WebKit/public/platform/WebGamepads.h"
20 20
21 #if defined(OS_MACOSX) 21 #if defined(OS_MACOSX)
22 #include "content/browser/renderer_host/popup_menu_helper_mac.h" 22 #include "content/browser/renderer_host/popup_menu_helper_mac.h"
23 #endif 23 #endif
24 24
25 using blink::WebDeviceMotionData; 25 using blink::WebDeviceMotionData;
26 using blink::WebDeviceOrientationData; 26 using blink::WebDeviceOrientationData;
27 using blink::WebGamepad;
27 using blink::WebGamepads; 28 using blink::WebGamepads;
28 using blink::WebRect; 29 using blink::WebRect;
29 using blink::WebSize; 30 using blink::WebSize;
30 using WebTestRunner::WebFrameTestProxy; 31 using WebTestRunner::WebFrameTestProxy;
31 using WebTestRunner::WebTestProxy; 32 using WebTestRunner::WebTestProxy;
32 using WebTestRunner::WebTestProxyBase; 33 using WebTestRunner::WebTestProxyBase;
33 34
34 namespace content { 35 namespace content {
35 36
36 namespace { 37 namespace {
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 const base::Callback<void(RenderView*, WebTestProxyBase*)>& callback) { 76 const base::Callback<void(RenderView*, WebTestProxyBase*)>& callback) {
76 g_callback.Get() = callback; 77 g_callback.Get() = callback;
77 RenderViewImpl::InstallCreateHook(CreateWebTestProxy); 78 RenderViewImpl::InstallCreateHook(CreateWebTestProxy);
78 RenderFrameImpl::InstallCreateHook(CreateWebFrameTestProxy); 79 RenderFrameImpl::InstallCreateHook(CreateWebFrameTestProxy);
79 } 80 }
80 81
81 void SetMockGamepads(const WebGamepads& pads) { 82 void SetMockGamepads(const WebGamepads& pads) {
82 RendererWebKitPlatformSupportImpl::SetMockGamepadsForTesting(pads); 83 RendererWebKitPlatformSupportImpl::SetMockGamepadsForTesting(pads);
83 } 84 }
84 85
86 void MockGamepadConnected(int index, const WebGamepad& pad) {
87 RendererWebKitPlatformSupportImpl::MockGamepadConnected(index, pad);
88 }
89
90 void MockGamepadDisconnected(int index, const WebGamepad& pad) {
91 RendererWebKitPlatformSupportImpl::MockGamepadDisconnected(index, pad);
92 }
93
85 void SetMockDeviceMotionData(const WebDeviceMotionData& data) { 94 void SetMockDeviceMotionData(const WebDeviceMotionData& data) {
86 RendererWebKitPlatformSupportImpl::SetMockDeviceMotionDataForTesting(data); 95 RendererWebKitPlatformSupportImpl::SetMockDeviceMotionDataForTesting(data);
87 } 96 }
88 97
89 void SetMockDeviceOrientationData(const WebDeviceOrientationData& data) { 98 void SetMockDeviceOrientationData(const WebDeviceOrientationData& data) {
90 RendererWebKitPlatformSupportImpl:: 99 RendererWebKitPlatformSupportImpl::
91 SetMockDeviceOrientationDataForTesting(data); 100 SetMockDeviceOrientationDataForTesting(data);
92 } 101 }
93 102
94 void SetMockScreenOrientation(const blink::WebScreenOrientation& orientation) { 103 void SetMockScreenOrientation(const blink::WebScreenOrientation& orientation) {
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 DisableAutoResizeForTesting(new_size); 160 DisableAutoResizeForTesting(new_size);
152 } 161 }
153 162
154 void UseMockMediaStreams(RenderView* render_view) { 163 void UseMockMediaStreams(RenderView* render_view) {
155 RenderViewImpl* render_view_impl = static_cast<RenderViewImpl*>(render_view); 164 RenderViewImpl* render_view_impl = static_cast<RenderViewImpl*>(render_view);
156 render_view_impl->SetMediaStreamClientForTesting( 165 render_view_impl->SetMediaStreamClientForTesting(
157 new TestMediaStreamClient(render_view_impl)); 166 new TestMediaStreamClient(render_view_impl));
158 } 167 }
159 168
160 } // namespace content 169 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698