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 "cc/blink/web_layer_impl.h" | 9 #include "cc/blink/web_layer_impl.h" |
10 #include "content/browser/renderer_host/render_widget_host_impl.h" | 10 #include "content/browser/renderer_host/render_widget_host_impl.h" |
11 #include "content/common/gpu/image_transport_surface.h" | 11 #include "content/common/gpu/image_transport_surface.h" |
12 #include "content/public/common/page_state.h" | 12 #include "content/public/common/page_state.h" |
| 13 #include "content/public/renderer/renderer_gamepad_provider.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" |
22 #include "third_party/WebKit/public/platform/WebBatteryStatus.h" | 23 #include "third_party/WebKit/public/platform/WebBatteryStatus.h" |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 } // namespace | 75 } // namespace |
75 | 76 |
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(scoped_ptr<RendererGamepadProvider> provider) { |
85 RenderThreadImpl::current()->webkit_platform_support()-> | 86 RenderThreadImpl::current()->webkit_platform_support()-> |
86 set_gamepad_provider(provider); | 87 SetPlatformEventObserverForTesting( |
| 88 blink::WebPlatformEventGamepad, |
| 89 provider.PassAs<PlatformEventObserverBase>()); |
87 } | 90 } |
88 | 91 |
89 void SetMockDeviceLightData(const double data) { | 92 void SetMockDeviceLightData(const double data) { |
90 RendererWebKitPlatformSupportImpl::SetMockDeviceLightDataForTesting(data); | 93 RendererWebKitPlatformSupportImpl::SetMockDeviceLightDataForTesting(data); |
91 } | 94 } |
92 | 95 |
93 void SetMockDeviceMotionData(const WebDeviceMotionData& data) { | 96 void SetMockDeviceMotionData(const WebDeviceMotionData& data) { |
94 RendererWebKitPlatformSupportImpl::SetMockDeviceMotionDataForTesting(data); | 97 RendererWebKitPlatformSupportImpl::SetMockDeviceMotionDataForTesting(data); |
95 } | 98 } |
96 | 99 |
97 void SetMockDeviceOrientationData(const WebDeviceOrientationData& data) { | 100 void SetMockDeviceOrientationData(const WebDeviceOrientationData& data) { |
98 RendererWebKitPlatformSupportImpl:: | 101 RendererWebKitPlatformSupportImpl:: |
99 SetMockDeviceOrientationDataForTesting(data); | 102 SetMockDeviceOrientationDataForTesting(data); |
100 } | 103 } |
101 | 104 |
102 void MockBatteryStatusChanged(const WebBatteryStatus& status) { | 105 void MockBatteryStatusChanged(const WebBatteryStatus& status) { |
103 RendererWebKitPlatformSupportImpl::MockBatteryStatusChangedForTesting(status); | 106 RenderThreadImpl::current()->webkit_platform_support()-> |
| 107 MockBatteryStatusChangedForTesting(status); |
104 } | 108 } |
105 | 109 |
106 void EnableRendererLayoutTestMode() { | 110 void EnableRendererLayoutTestMode() { |
107 RenderThreadImpl::current()->set_layout_test_mode(true); | 111 RenderThreadImpl::current()->set_layout_test_mode(true); |
108 } | 112 } |
109 | 113 |
110 void EnableBrowserLayoutTestMode() { | 114 void EnableBrowserLayoutTestMode() { |
111 #if defined(OS_MACOSX) | 115 #if defined(OS_MACOSX) |
112 ImageTransportSurface::SetAllowOSMesaForTesting(true); | 116 ImageTransportSurface::SetAllowOSMesaForTesting(true); |
113 PopupMenuHelper::DontShowPopupMenuForTesting(); | 117 PopupMenuHelper::DontShowPopupMenuForTesting(); |
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
350 } | 354 } |
351 result.append("===============================================\n"); | 355 result.append("===============================================\n"); |
352 return result; | 356 return result; |
353 } | 357 } |
354 | 358 |
355 blink::WebLayer* InstantiateWebLayer(scoped_refptr<cc::TextureLayer> layer) { | 359 blink::WebLayer* InstantiateWebLayer(scoped_refptr<cc::TextureLayer> layer) { |
356 return new cc_blink::WebLayerImpl(layer); | 360 return new cc_blink::WebLayerImpl(layer); |
357 } | 361 } |
358 | 362 |
359 } // namespace content | 363 } // namespace content |
OLD | NEW |