| 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_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 Loading... |
| 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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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::OnWmWillCreateDisplay(const display::Display& display) {} | 183 void AuraTestBase::OnWmWillCreateDisplay(const display::Display& display) {} |
| 182 | 184 |
| 183 void AuraTestBase::OnWmNewDisplay( | 185 void AuraTestBase::OnWmNewDisplay( |
| 184 std::unique_ptr<WindowTreeHostMus> window_tree_host, | 186 std::unique_ptr<WindowTreeHostMus> window_tree_host, |
| 185 const display::Display& display) { | 187 const display::Display& display) { |
| 186 // Take ownership of the WindowTreeHost. | 188 // Take ownership of the WindowTreeHost. |
| 187 window_tree_host_mus_ = std::move(window_tree_host); | 189 window_tree_hosts_.push_back(std::move(window_tree_host)); |
| 188 } | 190 } |
| 189 | 191 |
| 190 void AuraTestBase::OnWmDisplayRemoved(WindowTreeHostMus* window_tree_host) { | 192 void AuraTestBase::OnWmDisplayRemoved(WindowTreeHostMus* window_tree_host) { |
| 191 if (window_tree_host_mus_.get() == window_tree_host) | 193 for (auto iter = window_tree_hosts_.begin(); iter != window_tree_hosts_.end(); |
| 192 window_tree_host_mus_.reset(); | 194 ++iter) { |
| 195 if (iter->get() == window_tree_host) { |
| 196 window_tree_hosts_.erase(iter); |
| 197 return; |
| 198 } |
| 199 } |
| 200 NOTREACHED(); |
| 193 } | 201 } |
| 194 | 202 |
| 195 void AuraTestBase::OnWmDisplayModified(const display::Display& display) {} | 203 void AuraTestBase::OnWmDisplayModified(const display::Display& display) {} |
| 196 | 204 |
| 197 ui::mojom::EventResult AuraTestBase::OnAccelerator(uint32_t id, | 205 ui::mojom::EventResult AuraTestBase::OnAccelerator(uint32_t id, |
| 198 const ui::Event& event) { | 206 const ui::Event& event) { |
| 199 return ui::mojom::EventResult::HANDLED; | 207 return ui::mojom::EventResult::HANDLED; |
| 200 } | 208 } |
| 201 | 209 |
| 202 void AuraTestBase::OnWmPerformMoveLoop( | 210 void AuraTestBase::OnWmPerformMoveLoop( |
| (...skipping 25 matching lines...) Expand all Loading... |
| 228 | 236 |
| 229 void AuraTestBaseWithType::SetUp() { | 237 void AuraTestBaseWithType::SetUp() { |
| 230 DCHECK(!setup_called_); | 238 DCHECK(!setup_called_); |
| 231 setup_called_ = true; | 239 setup_called_ = true; |
| 232 ConfigureBackend(GetParam()); | 240 ConfigureBackend(GetParam()); |
| 233 AuraTestBase::SetUp(); | 241 AuraTestBase::SetUp(); |
| 234 } | 242 } |
| 235 | 243 |
| 236 } // namespace test | 244 } // namespace test |
| 237 } // namespace aura | 245 } // namespace aura |
| OLD | NEW |