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..9841fe7d8f8fa84a6dc2782e4d379b0e31031996 100644 |
| --- a/content/browser/renderer_host/render_widget_host_unittest.cc |
| +++ b/content/browser/renderer_host/render_widget_host_unittest.cc |
| @@ -3,9 +3,11 @@ |
| // found in the LICENSE file. |
| #include "base/basictypes.h" |
| +#include "base/command_line.h" |
| #include "base/memory/scoped_ptr.h" |
| #include "base/shared_memory.h" |
| #include "base/timer.h" |
| +#include "chrome/test/base/test_launcher_utils.h" |
|
sky
2011/10/13 19:52:00
content shouldn't depend on chrome or views.
danakj
2011/10/14 15:15:13
Oh this isn't even needed now, removed.
|
| #include "content/browser/browser_thread.h" |
| #include "content/browser/content_browser_client.h" |
| #include "content/browser/renderer_host/backing_store.h" |
| @@ -20,6 +22,11 @@ |
| #include "ui/base/keycodes/keyboard_codes.h" |
| #include "ui/gfx/canvas_skia.h" |
| +#if defined(VIEWS_COMPOSITOR) |
| +#include "ui/gfx/compositor/test_compositor.h" |
| +#include "views/widget/widget.h" |
| +#endif |
| + |
| using base::TimeDelta; |
| using WebKit::WebInputEvent; |
| @@ -237,6 +244,12 @@ class MockPaintingObserver : public NotificationObserver { |
| gfx::Size size_; |
| }; |
| +#if defined(VIEWS_COMPOSITOR) |
| +// static |
| +static ui::Compositor* TestCreateCompositor(ui::CompositorDelegate* owner) { |
| + return new ui::TestCompositor(owner); |
| +} |
| +#endif |
| // RenderWidgetHostTest -------------------------------------------------------- |
| @@ -250,6 +263,10 @@ class RenderWidgetHostTest : public testing::Test { |
| protected: |
| // testing::Test |
| void SetUp() { |
| +#if defined(VIEWS_COMPOSITOR) |
| + // Use a mock compositor that noops draws. |
| + views::Widget::set_compositor_factory_for_testing(&TestCreateCompositor); |
|
danakj
2011/10/14 15:15:13
Moved the factory to ui::Compositor.
|
| +#endif |
| browser_context_.reset(new TestBrowserContext()); |
| process_ = new RenderWidgetHostProcess(browser_context_.get()); |
| host_.reset(new MockRenderWidgetHost(process_, 1)); |
| @@ -262,6 +279,9 @@ class RenderWidgetHostTest : public testing::Test { |
| host_.reset(); |
| process_ = NULL; |
| browser_context_.reset(); |
| +#if defined(VIEWS_COMPOSITOR) |
| + views::Widget::set_compositor_factory_for_testing(NULL); |
| +#endif |
| // Process all pending tasks to avoid leaks. |
| MessageLoop::current()->RunAllPending(); |