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/location.h" |
9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
| 10 #include "base/single_thread_task_runner.h" |
10 #include "base/test/test_timeouts.h" | 11 #include "base/test/test_timeouts.h" |
| 12 #include "base/threading/thread_task_runner_handle.h" |
11 #include "components/mus/public/cpp/window.h" | 13 #include "components/mus/public/cpp/window.h" |
12 #include "components/mus/public/cpp/window_tree_client.h" | 14 #include "components/mus/public/cpp/window_tree_client.h" |
13 #include "components/mus/public/cpp/window_tree_host_factory.h" | 15 #include "components/mus/public/cpp/window_tree_host_factory.h" |
14 #include "services/shell/public/cpp/connector.h" | 16 #include "services/shell/public/cpp/connector.h" |
15 | 17 |
16 namespace mus { | 18 namespace mus { |
17 namespace { | 19 namespace { |
18 | 20 |
19 base::RunLoop* current_run_loop = nullptr; | 21 base::RunLoop* current_run_loop = nullptr; |
20 | 22 |
(...skipping 14 matching lines...) Expand all Loading... |
35 | 37 |
36 WindowServerTestBase::~WindowServerTestBase() {} | 38 WindowServerTestBase::~WindowServerTestBase() {} |
37 | 39 |
38 // static | 40 // static |
39 bool WindowServerTestBase::DoRunLoopWithTimeout() { | 41 bool WindowServerTestBase::DoRunLoopWithTimeout() { |
40 if (current_run_loop != nullptr) | 42 if (current_run_loop != nullptr) |
41 return false; | 43 return false; |
42 | 44 |
43 bool timeout = false; | 45 bool timeout = false; |
44 base::RunLoop run_loop; | 46 base::RunLoop run_loop; |
45 base::MessageLoop::current()->PostDelayedTask( | 47 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( |
46 FROM_HERE, base::Bind(&TimeoutRunLoop, run_loop.QuitClosure(), &timeout), | 48 FROM_HERE, base::Bind(&TimeoutRunLoop, run_loop.QuitClosure(), &timeout), |
47 TestTimeouts::action_timeout()); | 49 TestTimeouts::action_timeout()); |
48 | 50 |
49 current_run_loop = &run_loop; | 51 current_run_loop = &run_loop; |
50 current_run_loop->Run(); | 52 current_run_loop->Run(); |
51 current_run_loop = nullptr; | 53 current_run_loop = nullptr; |
52 return !timeout; | 54 return !timeout; |
53 } | 55 } |
54 | 56 |
55 // static | 57 // static |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 if (window_manager_delegate_) | 130 if (window_manager_delegate_) |
129 window_manager_delegate_->OnAccelerator(id, event); | 131 window_manager_delegate_->OnAccelerator(id, event); |
130 } | 132 } |
131 | 133 |
132 void WindowServerTestBase::Create(shell::Connection* connection, | 134 void WindowServerTestBase::Create(shell::Connection* connection, |
133 mojom::WindowTreeClientRequest request) { | 135 mojom::WindowTreeClientRequest request) { |
134 new WindowTreeClient(this, nullptr, std::move(request)); | 136 new WindowTreeClient(this, nullptr, std::move(request)); |
135 } | 137 } |
136 | 138 |
137 } // namespace mus | 139 } // namespace mus |
OLD | NEW |