| 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 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 (mode_ == Mode::LOCAL) ? Env::Mode::LOCAL : Env::Mode::MUS; | 102 (mode_ == Mode::LOCAL) ? Env::Mode::LOCAL : Env::Mode::MUS; |
| 103 if (mode_ == Mode::MUS_CREATE_WINDOW_TREE_CLIENT) | 103 if (mode_ == Mode::MUS_CREATE_WINDOW_TREE_CLIENT) |
| 104 InitWindowTreeClient(); | 104 InitWindowTreeClient(); |
| 105 if (!Env::GetInstanceDontCreate()) | 105 if (!Env::GetInstanceDontCreate()) |
| 106 env_ = Env::CreateInstance(env_mode); | 106 env_ = Env::CreateInstance(env_mode); |
| 107 EnvTestHelper env_helper; | 107 EnvTestHelper env_helper; |
| 108 // Always reset the mode. This really only matters for if Env was created | 108 // Always reset the mode. This really only matters for if Env was created |
| 109 // above. | 109 // above. |
| 110 env_helper.SetMode(env_mode); | 110 env_helper.SetMode(env_mode); |
| 111 env_helper.SetWindowTreeClient(window_tree_client_); | 111 env_helper.SetWindowTreeClient(window_tree_client_); |
| 112 // Tests assume they can set the mouse location on Env() and have it reflected |
| 113 // in tests. |
| 114 env_helper.SetAlwaysUseLastMouseLocation(true); |
| 112 Env::GetInstance()->SetActiveFocusClient(focus_client_.get(), nullptr); | 115 Env::GetInstance()->SetActiveFocusClient(focus_client_.get(), nullptr); |
| 113 Env::GetInstance()->set_context_factory(context_factory); | 116 Env::GetInstance()->set_context_factory(context_factory); |
| 114 Env::GetInstance()->set_context_factory_private(context_factory_private); | 117 Env::GetInstance()->set_context_factory_private(context_factory_private); |
| 115 // Unit tests generally don't want to query the system, rather use the state | 118 // Unit tests generally don't want to query the system, rather use the state |
| 116 // from RootWindow. | 119 // from RootWindow. |
| 117 env_helper.SetInputStateLookup(nullptr); | 120 env_helper.SetInputStateLookup(nullptr); |
| 118 env_helper.ResetEventState(); | 121 env_helper.ResetEventState(); |
| 119 | 122 |
| 120 ui::InitializeInputMethodForTesting(); | 123 ui::InitializeInputMethodForTesting(); |
| 121 | 124 |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 | 192 |
| 190 void AuraTestHelper::InitWindowTreeClient() { | 193 void AuraTestHelper::InitWindowTreeClient() { |
| 191 window_tree_client_setup_ = base::MakeUnique<TestWindowTreeClientSetup>(); | 194 window_tree_client_setup_ = base::MakeUnique<TestWindowTreeClientSetup>(); |
| 192 window_tree_client_setup_->InitForWindowManager(window_tree_delegate_, | 195 window_tree_client_setup_->InitForWindowManager(window_tree_delegate_, |
| 193 window_manager_delegate_); | 196 window_manager_delegate_); |
| 194 window_tree_client_ = window_tree_client_setup_->window_tree_client(); | 197 window_tree_client_ = window_tree_client_setup_->window_tree_client(); |
| 195 } | 198 } |
| 196 | 199 |
| 197 } // namespace test | 200 } // namespace test |
| 198 } // namespace aura | 201 } // namespace aura |
| OLD | NEW |