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

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

Issue 1840823002: Extract WebViewClient implementation out of WebTestProxyBase. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@separate-pixel-dump-code
Patch Set: Expanding a comment + an IWYU fix. Created 4 years, 8 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
« no previous file with comments | « content/shell/renderer/layout_test/layout_test_content_renderer_client.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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"
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 namespace content { 57 namespace content {
58 58
59 namespace { 59 namespace {
60 60
61 base::LazyInstance<ViewProxyCreationCallback>::Leaky 61 base::LazyInstance<ViewProxyCreationCallback>::Leaky
62 g_view_test_proxy_callback = LAZY_INSTANCE_INITIALIZER; 62 g_view_test_proxy_callback = LAZY_INSTANCE_INITIALIZER;
63 63
64 base::LazyInstance<FrameProxyCreationCallback>::Leaky 64 base::LazyInstance<FrameProxyCreationCallback>::Leaky
65 g_frame_test_proxy_callback = LAZY_INSTANCE_INITIALIZER; 65 g_frame_test_proxy_callback = LAZY_INSTANCE_INITIALIZER;
66 66
67 using WebTestProxyType = test_runner::WebTestProxy<RenderViewImpl,
68 CompositorDependencies*,
69 const ViewMsg_New_Params&>;
70
67 RenderViewImpl* CreateWebTestProxy(CompositorDependencies* compositor_deps, 71 RenderViewImpl* CreateWebTestProxy(CompositorDependencies* compositor_deps,
68 const ViewMsg_New_Params& params) { 72 const ViewMsg_New_Params& params) {
69 typedef test_runner::WebTestProxy<RenderViewImpl, CompositorDependencies*, 73 WebTestProxyType* render_view_proxy =
70 const ViewMsg_New_Params&> ProxyType; 74 new WebTestProxyType(compositor_deps, params);
71 ProxyType* render_view_proxy = new ProxyType(compositor_deps, params);
72 if (g_view_test_proxy_callback == 0) 75 if (g_view_test_proxy_callback == 0)
73 return render_view_proxy; 76 return render_view_proxy;
74 g_view_test_proxy_callback.Get().Run(render_view_proxy, render_view_proxy); 77 g_view_test_proxy_callback.Get().Run(render_view_proxy, render_view_proxy);
75 return render_view_proxy; 78 return render_view_proxy;
76 } 79 }
77 80
78 RenderFrameImpl* CreateWebFrameTestProxy( 81 RenderFrameImpl* CreateWebFrameTestProxy(
79 const RenderFrameImpl::CreateParams& params) { 82 const RenderFrameImpl::CreateParams& params) {
80 typedef test_runner::WebFrameTestProxy< 83 typedef test_runner::WebFrameTestProxy<
81 RenderFrameImpl, const RenderFrameImpl::CreateParams&> FrameProxy; 84 RenderFrameImpl, const RenderFrameImpl::CreateParams&> FrameProxy;
(...skipping 14 matching lines...) Expand all
96 i != files.end(); 99 i != files.end();
97 ++i) { 100 ++i) {
98 SkTypeface* typeface = fontmgr->createFromFile(i->c_str()); 101 SkTypeface* typeface = fontmgr->createFromFile(i->c_str());
99 blink::WebFontRendering::addSideloadedFontForTesting(typeface); 102 blink::WebFontRendering::addSideloadedFontForTesting(typeface);
100 } 103 }
101 } 104 }
102 #endif // OS_WIN 105 #endif // OS_WIN
103 106
104 } // namespace 107 } // namespace
105 108
109 test_runner::WebTestProxyBase* GetWebTestProxyBase(RenderView* render_view) {
110 WebTestProxyType* render_view_proxy =
111 static_cast<WebTestProxyType*>(render_view);
112 return static_cast<test_runner::WebTestProxyBase*>(render_view_proxy);
113 }
114
106 void EnableWebTestProxyCreation( 115 void EnableWebTestProxyCreation(
107 const ViewProxyCreationCallback& view_proxy_creation_callback, 116 const ViewProxyCreationCallback& view_proxy_creation_callback,
108 const FrameProxyCreationCallback& frame_proxy_creation_callback) { 117 const FrameProxyCreationCallback& frame_proxy_creation_callback) {
109 g_view_test_proxy_callback.Get() = view_proxy_creation_callback; 118 g_view_test_proxy_callback.Get() = view_proxy_creation_callback;
110 g_frame_test_proxy_callback.Get() = frame_proxy_creation_callback; 119 g_frame_test_proxy_callback.Get() = frame_proxy_creation_callback;
111 RenderViewImpl::InstallCreateHook(CreateWebTestProxy); 120 RenderViewImpl::InstallCreateHook(CreateWebTestProxy);
112 RenderFrameImpl::InstallCreateHook(CreateWebFrameTestProxy); 121 RenderFrameImpl::InstallCreateHook(CreateWebFrameTestProxy);
113 } 122 }
114 123
115 void FetchManifestDoneCallback( 124 void FetchManifestDoneCallback(
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after
439 result.append( 448 result.append(
440 DumpHistoryItem(entry->root_history_node(), 449 DumpHistoryItem(entry->root_history_node(),
441 8, 450 8,
442 index == current_index)); 451 index == current_index));
443 } 452 }
444 result.append("===============================================\n"); 453 result.append("===============================================\n");
445 return result; 454 return result;
446 } 455 }
447 456
448 } // namespace content 457 } // namespace content
OLDNEW
« no previous file with comments | « content/shell/renderer/layout_test/layout_test_content_renderer_client.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698