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/logging.h" | 9 #include "base/logging.h" |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
261 window->SetVisible(true); | 261 window->SetVisible(true); |
262 parent->AddChild(window); | 262 parent->AddChild(window); |
263 return window; | 263 return window; |
264 } | 264 } |
265 | 265 |
266 // Embeds another version of the test app @ window. This runs a run loop until | 266 // Embeds another version of the test app @ window. This runs a run loop until |
267 // a response is received, or a timeout. On success the new WindowServer is | 267 // a response is received, or a timeout. On success the new WindowServer is |
268 // returned. | 268 // returned. |
269 EmbedResult Embed(Window* window) { | 269 EmbedResult Embed(Window* window) { |
270 DCHECK(!embed_details_); | 270 DCHECK(!embed_details_); |
271 embed_details_.reset(new EmbedDetails); | 271 embed_details_ = base::MakeUnique<EmbedDetails>(); |
272 window->Embed(ConnectAndGetWindowServerClient(), | 272 window->Embed(ConnectAndGetWindowServerClient(), |
273 base::Bind(&WindowServerTest::EmbedCallbackImpl, | 273 base::Bind(&WindowServerTest::EmbedCallbackImpl, |
274 base::Unretained(this))); | 274 base::Unretained(this))); |
275 embed_details_->waiting = true; | 275 embed_details_->waiting = true; |
276 if (!WindowServerTestBase::DoRunLoopWithTimeout()) | 276 if (!WindowServerTestBase::DoRunLoopWithTimeout()) |
277 return EmbedResult(); | 277 return EmbedResult(); |
278 const EmbedResult result(embed_details_->client, | 278 const EmbedResult result(embed_details_->client, |
279 embed_details_->client_id); | 279 embed_details_->client_id); |
280 embed_details_.reset(); | 280 embed_details_.reset(); |
281 return result; | 281 return result; |
(...skipping 800 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1082 explicit EstablishConnectionViaFactoryDelegate( | 1082 explicit EstablishConnectionViaFactoryDelegate( |
1083 WindowTreeClient* client) | 1083 WindowTreeClient* client) |
1084 : client_(client), run_loop_(nullptr), created_window_(nullptr) {} | 1084 : client_(client), run_loop_(nullptr), created_window_(nullptr) {} |
1085 ~EstablishConnectionViaFactoryDelegate() override {} | 1085 ~EstablishConnectionViaFactoryDelegate() override {} |
1086 | 1086 |
1087 bool QuitOnCreate() { | 1087 bool QuitOnCreate() { |
1088 if (run_loop_) | 1088 if (run_loop_) |
1089 return false; | 1089 return false; |
1090 | 1090 |
1091 created_window_ = nullptr; | 1091 created_window_ = nullptr; |
1092 run_loop_.reset(new base::RunLoop); | 1092 run_loop_ = base::MakeUnique<base::RunLoop>(); |
1093 run_loop_->Run(); | 1093 run_loop_->Run(); |
1094 run_loop_.reset(); | 1094 run_loop_.reset(); |
1095 return created_window_ != nullptr; | 1095 return created_window_ != nullptr; |
1096 } | 1096 } |
1097 | 1097 |
1098 Window* created_window() { return created_window_; } | 1098 Window* created_window() { return created_window_; } |
1099 | 1099 |
1100 // WindowManagerDelegate: | 1100 // WindowManagerDelegate: |
1101 Window* OnWmCreateTopLevelWindow( | 1101 Window* OnWmCreateTopLevelWindow( |
1102 std::map<std::string, std::vector<uint8_t>>* properties) override { | 1102 std::map<std::string, std::vector<uint8_t>>* properties) override { |
(...skipping 27 matching lines...) Expand all Loading... |
1130 ASSERT_TRUE(window_in_wm); | 1130 ASSERT_TRUE(window_in_wm); |
1131 | 1131 |
1132 // Change the bounds in the wm, and make sure the child sees it. | 1132 // Change the bounds in the wm, and make sure the child sees it. |
1133 window_in_wm->SetBounds(gfx::Rect(1, 11, 12, 101)); | 1133 window_in_wm->SetBounds(gfx::Rect(1, 11, 12, 101)); |
1134 ASSERT_TRUE(WaitForBoundsToChange(window_in_second_client)); | 1134 ASSERT_TRUE(WaitForBoundsToChange(window_in_second_client)); |
1135 EXPECT_EQ(gfx::Rect(1, 11, 12, 101), window_in_second_client->bounds()); | 1135 EXPECT_EQ(gfx::Rect(1, 11, 12, 101), window_in_second_client->bounds()); |
1136 } | 1136 } |
1137 | 1137 |
1138 } // namespace ws | 1138 } // namespace ws |
1139 } // namespace ui | 1139 } // namespace ui |
OLD | NEW |