OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef ASH_TEST_ASH_TEST_ENVIRONMENT_H_ | 5 #ifndef ASH_TEST_ASH_TEST_ENVIRONMENT_H_ |
6 #define ASH_TEST_ASH_TEST_ENVIRONMENT_H_ | 6 #define ASH_TEST_ASH_TEST_ENVIRONMENT_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 namespace base { | 11 namespace base { |
12 class SequencedWorkerPool; | 12 class SequencedWorkerPool; |
13 } | 13 } |
14 | 14 |
15 namespace views { | |
16 class ViewsDelegate; | |
17 } | |
18 | |
19 namespace ash { | 15 namespace ash { |
20 namespace test { | 16 namespace test { |
21 | 17 |
| 18 class AshTestViewsDelegate; |
| 19 |
22 // AshTestEnvironment creates objects specific to an environment. Two | 20 // AshTestEnvironment creates objects specific to an environment. Two |
23 // environments are provided, one for content (AshTestEnvironmentContent) | 21 // environments are provided, one for content (AshTestEnvironmentContent) |
24 // and one without content (AshTestEnvironmentDefault). | 22 // and one without content (AshTestEnvironmentDefault). |
25 // | 23 // |
26 // AshTestBase creates an AshTestEnvironment by way of | 24 // AshTestBase creates an AshTestEnvironment by way of |
27 // AshTestEnvironment::Create(). The implementation of Create() depends upon | 25 // AshTestEnvironment::Create(). The implementation of Create() depends upon |
28 // the ash target that was linked against: //ash/test:test_support_with_content | 26 // the ash target that was linked against: //ash/test:test_support_with_content |
29 // includes AshTestEnvironmentContent and | 27 // includes AshTestEnvironmentContent and |
30 // //ash/test:test_support_without_content includes AshTestEnvironmentDefault. | 28 // //ash/test:test_support_without_content includes AshTestEnvironmentDefault. |
31 class AshTestEnvironment { | 29 class AshTestEnvironment { |
32 public: | 30 public: |
33 virtual ~AshTestEnvironment() {} | 31 virtual ~AshTestEnvironment() {} |
34 | 32 |
35 // Creates the object appropriate to the current environment. | 33 // Creates the object appropriate to the current environment. |
36 static std::unique_ptr<AshTestEnvironment> Create(); | 34 static std::unique_ptr<AshTestEnvironment> Create(); |
37 | 35 |
38 // Returns the ASCII file name of where the 100% resources are stored. | 36 // Returns the ASCII file name of where the 100% resources are stored. |
39 static std::string Get100PercentResourceFileName(); | 37 static std::string Get100PercentResourceFileName(); |
40 | 38 |
41 // Called from AshTestHelper::SetUp()/TearDown(). | 39 // Called from AshTestHelper::SetUp()/TearDown(). |
42 virtual void SetUp() {} | 40 virtual void SetUp() {} |
43 virtual void TearDown() {} | 41 virtual void TearDown() {} |
44 | 42 |
45 virtual base::SequencedWorkerPool* GetBlockingPool() = 0; | 43 virtual base::SequencedWorkerPool* GetBlockingPool() = 0; |
46 | 44 |
47 virtual std::unique_ptr<views::ViewsDelegate> CreateViewsDelegate() = 0; | 45 virtual std::unique_ptr<AshTestViewsDelegate> CreateViewsDelegate() = 0; |
48 | 46 |
49 protected: | 47 protected: |
50 AshTestEnvironment() {} | 48 AshTestEnvironment() {} |
51 }; | 49 }; |
52 | 50 |
53 } // namespace test | 51 } // namespace test |
54 } // namespace ash | 52 } // namespace ash |
55 | 53 |
56 #endif // ASH_TEST_ASH_TEST_ENVIRONMENT_H_ | 54 #endif // ASH_TEST_ASH_TEST_ENVIRONMENT_H_ |
OLD | NEW |