OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 ATHENA_TEST_ATHENA_TEST_HELPER_H_ | 5 #ifndef ATHENA_TEST_ATHENA_TEST_HELPER_H_ |
6 #define ATHENA_TEST_ATHENA_TEST_HELPER_H_ | 6 #define ATHENA_TEST_ATHENA_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 #include "ui/aura/window_tree_host.h" | 10 #include "ui/aura/window_tree_host.h" |
(...skipping 16 matching lines...) Expand all Loading... |
27 class FocusClient; | 27 class FocusClient; |
28 } | 28 } |
29 } | 29 } |
30 | 30 |
31 namespace wm { | 31 namespace wm { |
32 class InputMethodEventFilter; | 32 class InputMethodEventFilter; |
33 } | 33 } |
34 | 34 |
35 namespace athena { | 35 namespace athena { |
36 namespace test { | 36 namespace test { |
37 class TestScreenManagerDelegate; | |
38 | 37 |
39 // A helper class owned by tests that does common initialization required for | 38 // A helper class owned by tests that does common initialization required for |
40 // Athena use. This class creates a root window with clients and other objects | 39 // Athena use. This class creates a root window with clients and other objects |
41 // that are necessary to run test on Athena. | 40 // that are necessary to run test on Athena. |
42 class AthenaTestHelper { | 41 class AthenaTestHelper { |
43 public: | 42 public: |
44 explicit AthenaTestHelper(base::MessageLoopForUI* message_loop); | 43 explicit AthenaTestHelper(base::MessageLoopForUI* message_loop); |
45 ~AthenaTestHelper(); | 44 ~AthenaTestHelper(); |
46 | 45 |
47 // Creates and initializes (shows and sizes) the RootWindow for use in tests. | 46 // Creates and initializes (shows and sizes) the RootWindow for use in tests. |
48 void SetUp(ui::ContextFactory* context_factory); | 47 void SetUp(ui::ContextFactory* context_factory); |
49 | 48 |
50 // Clean up objects that are created for tests. This also deletes the Env | 49 // Clean up objects that are created for tests. This also deletes the Env |
51 // object. | 50 // object. |
52 void TearDown(); | 51 void TearDown(); |
53 | 52 |
54 // Flushes message loop. | 53 // Flushes message loop. |
55 void RunAllPendingInMessageLoop(); | 54 void RunAllPendingInMessageLoop(); |
56 | 55 |
57 aura::Window* root_window() { return host_->window(); } | 56 aura::Window* GetRootWindow(); |
58 aura::WindowTreeHost* host() { return host_.get(); } | 57 aura::WindowTreeHost* GetHost(); |
59 | 58 |
60 private: | 59 private: |
61 bool setup_called_; | 60 bool setup_called_; |
62 bool teardown_called_; | 61 bool teardown_called_; |
63 | 62 |
64 base::MessageLoopForUI* message_loop_; | 63 base::MessageLoopForUI* message_loop_; |
65 | 64 |
66 scoped_ptr<aura::WindowTreeHost> host_; | |
67 scoped_ptr<aura::TestScreen> test_screen_; | |
68 scoped_ptr<TestScreenManagerDelegate> screen_manager_delegate_; | |
69 scoped_ptr<aura::client::FocusClient> focus_client_; | |
70 scoped_ptr< ::wm::InputMethodEventFilter> input_method_filter_; | |
71 scoped_ptr<ui::ScopedAnimationDurationScaleMode> zero_duration_mode_; | 65 scoped_ptr<ui::ScopedAnimationDurationScaleMode> zero_duration_mode_; |
72 scoped_ptr<base::Thread> file_thread_; | 66 scoped_ptr<base::Thread> file_thread_; |
73 | 67 |
74 DISALLOW_COPY_AND_ASSIGN(AthenaTestHelper); | 68 DISALLOW_COPY_AND_ASSIGN(AthenaTestHelper); |
75 }; | 69 }; |
76 | 70 |
77 } // namespace test | 71 } // namespace test |
78 } // namespace athena | 72 } // namespace athena |
79 | 73 |
80 #endif // ATHENA_TEST_ATHENA_TEST_HELPER_H_ | 74 #endif // ATHENA_TEST_ATHENA_TEST_HELPER_H_ |
OLD | NEW |