| 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 "ui/aura/test/aura_test_helper.h" | 5 #include "ui/aura/test/aura_test_helper.h" |
| 6 | 6 |
| 7 #include "base/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
| 8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
| 9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
| 10 #include "ui/aura/client/default_capture_client.h" | 10 #include "ui/aura/client/default_capture_client.h" |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 (mode_ == Mode::LOCAL) ? Env::Mode::LOCAL : Env::Mode::MUS; | 92 (mode_ == Mode::LOCAL) ? Env::Mode::LOCAL : Env::Mode::MUS; |
| 93 if (mode_ == Mode::MUS_CREATE_WINDOW_TREE_CLIENT) | 93 if (mode_ == Mode::MUS_CREATE_WINDOW_TREE_CLIENT) |
| 94 InitWindowTreeClient(); | 94 InitWindowTreeClient(); |
| 95 if (!Env::GetInstanceDontCreate()) | 95 if (!Env::GetInstanceDontCreate()) |
| 96 env_ = Env::CreateInstance(env_mode); | 96 env_ = Env::CreateInstance(env_mode); |
| 97 EnvTestHelper env_helper; | 97 EnvTestHelper env_helper; |
| 98 // Always reset the mode. This really only matters for if Env was created | 98 // Always reset the mode. This really only matters for if Env was created |
| 99 // above. | 99 // above. |
| 100 env_helper.SetMode(env_mode); | 100 env_helper.SetMode(env_mode); |
| 101 env_helper.SetWindowTreeClient(window_tree_client_); | 101 env_helper.SetWindowTreeClient(window_tree_client_); |
| 102 // Tests assume they can set the mouse location on Env() and have it reflected |
| 103 // in tests. |
| 104 env_helper.SetAlwaysUseLastMouseLocation(true); |
| 102 Env::GetInstance()->SetActiveFocusClient(focus_client_.get(), nullptr); | 105 Env::GetInstance()->SetActiveFocusClient(focus_client_.get(), nullptr); |
| 103 Env::GetInstance()->set_context_factory(context_factory); | 106 Env::GetInstance()->set_context_factory(context_factory); |
| 104 Env::GetInstance()->set_context_factory_private(context_factory_private); | 107 Env::GetInstance()->set_context_factory_private(context_factory_private); |
| 105 // Unit tests generally don't want to query the system, rather use the state | 108 // Unit tests generally don't want to query the system, rather use the state |
| 106 // from RootWindow. | 109 // from RootWindow. |
| 107 env_helper.SetInputStateLookup(nullptr); | 110 env_helper.SetInputStateLookup(nullptr); |
| 108 env_helper.ResetEventState(); | 111 env_helper.ResetEventState(); |
| 109 | 112 |
| 110 ui::InitializeInputMethodForTesting(); | 113 ui::InitializeInputMethodForTesting(); |
| 111 | 114 |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 | 179 |
| 177 void AuraTestHelper::InitWindowTreeClient() { | 180 void AuraTestHelper::InitWindowTreeClient() { |
| 178 window_tree_client_setup_ = base::MakeUnique<TestWindowTreeClientSetup>(); | 181 window_tree_client_setup_ = base::MakeUnique<TestWindowTreeClientSetup>(); |
| 179 window_tree_client_setup_->InitForWindowManager(window_tree_delegate_, | 182 window_tree_client_setup_->InitForWindowManager(window_tree_delegate_, |
| 180 window_manager_delegate_); | 183 window_manager_delegate_); |
| 181 window_tree_client_ = window_tree_client_setup_->window_tree_client(); | 184 window_tree_client_ = window_tree_client_setup_->window_tree_client(); |
| 182 } | 185 } |
| 183 | 186 |
| 184 } // namespace test | 187 } // namespace test |
| 185 } // namespace aura | 188 } // namespace aura |
| OLD | NEW |