| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 <stddef.h> | 5 #include <stddef.h> |
| 6 #include <stdint.h> | 6 #include <stdint.h> |
| 7 | 7 |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 | 165 |
| 166 // Runs a nested MessageLoop until OnEmbed() has been encountered. | 166 // Runs a nested MessageLoop until OnEmbed() has been encountered. |
| 167 void WaitForOnEmbed() { | 167 void WaitForOnEmbed() { |
| 168 if (tree_) | 168 if (tree_) |
| 169 return; | 169 return; |
| 170 embed_run_loop_.reset(new base::RunLoop); | 170 embed_run_loop_.reset(new base::RunLoop); |
| 171 embed_run_loop_->Run(); | 171 embed_run_loop_->Run(); |
| 172 embed_run_loop_.reset(); | 172 embed_run_loop_.reset(); |
| 173 } | 173 } |
| 174 | 174 |
| 175 bool WaitForIncomingMethodCall() { | |
| 176 return binding_.WaitForIncomingMethodCall(); | |
| 177 } | |
| 178 | |
| 179 bool WaitForChangeCompleted(uint32_t id) { | 175 bool WaitForChangeCompleted(uint32_t id) { |
| 180 waiting_change_id_ = id; | 176 waiting_change_id_ = id; |
| 181 change_completed_run_loop_.reset(new base::RunLoop); | 177 change_completed_run_loop_.reset(new base::RunLoop); |
| 182 change_completed_run_loop_->Run(); | 178 change_completed_run_loop_->Run(); |
| 183 return on_change_completed_result_; | 179 return on_change_completed_result_; |
| 184 } | 180 } |
| 185 | 181 |
| 186 bool DeleteWindow(Id id) { | 182 bool DeleteWindow(Id id) { |
| 187 const uint32_t change_id = GetAndAdvanceChangeId(); | 183 const uint32_t change_id = GetAndAdvanceChangeId(); |
| 188 tree()->DeleteWindow(change_id, id); | 184 tree()->DeleteWindow(change_id, id); |
| (...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 578 connector()->ConnectToInterface("mojo:mus", &factory); | 574 connector()->ConnectToInterface("mojo:mus", &factory); |
| 579 | 575 |
| 580 mojom::WindowTreeClientPtr tree_client_ptr; | 576 mojom::WindowTreeClientPtr tree_client_ptr; |
| 581 wt_client1_.reset(new TestWindowTreeClientImpl()); | 577 wt_client1_.reset(new TestWindowTreeClientImpl()); |
| 582 wt_client1_->Bind(GetProxy(&tree_client_ptr)); | 578 wt_client1_->Bind(GetProxy(&tree_client_ptr)); |
| 583 | 579 |
| 584 factory->CreateWindowTreeHost(GetProxy(&host_), | 580 factory->CreateWindowTreeHost(GetProxy(&host_), |
| 585 std::move(tree_client_ptr)); | 581 std::move(tree_client_ptr)); |
| 586 | 582 |
| 587 // Next we should get an embed call on the "window manager" client. | 583 // Next we should get an embed call on the "window manager" client. |
| 588 wt_client1_->WaitForIncomingMethodCall(); | 584 wt_client1_->WaitForOnEmbed(); |
| 589 | 585 |
| 590 ASSERT_EQ(1u, changes1()->size()); | 586 ASSERT_EQ(1u, changes1()->size()); |
| 591 EXPECT_EQ(CHANGE_TYPE_EMBED, (*changes1())[0].type); | 587 EXPECT_EQ(CHANGE_TYPE_EMBED, (*changes1())[0].type); |
| 592 // All these tests assume 1 for the client id. The only real assertion here | 588 // All these tests assume 1 for the client id. The only real assertion here |
| 593 // is the client id is not zero, but adding this as rest of code here | 589 // is the client id is not zero, but adding this as rest of code here |
| 594 // assumes 1. | 590 // assumes 1. |
| 595 ASSERT_GT((*changes1())[0].connection_id, 0); | 591 ASSERT_GT((*changes1())[0].connection_id, 0); |
| 596 connection_id_1_ = (*changes1())[0].connection_id; | 592 connection_id_1_ = (*changes1())[0].connection_id; |
| 597 ASSERT_FALSE((*changes1())[0].windows.empty()); | 593 ASSERT_FALSE((*changes1())[0].windows.empty()); |
| 598 root_window_id_ = (*changes1())[0].windows[0].window_id; | 594 root_window_id_ = (*changes1())[0].windows[0].window_id; |
| (...skipping 1320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1919 | 1915 |
| 1920 // TODO(sky): make sure coverage of what was | 1916 // TODO(sky): make sure coverage of what was |
| 1921 // WindowManagerTest.SecondEmbedRoot_InitService and | 1917 // WindowManagerTest.SecondEmbedRoot_InitService and |
| 1922 // WindowManagerTest.MultipleEmbedRootsBeforeWTHReady gets added to window | 1918 // WindowManagerTest.MultipleEmbedRootsBeforeWTHReady gets added to window |
| 1923 // manager | 1919 // manager |
| 1924 // tests. | 1920 // tests. |
| 1925 | 1921 |
| 1926 } // namespace test | 1922 } // namespace test |
| 1927 } // namespace ws | 1923 } // namespace ws |
| 1928 } // namespace mus | 1924 } // namespace mus |
| OLD | NEW |