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 #include "athena/test/athena_test_helper.h" | 5 #include "athena/test/athena_test_helper.h" |
6 | 6 |
7 #include "athena/main/athena_launcher.h" | 7 #include "athena/main/athena_launcher.h" |
| 8 #include "athena/screen/public/screen_manager.h" |
8 #include "athena/test/sample_activity_factory.h" | 9 #include "athena/test/sample_activity_factory.h" |
9 #include "athena/test/test_app_model_builder.h" | 10 #include "athena/test/test_app_model_builder.h" |
10 #include "base/command_line.h" | 11 #include "base/command_line.h" |
11 #include "base/message_loop/message_loop.h" | 12 #include "base/message_loop/message_loop.h" |
12 #include "base/run_loop.h" | 13 #include "base/run_loop.h" |
13 #include "ui/app_list/app_list_switches.h" | 14 #include "ui/app_list/app_list_switches.h" |
14 #include "ui/aura/client/aura_constants.h" | 15 #include "ui/aura/client/aura_constants.h" |
15 #include "ui/aura/env.h" | 16 #include "ui/aura/env.h" |
16 #include "ui/aura/input_state_lookup.h" | 17 #include "ui/aura/input_state_lookup.h" |
17 #include "ui/aura/test/env_test_helper.h" | 18 #include "ui/aura/test/env_test_helper.h" |
18 #include "ui/aura/test/test_focus_client.h" | 19 #include "ui/aura/test/test_focus_client.h" |
19 #include "ui/aura/test/test_screen.h" | 20 #include "ui/aura/test/test_screen.h" |
20 #include "ui/aura/window_event_dispatcher.h" | 21 #include "ui/aura/window_event_dispatcher.h" |
21 #include "ui/base/ime/input_method_initializer.h" | 22 #include "ui/base/ime/input_method_initializer.h" |
22 #include "ui/compositor/scoped_animation_duration_scale_mode.h" | 23 #include "ui/compositor/scoped_animation_duration_scale_mode.h" |
23 #include "ui/gfx/screen.h" | 24 #include "ui/gfx/screen.h" |
24 #include "ui/wm/core/default_activation_client.h" | 25 #include "ui/wm/core/focus_controller.h" |
25 #include "ui/wm/core/input_method_event_filter.h" | 26 #include "ui/wm/core/input_method_event_filter.h" |
26 | 27 |
27 #if defined(USE_X11) | 28 #if defined(USE_X11) |
28 #include "ui/base/x/x11_util.h" | 29 #include "ui/base/x/x11_util.h" |
29 #endif | 30 #endif |
30 | 31 |
31 namespace athena { | 32 namespace athena { |
32 namespace test { | 33 namespace test { |
33 | 34 |
34 AthenaTestHelper::AthenaTestHelper(base::MessageLoopForUI* message_loop) | 35 AthenaTestHelper::AthenaTestHelper(base::MessageLoopForUI* message_loop) |
(...skipping 30 matching lines...) Expand all Loading... |
65 const gfx::Size host_size(800, 600); | 66 const gfx::Size host_size(800, 600); |
66 test_screen_.reset(aura::TestScreen::Create(host_size)); | 67 test_screen_.reset(aura::TestScreen::Create(host_size)); |
67 gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_NATIVE, test_screen_.get()); | 68 gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_NATIVE, test_screen_.get()); |
68 host_.reset(test_screen_->CreateHostForPrimaryDisplay()); | 69 host_.reset(test_screen_->CreateHostForPrimaryDisplay()); |
69 | 70 |
70 input_method_filter_.reset(new ::wm::InputMethodEventFilter( | 71 input_method_filter_.reset(new ::wm::InputMethodEventFilter( |
71 root_window()->GetHost()->GetAcceleratedWidget())); | 72 root_window()->GetHost()->GetAcceleratedWidget())); |
72 input_method_filter_->SetInputMethodPropertyInRootWindow( | 73 input_method_filter_->SetInputMethodPropertyInRootWindow( |
73 root_window()); | 74 root_window()); |
74 | 75 |
75 // TODO(oshima): Switch to athena implementation. | 76 wm::FocusController* focus_controller = |
76 focus_client_.reset(new aura::test::TestFocusClient); | 77 new wm::FocusController(ScreenManager::CreateFocusRules()); |
77 aura::client::SetFocusClient(root_window(), | 78 aura::client::SetFocusClient(root_window(), focus_controller); |
78 focus_client_.get()); | 79 root_window()->AddPreTargetHandler(focus_controller); |
79 new ::wm::DefaultActivationClient(root_window()); | 80 aura::client::SetActivationClient(root_window(), focus_controller); |
| 81 focus_client_.reset(focus_controller); |
80 | 82 |
81 root_window()->Show(); | 83 root_window()->Show(); |
82 // Ensure width != height so tests won't confuse them. | 84 // Ensure width != height so tests won't confuse them. |
83 host()->SetBounds(gfx::Rect(host_size)); | 85 host()->SetBounds(gfx::Rect(host_size)); |
84 | 86 |
85 athena::StartAthena(root_window(), | 87 athena::StartAthena(root_window(), |
86 new SampleActivityFactory(), | 88 new SampleActivityFactory(), |
87 new TestAppModelBuilder()); | 89 new TestAppModelBuilder()); |
88 } | 90 } |
89 | 91 |
(...skipping 22 matching lines...) Expand all Loading... |
112 | 114 |
113 void AthenaTestHelper::RunAllPendingInMessageLoop() { | 115 void AthenaTestHelper::RunAllPendingInMessageLoop() { |
114 // TODO(jbates) crbug.com/134753 Find quitters of this RunLoop and have them | 116 // TODO(jbates) crbug.com/134753 Find quitters of this RunLoop and have them |
115 // use run_loop.QuitClosure(). | 117 // use run_loop.QuitClosure(). |
116 base::RunLoop run_loop; | 118 base::RunLoop run_loop; |
117 run_loop.RunUntilIdle(); | 119 run_loop.RunUntilIdle(); |
118 } | 120 } |
119 | 121 |
120 } // namespace test | 122 } // namespace test |
121 } // namespace athena | 123 } // namespace athena |
OLD | NEW |