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/screen/public/screen_manager.h" |
9 #include "athena/test/sample_activity_factory.h" | 9 #include "athena/test/sample_activity_factory.h" |
10 #include "athena/test/test_app_model_builder.h" | 10 #include "athena/test/test_app_model_builder.h" |
| 11 #include "athena/test/test_screen_manager_delegate.h" |
11 #include "base/command_line.h" | 12 #include "base/command_line.h" |
12 #include "base/message_loop/message_loop.h" | 13 #include "base/message_loop/message_loop.h" |
13 #include "base/run_loop.h" | 14 #include "base/run_loop.h" |
14 #include "chromeos/dbus/dbus_thread_manager.h" | 15 #include "chromeos/dbus/dbus_thread_manager.h" |
15 #include "ui/app_list/app_list_switches.h" | 16 #include "ui/app_list/app_list_switches.h" |
16 #include "ui/aura/client/aura_constants.h" | 17 #include "ui/aura/client/aura_constants.h" |
17 #include "ui/aura/env.h" | 18 #include "ui/aura/env.h" |
18 #include "ui/aura/input_state_lookup.h" | 19 #include "ui/aura/input_state_lookup.h" |
19 #include "ui/aura/test/env_test_helper.h" | 20 #include "ui/aura/test/env_test_helper.h" |
20 #include "ui/aura/test/test_focus_client.h" | 21 #include "ui/aura/test/test_focus_client.h" |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 // from RootWindow. | 64 // from RootWindow. |
64 aura::test::EnvTestHelper(aura::Env::GetInstance()) | 65 aura::test::EnvTestHelper(aura::Env::GetInstance()) |
65 .SetInputStateLookup(scoped_ptr<aura::InputStateLookup>()); | 66 .SetInputStateLookup(scoped_ptr<aura::InputStateLookup>()); |
66 | 67 |
67 ui::InitializeInputMethodForTesting(); | 68 ui::InitializeInputMethodForTesting(); |
68 | 69 |
69 const gfx::Size host_size(800, 600); | 70 const gfx::Size host_size(800, 600); |
70 test_screen_.reset(aura::TestScreen::Create(host_size)); | 71 test_screen_.reset(aura::TestScreen::Create(host_size)); |
71 gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_NATIVE, test_screen_.get()); | 72 gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_NATIVE, test_screen_.get()); |
72 host_.reset(test_screen_->CreateHostForPrimaryDisplay()); | 73 host_.reset(test_screen_->CreateHostForPrimaryDisplay()); |
| 74 screen_manager_delegate_.reset( |
| 75 new TestScreenManagerDelegate(test_screen_.get())); |
73 | 76 |
74 input_method_filter_.reset(new ::wm::InputMethodEventFilter( | 77 input_method_filter_.reset(new ::wm::InputMethodEventFilter( |
75 root_window()->GetHost()->GetAcceleratedWidget())); | 78 root_window()->GetHost()->GetAcceleratedWidget())); |
76 input_method_filter_->SetInputMethodPropertyInRootWindow( | 79 input_method_filter_->SetInputMethodPropertyInRootWindow( |
77 root_window()); | 80 root_window()); |
78 | 81 |
79 wm::FocusController* focus_controller = | 82 wm::FocusController* focus_controller = |
80 new wm::FocusController(ScreenManager::CreateFocusRules()); | 83 new wm::FocusController(ScreenManager::CreateFocusRules()); |
81 aura::client::SetFocusClient(root_window(), focus_controller); | 84 aura::client::SetFocusClient(root_window(), focus_controller); |
82 root_window()->AddPreTargetHandler(focus_controller); | 85 root_window()->AddPreTargetHandler(focus_controller); |
83 aura::client::SetActivationClient(root_window(), focus_controller); | 86 aura::client::SetActivationClient(root_window(), focus_controller); |
84 focus_client_.reset(focus_controller); | 87 focus_client_.reset(focus_controller); |
85 | 88 |
86 root_window()->Show(); | 89 root_window()->Show(); |
87 // Ensure width != height so tests won't confuse them. | 90 // Ensure width != height so tests won't confuse them. |
88 host()->SetBounds(gfx::Rect(host_size)); | 91 host()->SetBounds(gfx::Rect(host_size)); |
89 | 92 |
90 athena::StartAthenaEnv(root_window()); | 93 athena::StartAthenaEnv(root_window(), screen_manager_delegate_.get()); |
91 athena::StartAthenaSession(new SampleActivityFactory(), | 94 athena::StartAthenaSession(new SampleActivityFactory(), |
92 new TestAppModelBuilder()); | 95 new TestAppModelBuilder()); |
93 } | 96 } |
94 | 97 |
95 void AthenaTestHelper::TearDown() { | 98 void AthenaTestHelper::TearDown() { |
96 teardown_called_ = true; | 99 teardown_called_ = true; |
97 | 100 |
98 athena::ShutdownAthena(); | 101 athena::ShutdownAthena(); |
99 | 102 |
100 aura::client::SetFocusClient(root_window(), NULL); | 103 aura::client::SetFocusClient(root_window(), NULL); |
(...skipping 18 matching lines...) Expand all Loading... |
119 | 122 |
120 void AthenaTestHelper::RunAllPendingInMessageLoop() { | 123 void AthenaTestHelper::RunAllPendingInMessageLoop() { |
121 // TODO(jbates) crbug.com/134753 Find quitters of this RunLoop and have them | 124 // TODO(jbates) crbug.com/134753 Find quitters of this RunLoop and have them |
122 // use run_loop.QuitClosure(). | 125 // use run_loop.QuitClosure(). |
123 base::RunLoop run_loop; | 126 base::RunLoop run_loop; |
124 run_loop.RunUntilIdle(); | 127 run_loop.RunUntilIdle(); |
125 } | 128 } |
126 | 129 |
127 } // namespace test | 130 } // namespace test |
128 } // namespace athena | 131 } // namespace athena |
OLD | NEW |