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 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 Window* window = connection->NewWindow(); | 222 Window* window = connection->NewWindow(); |
223 window->SetVisible(true); | 223 window->SetVisible(true); |
224 parent->AddChild(window); | 224 parent->AddChild(window); |
225 return window; | 225 return window; |
226 } | 226 } |
227 | 227 |
228 // Embeds another version of the test app @ window. This runs a run loop until | 228 // Embeds another version of the test app @ window. This runs a run loop until |
229 // a response is received, or a timeout. On success the new WindowServer is | 229 // a response is received, or a timeout. On success the new WindowServer is |
230 // returned. | 230 // returned. |
231 EmbedResult Embed(Window* window) { | 231 EmbedResult Embed(Window* window) { |
232 return Embed(window, mus::mojom::WindowTree::ACCESS_POLICY_DEFAULT); | 232 return Embed(window, mus::mojom::WindowTree::kAccessPolicyDefault); |
233 } | 233 } |
234 | 234 |
235 EmbedResult Embed(Window* window, uint32_t access_policy_bitmask) { | 235 EmbedResult Embed(Window* window, uint32_t access_policy_bitmask) { |
236 DCHECK(!embed_details_); | 236 DCHECK(!embed_details_); |
237 embed_details_.reset(new EmbedDetails); | 237 embed_details_.reset(new EmbedDetails); |
238 window->Embed(ConnectToApplicationAndGetWindowServerClient(), | 238 window->Embed(ConnectToApplicationAndGetWindowServerClient(), |
239 access_policy_bitmask, | 239 access_policy_bitmask, |
240 base::Bind(&WindowServerTest::EmbedCallbackImpl, | 240 base::Bind(&WindowServerTest::EmbedCallbackImpl, |
241 base::Unretained(this))); | 241 base::Unretained(this))); |
242 embed_details_->waiting = true; | 242 embed_details_->waiting = true; |
(...skipping 745 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
988 EXPECT_TRUE(got_destroy); | 988 EXPECT_TRUE(got_destroy); |
989 } | 989 } |
990 | 990 |
991 // Verifies an embed root sees windows created beneath it from another | 991 // Verifies an embed root sees windows created beneath it from another |
992 // connection. | 992 // connection. |
993 TEST_F(WindowServerTest, EmbedRootSeesHierarchyChanged) { | 993 TEST_F(WindowServerTest, EmbedRootSeesHierarchyChanged) { |
994 Window* embed_window = window_manager()->NewWindow(); | 994 Window* embed_window = window_manager()->NewWindow(); |
995 GetFirstWMRoot()->AddChild(embed_window); | 995 GetFirstWMRoot()->AddChild(embed_window); |
996 | 996 |
997 WindowTreeConnection* vm2 = | 997 WindowTreeConnection* vm2 = |
998 Embed(embed_window, mus::mojom::WindowTree::ACCESS_POLICY_EMBED_ROOT) | 998 Embed(embed_window, mus::mojom::WindowTree::kAccessPolicyEmbedRoot) |
999 .connection; | 999 .connection; |
1000 Window* vm2_v1 = vm2->NewWindow(); | 1000 Window* vm2_v1 = vm2->NewWindow(); |
1001 GetFirstRoot(vm2)->AddChild(vm2_v1); | 1001 GetFirstRoot(vm2)->AddChild(vm2_v1); |
1002 | 1002 |
1003 WindowTreeConnection* vm3 = Embed(vm2_v1).connection; | 1003 WindowTreeConnection* vm3 = Embed(vm2_v1).connection; |
1004 Window* vm3_v1 = vm3->NewWindow(); | 1004 Window* vm3_v1 = vm3->NewWindow(); |
1005 GetFirstRoot(vm3)->AddChild(vm3_v1); | 1005 GetFirstRoot(vm3)->AddChild(vm3_v1); |
1006 | 1006 |
1007 // As |vm2| is an embed root it should get notified about |vm3_v1|. | 1007 // As |vm2| is an embed root it should get notified about |vm3_v1|. |
1008 ASSERT_TRUE(WaitForTreeSizeToMatch(vm2_v1, 2)); | 1008 ASSERT_TRUE(WaitForTreeSizeToMatch(vm2_v1, 2)); |
1009 } | 1009 } |
1010 | 1010 |
1011 TEST_F(WindowServerTest, EmbedFromEmbedRoot) { | 1011 TEST_F(WindowServerTest, EmbedFromEmbedRoot) { |
1012 Window* embed_window = window_manager()->NewWindow(); | 1012 Window* embed_window = window_manager()->NewWindow(); |
1013 GetFirstWMRoot()->AddChild(embed_window); | 1013 GetFirstWMRoot()->AddChild(embed_window); |
1014 | 1014 |
1015 // Give the connection embedded at |embed_window| embed root powers. | 1015 // Give the connection embedded at |embed_window| embed root powers. |
1016 const EmbedResult result1 = | 1016 const EmbedResult result1 = |
1017 Embed(embed_window, mus::mojom::WindowTree::ACCESS_POLICY_EMBED_ROOT); | 1017 Embed(embed_window, mus::mojom::WindowTree::kAccessPolicyEmbedRoot); |
1018 WindowTreeConnection* vm2 = result1.connection; | 1018 WindowTreeConnection* vm2 = result1.connection; |
1019 EXPECT_EQ(result1.connection_id, vm2->GetConnectionId()); | 1019 EXPECT_EQ(result1.connection_id, vm2->GetConnectionId()); |
1020 Window* vm2_v1 = vm2->NewWindow(); | 1020 Window* vm2_v1 = vm2->NewWindow(); |
1021 GetFirstRoot(vm2)->AddChild(vm2_v1); | 1021 GetFirstRoot(vm2)->AddChild(vm2_v1); |
1022 | 1022 |
1023 const EmbedResult result2 = Embed(vm2_v1); | 1023 const EmbedResult result2 = Embed(vm2_v1); |
1024 WindowTreeConnection* vm3 = result2.connection; | 1024 WindowTreeConnection* vm3 = result2.connection; |
1025 EXPECT_EQ(result2.connection_id, vm3->GetConnectionId()); | 1025 EXPECT_EQ(result2.connection_id, vm3->GetConnectionId()); |
1026 Window* vm3_v1 = vm3->NewWindow(); | 1026 Window* vm3_v1 = vm3->NewWindow(); |
1027 GetFirstRoot(vm3)->AddChild(vm3_v1); | 1027 GetFirstRoot(vm3)->AddChild(vm3_v1); |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1059 embed_window->SetBounds(gfx::Rect(21, 22, 23, 24)); | 1059 embed_window->SetBounds(gfx::Rect(21, 22, 23, 24)); |
1060 WaitForBoundsToChange(GetFirstRoot(embedded_connection)); | 1060 WaitForBoundsToChange(GetFirstRoot(embedded_connection)); |
1061 EXPECT_TRUE(gfx::Rect(21, 22, 23, 24) == | 1061 EXPECT_TRUE(gfx::Rect(21, 22, 23, 24) == |
1062 GetFirstRoot(embedded_connection)->bounds()); | 1062 GetFirstRoot(embedded_connection)->bounds()); |
1063 EXPECT_TRUE(gfx::Insets(1, 2, 3, 4) == | 1063 EXPECT_TRUE(gfx::Insets(1, 2, 3, 4) == |
1064 GetFirstRoot(embedded_connection)->client_area()); | 1064 GetFirstRoot(embedded_connection)->client_area()); |
1065 } | 1065 } |
1066 | 1066 |
1067 } // namespace ws | 1067 } // namespace ws |
1068 } // namespace mus | 1068 } // namespace mus |
OLD | NEW |