Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(81)

Unified Diff: content/test/content_layouttest_support.cc

Issue 11362161: Use the WebTestProxy for layout tests in content_shell (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: version that doesn't expose RenderViewImpl in public API Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« content/shell/shell_render_process_observer.h ('K') | « content/test/DEPS ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/test/content_layouttest_support.cc
diff --git a/content/test/content_layouttest_support.cc b/content/test/content_layouttest_support.cc
new file mode 100644
index 0000000000000000000000000000000000000000..93ece7b8b50d1b733cdfa3367fa86209726c7ffe
--- /dev/null
+++ b/content/test/content_layouttest_support.cc
@@ -0,0 +1,40 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "content/public/test/content_layouttest_support.h"
+
+#include "base/callback.h"
+#include "base/lazy_instance.h"
+#include "content/renderer/render_view_impl.h"
+#include "third_party/WebKit/Tools/DumpRenderTree/chromium/TestRunner/public/WebTestProxy.h"
+
+using WebTestRunner::WebTestProxy;
+using WebTestRunner::WebTestProxyBase;
+
+namespace content {
+
+namespace {
+
+base::LazyInstance<base::Callback<void(WebTestProxyBase*)> >::Leaky g_callback;
+
+RenderViewImpl* CreateWebTestProxy(RenderViewImplParams* params) {
+ typedef WebTestProxy<RenderViewImpl, RenderViewImplParams*> ProxyType;
+ ProxyType* render_view_proxy = new ProxyType(
+ reinterpret_cast<RenderViewImplParams*>(params));
jam 2012/11/08 20:37:06 nit: no cast needed
+ if (g_callback == 0)
+ return render_view_proxy;
+ g_callback.Get().Run(static_cast<WebTestProxyBase*>(render_view_proxy));
+ return render_view_proxy;
+}
+
+} // namespace
+
+
+void EnableWebTestProxyCreation(
+ const base::Callback<void(WebTestProxyBase*)>& callback) {
+ g_callback.Get() = callback;
+ RenderViewImpl::InstallCreateHook(CreateWebTestProxy);
+}
+
+} // namespace content
« content/shell/shell_render_process_observer.h ('K') | « content/test/DEPS ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698