| 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 #include "ui/views/widget/widget.h" | 10 #include "ui/views/widget/widget.h" |
| 11 | 11 |
| 12 #if defined(USE_AURA) | 12 #if defined(USE_AURA) |
| 13 #include "ui/aura/window.h" | 13 #include "ui/aura/window.h" |
| 14 #endif | 14 #endif |
| 15 | 15 |
| 16 namespace views { | 16 namespace views { |
| 17 namespace { | 17 namespace { |
| 18 | 18 |
| 19 PlatformTestHelper::Factory test_helper_factory; | 19 PlatformTestHelper::Factory test_helper_factory; |
| 20 bool is_mus = false; | 20 bool is_mus = false; |
| 21 bool is_aura_mus_client = false; | |
| 22 | 21 |
| 23 } // namespace | 22 } // namespace |
| 24 | 23 |
| 25 void PlatformTestHelper::set_factory(const Factory& factory) { | 24 void PlatformTestHelper::set_factory(const Factory& factory) { |
| 26 DCHECK(test_helper_factory.is_null()); | 25 DCHECK(test_helper_factory.is_null()); |
| 27 test_helper_factory = factory; | 26 test_helper_factory = factory; |
| 28 } | 27 } |
| 29 | 28 |
| 30 // static | 29 // static |
| 31 std::unique_ptr<PlatformTestHelper> PlatformTestHelper::Create() { | 30 std::unique_ptr<PlatformTestHelper> PlatformTestHelper::Create() { |
| 32 return !test_helper_factory.is_null() | 31 return !test_helper_factory.is_null() |
| 33 ? test_helper_factory.Run() | 32 ? test_helper_factory.Run() |
| 34 : base::WrapUnique(new PlatformTestHelper); | 33 : base::WrapUnique(new PlatformTestHelper); |
| 35 } | 34 } |
| 36 | 35 |
| 37 // static | 36 // static |
| 38 void PlatformTestHelper::SetIsMus() { | 37 void PlatformTestHelper::SetIsMus() { |
| 39 is_mus = true; | 38 is_mus = true; |
| 40 } | 39 } |
| 41 | 40 |
| 42 // static | 41 // static |
| 43 bool PlatformTestHelper::IsMus() { | 42 bool PlatformTestHelper::IsMus() { |
| 44 return is_mus; | 43 return is_mus; |
| 45 } | 44 } |
| 46 | 45 |
| 47 // static | |
| 48 void PlatformTestHelper::SetIsAuraMusClient() { | |
| 49 is_aura_mus_client = true; | |
| 50 } | |
| 51 | |
| 52 // static | |
| 53 bool PlatformTestHelper::IsAuraMusClient() { | |
| 54 return is_aura_mus_client; | |
| 55 } | |
| 56 | |
| 57 #if defined(USE_AURA) | 46 #if defined(USE_AURA) |
| 58 void PlatformTestHelper::SimulateNativeDestroy(Widget* widget) { | 47 void PlatformTestHelper::SimulateNativeDestroy(Widget* widget) { |
| 59 delete widget->GetNativeView(); | 48 delete widget->GetNativeView(); |
| 60 } | 49 } |
| 61 #endif | 50 #endif |
| 62 | 51 |
| 63 } // namespace views | 52 } // namespace views |
| OLD | NEW |