OLD | NEW |
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/public/common/page_state.h" | 11 #include "content/public/common/page_state.h" |
| 12 #include "content/public/renderer/renderer_gamepad_provider.h" |
12 #include "content/renderer/compositor_bindings/web_layer_impl.h" | 13 #include "content/renderer/compositor_bindings/web_layer_impl.h" |
13 #include "content/renderer/history_entry.h" | 14 #include "content/renderer/history_entry.h" |
14 #include "content/renderer/history_serialization.h" | 15 #include "content/renderer/history_serialization.h" |
15 #include "content/renderer/render_frame_impl.h" | 16 #include "content/renderer/render_frame_impl.h" |
16 #include "content/renderer/render_thread_impl.h" | 17 #include "content/renderer/render_thread_impl.h" |
17 #include "content/renderer/render_view_impl.h" | 18 #include "content/renderer/render_view_impl.h" |
18 #include "content/renderer/renderer_webkitplatformsupport_impl.h" | 19 #include "content/renderer/renderer_webkitplatformsupport_impl.h" |
19 #include "content/shell/renderer/test_runner/test_common.h" | 20 #include "content/shell/renderer/test_runner/test_common.h" |
20 #include "content/shell/renderer/test_runner/web_frame_test_proxy.h" | 21 #include "content/shell/renderer/test_runner/web_frame_test_proxy.h" |
21 #include "content/shell/renderer/test_runner/web_test_proxy.h" | 22 #include "content/shell/renderer/test_runner/web_test_proxy.h" |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 | 77 |
77 void EnableWebTestProxyCreation( | 78 void EnableWebTestProxyCreation( |
78 const base::Callback<void(RenderView*, WebTestProxyBase*)>& callback) { | 79 const base::Callback<void(RenderView*, WebTestProxyBase*)>& callback) { |
79 g_callback.Get() = callback; | 80 g_callback.Get() = callback; |
80 RenderViewImpl::InstallCreateHook(CreateWebTestProxy); | 81 RenderViewImpl::InstallCreateHook(CreateWebTestProxy); |
81 RenderFrameImpl::InstallCreateHook(CreateWebFrameTestProxy); | 82 RenderFrameImpl::InstallCreateHook(CreateWebFrameTestProxy); |
82 } | 83 } |
83 | 84 |
84 void SetMockGamepadProvider(RendererGamepadProvider* provider) { | 85 void SetMockGamepadProvider(RendererGamepadProvider* provider) { |
85 RenderThreadImpl::current()->webkit_platform_support()-> | 86 RenderThreadImpl::current()->webkit_platform_support()-> |
86 set_gamepad_provider(provider); | 87 SetPlatformEventObserverForTesting(blink::WebPlatformEventGamepad, |
| 88 provider); |
87 } | 89 } |
88 | 90 |
89 void SetMockDeviceLightData(const double data) { | 91 void SetMockDeviceLightData(const double data) { |
90 RendererWebKitPlatformSupportImpl::SetMockDeviceLightDataForTesting(data); | 92 RendererWebKitPlatformSupportImpl::SetMockDeviceLightDataForTesting(data); |
91 } | 93 } |
92 | 94 |
93 void SetMockDeviceMotionData(const WebDeviceMotionData& data) { | 95 void SetMockDeviceMotionData(const WebDeviceMotionData& data) { |
94 RendererWebKitPlatformSupportImpl::SetMockDeviceMotionDataForTesting(data); | 96 RendererWebKitPlatformSupportImpl::SetMockDeviceMotionDataForTesting(data); |
95 } | 97 } |
96 | 98 |
97 void SetMockDeviceOrientationData(const WebDeviceOrientationData& data) { | 99 void SetMockDeviceOrientationData(const WebDeviceOrientationData& data) { |
98 RendererWebKitPlatformSupportImpl:: | 100 RendererWebKitPlatformSupportImpl:: |
99 SetMockDeviceOrientationDataForTesting(data); | 101 SetMockDeviceOrientationDataForTesting(data); |
100 } | 102 } |
101 | 103 |
102 void MockBatteryStatusChanged(const WebBatteryStatus& status) { | 104 void MockBatteryStatusChanged(const WebBatteryStatus& status) { |
103 RendererWebKitPlatformSupportImpl::MockBatteryStatusChangedForTesting(status); | 105 RenderThreadImpl::current()->webkit_platform_support()-> |
| 106 MockBatteryStatusChangedForTesting(status); |
104 } | 107 } |
105 | 108 |
106 void EnableRendererLayoutTestMode() { | 109 void EnableRendererLayoutTestMode() { |
107 RenderThreadImpl::current()->set_layout_test_mode(true); | 110 RenderThreadImpl::current()->set_layout_test_mode(true); |
108 } | 111 } |
109 | 112 |
110 void EnableBrowserLayoutTestMode() { | 113 void EnableBrowserLayoutTestMode() { |
111 #if defined(OS_MACOSX) | 114 #if defined(OS_MACOSX) |
112 ImageTransportSurface::SetAllowOSMesaForTesting(true); | 115 ImageTransportSurface::SetAllowOSMesaForTesting(true); |
113 PopupMenuHelper::DontShowPopupMenuForTesting(); | 116 PopupMenuHelper::DontShowPopupMenuForTesting(); |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
286 } | 289 } |
287 result.append("===============================================\n"); | 290 result.append("===============================================\n"); |
288 return result; | 291 return result; |
289 } | 292 } |
290 | 293 |
291 blink::WebLayer* InstantiateWebLayer(scoped_refptr<cc::TextureLayer> layer) { | 294 blink::WebLayer* InstantiateWebLayer(scoped_refptr<cc::TextureLayer> layer) { |
292 return new WebLayerImpl(layer); | 295 return new WebLayerImpl(layer); |
293 } | 296 } |
294 | 297 |
295 } // namespace content | 298 } // namespace content |
OLD | NEW |