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

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

Issue 2897663002: chromeos: makes it possible for windows to outlive WindowTreeClient (Closed)
Patch Set: cleanup Created 3 years, 7 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
« no previous file with comments | « ui/aura/test/aura_test_helper.h ('k') | ui/aura/test/env_test_helper.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/command_line.h" 7 #include "base/command_line.h"
8 #include "base/memory/ptr_util.h" 8 #include "base/memory/ptr_util.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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 } 79 }
80 80
81 void AuraTestHelper::EnableMusWithWindowTreeClient( 81 void AuraTestHelper::EnableMusWithWindowTreeClient(
82 WindowTreeClient* window_tree_client) { 82 WindowTreeClient* window_tree_client) {
83 DCHECK(!setup_called_); 83 DCHECK(!setup_called_);
84 DCHECK_EQ(Mode::LOCAL, mode_); 84 DCHECK_EQ(Mode::LOCAL, mode_);
85 mode_ = Mode::MUS; 85 mode_ = Mode::MUS;
86 window_tree_client_ = window_tree_client; 86 window_tree_client_ = window_tree_client;
87 } 87 }
88 88
89 void AuraTestHelper::DeleteWindowTreeClient() {
90 window_tree_client_setup_.reset();
91 window_tree_client_ = nullptr;
92 }
93
89 void AuraTestHelper::SetUp(ui::ContextFactory* context_factory, 94 void AuraTestHelper::SetUp(ui::ContextFactory* context_factory,
90 ui::ContextFactoryPrivate* context_factory_private) { 95 ui::ContextFactoryPrivate* context_factory_private) {
91 setup_called_ = true; 96 setup_called_ = true;
92 97
93 if (mode_ != Mode::MUS) { 98 if (mode_ != Mode::MUS) {
94 // Assume if an explicit WindowTreeClient was created then a WmState was 99 // Assume if an explicit WindowTreeClient was created then a WmState was
95 // already created. 100 // already created.
96 wm_state_ = base::MakeUnique<wm::WMState>(); 101 wm_state_ = base::MakeUnique<wm::WMState>();
97 } 102 }
98 // Needs to be before creating WindowTreeClient. 103 // Needs to be before creating WindowTreeClient.
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 170
166 window_tree_client_setup_.reset(); 171 window_tree_client_setup_.reset();
167 focus_client_.reset(); 172 focus_client_.reset();
168 capture_client_.reset(); 173 capture_client_.reset();
169 } 174 }
170 ui::GestureRecognizer::Reset(); 175 ui::GestureRecognizer::Reset();
171 ui::ShutdownInputMethodForTesting(); 176 ui::ShutdownInputMethodForTesting();
172 177
173 if (env_) 178 if (env_)
174 env_.reset(); 179 env_.reset();
175 else
176 EnvTestHelper().SetWindowTreeClient(nullptr);
177 wm_state_.reset(); 180 wm_state_.reset();
178 } 181 }
179 182
180 void AuraTestHelper::RunAllPendingInMessageLoop() { 183 void AuraTestHelper::RunAllPendingInMessageLoop() {
181 // TODO(jbates) crbug.com/134753 Find quitters of this RunLoop and have them 184 // TODO(jbates) crbug.com/134753 Find quitters of this RunLoop and have them
182 // use run_loop.QuitClosure(). 185 // use run_loop.QuitClosure().
183 base::RunLoop run_loop; 186 base::RunLoop run_loop;
184 run_loop.RunUntilIdle(); 187 run_loop.RunUntilIdle();
185 } 188 }
186 189
(...skipping 13 matching lines...) Expand all
200 window_tree_client_setup_ = base::MakeUnique<TestWindowTreeClientSetup>(); 203 window_tree_client_setup_ = base::MakeUnique<TestWindowTreeClientSetup>();
201 window_tree_client_setup_->InitForWindowManager(window_tree_delegate_, 204 window_tree_client_setup_->InitForWindowManager(window_tree_delegate_,
202 window_manager_delegate_); 205 window_manager_delegate_);
203 window_tree_client_ = window_tree_client_setup_->window_tree_client(); 206 window_tree_client_ = window_tree_client_setup_->window_tree_client();
204 window_tree_client_->capture_synchronizer()->AttachToCaptureClient( 207 window_tree_client_->capture_synchronizer()->AttachToCaptureClient(
205 capture_client_.get()); 208 capture_client_.get());
206 } 209 }
207 210
208 } // namespace test 211 } // namespace test
209 } // namespace aura 212 } // namespace aura
OLDNEW
« no previous file with comments | « ui/aura/test/aura_test_helper.h ('k') | ui/aura/test/env_test_helper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698