OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #include "content/public/test/content_layouttest_support.h" | |
6 | |
7 #include "base/callback.h" | |
8 #include "base/lazy_instance.h" | |
9 #include "content/renderer/render_view_impl.h" | |
10 #include "third_party/WebKit/Tools/DumpRenderTree/chromium/TestRunner/public/Web TestProxy.h" | |
11 | |
12 using WebTestRunner::WebTestProxy; | |
13 using WebTestRunner::WebTestProxyBase; | |
14 | |
15 namespace content { | |
16 | |
17 namespace { | |
18 | |
19 base::LazyInstance<base::Callback<void(WebTestProxyBase*)> >::Leaky g_callback; | |
20 | |
21 RenderViewImpl* CreateWebTestProxy(RenderViewImplParams* params) { | |
22 typedef WebTestProxy<RenderViewImpl, RenderViewImplParams*> ProxyType; | |
23 ProxyType* render_view_proxy = new ProxyType( | |
24 reinterpret_cast<RenderViewImplParams*>(params)); | |
jam
2012/11/08 20:37:06
nit: no cast needed
| |
25 if (g_callback == 0) | |
26 return render_view_proxy; | |
27 g_callback.Get().Run(static_cast<WebTestProxyBase*>(render_view_proxy)); | |
28 return render_view_proxy; | |
29 } | |
30 | |
31 } // namespace | |
32 | |
33 | |
34 void EnableWebTestProxyCreation( | |
35 const base::Callback<void(WebTestProxyBase*)>& callback) { | |
36 g_callback.Get() = callback; | |
37 RenderViewImpl::InstallCreateHook(CreateWebTestProxy); | |
38 } | |
39 | |
40 } // namespace content | |
OLD | NEW |