| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_VIEWS_TEST_BASE_H_ | 5 #ifndef UI_VIEWS_TEST_VIEWS_TEST_BASE_H_ |
| 6 #define UI_VIEWS_TEST_VIEWS_TEST_BASE_H_ | 6 #define UI_VIEWS_TEST_VIEWS_TEST_BASE_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 // testing::Test: | 35 // testing::Test: |
| 36 void SetUp() override; | 36 void SetUp() override; |
| 37 void TearDown() override; | 37 void TearDown() override; |
| 38 | 38 |
| 39 void RunPendingMessages(); | 39 void RunPendingMessages(); |
| 40 | 40 |
| 41 // Creates a widget of |type| with any platform specific data for use in | 41 // Creates a widget of |type| with any platform specific data for use in |
| 42 // cross-platform tests. | 42 // cross-platform tests. |
| 43 Widget::InitParams CreateParams(Widget::InitParams::Type type); | 43 Widget::InitParams CreateParams(Widget::InitParams::Type type); |
| 44 | 44 |
| 45 bool HasCompositingManager() const; |
| 46 |
| 45 protected: | 47 protected: |
| 46 TestViewsDelegate* views_delegate() const { | 48 TestViewsDelegate* views_delegate() const { |
| 47 return test_helper_->views_delegate(); | 49 return test_helper_->views_delegate(); |
| 48 } | 50 } |
| 49 | 51 |
| 50 void set_views_delegate(std::unique_ptr<TestViewsDelegate> views_delegate) { | 52 void set_views_delegate(std::unique_ptr<TestViewsDelegate> views_delegate) { |
| 51 DCHECK(!setup_called_); | 53 DCHECK(!setup_called_); |
| 52 views_delegate_for_setup_.swap(views_delegate); | 54 views_delegate_for_setup_.swap(views_delegate); |
| 53 } | 55 } |
| 54 | 56 |
| 55 base::MessageLoopForUI* message_loop() { return &message_loop_; } | 57 base::MessageLoopForUI* message_loop() { return &message_loop_; } |
| 56 | 58 |
| 57 // Returns a context view. In aura builds, this will be the | 59 // Returns a context view. In aura builds, this will be the |
| 58 // RootWindow. Everywhere else, NULL. | 60 // RootWindow. Everywhere else, NULL. |
| 59 gfx::NativeWindow GetContext(); | 61 gfx::NativeWindow GetContext(); |
| 60 | 62 |
| 61 private: | 63 private: |
| 62 base::MessageLoopForUI message_loop_; | 64 base::MessageLoopForUI message_loop_; |
| 63 std::unique_ptr<TestViewsDelegate> views_delegate_for_setup_; | 65 std::unique_ptr<TestViewsDelegate> views_delegate_for_setup_; |
| 64 std::unique_ptr<ScopedViewsTestHelper> test_helper_; | 66 std::unique_ptr<ScopedViewsTestHelper> test_helper_; |
| 65 bool setup_called_; | 67 bool setup_called_; |
| 66 bool teardown_called_; | 68 bool teardown_called_; |
| 69 bool has_compositing_manager_; |
| 67 | 70 |
| 68 #if defined(OS_WIN) | 71 #if defined(OS_WIN) |
| 69 ui::ScopedOleInitializer ole_initializer_; | 72 ui::ScopedOleInitializer ole_initializer_; |
| 70 #endif | 73 #endif |
| 71 | 74 |
| 72 DISALLOW_COPY_AND_ASSIGN(ViewsTestBase); | 75 DISALLOW_COPY_AND_ASSIGN(ViewsTestBase); |
| 73 }; | 76 }; |
| 74 | 77 |
| 75 } // namespace views | 78 } // namespace views |
| 76 | 79 |
| 77 #endif // UI_VIEWS_TEST_VIEWS_TEST_BASE_H_ | 80 #endif // UI_VIEWS_TEST_VIEWS_TEST_BASE_H_ |
| OLD | NEW |