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 std::unique_ptr<test_runner::WebWidgetTestClient> widget_test_client = |
76 ->test_interfaces() | 77 LayoutTestRenderThreadObserver::GetInstance() |
77 ->CreateWebWidgetTestClient(proxy)); | 78 ->test_interfaces() |
| 79 ->CreateWebWidgetTestClient(proxy); |
| 80 widget_test_client->set_web_view_test_proxy_base(proxy); |
| 81 proxy->set_widget_test_client(std::move(widget_test_client)); |
78 proxy->SetInterfaces(interfaces); | 82 proxy->SetInterfaces(interfaces); |
79 } | 83 } |
80 | 84 |
| 85 void WebWidgetTestProxyCreated(blink::WebWidget* web_widget, |
| 86 test_runner::WebWidgetTestProxyBase* proxy) { |
| 87 CHECK(web_widget->isWebFrameWidget()); |
| 88 proxy->set_web_widget(web_widget); |
| 89 blink::WebFrameWidget* web_frame_widget = |
| 90 static_cast<blink::WebFrameWidget*>(web_widget); |
| 91 blink::WebView* web_view = web_frame_widget->localRoot()->view(); |
| 92 RenderView* render_view = RenderView::FromWebView(web_view); |
| 93 test_runner::WebViewTestProxyBase* view_proxy = |
| 94 GetWebViewTestProxyBase(render_view); |
| 95 std::unique_ptr<test_runner::WebWidgetTestClient> widget_test_client = |
| 96 LayoutTestRenderThreadObserver::GetInstance() |
| 97 ->test_interfaces() |
| 98 ->CreateWebWidgetTestClient(proxy); |
| 99 widget_test_client->set_web_view_test_proxy_base(view_proxy); |
| 100 proxy->set_widget_test_client(std::move(widget_test_client)); |
| 101 } |
| 102 |
81 void WebFrameTestProxyCreated(RenderFrame* render_frame, | 103 void WebFrameTestProxyCreated(RenderFrame* render_frame, |
82 test_runner::WebFrameTestProxyBase* proxy) { | 104 test_runner::WebFrameTestProxyBase* proxy) { |
83 test_runner::WebViewTestProxyBase* web_view_test_proxy_base = | 105 test_runner::WebViewTestProxyBase* web_view_test_proxy_base = |
84 GetWebViewTestProxyBase(render_frame->GetRenderView()); | 106 GetWebViewTestProxyBase(render_frame->GetRenderView()); |
85 proxy->set_test_client( | 107 proxy->set_test_client( |
86 LayoutTestRenderThreadObserver::GetInstance() | 108 LayoutTestRenderThreadObserver::GetInstance() |
87 ->test_interfaces() | 109 ->test_interfaces() |
88 ->CreateWebFrameTestClient(web_view_test_proxy_base, proxy)); | 110 ->CreateWebFrameTestClient(web_view_test_proxy_base, proxy)); |
89 } | 111 } |
90 | 112 |
91 } // namespace | 113 } // namespace |
92 | 114 |
93 LayoutTestContentRendererClient::LayoutTestContentRendererClient() { | 115 LayoutTestContentRendererClient::LayoutTestContentRendererClient() { |
94 EnableWebTestProxyCreation(base::Bind(&WebViewTestProxyCreated), | 116 EnableWebTestProxyCreation(base::Bind(&WebViewTestProxyCreated), |
| 117 base::Bind(&WebWidgetTestProxyCreated), |
95 base::Bind(&WebFrameTestProxyCreated)); | 118 base::Bind(&WebFrameTestProxyCreated)); |
96 } | 119 } |
97 | 120 |
98 LayoutTestContentRendererClient::~LayoutTestContentRendererClient() { | 121 LayoutTestContentRendererClient::~LayoutTestContentRendererClient() { |
99 } | 122 } |
100 | 123 |
101 void LayoutTestContentRendererClient::RenderThreadStarted() { | 124 void LayoutTestContentRendererClient::RenderThreadStarted() { |
102 ShellContentRendererClient::RenderThreadStarted(); | 125 ShellContentRendererClient::RenderThreadStarted(); |
103 shell_observer_.reset(new LayoutTestRenderThreadObserver()); | 126 shell_observer_.reset(new LayoutTestRenderThreadObserver()); |
104 } | 127 } |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 return nullptr; | 225 return nullptr; |
203 #endif | 226 #endif |
204 } | 227 } |
205 | 228 |
206 void LayoutTestContentRendererClient::DidInitializeWorkerContextOnWorkerThread( | 229 void LayoutTestContentRendererClient::DidInitializeWorkerContextOnWorkerThread( |
207 v8::Local<v8::Context> context) { | 230 v8::Local<v8::Context> context) { |
208 blink::WebTestingSupport::injectInternalsObject(context); | 231 blink::WebTestingSupport::injectInternalsObject(context); |
209 } | 232 } |
210 | 233 |
211 } // namespace content | 234 } // namespace content |
OLD | NEW |