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

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

Issue 2213653002: Revert of Add WebWidgetTestProxy. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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 <stddef.h> 7 #include <stddef.h>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/callback.h" 10 #include "base/callback.h"
11 #include "base/lazy_instance.h" 11 #include "base/lazy_instance.h"
12 #include "base/memory/ptr_util.h" 12 #include "base/memory/ptr_util.h"
13 #include "base/strings/string_util.h" 13 #include "base/strings/string_util.h"
14 #include "build/build_config.h" 14 #include "build/build_config.h"
15 #include "cc/output/copy_output_request.h" 15 #include "cc/output/copy_output_request.h"
16 #include "cc/test/pixel_test_output_surface.h" 16 #include "cc/test/pixel_test_output_surface.h"
17 #include "cc/test/test_delegating_output_surface.h" 17 #include "cc/test/test_delegating_output_surface.h"
18 #include "components/scheduler/test/renderer_scheduler_test_support.h" 18 #include "components/scheduler/test/renderer_scheduler_test_support.h"
19 #include "components/test_runner/test_common.h" 19 #include "components/test_runner/test_common.h"
20 #include "components/test_runner/web_frame_test_proxy.h" 20 #include "components/test_runner/web_frame_test_proxy.h"
21 #include "components/test_runner/web_view_test_proxy.h" 21 #include "components/test_runner/web_view_test_proxy.h"
22 #include "components/test_runner/web_widget_test_proxy.h"
23 #include "content/browser/bluetooth/bluetooth_device_chooser_controller.h" 22 #include "content/browser/bluetooth/bluetooth_device_chooser_controller.h"
24 #include "content/browser/renderer_host/render_process_host_impl.h" 23 #include "content/browser/renderer_host/render_process_host_impl.h"
25 #include "content/browser/renderer_host/render_widget_host_impl.h" 24 #include "content/browser/renderer_host/render_widget_host_impl.h"
26 #include "content/common/gpu/client/context_provider_command_buffer.h" 25 #include "content/common/gpu/client/context_provider_command_buffer.h"
27 #include "content/common/site_isolation_policy.h" 26 #include "content/common/site_isolation_policy.h"
28 #include "content/public/common/page_state.h" 27 #include "content/public/common/page_state.h"
29 #include "content/public/renderer/renderer_gamepad_provider.h" 28 #include "content/public/renderer/renderer_gamepad_provider.h"
30 #include "content/renderer/fetchers/manifest_fetcher.h" 29 #include "content/renderer/fetchers/manifest_fetcher.h"
31 #include "content/renderer/gpu/render_widget_compositor.h" 30 #include "content/renderer/gpu/render_widget_compositor.h"
32 #include "content/renderer/history_entry.h" 31 #include "content/renderer/history_entry.h"
33 #include "content/renderer/history_serialization.h" 32 #include "content/renderer/history_serialization.h"
34 #include "content/renderer/layout_test_dependencies.h" 33 #include "content/renderer/layout_test_dependencies.h"
35 #include "content/renderer/render_frame_impl.h" 34 #include "content/renderer/render_frame_impl.h"
36 #include "content/renderer/render_thread_impl.h" 35 #include "content/renderer/render_thread_impl.h"
37 #include "content/renderer/render_view_impl.h" 36 #include "content/renderer/render_view_impl.h"
38 #include "content/renderer/render_widget.h"
39 #include "content/renderer/renderer_blink_platform_impl.h" 37 #include "content/renderer/renderer_blink_platform_impl.h"
40 #include "content/shell/common/shell_switches.h" 38 #include "content/shell/common/shell_switches.h"
41 #include "gpu/ipc/service/image_transport_surface.h" 39 #include "gpu/ipc/service/image_transport_surface.h"
42 #include "third_party/WebKit/public/platform/WebFloatRect.h" 40 #include "third_party/WebKit/public/platform/WebFloatRect.h"
43 #include "third_party/WebKit/public/platform/WebGamepads.h" 41 #include "third_party/WebKit/public/platform/WebGamepads.h"
44 #include "third_party/WebKit/public/platform/modules/device_orientation/WebDevic eMotionData.h" 42 #include "third_party/WebKit/public/platform/modules/device_orientation/WebDevic eMotionData.h"
45 #include "third_party/WebKit/public/platform/modules/device_orientation/WebDevic eOrientationData.h" 43 #include "third_party/WebKit/public/platform/modules/device_orientation/WebDevic eOrientationData.h"
46 #include "third_party/WebKit/public/web/WebHistoryItem.h" 44 #include "third_party/WebKit/public/web/WebHistoryItem.h"
47 #include "third_party/WebKit/public/web/WebView.h" 45 #include "third_party/WebKit/public/web/WebView.h"
48 46
(...skipping 14 matching lines...) Expand all
63 using blink::WebRect; 61 using blink::WebRect;
64 using blink::WebSize; 62 using blink::WebSize;
65 63
66 namespace content { 64 namespace content {
67 65
68 namespace { 66 namespace {
69 67
70 base::LazyInstance<ViewProxyCreationCallback>::Leaky 68 base::LazyInstance<ViewProxyCreationCallback>::Leaky
71 g_view_test_proxy_callback = LAZY_INSTANCE_INITIALIZER; 69 g_view_test_proxy_callback = LAZY_INSTANCE_INITIALIZER;
72 70
73 base::LazyInstance<WidgetProxyCreationCallback>::Leaky
74 g_widget_test_proxy_callback = LAZY_INSTANCE_INITIALIZER;
75
76 base::LazyInstance<FrameProxyCreationCallback>::Leaky 71 base::LazyInstance<FrameProxyCreationCallback>::Leaky
77 g_frame_test_proxy_callback = LAZY_INSTANCE_INITIALIZER; 72 g_frame_test_proxy_callback = LAZY_INSTANCE_INITIALIZER;
78 73
79 using WebViewTestProxyType = 74 using WebViewTestProxyType =
80 test_runner::WebViewTestProxy<RenderViewImpl, 75 test_runner::WebViewTestProxy<RenderViewImpl,
81 CompositorDependencies*, 76 CompositorDependencies*,
82 const ViewMsg_New_Params&>; 77 const ViewMsg_New_Params&>;
83 using WebWidgetTestProxyType =
84 test_runner::WebWidgetTestProxy<RenderWidget,
85 CompositorDependencies*,
86 blink::WebPopupType,
87 const blink::WebScreenInfo&,
88 bool,
89 bool,
90 bool>;
91 using WebFrameTestProxyType = 78 using WebFrameTestProxyType =
92 test_runner::WebFrameTestProxy<RenderFrameImpl, 79 test_runner::WebFrameTestProxy<RenderFrameImpl,
93 const RenderFrameImpl::CreateParams&>; 80 const RenderFrameImpl::CreateParams&>;
94 81
95 RenderViewImpl* CreateWebViewTestProxy(CompositorDependencies* compositor_deps, 82 RenderViewImpl* CreateWebViewTestProxy(CompositorDependencies* compositor_deps,
96 const ViewMsg_New_Params& params) { 83 const ViewMsg_New_Params& params) {
97 WebViewTestProxyType* render_view_proxy = 84 WebViewTestProxyType* render_view_proxy =
98 new WebViewTestProxyType(compositor_deps, params); 85 new WebViewTestProxyType(compositor_deps, params);
99 if (g_view_test_proxy_callback == 0) 86 if (g_view_test_proxy_callback == 0)
100 return render_view_proxy; 87 return render_view_proxy;
101 g_view_test_proxy_callback.Get().Run(render_view_proxy, render_view_proxy); 88 g_view_test_proxy_callback.Get().Run(render_view_proxy, render_view_proxy);
102 return render_view_proxy; 89 return render_view_proxy;
103 } 90 }
104 91
105 RenderWidget* CreateWebWidgetTestProxy(CompositorDependencies* compositor_deps,
106 blink::WebPopupType popup_type,
107 const blink::WebScreenInfo& screen_info,
108 bool swapped_out,
109 bool hidden,
110 bool never_visible) {
111 WebWidgetTestProxyType* render_widget_proxy =
112 new WebWidgetTestProxyType(compositor_deps, popup_type, screen_info,
113 swapped_out, hidden, never_visible);
114 if (g_widget_test_proxy_callback == 0)
115 return render_widget_proxy;
116 g_widget_test_proxy_callback.Get().Run(render_widget_proxy->web_widget(),
117 render_widget_proxy);
118 return render_widget_proxy;
119 }
120
121 RenderFrameImpl* CreateWebFrameTestProxy( 92 RenderFrameImpl* CreateWebFrameTestProxy(
122 const RenderFrameImpl::CreateParams& params) { 93 const RenderFrameImpl::CreateParams& params) {
123 WebFrameTestProxyType* render_frame_proxy = new WebFrameTestProxyType(params); 94 WebFrameTestProxyType* render_frame_proxy = new WebFrameTestProxyType(params);
124 if (g_frame_test_proxy_callback == 0) 95 if (g_frame_test_proxy_callback == 0)
125 return render_frame_proxy; 96 return render_frame_proxy;
126 g_frame_test_proxy_callback.Get().Run(render_frame_proxy, render_frame_proxy); 97 g_frame_test_proxy_callback.Get().Run(render_frame_proxy, render_frame_proxy);
127 return render_frame_proxy; 98 return render_frame_proxy;
128 } 99 }
129 100
130 #if defined(OS_WIN) 101 #if defined(OS_WIN)
(...skipping 21 matching lines...) Expand all
152 123
153 test_runner::WebFrameTestProxyBase* GetWebFrameTestProxyBase( 124 test_runner::WebFrameTestProxyBase* GetWebFrameTestProxyBase(
154 RenderFrame* render_frame) { 125 RenderFrame* render_frame) {
155 WebFrameTestProxyType* render_frame_proxy = 126 WebFrameTestProxyType* render_frame_proxy =
156 static_cast<WebFrameTestProxyType*>(render_frame); 127 static_cast<WebFrameTestProxyType*>(render_frame);
157 return static_cast<test_runner::WebFrameTestProxyBase*>(render_frame_proxy); 128 return static_cast<test_runner::WebFrameTestProxyBase*>(render_frame_proxy);
158 } 129 }
159 130
160 void EnableWebTestProxyCreation( 131 void EnableWebTestProxyCreation(
161 const ViewProxyCreationCallback& view_proxy_creation_callback, 132 const ViewProxyCreationCallback& view_proxy_creation_callback,
162 const WidgetProxyCreationCallback& widget_proxy_creation_callback,
163 const FrameProxyCreationCallback& frame_proxy_creation_callback) { 133 const FrameProxyCreationCallback& frame_proxy_creation_callback) {
164 g_view_test_proxy_callback.Get() = view_proxy_creation_callback; 134 g_view_test_proxy_callback.Get() = view_proxy_creation_callback;
165 g_widget_test_proxy_callback.Get() = widget_proxy_creation_callback;
166 g_frame_test_proxy_callback.Get() = frame_proxy_creation_callback; 135 g_frame_test_proxy_callback.Get() = frame_proxy_creation_callback;
167 RenderViewImpl::InstallCreateHook(CreateWebViewTestProxy); 136 RenderViewImpl::InstallCreateHook(CreateWebViewTestProxy);
168 RenderWidget::InstallCreateHook(CreateWebWidgetTestProxy);
169 RenderFrameImpl::InstallCreateHook(CreateWebFrameTestProxy); 137 RenderFrameImpl::InstallCreateHook(CreateWebFrameTestProxy);
170 } 138 }
171 139
172 void FetchManifestDoneCallback(std::unique_ptr<ManifestFetcher> fetcher, 140 void FetchManifestDoneCallback(std::unique_ptr<ManifestFetcher> fetcher,
173 const FetchManifestCallback& callback, 141 const FetchManifestCallback& callback,
174 const blink::WebURLResponse& response, 142 const blink::WebURLResponse& response,
175 const std::string& data) { 143 const std::string& data) {
176 // |fetcher| will be autodeleted here as it is going out of scope. 144 // |fetcher| will be autodeleted here as it is going out of scope.
177 callback.Run(response, data); 145 callback.Run(response, data);
178 } 146 }
(...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after
601 return result; 569 return result;
602 } 570 }
603 571
604 void SchedulerRunIdleTasks(const base::Closure& callback) { 572 void SchedulerRunIdleTasks(const base::Closure& callback) {
605 scheduler::RendererScheduler* scheduler = 573 scheduler::RendererScheduler* scheduler =
606 content::RenderThreadImpl::current()->GetRendererScheduler(); 574 content::RenderThreadImpl::current()->GetRendererScheduler();
607 scheduler::RunIdleTasksForTesting(scheduler, callback); 575 scheduler::RunIdleTasksForTesting(scheduler, callback);
608 } 576 }
609 577
610 } // namespace content 578 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698