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

Side by Side Diff: ash/test/ash_test_environment_default.cc

Issue 2303453003: Revert of Moves ash content specific tests into ash_content_unittests (Closed)
Patch Set: 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/threading/sequenced_worker_pool.h"
12
13 namespace ash {
14 namespace test {
15 namespace {
16
17 class AshTestEnvironmentDefault : public AshTestEnvironment {
18 public:
19 AshTestEnvironmentDefault() {}
20
21 ~AshTestEnvironmentDefault() override {
22 base::RunLoop().RunUntilIdle();
23 if (blocking_pool_) {
24 blocking_pool_->FlushForTesting();
25 blocking_pool_->Shutdown();
26 blocking_pool_ = nullptr;
27 }
28 base::RunLoop().RunUntilIdle();
29 }
30
31 // AshTestEnvironment:
32 base::SequencedWorkerPool* GetBlockingPool() override {
33 if (!blocking_pool_) {
34 const size_t kMaxNumberThreads = 3u; // Matches that of content.
35 blocking_pool_ = new base::SequencedWorkerPool(
36 kMaxNumberThreads, "AshBlocking", base::TaskPriority::USER_VISIBLE);
37 }
38 return blocking_pool_.get();
39 }
40 std::unique_ptr<views::ViewsDelegate> CreateViewsDelegate() override {
41 return base::MakeUnique<AshTestViewsDelegate>();
42 }
43
44 private:
45 base::MessageLoopForUI message_loop_;
46 scoped_refptr<base::SequencedWorkerPool> blocking_pool_;
47
48 DISALLOW_COPY_AND_ASSIGN(AshTestEnvironmentDefault);
49 };
50
51 } // namespace
52
53 // static
54 std::unique_ptr<AshTestEnvironment> AshTestEnvironment::Create() {
55 return base::MakeUnique<AshTestEnvironmentDefault>();
56 }
57
58 } // namespace test
59 } // 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