OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_SCOPED_VIEWS_TEST_HELPER_H_ | 5 #ifndef UI_VIEWS_TEST_SCOPED_VIEWS_TEST_HELPER_H_ |
6 #define UI_VIEWS_TEST_SCOPED_VIEWS_TEST_HELPER_H_ | 6 #define UI_VIEWS_TEST_SCOPED_VIEWS_TEST_HELPER_H_ |
7 | 7 |
| 8 #include <memory> |
| 9 |
8 #include "base/macros.h" | 10 #include "base/macros.h" |
9 #include "base/memory/scoped_ptr.h" | |
10 #include "ui/gfx/native_widget_types.h" | 11 #include "ui/gfx/native_widget_types.h" |
11 | 12 |
12 namespace views { | 13 namespace views { |
13 | 14 |
14 class PlatformTestHelper; | 15 class PlatformTestHelper; |
15 class TestViewsDelegate; | 16 class TestViewsDelegate; |
16 class ViewsTestHelper; | 17 class ViewsTestHelper; |
17 | 18 |
18 // Creates a ViewsTestHelper that is destroyed automatically. Acts like | 19 // Creates a ViewsTestHelper that is destroyed automatically. Acts like |
19 // ViewsTestBase but allows a test harness to use a different base class, or | 20 // ViewsTestBase but allows a test harness to use a different base class, or |
20 // make use of a TestBrowserThreadBundle, rather than the MessageLoop provided | 21 // make use of a TestBrowserThreadBundle, rather than the MessageLoop provided |
21 // by ViewsTestBase. | 22 // by ViewsTestBase. |
22 class ScopedViewsTestHelper { | 23 class ScopedViewsTestHelper { |
23 public: | 24 public: |
24 // Initialize with the default TestViewsDelegate, MessageLoopForUI::current() | 25 // Initialize with the default TestViewsDelegate, MessageLoopForUI::current() |
25 // and the default test ContextFactory. | 26 // and the default test ContextFactory. |
26 ScopedViewsTestHelper(); | 27 ScopedViewsTestHelper(); |
27 | 28 |
28 // Initialize with the given TestViewsDelegate instance, after setting the | 29 // Initialize with the given TestViewsDelegate instance, after setting the |
29 // ContextFactory. | 30 // ContextFactory. |
30 explicit ScopedViewsTestHelper(scoped_ptr<TestViewsDelegate> views_delegate); | 31 explicit ScopedViewsTestHelper( |
| 32 std::unique_ptr<TestViewsDelegate> views_delegate); |
31 | 33 |
32 ~ScopedViewsTestHelper(); | 34 ~ScopedViewsTestHelper(); |
33 | 35 |
34 // Returns the context for creating new windows. In Aura builds, this will be | 36 // Returns the context for creating new windows. In Aura builds, this will be |
35 // the RootWindow. Everywhere else, null. | 37 // the RootWindow. Everywhere else, null. |
36 gfx::NativeWindow GetContext(); | 38 gfx::NativeWindow GetContext(); |
37 | 39 |
38 TestViewsDelegate* views_delegate() { return views_delegate_.get(); }; | 40 TestViewsDelegate* views_delegate() { return views_delegate_.get(); }; |
39 | 41 |
40 bool IsMus() const; | 42 bool IsMus() const; |
41 | 43 |
42 private: | 44 private: |
43 scoped_ptr<TestViewsDelegate> views_delegate_; | 45 std::unique_ptr<TestViewsDelegate> views_delegate_; |
44 scoped_ptr<ViewsTestHelper> test_helper_; | 46 std::unique_ptr<ViewsTestHelper> test_helper_; |
45 scoped_ptr<PlatformTestHelper> platform_test_helper_; | 47 std::unique_ptr<PlatformTestHelper> platform_test_helper_; |
46 | 48 |
47 DISALLOW_COPY_AND_ASSIGN(ScopedViewsTestHelper); | 49 DISALLOW_COPY_AND_ASSIGN(ScopedViewsTestHelper); |
48 }; | 50 }; |
49 | 51 |
50 } // namespace views | 52 } // namespace views |
51 | 53 |
52 #endif // UI_VIEWS_TEST_SCOPED_VIEWS_TEST_HELPER_H_ | 54 #endif // UI_VIEWS_TEST_SCOPED_VIEWS_TEST_HELPER_H_ |
OLD | NEW |