| 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 "components/mus/public/cpp/tests/window_server_test_base.h" | 5 #include "components/mus/public/cpp/tests/window_server_test_base.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
| 9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
| 10 #include "base/test/test_timeouts.h" | 10 #include "base/test/test_timeouts.h" |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 | 64 |
| 65 void WindowServerTestBase::SetUp() { | 65 void WindowServerTestBase::SetUp() { |
| 66 ApplicationTestBase::SetUp(); | 66 ApplicationTestBase::SetUp(); |
| 67 | 67 |
| 68 CreateWindowTreeHost(shell(), this, &host_, this); | 68 CreateWindowTreeHost(shell(), this, &host_, this); |
| 69 | 69 |
| 70 ASSERT_TRUE(DoRunLoopWithTimeout()); // RunLoop should be quit by OnEmbed(). | 70 ASSERT_TRUE(DoRunLoopWithTimeout()); // RunLoop should be quit by OnEmbed(). |
| 71 std::swap(window_manager_, most_recent_connection_); | 71 std::swap(window_manager_, most_recent_connection_); |
| 72 } | 72 } |
| 73 | 73 |
| 74 mojo::ApplicationDelegate* WindowServerTestBase::GetApplicationDelegate() { | 74 mojo::ShellClient* WindowServerTestBase::GetShellClient() { |
| 75 return this; | 75 return this; |
| 76 } | 76 } |
| 77 | 77 |
| 78 bool WindowServerTestBase::AcceptConnection( | 78 bool WindowServerTestBase::AcceptConnection(mojo::Connection* connection) { |
| 79 mojo::ApplicationConnection* connection) { | |
| 80 connection->AddService<mojom::WindowTreeClient>(this); | 79 connection->AddService<mojom::WindowTreeClient>(this); |
| 81 return true; | 80 return true; |
| 82 } | 81 } |
| 83 | 82 |
| 84 void WindowServerTestBase::OnEmbed(Window* root) { | 83 void WindowServerTestBase::OnEmbed(Window* root) { |
| 85 most_recent_connection_ = root->connection(); | 84 most_recent_connection_ = root->connection(); |
| 86 EXPECT_TRUE(QuitRunLoop()); | 85 EXPECT_TRUE(QuitRunLoop()); |
| 87 ASSERT_TRUE(window_manager_client_); | 86 ASSERT_TRUE(window_manager_client_); |
| 88 window_manager_client_->AddActivationParent(root); | 87 window_manager_client_->AddActivationParent(root); |
| 89 } | 88 } |
| (...skipping 27 matching lines...) Expand all Loading... |
| 117 ? window_manager_delegate_->OnWmCreateTopLevelWindow(properties) | 116 ? window_manager_delegate_->OnWmCreateTopLevelWindow(properties) |
| 118 : nullptr; | 117 : nullptr; |
| 119 } | 118 } |
| 120 | 119 |
| 121 void WindowServerTestBase::OnAccelerator(uint32_t id, mojom::EventPtr event) { | 120 void WindowServerTestBase::OnAccelerator(uint32_t id, mojom::EventPtr event) { |
| 122 if (window_manager_delegate_) | 121 if (window_manager_delegate_) |
| 123 window_manager_delegate_->OnAccelerator(id, std::move(event)); | 122 window_manager_delegate_->OnAccelerator(id, std::move(event)); |
| 124 } | 123 } |
| 125 | 124 |
| 126 void WindowServerTestBase::Create( | 125 void WindowServerTestBase::Create( |
| 127 mojo::ApplicationConnection* connection, | 126 mojo::Connection* connection, |
| 128 mojo::InterfaceRequest<mojom::WindowTreeClient> request) { | 127 mojo::InterfaceRequest<mojom::WindowTreeClient> request) { |
| 129 WindowTreeConnection::Create( | 128 WindowTreeConnection::Create( |
| 130 this, std::move(request), | 129 this, std::move(request), |
| 131 WindowTreeConnection::CreateType::DONT_WAIT_FOR_EMBED); | 130 WindowTreeConnection::CreateType::DONT_WAIT_FOR_EMBED); |
| 132 } | 131 } |
| 133 | 132 |
| 134 } // namespace mus | 133 } // namespace mus |
| OLD | NEW |