| 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" |
| 11 #include "base/message_loop/message_loop.h" | 11 #include "base/test/scoped_task_environment.h" |
| 12 #include "build/build_config.h" | 12 #include "build/build_config.h" |
| 13 #include "testing/gtest/include/gtest/gtest.h" | 13 #include "testing/gtest/include/gtest/gtest.h" |
| 14 #include "testing/platform_test.h" | 14 #include "testing/platform_test.h" |
| 15 #include "ui/views/test/scoped_views_test_helper.h" | 15 #include "ui/views/test/scoped_views_test_helper.h" |
| 16 #include "ui/views/test/test_views_delegate.h" | 16 #include "ui/views/test/test_views_delegate.h" |
| 17 #include "ui/views/widget/widget.h" | 17 #include "ui/views/widget/widget.h" |
| 18 | 18 |
| 19 #if defined(OS_WIN) | 19 #if defined(OS_WIN) |
| 20 #include "ui/base/win/scoped_ole_initializer.h" | 20 #include "ui/base/win/scoped_ole_initializer.h" |
| 21 #endif | 21 #endif |
| (...skipping 29 matching lines...) Expand all Loading... |
| 51 protected: | 51 protected: |
| 52 TestViewsDelegate* test_views_delegate() const { | 52 TestViewsDelegate* test_views_delegate() const { |
| 53 return test_helper_->test_views_delegate(); | 53 return test_helper_->test_views_delegate(); |
| 54 } | 54 } |
| 55 | 55 |
| 56 void set_views_delegate(std::unique_ptr<TestViewsDelegate> views_delegate) { | 56 void set_views_delegate(std::unique_ptr<TestViewsDelegate> views_delegate) { |
| 57 DCHECK(!setup_called_); | 57 DCHECK(!setup_called_); |
| 58 views_delegate_for_setup_.swap(views_delegate); | 58 views_delegate_for_setup_.swap(views_delegate); |
| 59 } | 59 } |
| 60 | 60 |
| 61 base::MessageLoopForUI* message_loop() { return &message_loop_; } | |
| 62 | |
| 63 // Returns a context view. In aura builds, this will be the | 61 // Returns a context view. In aura builds, this will be the |
| 64 // RootWindow. Everywhere else, NULL. | 62 // RootWindow. Everywhere else, NULL. |
| 65 gfx::NativeWindow GetContext(); | 63 gfx::NativeWindow GetContext(); |
| 66 | 64 |
| 67 private: | 65 private: |
| 68 base::MessageLoopForUI message_loop_; | 66 base::test::ScopedTaskEnvironment scoped_task_environment_; |
| 69 std::unique_ptr<TestViewsDelegate> views_delegate_for_setup_; | 67 std::unique_ptr<TestViewsDelegate> views_delegate_for_setup_; |
| 70 std::unique_ptr<ScopedViewsTestHelper> test_helper_; | 68 std::unique_ptr<ScopedViewsTestHelper> test_helper_; |
| 71 bool setup_called_; | 69 bool setup_called_; |
| 72 bool teardown_called_; | 70 bool teardown_called_; |
| 73 bool has_compositing_manager_; | 71 bool has_compositing_manager_; |
| 74 | 72 |
| 75 #if defined(OS_WIN) | 73 #if defined(OS_WIN) |
| 76 ui::ScopedOleInitializer ole_initializer_; | 74 ui::ScopedOleInitializer ole_initializer_; |
| 77 #endif | 75 #endif |
| 78 | 76 |
| 79 DISALLOW_COPY_AND_ASSIGN(ViewsTestBase); | 77 DISALLOW_COPY_AND_ASSIGN(ViewsTestBase); |
| 80 }; | 78 }; |
| 81 | 79 |
| 82 } // namespace views | 80 } // namespace views |
| 83 | 81 |
| 84 #endif // UI_VIEWS_TEST_VIEWS_TEST_BASE_H_ | 82 #endif // UI_VIEWS_TEST_VIEWS_TEST_BASE_H_ |
| OLD | NEW |