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

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

Issue 2535983004: Makes sure bounds and visibilty are updated correctly for new displays (Closed)
Patch Set: Created 4 years 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_base.h" 5 #include "ui/aura/test/aura_test_base.h"
6 6
7 #include "ui/aura/client/window_parenting_client.h" 7 #include "ui/aura/client/window_parenting_client.h"
8 #include "ui/aura/mus/property_utils.h" 8 #include "ui/aura/mus/property_utils.h"
9 #include "ui/aura/mus/window_tree_client.h" 9 #include "ui/aura/mus/window_tree_client.h"
10 #include "ui/aura/mus/window_tree_host_mus.h" 10 #include "ui/aura/mus/window_tree_host_mus.h"
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 helper_->SetUp(context_factory); 85 helper_->SetUp(context_factory);
86 } 86 }
87 87
88 void AuraTestBase::TearDown() { 88 void AuraTestBase::TearDown() {
89 teardown_called_ = true; 89 teardown_called_ = true;
90 90
91 // Flush the message loop because we have pending release tasks 91 // Flush the message loop because we have pending release tasks
92 // and these tasks if un-executed would upset Valgrind. 92 // and these tasks if un-executed would upset Valgrind.
93 RunAllPendingInMessageLoop(); 93 RunAllPendingInMessageLoop();
94 94
95 window_tree_hosts_.clear();
96
95 helper_->TearDown(); 97 helper_->TearDown();
96 ui::TerminateContextFactoryForTests(); 98 ui::TerminateContextFactoryForTests();
97 ui::ShutdownInputMethodForTesting(); 99 ui::ShutdownInputMethodForTesting();
98 testing::Test::TearDown(); 100 testing::Test::TearDown();
99 } 101 }
100 102
101 Window* AuraTestBase::CreateNormalWindow(int id, Window* parent, 103 Window* AuraTestBase::CreateNormalWindow(int id, Window* parent,
102 WindowDelegate* delegate) { 104 WindowDelegate* delegate) {
103 Window* window = new Window( 105 Window* window = new Window(
104 delegate ? delegate : 106 delegate ? delegate :
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 } 177 }
176 178
177 void AuraTestBase::OnWmClientJankinessChanged( 179 void AuraTestBase::OnWmClientJankinessChanged(
178 const std::set<Window*>& client_windows, 180 const std::set<Window*>& client_windows,
179 bool janky) {} 181 bool janky) {}
180 182
181 void AuraTestBase::OnWmNewDisplay( 183 void AuraTestBase::OnWmNewDisplay(
182 std::unique_ptr<WindowTreeHostMus> window_tree_host, 184 std::unique_ptr<WindowTreeHostMus> window_tree_host,
183 const display::Display& display) { 185 const display::Display& display) {
184 // Take ownership of the WindowTreeHost. 186 // Take ownership of the WindowTreeHost.
185 window_tree_host_mus_ = std::move(window_tree_host); 187 window_tree_hosts_.push_back(std::move(window_tree_host));
186 } 188 }
187 189
188 void AuraTestBase::OnWmDisplayRemoved(WindowTreeHostMus* window_tree_host) { 190 void AuraTestBase::OnWmDisplayRemoved(WindowTreeHostMus* window_tree_host) {
189 if (window_tree_host_mus_.get() == window_tree_host) 191 for (auto iter = window_tree_hosts_.begin(); iter != window_tree_hosts_.end();
190 window_tree_host_mus_.reset(); 192 ++iter) {
193 if (iter->get() == window_tree_host) {
194 window_tree_hosts_.erase(iter);
195 return;
196 }
197 }
198 NOTREACHED();
191 } 199 }
192 200
193 void AuraTestBase::OnWmDisplayModified(const display::Display& display) {} 201 void AuraTestBase::OnWmDisplayModified(const display::Display& display) {}
194 202
195 ui::mojom::EventResult AuraTestBase::OnAccelerator(uint32_t id, 203 ui::mojom::EventResult AuraTestBase::OnAccelerator(uint32_t id,
196 const ui::Event& event) { 204 const ui::Event& event) {
197 return ui::mojom::EventResult::HANDLED; 205 return ui::mojom::EventResult::HANDLED;
198 } 206 }
199 207
200 void AuraTestBase::OnWmPerformMoveLoop( 208 void AuraTestBase::OnWmPerformMoveLoop(
(...skipping 20 matching lines...) Expand all
221 229
222 void AuraTestBaseWithType::SetUp() { 230 void AuraTestBaseWithType::SetUp() {
223 DCHECK(!setup_called_); 231 DCHECK(!setup_called_);
224 setup_called_ = true; 232 setup_called_ = true;
225 ConfigureBackend(GetParam()); 233 ConfigureBackend(GetParam());
226 AuraTestBase::SetUp(); 234 AuraTestBase::SetUp();
227 } 235 }
228 236
229 } // namespace test 237 } // namespace test
230 } // namespace aura 238 } // namespace aura
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698