| 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 #include "ui/views/test/platform_test_helper.h" | 5 #include "ui/views/test/platform_test_helper.h" |
| 6 | 6 |
| 7 #include "base/callback.h" | 7 #include "base/callback.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
| 10 | 10 |
| 11 namespace views { | 11 namespace views { |
| 12 namespace { | 12 namespace { |
| 13 | 13 |
| 14 class DefaultPlatformTestHelper : public PlatformTestHelper { | 14 class DefaultPlatformTestHelper : public PlatformTestHelper { |
| 15 public: | 15 public: |
| 16 DefaultPlatformTestHelper() {} | 16 DefaultPlatformTestHelper() {} |
| 17 | 17 |
| 18 ~DefaultPlatformTestHelper() override {} | 18 ~DefaultPlatformTestHelper() override {} |
| 19 | 19 |
| 20 private: | 20 private: |
| 21 DISALLOW_COPY_AND_ASSIGN(DefaultPlatformTestHelper); | 21 DISALLOW_COPY_AND_ASSIGN(DefaultPlatformTestHelper); |
| 22 }; | 22 }; |
| 23 | 23 |
| 24 PlatformTestHelper::Factory test_helper_factory; | 24 PlatformTestHelper::Factory test_helper_factory; |
| 25 bool is_mus = false; | 25 bool is_mus = false; |
| 26 bool is_aura_mus_client = false; |
| 26 | 27 |
| 27 } // namespace | 28 } // namespace |
| 28 | 29 |
| 29 void PlatformTestHelper::set_factory(const Factory& factory) { | 30 void PlatformTestHelper::set_factory(const Factory& factory) { |
| 30 DCHECK(test_helper_factory.is_null()); | 31 DCHECK(test_helper_factory.is_null()); |
| 31 test_helper_factory = factory; | 32 test_helper_factory = factory; |
| 32 } | 33 } |
| 33 | 34 |
| 34 // static | 35 // static |
| 35 std::unique_ptr<PlatformTestHelper> PlatformTestHelper::Create() { | 36 std::unique_ptr<PlatformTestHelper> PlatformTestHelper::Create() { |
| 36 return !test_helper_factory.is_null() | 37 return !test_helper_factory.is_null() |
| 37 ? test_helper_factory.Run() | 38 ? test_helper_factory.Run() |
| 38 : base::WrapUnique(new DefaultPlatformTestHelper); | 39 : base::WrapUnique(new DefaultPlatformTestHelper); |
| 39 } | 40 } |
| 40 | 41 |
| 41 // static | 42 // static |
| 42 void PlatformTestHelper::SetIsMus() { | 43 void PlatformTestHelper::SetIsMus() { |
| 43 is_mus = true; | 44 is_mus = true; |
| 44 } | 45 } |
| 45 | 46 |
| 46 // static | 47 // static |
| 47 bool PlatformTestHelper::IsMus() { | 48 bool PlatformTestHelper::IsMus() { |
| 48 return is_mus; | 49 return is_mus; |
| 49 } | 50 } |
| 50 | 51 |
| 52 // static |
| 53 void PlatformTestHelper::SetIsAuraMusClient() { |
| 54 is_aura_mus_client = true; |
| 55 } |
| 56 |
| 57 // static |
| 58 bool PlatformTestHelper::IsAuraMusClient() { |
| 59 return is_aura_mus_client; |
| 60 } |
| 61 |
| 51 } // namespace views | 62 } // namespace views |
| OLD | NEW |