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