| 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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 WindowServerServiceTestBase::SetUp(); | 82 WindowServerServiceTestBase::SetUp(); |
| 83 | 83 |
| 84 std::unique_ptr<WindowTreeClient> window_manager_window_tree_client = | 84 std::unique_ptr<WindowTreeClient> window_manager_window_tree_client = |
| 85 CreateWindowTreeHost(connector(), this, &host_, this); | 85 CreateWindowTreeHost(connector(), this, &host_, this); |
| 86 window_manager_ = window_manager_window_tree_client.get(); | 86 window_manager_ = window_manager_window_tree_client.get(); |
| 87 window_tree_clients_.insert(std::move(window_manager_window_tree_client)); | 87 window_tree_clients_.insert(std::move(window_manager_window_tree_client)); |
| 88 | 88 |
| 89 ASSERT_TRUE(DoRunLoopWithTimeout()); // RunLoop should be quit by OnEmbed(). | 89 ASSERT_TRUE(DoRunLoopWithTimeout()); // RunLoop should be quit by OnEmbed(). |
| 90 } | 90 } |
| 91 | 91 |
| 92 bool WindowServerTestBase::OnConnect(const shell::Identity& remote_identity, | 92 bool WindowServerTestBase::OnConnect( |
| 93 shell::InterfaceRegistry* registry) { | 93 const service_manager::Identity& remote_identity, |
| 94 service_manager::InterfaceRegistry* registry) { |
| 94 registry->AddInterface<mojom::WindowTreeClient>(this); | 95 registry->AddInterface<mojom::WindowTreeClient>(this); |
| 95 return true; | 96 return true; |
| 96 } | 97 } |
| 97 | 98 |
| 98 void WindowServerTestBase::OnEmbed(Window* root) { | 99 void WindowServerTestBase::OnEmbed(Window* root) { |
| 99 most_recent_client_ = root->window_tree(); | 100 most_recent_client_ = root->window_tree(); |
| 100 EXPECT_TRUE(QuitRunLoop()); | 101 EXPECT_TRUE(QuitRunLoop()); |
| 101 ASSERT_TRUE(window_manager_client_); | 102 ASSERT_TRUE(window_manager_client_); |
| 102 window_manager_client_->AddActivationParent(root); | 103 window_manager_client_->AddActivationParent(root); |
| 103 } | 104 } |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 window_manager_delegate_->OnWmCancelMoveLoop(window); | 175 window_manager_delegate_->OnWmCancelMoveLoop(window); |
| 175 } | 176 } |
| 176 | 177 |
| 177 mojom::EventResult WindowServerTestBase::OnAccelerator(uint32_t accelerator_id, | 178 mojom::EventResult WindowServerTestBase::OnAccelerator(uint32_t accelerator_id, |
| 178 const ui::Event& event) { | 179 const ui::Event& event) { |
| 179 return window_manager_delegate_ | 180 return window_manager_delegate_ |
| 180 ? window_manager_delegate_->OnAccelerator(accelerator_id, event) | 181 ? window_manager_delegate_->OnAccelerator(accelerator_id, event) |
| 181 : mojom::EventResult::UNHANDLED; | 182 : mojom::EventResult::UNHANDLED; |
| 182 } | 183 } |
| 183 | 184 |
| 184 void WindowServerTestBase::Create(const shell::Identity& remote_identity, | 185 void WindowServerTestBase::Create( |
| 185 mojom::WindowTreeClientRequest request) { | 186 const service_manager::Identity& remote_identity, |
| 187 mojom::WindowTreeClientRequest request) { |
| 186 window_tree_clients_.insert( | 188 window_tree_clients_.insert( |
| 187 base::MakeUnique<WindowTreeClient>(this, nullptr, std::move(request))); | 189 base::MakeUnique<WindowTreeClient>(this, nullptr, std::move(request))); |
| 188 } | 190 } |
| 189 | 191 |
| 190 } // namespace ui | 192 } // namespace ui |
| OLD | NEW |