| 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 "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
| 11 #include "ui/views/test/test_views_delegate.h" | 11 #include "ui/views/test/test_views_delegate.h" |
| 12 | 12 |
| 13 #if defined(OS_WIN) | 13 #if defined(OS_WIN) |
| 14 #include "ui/base/win/scoped_ole_initializer.h" | 14 #include "ui/base/win/scoped_ole_initializer.h" |
| 15 #endif | 15 #endif |
| 16 | 16 |
| 17 namespace ui { |
| 18 class EventProcessor; |
| 19 } |
| 20 |
| 17 namespace aura { | 21 namespace aura { |
| 22 class WindowTreeHost; |
| 18 namespace test { | 23 namespace test { |
| 19 class AuraTestHelper; | 24 class AuraTestHelper; |
| 20 } | 25 } |
| 21 } | 26 } |
| 22 | 27 |
| 23 namespace views { | 28 namespace views { |
| 24 | 29 |
| 25 // A base class for views unit test. It creates a message loop necessary | 30 // A base class for views unit test. It creates a message loop necessary |
| 26 // to drive UI events and takes care of OLE initialization for windows. | 31 // to drive UI events and takes care of OLE initialization for windows. |
| 27 class ViewsTestBase : public testing::Test { | 32 class ViewsTestBase : public testing::Test { |
| (...skipping 13 matching lines...) Expand all Loading... |
| 41 | 46 |
| 42 protected: | 47 protected: |
| 43 TestViewsDelegate& views_delegate() const { return *views_delegate_.get(); } | 48 TestViewsDelegate& views_delegate() const { return *views_delegate_.get(); } |
| 44 | 49 |
| 45 void set_views_delegate(TestViewsDelegate* views_delegate) { | 50 void set_views_delegate(TestViewsDelegate* views_delegate) { |
| 46 views_delegate_.reset(views_delegate); | 51 views_delegate_.reset(views_delegate); |
| 47 } | 52 } |
| 48 | 53 |
| 49 base::MessageLoopForUI* message_loop() { return &message_loop_; } | 54 base::MessageLoopForUI* message_loop() { return &message_loop_; } |
| 50 | 55 |
| 56 ui::EventProcessor* event_processor(); |
| 57 aura::WindowTreeHost* host(); |
| 58 |
| 51 // Returns a context view. In aura builds, this will be the | 59 // Returns a context view. In aura builds, this will be the |
| 52 // RootWindow. Everywhere else, NULL. | 60 // RootWindow. Everywhere else, NULL. |
| 53 gfx::NativeView GetContext(); | 61 gfx::NativeView GetContext(); |
| 54 | 62 |
| 55 private: | 63 private: |
| 56 base::MessageLoopForUI message_loop_; | 64 base::MessageLoopForUI message_loop_; |
| 57 scoped_ptr<TestViewsDelegate> views_delegate_; | 65 scoped_ptr<TestViewsDelegate> views_delegate_; |
| 58 scoped_ptr<aura::test::AuraTestHelper> aura_test_helper_; | 66 scoped_ptr<aura::test::AuraTestHelper> aura_test_helper_; |
| 59 scoped_ptr<views::corewm::WMState> wm_state_; | 67 scoped_ptr<views::corewm::WMState> wm_state_; |
| 60 bool setup_called_; | 68 bool setup_called_; |
| 61 bool teardown_called_; | 69 bool teardown_called_; |
| 62 | 70 |
| 63 #if defined(OS_WIN) | 71 #if defined(OS_WIN) |
| 64 ui::ScopedOleInitializer ole_initializer_; | 72 ui::ScopedOleInitializer ole_initializer_; |
| 65 #endif | 73 #endif |
| 66 | 74 |
| 67 DISALLOW_COPY_AND_ASSIGN(ViewsTestBase); | 75 DISALLOW_COPY_AND_ASSIGN(ViewsTestBase); |
| 68 }; | 76 }; |
| 69 | 77 |
| 70 } // namespace views | 78 } // namespace views |
| 71 | 79 |
| 72 #endif // UI_VIEWS_TEST_VIEWS_TEST_BASE_H_ | 80 #endif // UI_VIEWS_TEST_VIEWS_TEST_BASE_H_ |
| OLD | NEW |