| 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_HELPER_H_ | 5 #ifndef UI_AURA_TEST_AURA_TEST_HELPER_H_ |
| 6 #define UI_AURA_TEST_AURA_TEST_HELPER_H_ | 6 #define UI_AURA_TEST_AURA_TEST_HELPER_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 | 10 |
| 11 namespace base { |
| 11 class MessageLoopForUI; | 12 class MessageLoopForUI; |
| 13 } |
| 12 | 14 |
| 13 namespace ui { | 15 namespace ui { |
| 14 class InputMethod; | 16 class InputMethod; |
| 15 class ScopedAnimationDurationScaleMode; | 17 class ScopedAnimationDurationScaleMode; |
| 16 } | 18 } |
| 17 | 19 |
| 18 namespace aura { | 20 namespace aura { |
| 19 class RootWindow; | 21 class RootWindow; |
| 20 class TestScreen; | 22 class TestScreen; |
| 21 namespace client { | 23 namespace client { |
| 22 class DefaultCaptureClient; | 24 class DefaultCaptureClient; |
| 23 class FocusClient; | 25 class FocusClient; |
| 24 } | 26 } |
| 25 namespace test { | 27 namespace test { |
| 26 class TestActivationClient; | 28 class TestActivationClient; |
| 27 class TestStackingClient; | 29 class TestStackingClient; |
| 28 | 30 |
| 29 // A helper class owned by tests that does common initialization required for | 31 // A helper class owned by tests that does common initialization required for |
| 30 // Aura use. This class creates a root window with clients and other objects | 32 // Aura use. This class creates a root window with clients and other objects |
| 31 // that are necessary to run test on Aura. | 33 // that are necessary to run test on Aura. |
| 32 class AuraTestHelper { | 34 class AuraTestHelper { |
| 33 public: | 35 public: |
| 34 explicit AuraTestHelper(MessageLoopForUI* message_loop); | 36 explicit AuraTestHelper(base::MessageLoopForUI* message_loop); |
| 35 ~AuraTestHelper(); | 37 ~AuraTestHelper(); |
| 36 | 38 |
| 37 // Creates and initializes (shows and sizes) the RootWindow for use in tests. | 39 // Creates and initializes (shows and sizes) the RootWindow for use in tests. |
| 38 void SetUp(); | 40 void SetUp(); |
| 39 | 41 |
| 40 // Clean up objects that are created for tests. This also deletes the Env | 42 // Clean up objects that are created for tests. This also deletes the Env |
| 41 // object. | 43 // object. |
| 42 void TearDown(); | 44 void TearDown(); |
| 43 | 45 |
| 44 // Flushes message loop. | 46 // Flushes message loop. |
| 45 void RunAllPendingInMessageLoop(); | 47 void RunAllPendingInMessageLoop(); |
| 46 | 48 |
| 47 RootWindow* root_window() { return root_window_.get(); } | 49 RootWindow* root_window() { return root_window_.get(); } |
| 48 | 50 |
| 49 TestScreen* test_screen() { return test_screen_.get(); } | 51 TestScreen* test_screen() { return test_screen_.get(); } |
| 50 | 52 |
| 51 private: | 53 private: |
| 52 MessageLoopForUI* message_loop_; | 54 base::MessageLoopForUI* message_loop_; |
| 53 bool setup_called_; | 55 bool setup_called_; |
| 54 bool teardown_called_; | 56 bool teardown_called_; |
| 55 bool owns_root_window_; | 57 bool owns_root_window_; |
| 56 scoped_ptr<RootWindow> root_window_; | 58 scoped_ptr<RootWindow> root_window_; |
| 57 scoped_ptr<TestStackingClient> stacking_client_; | 59 scoped_ptr<TestStackingClient> stacking_client_; |
| 58 scoped_ptr<TestActivationClient> test_activation_client_; | 60 scoped_ptr<TestActivationClient> test_activation_client_; |
| 59 scoped_ptr<client::DefaultCaptureClient> capture_client_; | 61 scoped_ptr<client::DefaultCaptureClient> capture_client_; |
| 60 scoped_ptr<ui::InputMethod> test_input_method_; | 62 scoped_ptr<ui::InputMethod> test_input_method_; |
| 61 scoped_ptr<client::FocusClient> focus_client_; | 63 scoped_ptr<client::FocusClient> focus_client_; |
| 62 scoped_ptr<TestScreen> test_screen_; | 64 scoped_ptr<TestScreen> test_screen_; |
| 63 scoped_ptr<ui::ScopedAnimationDurationScaleMode> zero_duration_mode_; | 65 scoped_ptr<ui::ScopedAnimationDurationScaleMode> zero_duration_mode_; |
| 64 | 66 |
| 65 DISALLOW_COPY_AND_ASSIGN(AuraTestHelper); | 67 DISALLOW_COPY_AND_ASSIGN(AuraTestHelper); |
| 66 }; | 68 }; |
| 67 | 69 |
| 68 } // namespace test | 70 } // namespace test |
| 69 } // namespace aura | 71 } // namespace aura |
| 70 | 72 |
| 71 #endif // UI_AURA_TEST_AURA_TEST_HELPER_H_ | 73 #endif // UI_AURA_TEST_AURA_TEST_HELPER_H_ |
| OLD | NEW |