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" | |
33 #include "third_party/WebKit/public/web/WebPluginParams.h" | 32 #include "third_party/WebKit/public/web/WebPluginParams.h" |
34 #include "third_party/WebKit/public/web/WebTestingSupport.h" | 33 #include "third_party/WebKit/public/web/WebTestingSupport.h" |
35 #include "third_party/WebKit/public/web/WebView.h" | 34 #include "third_party/WebKit/public/web/WebView.h" |
36 #include "v8/include/v8.h" | 35 #include "v8/include/v8.h" |
37 | 36 |
38 using blink::WebAudioDevice; | 37 using blink::WebAudioDevice; |
39 using blink::WebClipboard; | 38 using blink::WebClipboard; |
40 using blink::WebFrame; | 39 using blink::WebFrame; |
41 using blink::WebLocalFrame; | 40 using blink::WebLocalFrame; |
42 using blink::WebMIDIAccessor; | 41 using blink::WebMIDIAccessor; |
(...skipping 23 matching lines...) Expand all Loading... |
66 static bool first_test_runner = true; | 65 static bool first_test_runner = true; |
67 if (first_test_runner) { | 66 if (first_test_runner) { |
68 first_test_runner = false; | 67 first_test_runner = false; |
69 interfaces->SetDelegate(test_runner); | 68 interfaces->SetDelegate(test_runner); |
70 } | 69 } |
71 | 70 |
72 proxy->set_delegate(test_runner); | 71 proxy->set_delegate(test_runner); |
73 proxy->set_view_test_client(LayoutTestRenderThreadObserver::GetInstance() | 72 proxy->set_view_test_client(LayoutTestRenderThreadObserver::GetInstance() |
74 ->test_interfaces() | 73 ->test_interfaces() |
75 ->CreateWebViewTestClient(proxy)); | 74 ->CreateWebViewTestClient(proxy)); |
76 std::unique_ptr<test_runner::WebWidgetTestClient> widget_test_client = | 75 proxy->set_widget_test_client(LayoutTestRenderThreadObserver::GetInstance() |
77 LayoutTestRenderThreadObserver::GetInstance() | 76 ->test_interfaces() |
78 ->test_interfaces() | 77 ->CreateWebWidgetTestClient(proxy)); |
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)); | |
82 proxy->SetInterfaces(interfaces); | 78 proxy->SetInterfaces(interfaces); |
83 } | 79 } |
84 | 80 |
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 | |
103 void WebFrameTestProxyCreated(RenderFrame* render_frame, | 81 void WebFrameTestProxyCreated(RenderFrame* render_frame, |
104 test_runner::WebFrameTestProxyBase* proxy) { | 82 test_runner::WebFrameTestProxyBase* proxy) { |
105 test_runner::WebViewTestProxyBase* web_view_test_proxy_base = | 83 test_runner::WebViewTestProxyBase* web_view_test_proxy_base = |
106 GetWebViewTestProxyBase(render_frame->GetRenderView()); | 84 GetWebViewTestProxyBase(render_frame->GetRenderView()); |
107 proxy->set_test_client( | 85 proxy->set_test_client( |
108 LayoutTestRenderThreadObserver::GetInstance() | 86 LayoutTestRenderThreadObserver::GetInstance() |
109 ->test_interfaces() | 87 ->test_interfaces() |
110 ->CreateWebFrameTestClient(web_view_test_proxy_base, proxy)); | 88 ->CreateWebFrameTestClient(web_view_test_proxy_base, proxy)); |
111 } | 89 } |
112 | 90 |
113 } // namespace | 91 } // namespace |
114 | 92 |
115 LayoutTestContentRendererClient::LayoutTestContentRendererClient() { | 93 LayoutTestContentRendererClient::LayoutTestContentRendererClient() { |
116 EnableWebTestProxyCreation(base::Bind(&WebViewTestProxyCreated), | 94 EnableWebTestProxyCreation(base::Bind(&WebViewTestProxyCreated), |
117 base::Bind(&WebWidgetTestProxyCreated), | |
118 base::Bind(&WebFrameTestProxyCreated)); | 95 base::Bind(&WebFrameTestProxyCreated)); |
119 } | 96 } |
120 | 97 |
121 LayoutTestContentRendererClient::~LayoutTestContentRendererClient() { | 98 LayoutTestContentRendererClient::~LayoutTestContentRendererClient() { |
122 } | 99 } |
123 | 100 |
124 void LayoutTestContentRendererClient::RenderThreadStarted() { | 101 void LayoutTestContentRendererClient::RenderThreadStarted() { |
125 ShellContentRendererClient::RenderThreadStarted(); | 102 ShellContentRendererClient::RenderThreadStarted(); |
126 shell_observer_.reset(new LayoutTestRenderThreadObserver()); | 103 shell_observer_.reset(new LayoutTestRenderThreadObserver()); |
127 } | 104 } |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
225 return nullptr; | 202 return nullptr; |
226 #endif | 203 #endif |
227 } | 204 } |
228 | 205 |
229 void LayoutTestContentRendererClient::DidInitializeWorkerContextOnWorkerThread( | 206 void LayoutTestContentRendererClient::DidInitializeWorkerContextOnWorkerThread( |
230 v8::Local<v8::Context> context) { | 207 v8::Local<v8::Context> context) { |
231 blink::WebTestingSupport::injectInternalsObject(context); | 208 blink::WebTestingSupport::injectInternalsObject(context); |
232 } | 209 } |
233 | 210 |
234 } // namespace content | 211 } // namespace content |
OLD | NEW |