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 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
268 const EmbedResult result(embed_details_->connection, | 268 const EmbedResult result(embed_details_->connection, |
269 embed_details_->connection_id); | 269 embed_details_->connection_id); |
270 embed_details_.reset(); | 270 embed_details_.reset(); |
271 return result; | 271 return result; |
272 } | 272 } |
273 | 273 |
274 // Establishes a connection to this application and asks for a | 274 // Establishes a connection to this application and asks for a |
275 // WindowTreeClient. | 275 // WindowTreeClient. |
276 mus::mojom::WindowTreeClientPtr ConnectAndGetWindowServerClient() { | 276 mus::mojom::WindowTreeClientPtr ConnectAndGetWindowServerClient() { |
277 mus::mojom::WindowTreeClientPtr client; | 277 mus::mojom::WindowTreeClientPtr client; |
278 shell()->ConnectToInterface(shell_url(), &client); | 278 connector()->ConnectToInterface(test_url(), &client); |
279 return client; | 279 return client; |
280 } | 280 } |
281 | 281 |
282 // WindowServerTestBase: | 282 // WindowServerTestBase: |
283 void OnEmbed(Window* root) override { | 283 void OnEmbed(Window* root) override { |
284 if (!embed_details_) { | 284 if (!embed_details_) { |
285 WindowServerTestBase::OnEmbed(root); | 285 WindowServerTestBase::OnEmbed(root); |
286 return; | 286 return; |
287 } | 287 } |
288 | 288 |
(...skipping 863 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1152 scoped_ptr<base::RunLoop> run_loop_; | 1152 scoped_ptr<base::RunLoop> run_loop_; |
1153 Window* created_window_; | 1153 Window* created_window_; |
1154 | 1154 |
1155 DISALLOW_COPY_AND_ASSIGN(EstablishConnectionViaFactoryDelegate); | 1155 DISALLOW_COPY_AND_ASSIGN(EstablishConnectionViaFactoryDelegate); |
1156 }; | 1156 }; |
1157 | 1157 |
1158 TEST_F(WindowServerTest, EstablishConnectionViaFactory) { | 1158 TEST_F(WindowServerTest, EstablishConnectionViaFactory) { |
1159 EstablishConnectionViaFactoryDelegate delegate(window_manager()); | 1159 EstablishConnectionViaFactoryDelegate delegate(window_manager()); |
1160 set_window_manager_delegate(&delegate); | 1160 set_window_manager_delegate(&delegate); |
1161 scoped_ptr<WindowTreeConnection> second_connection( | 1161 scoped_ptr<WindowTreeConnection> second_connection( |
1162 WindowTreeConnection::Create(this, shell())); | 1162 WindowTreeConnection::Create(this, connector())); |
1163 Window* window_in_second_connection = | 1163 Window* window_in_second_connection = |
1164 second_connection->NewTopLevelWindow(nullptr); | 1164 second_connection->NewTopLevelWindow(nullptr); |
1165 ASSERT_TRUE(window_in_second_connection); | 1165 ASSERT_TRUE(window_in_second_connection); |
1166 ASSERT_TRUE(second_connection->GetRoots().count(window_in_second_connection) > | 1166 ASSERT_TRUE(second_connection->GetRoots().count(window_in_second_connection) > |
1167 0); | 1167 0); |
1168 // Wait for the window to appear in the wm. | 1168 // Wait for the window to appear in the wm. |
1169 ASSERT_TRUE(delegate.QuitOnCreate()); | 1169 ASSERT_TRUE(delegate.QuitOnCreate()); |
1170 | 1170 |
1171 Window* window_in_wm = delegate.created_window(); | 1171 Window* window_in_wm = delegate.created_window(); |
1172 ASSERT_TRUE(window_in_wm); | 1172 ASSERT_TRUE(window_in_wm); |
1173 | 1173 |
1174 // Change the bounds in the wm, and make sure the child sees it. | 1174 // Change the bounds in the wm, and make sure the child sees it. |
1175 window_in_wm->SetBounds(gfx::Rect(1, 11, 12, 101)); | 1175 window_in_wm->SetBounds(gfx::Rect(1, 11, 12, 101)); |
1176 ASSERT_TRUE(WaitForBoundsToChange(window_in_second_connection)); | 1176 ASSERT_TRUE(WaitForBoundsToChange(window_in_second_connection)); |
1177 EXPECT_EQ(gfx::Rect(1, 11, 12, 101), window_in_second_connection->bounds()); | 1177 EXPECT_EQ(gfx::Rect(1, 11, 12, 101), window_in_second_connection->bounds()); |
1178 } | 1178 } |
1179 | 1179 |
1180 } // namespace ws | 1180 } // namespace ws |
1181 } // namespace mus | 1181 } // namespace mus |
OLD | NEW |