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