| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "services/ui/public/cpp/tests/window_server_test_base.h" | 5 #include "services/ui/public/cpp/tests/window_server_test_base.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/location.h" | 8 #include "base/location.h" |
| 9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
| 10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 } | 28 } |
| 29 | 29 |
| 30 } // namespace | 30 } // namespace |
| 31 | 31 |
| 32 WindowServerTestBase::WindowServerTestBase() | 32 WindowServerTestBase::WindowServerTestBase() |
| 33 : window_manager_(nullptr), | 33 : window_manager_(nullptr), |
| 34 window_manager_delegate_(nullptr), | 34 window_manager_delegate_(nullptr), |
| 35 window_manager_client_(nullptr) {} | 35 window_manager_client_(nullptr) {} |
| 36 | 36 |
| 37 WindowServerTestBase::~WindowServerTestBase() { | 37 WindowServerTestBase::~WindowServerTestBase() { |
| 38 display::Screen::SetScreenInstance(nullptr); |
| 38 window_tree_clients_.clear(); | 39 window_tree_clients_.clear(); |
| 39 } | 40 } |
| 40 | 41 |
| 41 // static | 42 // static |
| 42 bool WindowServerTestBase::DoRunLoopWithTimeout() { | 43 bool WindowServerTestBase::DoRunLoopWithTimeout() { |
| 43 if (current_run_loop != nullptr) | 44 if (current_run_loop != nullptr) |
| 44 return false; | 45 return false; |
| 45 | 46 |
| 46 bool timeout = false; | 47 bool timeout = false; |
| 47 base::RunLoop run_loop; | 48 base::RunLoop run_loop; |
| (...skipping 25 matching lines...) Expand all Loading... |
| 73 window_tree_clients_.erase(iter); | 74 window_tree_clients_.erase(iter); |
| 74 return; | 75 return; |
| 75 } | 76 } |
| 76 } | 77 } |
| 77 NOTREACHED(); | 78 NOTREACHED(); |
| 78 } | 79 } |
| 79 | 80 |
| 80 void WindowServerTestBase::SetUp() { | 81 void WindowServerTestBase::SetUp() { |
| 81 WindowServerServiceTestBase::SetUp(); | 82 WindowServerServiceTestBase::SetUp(); |
| 82 | 83 |
| 84 display::Screen::SetScreenInstance(&test_screen_); |
| 83 std::unique_ptr<WindowTreeClient> window_manager_window_tree_client = | 85 std::unique_ptr<WindowTreeClient> window_manager_window_tree_client = |
| 84 base::MakeUnique<WindowTreeClient>(this, this); | 86 base::MakeUnique<WindowTreeClient>(this, this); |
| 85 window_manager_window_tree_client->ConnectAsWindowManager(connector()); | 87 window_manager_window_tree_client->ConnectAsWindowManager(connector()); |
| 86 window_manager_ = window_manager_window_tree_client.get(); | 88 window_manager_ = window_manager_window_tree_client.get(); |
| 87 window_tree_clients_.insert(std::move(window_manager_window_tree_client)); | 89 window_tree_clients_.insert(std::move(window_manager_window_tree_client)); |
| 88 | 90 |
| 89 ASSERT_TRUE(DoRunLoopWithTimeout()); // RunLoop should be quit by OnEmbed(). | 91 ASSERT_TRUE(DoRunLoopWithTimeout()); // RunLoop should be quit by OnEmbed(). |
| 90 } | 92 } |
| 91 | 93 |
| 92 bool WindowServerTestBase::OnConnect( | 94 bool WindowServerTestBase::OnConnect( |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 190 } | 192 } |
| 191 | 193 |
| 192 void WindowServerTestBase::Create( | 194 void WindowServerTestBase::Create( |
| 193 const service_manager::Identity& remote_identity, | 195 const service_manager::Identity& remote_identity, |
| 194 mojom::WindowTreeClientRequest request) { | 196 mojom::WindowTreeClientRequest request) { |
| 195 window_tree_clients_.insert( | 197 window_tree_clients_.insert( |
| 196 base::MakeUnique<WindowTreeClient>(this, nullptr, std::move(request))); | 198 base::MakeUnique<WindowTreeClient>(this, nullptr, std::move(request))); |
| 197 } | 199 } |
| 198 | 200 |
| 199 } // namespace ui | 201 } // namespace ui |
| OLD | NEW |