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

Side by Side 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "ash/test/ash_test_environment.h"
6
7 #include "ash/test/ash_test_views_delegate.h"
8 #include "base/memory/ptr_util.h"
9 #include "base/message_loop/message_loop.h"
10 #include "base/run_loop.h"
11 #include "base/test/sequenced_worker_pool_owner.h"
12 #include "base/threading/sequenced_worker_pool.h"
13
14 namespace ash {
15 namespace test {
16 namespace {
17
18 class AshTestEnvironmentDefault : public AshTestEnvironment {
19 public:
20 AshTestEnvironmentDefault() {}
21
22 ~AshTestEnvironmentDefault() override {
23 base::RunLoop().RunUntilIdle();
24 blocking_pool_owner_.reset();
25 base::RunLoop().RunUntilIdle();
26 }
27
28 // AshTestEnvironment:
29 base::SequencedWorkerPool* GetBlockingPool() override {
30 if (!blocking_pool_owner_) {
31 const size_t kMaxNumberThreads = 3u; // Matches that of content.
32 const char kThreadNamePrefix[] = "AshBlocking";
33 blocking_pool_owner_ = base::MakeUnique<base::SequencedWorkerPoolOwner>(
34 kMaxNumberThreads, kThreadNamePrefix);
35 }
36 return blocking_pool_owner_->pool().get();
37 }
38 std::unique_ptr<views::ViewsDelegate> CreateViewsDelegate() override {
39 return base::MakeUnique<AshTestViewsDelegate>();
40 }
41
42 private:
43 base::MessageLoopForUI message_loop_;
44 std::unique_ptr<base::SequencedWorkerPoolOwner> blocking_pool_owner_;
45
46 DISALLOW_COPY_AND_ASSIGN(AshTestEnvironmentDefault);
47 };
48
49 } // namespace
50
51 // static
52 std::unique_ptr<AshTestEnvironment> AshTestEnvironment::Create() {
53 return base::MakeUnique<AshTestEnvironmentDefault>();
54 }
55
56 } // namespace test
57 } // namespace ash
OLDNEW
« 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