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