| 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 UI_VIEWS_TEST_PLATFORM_TEST_HELPER_H_ | 5 #ifndef UI_VIEWS_TEST_PLATFORM_TEST_HELPER_H_ |
| 6 #define UI_VIEWS_TEST_PLATFORM_TEST_HELPER_H_ | 6 #define UI_VIEWS_TEST_PLATFORM_TEST_HELPER_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/callback_forward.h" | 10 #include "base/callback_forward.h" |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 | 12 |
| 13 namespace ui { |
| 14 class ContextFactory; |
| 15 class ContextFactoryPrivate; |
| 16 } |
| 17 |
| 13 namespace views { | 18 namespace views { |
| 14 | 19 |
| 15 class ViewsTestHelper; | 20 class ViewsTestHelper; |
| 16 class Widget; | 21 class Widget; |
| 17 | 22 |
| 18 class PlatformTestHelper { | 23 class PlatformTestHelper { |
| 19 public: | 24 public: |
| 20 using Factory = base::Callback<std::unique_ptr<PlatformTestHelper>(void)>; | 25 using Factory = base::Callback<std::unique_ptr<PlatformTestHelper>(void)>; |
| 21 PlatformTestHelper() {} | 26 PlatformTestHelper() {} |
| 22 virtual ~PlatformTestHelper() {} | 27 virtual ~PlatformTestHelper(); |
| 23 | 28 |
| 24 static void set_factory(const Factory& factory); | 29 static void set_factory(const Factory& factory); |
| 25 static std::unique_ptr<PlatformTestHelper> Create(); | 30 static std::unique_ptr<PlatformTestHelper> Create(); |
| 26 | 31 |
| 27 static void SetIsMus(); | 32 static void SetIsMus(); |
| 28 static bool IsMus(); | 33 static bool IsMus(); |
| 29 | 34 |
| 30 // Called once the ViewsTestHelper has been created, but before SetUp() is | 35 // Called once the ViewsTestHelper has been created, but before SetUp() is |
| 31 // called. | 36 // called. |
| 32 virtual void OnTestHelperCreated(ViewsTestHelper* helper) {} | 37 virtual void OnTestHelperCreated(ViewsTestHelper* helper) {} |
| 33 | 38 |
| 34 // Simulate an OS-level destruction of the native window held by |widget|. | 39 // Simulate an OS-level destruction of the native window held by |widget|. |
| 35 virtual void SimulateNativeDestroy(Widget* widget); | 40 virtual void SimulateNativeDestroy(Widget* widget); |
| 36 | 41 |
| 42 virtual void InitializeContextFactory( |
| 43 ui::ContextFactory** factory, |
| 44 ui::ContextFactoryPrivate** factory_private); |
| 45 |
| 37 private: | 46 private: |
| 38 DISALLOW_COPY_AND_ASSIGN(PlatformTestHelper); | 47 DISALLOW_COPY_AND_ASSIGN(PlatformTestHelper); |
| 39 }; | 48 }; |
| 40 | 49 |
| 41 } // namespace views | 50 } // namespace views |
| 42 | 51 |
| 43 #endif // UI_VIEWS_TEST_PLATFORM_TEST_HELPER_H_ | 52 #endif // UI_VIEWS_TEST_PLATFORM_TEST_HELPER_H_ |
| OLD | NEW |