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

Side by Side Diff: content/shell/renderer/layout_test/layout_test_content_renderer_client.cc

Issue 1821923003: Extract WebFrameClient implementation out of WebTestProxyBase. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebasing... Created 4 years, 9 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) 2014 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2014 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/shell/renderer/layout_test/layout_test_content_renderer_client .h" 5 #include "content/shell/renderer/layout_test/layout_test_content_renderer_client .h"
6 6
7 #include "base/callback.h" 7 #include "base/callback.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/debug/debugger.h" 9 #include "base/debug/debugger.h"
10 #include "components/test_runner/mock_credential_manager_client.h" 10 #include "components/test_runner/mock_credential_manager_client.h"
11 #include "components/test_runner/web_frame_test_proxy.h"
11 #include "components/test_runner/web_test_interfaces.h" 12 #include "components/test_runner/web_test_interfaces.h"
12 #include "components/test_runner/web_test_proxy.h" 13 #include "components/test_runner/web_test_proxy.h"
13 #include "components/web_cache/renderer/web_cache_render_process_observer.h" 14 #include "components/web_cache/renderer/web_cache_render_process_observer.h"
14 #include "content/public/common/content_constants.h" 15 #include "content/public/common/content_constants.h"
15 #include "content/public/common/content_switches.h" 16 #include "content/public/common/content_switches.h"
16 #include "content/public/renderer/render_view.h" 17 #include "content/public/renderer/render_view.h"
17 #include "content/public/test/layouttest_support.h" 18 #include "content/public/test/layouttest_support.h"
18 #include "content/shell/common/shell_switches.h" 19 #include "content/shell/common/shell_switches.h"
19 #include "content/shell/renderer/layout_test/blink_test_helpers.h" 20 #include "content/shell/renderer/layout_test/blink_test_helpers.h"
20 #include "content/shell/renderer/layout_test/blink_test_runner.h" 21 #include "content/shell/renderer/layout_test/blink_test_runner.h"
(...skipping 17 matching lines...) Expand all
38 using blink::WebMediaStreamCenter; 39 using blink::WebMediaStreamCenter;
39 using blink::WebMediaStreamCenterClient; 40 using blink::WebMediaStreamCenterClient;
40 using blink::WebPlugin; 41 using blink::WebPlugin;
41 using blink::WebPluginParams; 42 using blink::WebPluginParams;
42 using blink::WebRTCPeerConnectionHandler; 43 using blink::WebRTCPeerConnectionHandler;
43 using blink::WebRTCPeerConnectionHandlerClient; 44 using blink::WebRTCPeerConnectionHandlerClient;
44 using blink::WebThemeEngine; 45 using blink::WebThemeEngine;
45 46
46 namespace content { 47 namespace content {
47 48
49 namespace {
50
51 void WebTestProxyCreated(RenderView* render_view,
52 test_runner::WebTestProxyBase* proxy) {
53 BlinkTestRunner* test_runner = new BlinkTestRunner(render_view);
54 test_runner->set_proxy(proxy);
55 if (!LayoutTestRenderProcessObserver::GetInstance()->test_delegate()) {
56 LayoutTestRenderProcessObserver::GetInstance()->SetTestDelegate(
57 test_runner);
58 }
59 proxy->SetInterfaces(
60 LayoutTestRenderProcessObserver::GetInstance()->test_interfaces());
61 test_runner->proxy()->SetDelegate(
62 LayoutTestRenderProcessObserver::GetInstance()->test_delegate());
63 }
64
65 void WebFrameTestProxyCreated(RenderFrame* render_frame,
66 test_runner::WebFrameTestProxyBase* proxy) {
67 proxy->set_test_client(LayoutTestRenderProcessObserver::GetInstance()
68 ->test_interfaces()
69 ->GetWebFrameTestClient());
70 }
71
72 } // namespace
73
48 LayoutTestContentRendererClient::LayoutTestContentRendererClient() { 74 LayoutTestContentRendererClient::LayoutTestContentRendererClient() {
49 EnableWebTestProxyCreation( 75 EnableWebTestProxyCreation(base::Bind(&WebTestProxyCreated),
50 base::Bind(&LayoutTestContentRendererClient::WebTestProxyCreated, 76 base::Bind(&WebFrameTestProxyCreated));
51 base::Unretained(this)));
52 } 77 }
53 78
54 LayoutTestContentRendererClient::~LayoutTestContentRendererClient() { 79 LayoutTestContentRendererClient::~LayoutTestContentRendererClient() {
55 } 80 }
56 81
57 void LayoutTestContentRendererClient::RenderThreadStarted() { 82 void LayoutTestContentRendererClient::RenderThreadStarted() {
58 ShellContentRendererClient::RenderThreadStarted(); 83 ShellContentRendererClient::RenderThreadStarted();
59 shell_observer_.reset(new LayoutTestRenderProcessObserver()); 84 shell_observer_.reset(new LayoutTestRenderProcessObserver());
60 } 85 }
61 86
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 scoped_ptr<MediaStreamRendererFactory> 169 scoped_ptr<MediaStreamRendererFactory>
145 LayoutTestContentRendererClient::CreateMediaStreamRendererFactory() { 170 LayoutTestContentRendererClient::CreateMediaStreamRendererFactory() {
146 #if defined(ENABLE_WEBRTC) 171 #if defined(ENABLE_WEBRTC)
147 return scoped_ptr<MediaStreamRendererFactory>( 172 return scoped_ptr<MediaStreamRendererFactory>(
148 new TestMediaStreamRendererFactory()); 173 new TestMediaStreamRendererFactory());
149 #else 174 #else
150 return nullptr; 175 return nullptr;
151 #endif 176 #endif
152 } 177 }
153 178
154 void LayoutTestContentRendererClient::WebTestProxyCreated(
155 RenderView* render_view,
156 test_runner::WebTestProxyBase* proxy) {
157 BlinkTestRunner* test_runner = new BlinkTestRunner(render_view);
158 test_runner->set_proxy(proxy);
159 if (!LayoutTestRenderProcessObserver::GetInstance()->test_delegate()) {
160 LayoutTestRenderProcessObserver::GetInstance()->SetTestDelegate(
161 test_runner);
162 }
163 proxy->SetInterfaces(
164 LayoutTestRenderProcessObserver::GetInstance()->test_interfaces());
165 test_runner->proxy()->SetDelegate(
166 LayoutTestRenderProcessObserver::GetInstance()->test_delegate());
167 }
168
169 } // namespace content 179 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698