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

Unified Diff: ash/test/ash_test_environment_default.cc

Issue 2296973002: Moves ash content specific tests into ash_content_unittests (Closed)
Patch Set: add dep to base test suport Created 4 years, 3 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_environment_content.cc ('k') | ash/test/ash_test_helper.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/test/ash_test_environment_default.cc
diff --git a/ash/test/ash_test_environment_default.cc b/ash/test/ash_test_environment_default.cc
new file mode 100644
index 0000000000000000000000000000000000000000..f1d9d3280e87eb246058e77d6565ad0fb3f2b5bc
--- /dev/null
+++ b/ash/test/ash_test_environment_default.cc
@@ -0,0 +1,57 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "ash/test/ash_test_environment.h"
+
+#include "ash/test/ash_test_views_delegate.h"
+#include "base/memory/ptr_util.h"
+#include "base/message_loop/message_loop.h"
+#include "base/run_loop.h"
+#include "base/test/sequenced_worker_pool_owner.h"
+#include "base/threading/sequenced_worker_pool.h"
+
+namespace ash {
+namespace test {
+namespace {
+
+class AshTestEnvironmentDefault : public AshTestEnvironment {
+ public:
+ AshTestEnvironmentDefault() {}
+
+ ~AshTestEnvironmentDefault() override {
+ base::RunLoop().RunUntilIdle();
+ blocking_pool_owner_.reset();
+ base::RunLoop().RunUntilIdle();
+ }
+
+ // AshTestEnvironment:
+ base::SequencedWorkerPool* GetBlockingPool() override {
+ if (!blocking_pool_owner_) {
+ const size_t kMaxNumberThreads = 3u; // Matches that of content.
+ const char kThreadNamePrefix[] = "AshBlocking";
+ blocking_pool_owner_ = base::MakeUnique<base::SequencedWorkerPoolOwner>(
+ kMaxNumberThreads, kThreadNamePrefix);
+ }
+ return blocking_pool_owner_->pool().get();
+ }
+ std::unique_ptr<views::ViewsDelegate> CreateViewsDelegate() override {
+ return base::MakeUnique<AshTestViewsDelegate>();
+ }
+
+ private:
+ base::MessageLoopForUI message_loop_;
+ std::unique_ptr<base::SequencedWorkerPoolOwner> blocking_pool_owner_;
+
+ DISALLOW_COPY_AND_ASSIGN(AshTestEnvironmentDefault);
+};
+
+} // namespace
+
+// static
+std::unique_ptr<AshTestEnvironment> AshTestEnvironment::Create() {
+ return base::MakeUnique<AshTestEnvironmentDefault>();
+}
+
+} // namespace test
+} // namespace ash
« no previous file with comments | « ash/test/ash_test_environment_content.cc ('k') | ash/test/ash_test_helper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698