Chromium Code Reviews| 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/public/renderer/renderer_gamepad_provider.h" |
| 14 #include "content/renderer/fetchers/manifest_fetcher.h" | |
| 14 #include "content/renderer/history_entry.h" | 15 #include "content/renderer/history_entry.h" |
| 15 #include "content/renderer/history_serialization.h" | 16 #include "content/renderer/history_serialization.h" |
| 16 #include "content/renderer/render_frame_impl.h" | 17 #include "content/renderer/render_frame_impl.h" |
| 17 #include "content/renderer/render_thread_impl.h" | 18 #include "content/renderer/render_thread_impl.h" |
| 18 #include "content/renderer/render_view_impl.h" | 19 #include "content/renderer/render_view_impl.h" |
| 19 #include "content/renderer/renderer_webkitplatformsupport_impl.h" | 20 #include "content/renderer/renderer_webkitplatformsupport_impl.h" |
| 20 #include "content/shell/renderer/test_runner/test_common.h" | 21 #include "content/shell/renderer/test_runner/test_common.h" |
| 21 #include "content/shell/renderer/test_runner/web_frame_test_proxy.h" | 22 #include "content/shell/renderer/test_runner/web_frame_test_proxy.h" |
| 22 #include "content/shell/renderer/test_runner/web_test_proxy.h" | 23 #include "content/shell/renderer/test_runner/web_test_proxy.h" |
| 23 #include "third_party/WebKit/public/platform/WebBatteryStatus.h" | 24 #include "third_party/WebKit/public/platform/WebBatteryStatus.h" |
| 24 #include "third_party/WebKit/public/platform/WebDeviceMotionData.h" | 25 #include "third_party/WebKit/public/platform/WebDeviceMotionData.h" |
| 25 #include "third_party/WebKit/public/platform/WebDeviceOrientationData.h" | 26 #include "third_party/WebKit/public/platform/WebDeviceOrientationData.h" |
| 26 #include "third_party/WebKit/public/platform/WebGamepads.h" | 27 #include "third_party/WebKit/public/platform/WebGamepads.h" |
| 27 #include "third_party/WebKit/public/web/WebHistoryItem.h" | 28 #include "third_party/WebKit/public/web/WebHistoryItem.h" |
| 29 #include "third_party/WebKit/public/web/WebView.h" | |
| 28 | 30 |
| 29 #if defined(OS_MACOSX) | 31 #if defined(OS_MACOSX) |
| 30 #include "content/browser/frame_host/popup_menu_helper_mac.h" | 32 #include "content/browser/frame_host/popup_menu_helper_mac.h" |
| 31 #endif | 33 #endif |
| 32 | 34 |
| 33 using blink::WebBatteryStatus; | 35 using blink::WebBatteryStatus; |
| 34 using blink::WebDeviceMotionData; | 36 using blink::WebDeviceMotionData; |
| 35 using blink::WebDeviceOrientationData; | 37 using blink::WebDeviceOrientationData; |
| 36 using blink::WebGamepad; | 38 using blink::WebGamepad; |
| 37 using blink::WebGamepads; | 39 using blink::WebGamepads; |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 75 } // namespace | 77 } // namespace |
| 76 | 78 |
| 77 | 79 |
| 78 void EnableWebTestProxyCreation( | 80 void EnableWebTestProxyCreation( |
| 79 const base::Callback<void(RenderView*, WebTestProxyBase*)>& callback) { | 81 const base::Callback<void(RenderView*, WebTestProxyBase*)>& callback) { |
| 80 g_callback.Get() = callback; | 82 g_callback.Get() = callback; |
| 81 RenderViewImpl::InstallCreateHook(CreateWebTestProxy); | 83 RenderViewImpl::InstallCreateHook(CreateWebTestProxy); |
| 82 RenderFrameImpl::InstallCreateHook(CreateWebFrameTestProxy); | 84 RenderFrameImpl::InstallCreateHook(CreateWebFrameTestProxy); |
| 83 } | 85 } |
| 84 | 86 |
| 87 void FetchManifestDoneCallback(ManifestFetcher* fetcher, | |
|
mlamouri (slow - plz ping)
2014/09/18 17:36:05
nit: I think you should align parameters.
| |
| 88 ManifestFetcher::Callback callback, | |
|
mlamouri (slow - plz ping)
2014/09/18 17:36:05
const ManifestFetcher::Callback& callback
| |
| 89 const blink::WebURLResponse& response, | |
| 90 const std::string& data) { | |
| 91 delete fetcher; | |
| 92 callback.Run(response, data); | |
| 93 } | |
| 94 | |
| 95 void FetchManifest(blink::WebView* view, GURL url, | |
| 96 ManifestFetcher::Callback callback) { | |
|
mlamouri (slow - plz ping)
2014/09/18 17:36:05
It's a bit odd to have a non typed callback in the
| |
| 97 ManifestFetcher* fetcher = new ManifestFetcher(url); | |
| 98 | |
| 99 fetcher->Start(view->mainFrame(), | |
| 100 base::Bind(&FetchManifestDoneCallback, | |
| 101 base::Unretained(fetcher), | |
|
mlamouri (slow - plz ping)
2014/09/18 17:36:05
Alternatively, you could make |fetcher| be a scope
| |
| 102 callback)); | |
| 103 } | |
| 104 | |
| 85 void SetMockGamepadProvider(scoped_ptr<RendererGamepadProvider> provider) { | 105 void SetMockGamepadProvider(scoped_ptr<RendererGamepadProvider> provider) { |
| 86 RenderThreadImpl::current()->webkit_platform_support()-> | 106 RenderThreadImpl::current()->webkit_platform_support()-> |
| 87 SetPlatformEventObserverForTesting( | 107 SetPlatformEventObserverForTesting( |
| 88 blink::WebPlatformEventGamepad, | 108 blink::WebPlatformEventGamepad, |
| 89 provider.PassAs<PlatformEventObserverBase>()); | 109 provider.PassAs<PlatformEventObserverBase>()); |
| 90 } | 110 } |
| 91 | 111 |
| 92 void SetMockDeviceLightData(const double data) { | 112 void SetMockDeviceLightData(const double data) { |
| 93 RendererWebKitPlatformSupportImpl::SetMockDeviceLightDataForTesting(data); | 113 RendererWebKitPlatformSupportImpl::SetMockDeviceLightDataForTesting(data); |
| 94 } | 114 } |
| (...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 360 } | 380 } |
| 361 result.append("===============================================\n"); | 381 result.append("===============================================\n"); |
| 362 return result; | 382 return result; |
| 363 } | 383 } |
| 364 | 384 |
| 365 blink::WebLayer* InstantiateWebLayer(scoped_refptr<cc::TextureLayer> layer) { | 385 blink::WebLayer* InstantiateWebLayer(scoped_refptr<cc::TextureLayer> layer) { |
| 366 return new cc_blink::WebLayerImpl(layer); | 386 return new cc_blink::WebLayerImpl(layer); |
| 367 } | 387 } |
| 368 | 388 |
| 369 } // namespace content | 389 } // namespace content |
| OLD | NEW |