Index: ui/views/test/views_test_base.cc |
diff --git a/ui/views/test/views_test_base.cc b/ui/views/test/views_test_base.cc |
index 5b7f5c1f2b22a911f10f8e885c1fe1b8c12d58b5..2014b51707187bdb1c44a17525e0349e27048624 100644 |
--- a/ui/views/test/views_test_base.cc |
+++ b/ui/views/test/views_test_base.cc |
@@ -13,7 +13,8 @@ |
namespace views { |
ViewsTestBase::ViewsTestBase() |
- : setup_called_(false), |
+ : context_factory_(NULL), |
+ setup_called_(false), |
teardown_called_(false) { |
} |
@@ -27,13 +28,17 @@ ViewsTestBase::~ViewsTestBase() { |
void ViewsTestBase::SetUp() { |
testing::Test::SetUp(); |
setup_called_ = true; |
- if (!views_delegate_.get()) |
- views_delegate_.reset(new TestViewsDelegate()); |
+ TestViewsDelegate* test_views_delegate = NULL; |
+ if (!views_delegate_.get()) { |
+ test_views_delegate = new TestViewsDelegate; |
+ views_delegate_.reset(test_views_delegate); |
+ } |
// The ContextFactory must exist before any Compositors are created. |
bool enable_pixel_output = false; |
- ui::InitializeContextFactoryForTests(enable_pixel_output); |
+ context_factory_ = ui::InitializeContextFactoryForTests(enable_pixel_output); |
+ views_delegate_->set_context_factory(context_factory_); |
- test_helper_.reset(ViewsTestHelper::Create(&message_loop_)); |
+ test_helper_.reset(ViewsTestHelper::Create(&message_loop_, context_factory_)); |
test_helper_->SetUp(); |
ui::InitializeInputMethodForTesting(); |
} |