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