Chromium Code Reviews| Index: content/browser/renderer_host/render_widget_host_unittest.cc |
| diff --git a/content/browser/renderer_host/render_widget_host_unittest.cc b/content/browser/renderer_host/render_widget_host_unittest.cc |
| index 7a8bea2a21f0d28679fee5a67cc504ab0539928d..03ce32ebeb5f5d47e1618e7a3dfcbc32c1ac3808 100644 |
| --- a/content/browser/renderer_host/render_widget_host_unittest.cc |
| +++ b/content/browser/renderer_host/render_widget_host_unittest.cc |
| @@ -20,6 +20,11 @@ |
| #include "ui/base/keycodes/keyboard_codes.h" |
| #include "ui/gfx/canvas_skia.h" |
| +#if defined(VIEWS_COMPOSITOR) |
| +#include "ui/gfx/compositor/compositor.h" |
| +#include "ui/gfx/compositor/test_compositor.h" |
| +#endif |
| + |
| using base::TimeDelta; |
| using WebKit::WebInputEvent; |
| @@ -237,6 +242,12 @@ class MockPaintingObserver : public NotificationObserver { |
| gfx::Size size_; |
| }; |
| +#if defined(VIEWS_COMPOSITOR) |
|
sky
2011/10/14 17:07:16
I was wrong in where I put some of this code. It s
danakj
2011/10/14 19:51:39
done. does it look right/did i get the relevant on
|
| +// static |
| +static ui::Compositor* TestCreateCompositor(ui::CompositorDelegate* owner) { |
| + return new ui::TestCompositor(owner); |
| +} |
| +#endif |
| // RenderWidgetHostTest -------------------------------------------------------- |
| @@ -250,6 +261,10 @@ class RenderWidgetHostTest : public testing::Test { |
| protected: |
| // testing::Test |
| void SetUp() { |
| +#if defined(VIEWS_COMPOSITOR) |
| + // Use a mock compositor that noops draws. |
| + ui::Compositor::set_compositor_factory_for_testing(&TestCreateCompositor); |
| +#endif |
| browser_context_.reset(new TestBrowserContext()); |
| process_ = new RenderWidgetHostProcess(browser_context_.get()); |
| host_.reset(new MockRenderWidgetHost(process_, 1)); |
| @@ -262,6 +277,9 @@ class RenderWidgetHostTest : public testing::Test { |
| host_.reset(); |
| process_ = NULL; |
| browser_context_.reset(); |
| +#if defined(VIEWS_COMPOSITOR) |
| + ui::Compositor::set_compositor_factory_for_testing(NULL); |
| +#endif |
| // Process all pending tasks to avoid leaks. |
| MessageLoop::current()->RunAllPending(); |