OLD | NEW |
---|---|
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" |
(...skipping 11 matching lines...) Expand all Loading... | |
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 " |
25 #include "content/shell/renderer/layout_test/layout_test_render_thread_observer. h" | 25 #include "content/shell/renderer/layout_test/layout_test_render_thread_observer. h" |
26 #include "content/shell/renderer/layout_test/test_media_stream_renderer_factory. h" | 26 #include "content/shell/renderer/layout_test/test_media_stream_renderer_factory. h" |
27 #include "content/shell/renderer/shell_render_view_observer.h" | 27 #include "content/shell/renderer/shell_render_view_observer.h" |
28 #include "content/test/mock_webclipboard_impl.h" | 28 #include "content/test/mock_webclipboard_impl.h" |
29 #include "ppapi/shared_impl/ppapi_switches.h" | 29 #include "ppapi/shared_impl/ppapi_switches.h" |
30 #include "third_party/WebKit/public/platform/WebMediaStreamCenter.h" | 30 #include "third_party/WebKit/public/platform/WebMediaStreamCenter.h" |
31 #include "third_party/WebKit/public/platform/modules/app_banner/WebAppBannerClie nt.h" | 31 #include "third_party/WebKit/public/platform/modules/app_banner/WebAppBannerClie nt.h" |
32 #include "third_party/WebKit/public/web/WebFrameWidget.h" | |
32 #include "third_party/WebKit/public/web/WebPluginParams.h" | 33 #include "third_party/WebKit/public/web/WebPluginParams.h" |
33 #include "third_party/WebKit/public/web/WebTestingSupport.h" | 34 #include "third_party/WebKit/public/web/WebTestingSupport.h" |
34 #include "third_party/WebKit/public/web/WebView.h" | 35 #include "third_party/WebKit/public/web/WebView.h" |
35 #include "v8/include/v8.h" | 36 #include "v8/include/v8.h" |
36 | 37 |
37 using blink::WebAudioDevice; | 38 using blink::WebAudioDevice; |
38 using blink::WebClipboard; | 39 using blink::WebClipboard; |
39 using blink::WebFrame; | 40 using blink::WebFrame; |
40 using blink::WebLocalFrame; | 41 using blink::WebLocalFrame; |
41 using blink::WebMIDIAccessor; | 42 using blink::WebMIDIAccessor; |
(...skipping 23 matching lines...) Expand all Loading... | |
65 static bool first_test_runner = true; | 66 static bool first_test_runner = true; |
66 if (first_test_runner) { | 67 if (first_test_runner) { |
67 first_test_runner = false; | 68 first_test_runner = false; |
68 interfaces->SetDelegate(test_runner); | 69 interfaces->SetDelegate(test_runner); |
69 } | 70 } |
70 | 71 |
71 proxy->set_delegate(test_runner); | 72 proxy->set_delegate(test_runner); |
72 proxy->set_view_test_client(LayoutTestRenderThreadObserver::GetInstance() | 73 proxy->set_view_test_client(LayoutTestRenderThreadObserver::GetInstance() |
73 ->test_interfaces() | 74 ->test_interfaces() |
74 ->CreateWebViewTestClient(proxy)); | 75 ->CreateWebViewTestClient(proxy)); |
75 proxy->set_widget_test_client(LayoutTestRenderThreadObserver::GetInstance() | 76 auto widget_test_client = LayoutTestRenderThreadObserver::GetInstance() |
76 ->test_interfaces() | 77 ->test_interfaces() |
77 ->CreateWebWidgetTestClient(proxy)); | 78 ->CreateWebWidgetTestClient(proxy); |
79 widget_test_client->set_web_view_test_proxy_base(proxy); | |
80 proxy->set_widget_test_client(std::move(widget_test_client)); | |
Łukasz Anforowicz
2016/08/02 20:38:13
For a moment I was confused seeing 1) the call abo
lfg
2016/08/02 22:27:21
That's right, yes, see my other comment, but basic
| |
78 proxy->SetInterfaces(interfaces); | 81 proxy->SetInterfaces(interfaces); |
79 } | 82 } |
80 | 83 |
84 void WebWidgetTestProxyCreated(blink::WebWidget* web_widget, | |
85 test_runner::WebWidgetTestProxyBase* proxy) { | |
86 CHECK(web_widget->isWebFrameWidget()); | |
87 proxy->set_web_widget(web_widget); | |
88 blink::WebFrameWidget* web_frame_widget = | |
89 static_cast<blink::WebFrameWidget*>(web_widget); | |
90 blink::WebView* web_view = web_frame_widget->localRoot()->view(); | |
91 RenderView* render_view = RenderView::FromWebView(web_view); | |
92 test_runner::WebViewTestProxyBase* view_proxy = | |
93 GetWebViewTestProxyBase(render_view); | |
94 auto widget_test_client = LayoutTestRenderThreadObserver::GetInstance() | |
95 ->test_interfaces() | |
96 ->CreateWebWidgetTestClient(proxy); | |
97 widget_test_client->set_web_view_test_proxy_base(view_proxy); | |
98 proxy->set_widget_test_client(std::move(widget_test_client)); | |
99 } | |
100 | |
81 void WebFrameTestProxyCreated(RenderFrame* render_frame, | 101 void WebFrameTestProxyCreated(RenderFrame* render_frame, |
82 test_runner::WebFrameTestProxyBase* proxy) { | 102 test_runner::WebFrameTestProxyBase* proxy) { |
83 test_runner::WebViewTestProxyBase* web_view_test_proxy_base = | 103 test_runner::WebViewTestProxyBase* web_view_test_proxy_base = |
84 GetWebViewTestProxyBase(render_frame->GetRenderView()); | 104 GetWebViewTestProxyBase(render_frame->GetRenderView()); |
85 proxy->set_test_client( | 105 proxy->set_test_client( |
86 LayoutTestRenderThreadObserver::GetInstance() | 106 LayoutTestRenderThreadObserver::GetInstance() |
87 ->test_interfaces() | 107 ->test_interfaces() |
88 ->CreateWebFrameTestClient(web_view_test_proxy_base, proxy)); | 108 ->CreateWebFrameTestClient(web_view_test_proxy_base, proxy)); |
89 } | 109 } |
90 | 110 |
91 } // namespace | 111 } // namespace |
92 | 112 |
93 LayoutTestContentRendererClient::LayoutTestContentRendererClient() { | 113 LayoutTestContentRendererClient::LayoutTestContentRendererClient() { |
94 EnableWebTestProxyCreation(base::Bind(&WebViewTestProxyCreated), | 114 EnableWebTestProxyCreation(base::Bind(&WebViewTestProxyCreated), |
115 base::Bind(&WebWidgetTestProxyCreated), | |
95 base::Bind(&WebFrameTestProxyCreated)); | 116 base::Bind(&WebFrameTestProxyCreated)); |
96 } | 117 } |
97 | 118 |
98 LayoutTestContentRendererClient::~LayoutTestContentRendererClient() { | 119 LayoutTestContentRendererClient::~LayoutTestContentRendererClient() { |
99 } | 120 } |
100 | 121 |
101 void LayoutTestContentRendererClient::RenderThreadStarted() { | 122 void LayoutTestContentRendererClient::RenderThreadStarted() { |
102 ShellContentRendererClient::RenderThreadStarted(); | 123 ShellContentRendererClient::RenderThreadStarted(); |
103 shell_observer_.reset(new LayoutTestRenderThreadObserver()); | 124 shell_observer_.reset(new LayoutTestRenderThreadObserver()); |
104 } | 125 } |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
202 return nullptr; | 223 return nullptr; |
203 #endif | 224 #endif |
204 } | 225 } |
205 | 226 |
206 void LayoutTestContentRendererClient::DidInitializeWorkerContextOnWorkerThread( | 227 void LayoutTestContentRendererClient::DidInitializeWorkerContextOnWorkerThread( |
207 v8::Local<v8::Context> context) { | 228 v8::Local<v8::Context> context) { |
208 blink::WebTestingSupport::injectInternalsObject(context); | 229 blink::WebTestingSupport::injectInternalsObject(context); |
209 } | 230 } |
210 | 231 |
211 } // namespace content | 232 } // namespace content |
OLD | NEW |