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

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

Issue 2171503005: Rename WebTestProxy to WebViewTestProxy. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: addressing comments Created 4 years, 5 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_frame_test_proxy.h"
12 #include "components/test_runner/web_test_interfaces.h" 12 #include "components/test_runner/web_test_interfaces.h"
13 #include "components/test_runner/web_test_proxy.h"
14 #include "components/test_runner/web_test_runner.h" 13 #include "components/test_runner/web_test_runner.h"
14 #include "components/test_runner/web_view_test_proxy.h"
15 #include "components/web_cache/renderer/web_cache_impl.h" 15 #include "components/web_cache/renderer/web_cache_impl.h"
16 #include "content/public/common/content_constants.h" 16 #include "content/public/common/content_constants.h"
17 #include "content/public/common/content_switches.h" 17 #include "content/public/common/content_switches.h"
18 #include "content/public/renderer/render_frame.h" 18 #include "content/public/renderer/render_frame.h"
19 #include "content/public/renderer/render_view.h" 19 #include "content/public/renderer/render_view.h"
20 #include "content/public/test/layouttest_support.h" 20 #include "content/public/test/layouttest_support.h"
21 #include "content/shell/common/shell_switches.h" 21 #include "content/shell/common/shell_switches.h"
22 #include "content/shell/renderer/layout_test/blink_test_helpers.h" 22 #include "content/shell/renderer/layout_test/blink_test_helpers.h"
23 #include "content/shell/renderer/layout_test/blink_test_runner.h" 23 #include "content/shell/renderer/layout_test/blink_test_runner.h"
24 #include "content/shell/renderer/layout_test/layout_test_render_frame_observer.h " 24 #include "content/shell/renderer/layout_test/layout_test_render_frame_observer.h "
(...skipping 20 matching lines...) Expand all
45 using blink::WebPlugin; 45 using blink::WebPlugin;
46 using blink::WebPluginParams; 46 using blink::WebPluginParams;
47 using blink::WebRTCPeerConnectionHandler; 47 using blink::WebRTCPeerConnectionHandler;
48 using blink::WebRTCPeerConnectionHandlerClient; 48 using blink::WebRTCPeerConnectionHandlerClient;
49 using blink::WebThemeEngine; 49 using blink::WebThemeEngine;
50 50
51 namespace content { 51 namespace content {
52 52
53 namespace { 53 namespace {
54 54
55 void WebTestProxyCreated(RenderView* render_view, 55 void WebViewTestProxyCreated(RenderView* render_view,
56 test_runner::WebTestProxyBase* proxy) { 56 test_runner::WebViewTestProxyBase* proxy) {
57 test_runner::WebTestInterfaces* interfaces = 57 test_runner::WebTestInterfaces* interfaces =
58 LayoutTestRenderThreadObserver::GetInstance()->test_interfaces(); 58 LayoutTestRenderThreadObserver::GetInstance()->test_interfaces();
59 59
60 BlinkTestRunner* test_runner = new BlinkTestRunner(render_view); 60 BlinkTestRunner* test_runner = new BlinkTestRunner(render_view);
61 // TODO(lukasza): Using the 1st BlinkTestRunner as the main delegate is wrong, 61 // TODO(lukasza): Using the 1st BlinkTestRunner as the main delegate is wrong,
62 // but it is difficult to change because this behavior has been baked for a 62 // but it is difficult to change because this behavior has been baked for a
63 // long time into test assumptions (i.e. which PrintMessage gets delivered to 63 // long time into test assumptions (i.e. which PrintMessage gets delivered to
64 // the browser depends on this). 64 // the browser depends on this).
65 static bool first_test_runner = true; 65 static bool first_test_runner = true;
66 if (first_test_runner) { 66 if (first_test_runner) {
67 first_test_runner = false; 67 first_test_runner = false;
68 interfaces->SetDelegate(test_runner); 68 interfaces->SetDelegate(test_runner);
69 } 69 }
70 70
71 proxy->set_delegate(test_runner); 71 proxy->set_delegate(test_runner);
72 proxy->set_view_test_client(LayoutTestRenderThreadObserver::GetInstance() 72 proxy->set_view_test_client(LayoutTestRenderThreadObserver::GetInstance()
73 ->test_interfaces() 73 ->test_interfaces()
74 ->CreateWebViewTestClient(proxy)); 74 ->CreateWebViewTestClient(proxy));
75 proxy->set_widget_test_client(LayoutTestRenderThreadObserver::GetInstance() 75 proxy->set_widget_test_client(LayoutTestRenderThreadObserver::GetInstance()
76 ->test_interfaces() 76 ->test_interfaces()
77 ->CreateWebWidgetTestClient(proxy)); 77 ->CreateWebWidgetTestClient(proxy));
78 proxy->SetInterfaces(interfaces); 78 proxy->SetInterfaces(interfaces);
79 } 79 }
80 80
81 void WebFrameTestProxyCreated(RenderFrame* render_frame, 81 void WebFrameTestProxyCreated(RenderFrame* render_frame,
82 test_runner::WebFrameTestProxyBase* proxy) { 82 test_runner::WebFrameTestProxyBase* proxy) {
83 test_runner::WebTestProxyBase* web_test_proxy_base = 83 test_runner::WebViewTestProxyBase* web_view_test_proxy_base =
84 GetWebTestProxyBase(render_frame->GetRenderView()); 84 GetWebViewTestProxyBase(render_frame->GetRenderView());
85 proxy->set_test_client( 85 proxy->set_test_client(
86 LayoutTestRenderThreadObserver::GetInstance() 86 LayoutTestRenderThreadObserver::GetInstance()
87 ->test_interfaces() 87 ->test_interfaces()
88 ->CreateWebFrameTestClient(web_test_proxy_base, proxy)); 88 ->CreateWebFrameTestClient(web_view_test_proxy_base, proxy));
89 } 89 }
90 90
91 } // namespace 91 } // namespace
92 92
93 LayoutTestContentRendererClient::LayoutTestContentRendererClient() { 93 LayoutTestContentRendererClient::LayoutTestContentRendererClient() {
94 EnableWebTestProxyCreation(base::Bind(&WebTestProxyCreated), 94 EnableWebTestProxyCreation(base::Bind(&WebViewTestProxyCreated),
95 base::Bind(&WebFrameTestProxyCreated)); 95 base::Bind(&WebFrameTestProxyCreated));
96 } 96 }
97 97
98 LayoutTestContentRendererClient::~LayoutTestContentRendererClient() { 98 LayoutTestContentRendererClient::~LayoutTestContentRendererClient() {
99 } 99 }
100 100
101 void LayoutTestContentRendererClient::RenderThreadStarted() { 101 void LayoutTestContentRendererClient::RenderThreadStarted() {
102 ShellContentRendererClient::RenderThreadStarted(); 102 ShellContentRendererClient::RenderThreadStarted();
103 shell_observer_.reset(new LayoutTestRenderThreadObserver()); 103 shell_observer_.reset(new LayoutTestRenderThreadObserver());
104 } 104 }
105 105
106 void LayoutTestContentRendererClient::RenderFrameCreated( 106 void LayoutTestContentRendererClient::RenderFrameCreated(
107 RenderFrame* render_frame) { 107 RenderFrame* render_frame) {
108 test_runner::WebFrameTestProxyBase* frame_proxy = 108 test_runner::WebFrameTestProxyBase* frame_proxy =
109 GetWebFrameTestProxyBase(render_frame); 109 GetWebFrameTestProxyBase(render_frame);
110 frame_proxy->set_web_frame(render_frame->GetWebFrame()); 110 frame_proxy->set_web_frame(render_frame->GetWebFrame());
111 new LayoutTestRenderFrameObserver(render_frame); 111 new LayoutTestRenderFrameObserver(render_frame);
112 } 112 }
113 113
114 void LayoutTestContentRendererClient::RenderViewCreated( 114 void LayoutTestContentRendererClient::RenderViewCreated(
115 RenderView* render_view) { 115 RenderView* render_view) {
116 new ShellRenderViewObserver(render_view); 116 new ShellRenderViewObserver(render_view);
117 117
118 test_runner::WebTestProxyBase* proxy = GetWebTestProxyBase(render_view); 118 test_runner::WebViewTestProxyBase* proxy =
119 GetWebViewTestProxyBase(render_view);
119 proxy->set_web_view(render_view->GetWebView()); 120 proxy->set_web_view(render_view->GetWebView());
120 // TODO(lfg): We should fix the TestProxy to track the WebWidgets on every 121 // TODO(lfg): We should fix the TestProxy to track the WebWidgets on every
121 // local root in WebFrameTestProxy instead of having only the WebWidget for 122 // local root in WebFrameTestProxy instead of having only the WebWidget for
122 // the main frame in WebTestProxy. 123 // the main frame in WebViewTestProxy.
123 proxy->set_web_widget(render_view->GetWebView()->widget()); 124 proxy->set_web_widget(render_view->GetWebView()->widget());
124 proxy->Reset(); 125 proxy->Reset();
125 126
126 BlinkTestRunner* test_runner = BlinkTestRunner::Get(render_view); 127 BlinkTestRunner* test_runner = BlinkTestRunner::Get(render_view);
127 test_runner->Reset(false /* for_new_test */); 128 test_runner->Reset(false /* for_new_test */);
128 129
129 LayoutTestRenderThreadObserver::GetInstance() 130 LayoutTestRenderThreadObserver::GetInstance()
130 ->test_interfaces() 131 ->test_interfaces()
131 ->TestRunner() 132 ->TestRunner()
132 ->InitializeWebViewWithMocks(render_view->GetWebView()); 133 ->InitializeWebViewWithMocks(render_view->GetWebView());
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 return nullptr; 202 return nullptr;
202 #endif 203 #endif
203 } 204 }
204 205
205 void LayoutTestContentRendererClient::DidInitializeWorkerContextOnWorkerThread( 206 void LayoutTestContentRendererClient::DidInitializeWorkerContextOnWorkerThread(
206 v8::Local<v8::Context> context) { 207 v8::Local<v8::Context> context) {
207 blink::WebTestingSupport::injectInternalsObject(context); 208 blink::WebTestingSupport::injectInternalsObject(context);
208 } 209 }
209 210
210 } // namespace content 211 } // namespace content
OLDNEW
« no previous file with comments | « content/shell/renderer/layout_test/blink_test_runner.cc ('k') | content/test/layouttest_support.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698