Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(373)

Side by Side Diff: components/mus/ws/window_manager_client_apptest.cc

Issue 1527183003: Change mojo enums to be scoped enums in the generated C++ bindings. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@mojo-binding-equals
Patch Set: rebase Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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
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
OLDNEW
« no previous file with comments | « components/mus/ws/window_manager_access_policy.cc ('k') | components/mus/ws/window_tree_apptest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698