Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(90)

Side by Side Diff: ui/aura/test/aura_test_helper.cc

Issue 2657283003: mash: make Env::last_mouse_location() accurate for Mus (Closed)
Patch Set: fix test Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698