| 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_AURA_TEST_AURA_TEST_BASE_H_ | 5 #ifndef UI_AURA_TEST_AURA_TEST_BASE_H_ |
| 6 #define UI_AURA_TEST_AURA_TEST_BASE_H_ | 6 #define UI_AURA_TEST_AURA_TEST_BASE_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| 11 #include "testing/gtest/include/gtest/gtest.h" | 11 #include "testing/gtest/include/gtest/gtest.h" |
| 12 #include "ui/aura/test/aura_test_helper.h" | 12 #include "ui/aura/test/aura_test_helper.h" |
| 13 | 13 |
| 14 namespace aura { | 14 namespace aura { |
| 15 class Window; | 15 class Window; |
| 16 class WindowDelegate; | 16 class WindowDelegate; |
| 17 class WindowEventDispatcher; | |
| 18 namespace test { | 17 namespace test { |
| 19 | 18 |
| 20 // A base class for aura unit tests. | 19 // A base class for aura unit tests. |
| 21 // TODO(beng): Instances of this test will create and own a RootWindow. | 20 // TODO(beng): Instances of this test will create and own a RootWindow. |
| 22 class AuraTestBase : public testing::Test { | 21 class AuraTestBase : public testing::Test { |
| 23 public: | 22 public: |
| 24 AuraTestBase(); | 23 AuraTestBase(); |
| 25 virtual ~AuraTestBase(); | 24 virtual ~AuraTestBase(); |
| 26 | 25 |
| 27 // testing::Test: | 26 // testing::Test: |
| 28 virtual void SetUp() OVERRIDE; | 27 virtual void SetUp() OVERRIDE; |
| 29 virtual void TearDown() OVERRIDE; | 28 virtual void TearDown() OVERRIDE; |
| 30 | 29 |
| 31 // Creates a normal window parented to |parent|. | 30 // Creates a normal window parented to |parent|. |
| 32 aura::Window* CreateNormalWindow(int id, Window* parent, | 31 aura::Window* CreateNormalWindow(int id, Window* parent, |
| 33 aura::WindowDelegate* delegate); | 32 aura::WindowDelegate* delegate); |
| 34 | 33 |
| 35 protected: | 34 protected: |
| 36 void RunAllPendingInMessageLoop(); | 35 void RunAllPendingInMessageLoop(); |
| 37 | 36 |
| 38 void ParentWindow(Window* window); | 37 void ParentWindow(Window* window); |
| 39 | 38 |
| 40 // A convenience function for dispatching an event to |dispatcher()|. | 39 // A convenience function for dispatching an event to |dispatcher()|. |
| 41 // Returns whether |event| was handled. | 40 // Returns whether |event| was handled. |
| 42 bool DispatchEventUsingWindowDispatcher(ui::Event* event); | 41 bool DispatchEventUsingWindowDispatcher(ui::Event* event); |
| 43 | 42 |
| 44 Window* root_window() { return helper_->root_window(); } | 43 Window* root_window() { return helper_->root_window(); } |
| 45 WindowEventDispatcher* dispatcher() { return helper_->dispatcher(); } | 44 WindowTreeHost* host() { return helper_->host(); } |
| 45 ui::EventProcessor* event_processor() { return helper_->event_processor(); } |
| 46 TestScreen* test_screen() { return helper_->test_screen(); } | 46 TestScreen* test_screen() { return helper_->test_screen(); } |
| 47 | 47 |
| 48 private: | 48 private: |
| 49 bool setup_called_; | 49 bool setup_called_; |
| 50 bool teardown_called_; | 50 bool teardown_called_; |
| 51 base::MessageLoopForUI message_loop_; | 51 base::MessageLoopForUI message_loop_; |
| 52 scoped_ptr<AuraTestHelper> helper_; | 52 scoped_ptr<AuraTestHelper> helper_; |
| 53 | 53 |
| 54 DISALLOW_COPY_AND_ASSIGN(AuraTestBase); | 54 DISALLOW_COPY_AND_ASSIGN(AuraTestBase); |
| 55 }; | 55 }; |
| 56 | 56 |
| 57 } // namespace test | 57 } // namespace test |
| 58 } // namespace aura | 58 } // namespace aura |
| 59 | 59 |
| 60 #endif // UI_AURA_TEST_AURA_TEST_BASE_H_ | 60 #endif // UI_AURA_TEST_AURA_TEST_BASE_H_ |
| OLD | NEW |