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

Unified Diff: chrome/browser/notifications/desktop_notifications_unittest.cc

Issue 45963003: Move test-only ContextFactory implementations out of production targets (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: revert bad ui/base changes Created 7 years, 2 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/browser/notifications/desktop_notifications_unittest.cc
diff --git a/chrome/browser/notifications/desktop_notifications_unittest.cc b/chrome/browser/notifications/desktop_notifications_unittest.cc
index 9d07c8b84e544677a8da7b920ff6991cdd04dd19..c62ae50894384815a0b33e73a5c106fe11b45efc 100644
--- a/chrome/browser/notifications/desktop_notifications_unittest.cc
+++ b/chrome/browser/notifications/desktop_notifications_unittest.cc
@@ -24,6 +24,7 @@
#include "ui/aura/env.h"
#include "ui/aura/root_window.h"
#include "ui/compositor/scoped_animation_duration_scale_mode.h"
+#include "ui/compositor/test/context_factories_for_test.h"
#endif
@@ -107,6 +108,9 @@ void DesktopNotificationsTest::SetUp() {
// The message center is notmally initialized on |g_browser_process| which
// is not created for these tests.
message_center::MessageCenter::Initialize();
+ // The ContextFactory must exist before any Compositors are created.
+ bool allow_test_contexts = true;
+ ui::InitializeContextFactoryForTests(allow_test_contexts);
// MockBalloonCollection retrieves information about the screen on creation.
// So it is necessary to make sure the desktop gets created first.
ash::Shell::CreateInstance(new ash::test::TestShellDelegate);
@@ -131,6 +135,7 @@ void DesktopNotificationsTest::TearDown() {
// is not created for these tests.
message_center::MessageCenter::Shutdown();
aura::Env::DeleteInstance();
+ ui::TerminateContextFactoryForTests();
#endif
ui::ShutdownInputMethodForTesting();
}

Powered by Google App Engine
This is Rietveld 408576698