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