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 #include "ash/test/ash_test_base.h" | 5 #include "ash/test/ash_test_base.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "ash/common/ash_switches.h" | 10 #include "ash/common/ash_switches.h" |
11 #include "ash/common/wm/window_positioner.h" | 11 #include "ash/common/wm/window_positioner.h" |
12 #include "ash/common/wm_root_window_controller.h" | 12 #include "ash/common/wm_root_window_controller.h" |
13 #include "ash/common/wm_shell.h" | 13 #include "ash/common/wm_shell.h" |
14 #include "ash/common/wm_window.h" | 14 #include "ash/common/wm_window.h" |
15 #include "ash/display/window_tree_host_manager.h" | 15 #include "ash/display/window_tree_host_manager.h" |
16 #include "ash/ime/input_method_event_handler.h" | 16 #include "ash/ime/input_method_event_handler.h" |
17 #include "ash/shell.h" | 17 #include "ash/shell.h" |
18 #include "ash/shell/toplevel_window.h" | 18 #include "ash/shell/toplevel_window.h" |
| 19 #include "ash/test/ash_test_environment.h" |
19 #include "ash/test/ash_test_helper.h" | 20 #include "ash/test/ash_test_helper.h" |
20 #include "ash/test/display_manager_test_api.h" | 21 #include "ash/test/display_manager_test_api.h" |
21 #include "ash/test/test_session_state_delegate.h" | 22 #include "ash/test/test_session_state_delegate.h" |
22 #include "ash/test/test_shell_delegate.h" | 23 #include "ash/test/test_shell_delegate.h" |
23 #include "ash/test/test_system_tray_delegate.h" | 24 #include "ash/test/test_system_tray_delegate.h" |
24 #include "base/command_line.h" | 25 #include "base/command_line.h" |
25 #include "ui/aura/client/aura_constants.h" | 26 #include "ui/aura/client/aura_constants.h" |
26 #include "ui/aura/client/screen_position_client.h" | 27 #include "ui/aura/client/screen_position_client.h" |
27 #include "ui/aura/client/window_tree_client.h" | 28 #include "ui/aura/client/window_tree_client.h" |
28 #include "ui/aura/test/event_generator_delegate_aura.h" | 29 #include "ui/aura/test/event_generator_delegate_aura.h" |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 teardown_called_(false), | 96 teardown_called_(false), |
96 start_session_(true), | 97 start_session_(true), |
97 material_mode_(MaterialDesignController::Mode::UNINITIALIZED) { | 98 material_mode_(MaterialDesignController::Mode::UNINITIALIZED) { |
98 #if defined(USE_X11) | 99 #if defined(USE_X11) |
99 // This is needed for tests which use this base class but are run in browser | 100 // This is needed for tests which use this base class but are run in browser |
100 // test binaries so don't get the default initialization in the unit test | 101 // test binaries so don't get the default initialization in the unit test |
101 // suite. | 102 // suite. |
102 gfx::InitializeThreadedX11(); | 103 gfx::InitializeThreadedX11(); |
103 #endif | 104 #endif |
104 | 105 |
105 thread_bundle_.reset(new content::TestBrowserThreadBundle); | 106 ash_test_environment_ = AshTestEnvironment::Create(); |
| 107 |
106 // Must initialize |ash_test_helper_| here because some tests rely on | 108 // Must initialize |ash_test_helper_| here because some tests rely on |
107 // AshTestBase methods before they call AshTestBase::SetUp(). | 109 // AshTestBase methods before they call AshTestBase::SetUp(). |
108 ash_test_helper_.reset(new AshTestHelper(base::MessageLoopForUI::current())); | 110 ash_test_helper_.reset(new AshTestHelper(ash_test_environment_.get())); |
109 } | 111 } |
110 | 112 |
111 AshTestBase::~AshTestBase() { | 113 AshTestBase::~AshTestBase() { |
112 CHECK(setup_called_) | 114 CHECK(setup_called_) |
113 << "You have overridden SetUp but never called AshTestBase::SetUp"; | 115 << "You have overridden SetUp but never called AshTestBase::SetUp"; |
114 CHECK(teardown_called_) | 116 CHECK(teardown_called_) |
115 << "You have overridden TearDown but never called AshTestBase::TearDown"; | 117 << "You have overridden TearDown but never called AshTestBase::TearDown"; |
116 } | 118 } |
117 | 119 |
118 void AshTestBase::SetUp() { | 120 void AshTestBase::SetUp() { |
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
378 | 380 |
379 void AshTestBase::DisableIME() { | 381 void AshTestBase::DisableIME() { |
380 Shell::GetInstance()->RemovePreTargetHandler( | 382 Shell::GetInstance()->RemovePreTargetHandler( |
381 Shell::GetInstance() | 383 Shell::GetInstance() |
382 ->window_tree_host_manager() | 384 ->window_tree_host_manager() |
383 ->input_method_event_handler()); | 385 ->input_method_event_handler()); |
384 } | 386 } |
385 | 387 |
386 } // namespace test | 388 } // namespace test |
387 } // namespace ash | 389 } // namespace ash |
OLD | NEW |