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

Unified Diff: ash/test/ash_test_suite.cc

Issue 2788463003: Adds ability for ash_unittests to run in mushrome mode (Closed)
Patch Set: cleanup Created 3 years, 9 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: ash/test/ash_test_suite.cc
diff --git a/ash/test/ash_test_suite.cc b/ash/test/ash_test_suite.cc
index 9b141b8f399f7c0b54ec35eabd7a8c928112991b..f1ff980466220a1b220a4094f3d147be099cdf2d 100644
--- a/ash/test/ash_test_suite.cc
+++ b/ash/test/ash_test_suite.cc
@@ -4,7 +4,9 @@
#include "ash/test/ash_test_suite.h"
+#include "ash/public/cpp/config.h"
#include "ash/test/ash_test_environment.h"
+#include "ash/test/ash_test_helper.h"
#include "base/command_line.h"
#include "base/files/file_path.h"
#include "base/i18n/rtl.h"
@@ -13,6 +15,7 @@
#include "testing/gtest/include/gtest/gtest.h"
#include "ui/base/resource/resource_bundle.h"
#include "ui/base/ui_base_paths.h"
+#include "ui/compositor/test/fake_context_factory.h"
#include "ui/gfx/gfx_paths.h"
#include "ui/gl/test/gl_surface_test_support.h"
@@ -54,8 +57,20 @@ void AshTestSuite::Initialize() {
ash_test_resources_200, ui::SCALE_FACTOR_200P);
}
+ const bool is_classic =
msw 2017/03/30 23:06:05 optional nit: is_mus would be a one-liner.
sky 2017/03/30 23:35:46 Nice!
+ !base::CommandLine::ForCurrentProcess()->HasSwitch("mus");
+ ash::test::AshTestHelper::config_ =
+ is_classic ? Config::CLASSIC : Config::MUS;
+
base::DiscardableMemoryAllocator::SetInstance(&discardable_memory_allocator_);
- env_ = aura::Env::CreateInstance();
+ env_ = aura::Env::CreateInstance(is_classic ? aura::Env::Mode::LOCAL
+ : aura::Env::Mode::MUS);
+
+ if (!is_classic) {
+ context_factory_ = base::MakeUnique<ui::FakeContextFactory>();
+ env_->set_context_factory(context_factory_.get());
+ env_->set_context_factory_private(nullptr);
+ }
}
void AshTestSuite::Shutdown() {

Powered by Google App Engine
This is Rietveld 408576698