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

Unified Diff: chrome/test/base/view_event_test_base.cc

Issue 22293003: Clean up compositor initialization/destruction. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: cleanupcompositor: UseRealGLBindings in NetInternalsTest Created 7 years, 4 months 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
Index: chrome/test/base/view_event_test_base.cc
diff --git a/chrome/test/base/view_event_test_base.cc b/chrome/test/base/view_event_test_base.cc
index aabfb25f6148ec5f6617d4717be8e3bbe4e77ee4..4654a7e2887ec3d90bbb5f7b065952bca0ffc884 100644
--- a/chrome/test/base/view_event_test_base.cc
+++ b/chrome/test/base/view_event_test_base.cc
@@ -22,6 +22,9 @@
#include "ash/shell.h"
#include "ash/test/test_session_state_delegate.h"
#include "ash/test/test_shell_delegate.h"
+#if defined(OS_WIN)
+#include "ui/compositor/compositor.h"
+#endif
#endif
#if defined(USE_AURA)
@@ -101,20 +104,26 @@ void ViewEventTestBase::SetUp() {
// interactive_ui_tests is brought up on that platform.
gfx::Screen::SetScreenInstance(
gfx::SCREEN_TYPE_NATIVE, views::CreateDesktopScreen());
-#else
+
+ // The ContextFactory must exist before any Compositors are created. The
+ // ash::Shell code path below handles this, but since we skip it we must
+ // do this here.
+ bool allow_test_contexts = true;
+ ui::Compositor::InitializeContextFactoryForTests(allow_test_contexts);
+#else // !OS_WIN
// Ash Shell can't just live on its own without a browser process, we need to
// also create the message center.
message_center::MessageCenter::Initialize();
#if defined(OS_CHROMEOS)
chromeos::CrasAudioHandler::InitializeForTesting();
-#endif
+#endif // OS_CHROMEOS
ash::test::TestShellDelegate* shell_delegate =
new ash::test::TestShellDelegate();
ash::Shell::CreateInstance(shell_delegate);
shell_delegate->test_session_state_delegate()
->SetActiveUserSessionStarted(true);
context = ash::Shell::GetPrimaryRootWindow();
-#endif
+#endif // !OS_WIN
#elif defined(USE_AURA)
// Instead of using the ash shell, use an AuraTestHelper to create and manage
// the test screen.
@@ -122,7 +131,7 @@ void ViewEventTestBase::SetUp() {
new aura::test::AuraTestHelper(base::MessageLoopForUI::current()));
aura_test_helper_->SetUp();
context = aura_test_helper_->root_window();
-#endif
+#endif // USE_AURA
window_ = views::Widget::CreateWindowWithContext(this, context);
}

Powered by Google App Engine
This is Rietveld 408576698