| 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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 proxy->set_widget_test_client(LayoutTestRenderThreadObserver::GetInstance() | 76 proxy->set_widget_test_client(LayoutTestRenderThreadObserver::GetInstance() |
| 77 ->test_interfaces() | 77 ->test_interfaces() |
| 78 ->CreateWebWidgetTestClient(proxy)); | 78 ->CreateWebWidgetTestClient(proxy)); |
| 79 proxy->SetInterfaces(interfaces); | 79 proxy->SetInterfaces(interfaces); |
| 80 } | 80 } |
| 81 | 81 |
| 82 void WebFrameTestProxyCreated(RenderFrame* render_frame, | 82 void WebFrameTestProxyCreated(RenderFrame* render_frame, |
| 83 test_runner::WebFrameTestProxyBase* proxy) { | 83 test_runner::WebFrameTestProxyBase* proxy) { |
| 84 test_runner::WebTestProxyBase* web_test_proxy_base = | 84 test_runner::WebTestProxyBase* web_test_proxy_base = |
| 85 GetWebTestProxyBase(render_frame->GetRenderView()); | 85 GetWebTestProxyBase(render_frame->GetRenderView()); |
| 86 proxy->set_web_test_proxy_base(web_test_proxy_base); |
| 86 proxy->set_test_client( | 87 proxy->set_test_client( |
| 87 LayoutTestRenderThreadObserver::GetInstance() | 88 LayoutTestRenderThreadObserver::GetInstance() |
| 88 ->test_interfaces() | 89 ->test_interfaces() |
| 89 ->CreateWebFrameTestClient(web_test_proxy_base, proxy)); | 90 ->CreateWebFrameTestClient(web_test_proxy_base, proxy)); |
| 90 } | 91 } |
| 91 | 92 |
| 92 } // namespace | 93 } // namespace |
| 93 | 94 |
| 94 LayoutTestContentRendererClient::LayoutTestContentRendererClient() { | 95 LayoutTestContentRendererClient::LayoutTestContentRendererClient() { |
| 95 EnableWebTestProxyCreation(base::Bind(&WebTestProxyCreated), | 96 EnableWebTestProxyCreation(base::Bind(&WebTestProxyCreated), |
| 96 base::Bind(&WebFrameTestProxyCreated)); | 97 base::Bind(&WebFrameTestProxyCreated)); |
| 97 } | 98 } |
| 98 | 99 |
| 99 LayoutTestContentRendererClient::~LayoutTestContentRendererClient() { | 100 LayoutTestContentRendererClient::~LayoutTestContentRendererClient() { |
| 100 } | 101 } |
| 101 | 102 |
| 102 void LayoutTestContentRendererClient::RenderThreadStarted() { | 103 void LayoutTestContentRendererClient::RenderThreadStarted() { |
| 103 ShellContentRendererClient::RenderThreadStarted(); | 104 ShellContentRendererClient::RenderThreadStarted(); |
| 104 shell_observer_.reset(new LayoutTestRenderThreadObserver()); | 105 shell_observer_.reset(new LayoutTestRenderThreadObserver()); |
| 105 } | 106 } |
| 106 | 107 |
| 107 void LayoutTestContentRendererClient::RenderFrameCreated( | 108 void LayoutTestContentRendererClient::RenderFrameCreated( |
| 108 RenderFrame* render_frame) { | 109 RenderFrame* render_frame) { |
| 109 test_runner::WebFrameTestProxyBase* frame_proxy = | 110 test_runner::WebFrameTestProxyBase* frame_proxy = |
| 110 GetWebFrameTestProxyBase(render_frame); | 111 GetWebFrameTestProxyBase(render_frame); |
| 111 frame_proxy->set_web_frame(render_frame->GetWebFrame()); | 112 frame_proxy->set_web_frame(render_frame->GetWebFrame()); |
| 113 frame_proxy->SetSendWheelGestures(UseGestureBasedWheelScrolling()); |
| 112 new LayoutTestRenderFrameObserver(render_frame); | 114 new LayoutTestRenderFrameObserver(render_frame); |
| 113 } | 115 } |
| 114 | 116 |
| 115 void LayoutTestContentRendererClient::RenderViewCreated( | 117 void LayoutTestContentRendererClient::RenderViewCreated( |
| 116 RenderView* render_view) { | 118 RenderView* render_view) { |
| 117 new ShellRenderViewObserver(render_view); | 119 new ShellRenderViewObserver(render_view); |
| 118 | 120 |
| 119 test_runner::WebTestProxyBase* proxy = GetWebTestProxyBase(render_view); | 121 test_runner::WebTestProxyBase* proxy = GetWebTestProxyBase(render_view); |
| 120 proxy->set_web_view(render_view->GetWebView()); | 122 proxy->set_web_view(render_view->GetWebView()); |
| 121 // TODO(lfg): We should fix the TestProxy to track the WebWidgets on every | 123 // TODO(lfg): We should fix the TestProxy to track the WebWidgets on every |
| 122 // local root in WebFrameTestProxy instead of having only the WebWidget for | 124 // local root in WebFrameTestProxy instead of having only the WebWidget for |
| 123 // the main frame in WebTestProxy. | 125 // the main frame in WebTestProxy. |
| 124 proxy->set_web_widget(render_view->GetWebView()->widget()); | 126 proxy->set_web_widget(render_view->GetWebView()->widget()); |
| 125 proxy->Reset(); | 127 proxy->Reset(); |
| 126 proxy->SetSendWheelGestures(UseGestureBasedWheelScrolling()); | |
| 127 | 128 |
| 128 BlinkTestRunner* test_runner = BlinkTestRunner::Get(render_view); | 129 BlinkTestRunner* test_runner = BlinkTestRunner::Get(render_view); |
| 129 test_runner->Reset(false /* for_new_test */); | 130 test_runner->Reset(false /* for_new_test */); |
| 130 | 131 |
| 131 LayoutTestRenderThreadObserver::GetInstance() | 132 LayoutTestRenderThreadObserver::GetInstance() |
| 132 ->test_interfaces() | 133 ->test_interfaces() |
| 133 ->TestRunner() | 134 ->TestRunner() |
| 134 ->InitializeWebViewWithMocks(render_view->GetWebView()); | 135 ->InitializeWebViewWithMocks(render_view->GetWebView()); |
| 135 } | 136 } |
| 136 | 137 |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 return nullptr; | 204 return nullptr; |
| 204 #endif | 205 #endif |
| 205 } | 206 } |
| 206 | 207 |
| 207 void LayoutTestContentRendererClient::DidInitializeWorkerContextOnWorkerThread( | 208 void LayoutTestContentRendererClient::DidInitializeWorkerContextOnWorkerThread( |
| 208 v8::Local<v8::Context> context) { | 209 v8::Local<v8::Context> context) { |
| 209 blink::WebTestingSupport::injectInternalsObject(context); | 210 blink::WebTestingSupport::injectInternalsObject(context); |
| 210 } | 211 } |
| 211 | 212 |
| 212 } // namespace content | 213 } // namespace content |
| OLD | NEW |