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

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: remove GetMessageLoop and merge 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
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 blocking_pool_ = new base::SequencedWorkerPool(
35 3, "AshBlocking", base::TaskPriority::USER_VISIBLE);
James Cook 2016/08/31 16:20:16 nit: put 3 in a named constant or comment what it
sky 2016/08/31 17:35:57 Done.
36 }
37 return blocking_pool_.get();
38 }
39 std::unique_ptr<views::ViewsDelegate> CreateViewsDelegate() override {
40 return base::MakeUnique<AshTestViewsDelegate>();
41 }
42
43 private:
44 base::MessageLoopForUI message_loop_;
45 scoped_refptr<base::SequencedWorkerPool> blocking_pool_;
46
47 DISALLOW_COPY_AND_ASSIGN(AshTestEnvironmentDefault);
48 };
49
50 } // namespace
51
52 // static
53 std::unique_ptr<AshTestEnvironment> AshTestEnvironment::Create() {
54 return base::MakeUnique<AshTestEnvironmentDefault>();
55 }
56
57 } // namespace test
58 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698