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

Unified Diff: ash/test/ash_test_suite.cc

Issue 2788463003: Adds ability for ash_unittests to run in mushrome mode (Closed)
Patch Set: feedback 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
« no previous file with comments | « ash/test/ash_test_suite.h ('k') | components/exo/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..2ad4a54681480eedcc28599d268aab1182c6aa61 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,18 @@ void AshTestSuite::Initialize() {
ash_test_resources_200, ui::SCALE_FACTOR_200P);
}
+ const bool is_mus = base::CommandLine::ForCurrentProcess()->HasSwitch("mus");
+ ash::test::AshTestHelper::config_ = is_mus ? Config::MUS : Config::CLASSIC;
+
base::DiscardableMemoryAllocator::SetInstance(&discardable_memory_allocator_);
- env_ = aura::Env::CreateInstance();
+ env_ = aura::Env::CreateInstance(is_mus ? aura::Env::Mode::MUS
+ : aura::Env::Mode::LOCAL);
+
+ if (is_mus) {
+ context_factory_ = base::MakeUnique<ui::FakeContextFactory>();
+ env_->set_context_factory(context_factory_.get());
+ env_->set_context_factory_private(nullptr);
+ }
}
void AshTestSuite::Shutdown() {
« no previous file with comments | « ash/test/ash_test_suite.h ('k') | components/exo/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698