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

Side by Side Diff: components/view_manager/view_manager_client_apptest.cc

Issue 1317713006: Changes around how embed roots are set (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: merge to trunk Created 5 years, 3 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
« no previous file with comments | « components/view_manager/server_view.cc ('k') | components/view_manager/view_tree_apptest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "base/logging.h" 5 #include "base/logging.h"
6 #include "components/view_manager/public/cpp/tests/view_manager_test_base.h" 6 #include "components/view_manager/public/cpp/tests/view_manager_test_base.h"
7 #include "components/view_manager/public/cpp/view_observer.h" 7 #include "components/view_manager/public/cpp/view_observer.h"
8 #include "components/view_manager/public/cpp/view_tree_connection.h" 8 #include "components/view_manager/public/cpp/view_tree_connection.h"
9 #include "components/view_manager/public/cpp/view_tree_delegate.h" 9 #include "components/view_manager/public/cpp/view_tree_delegate.h"
10 #include "mojo/application/public/cpp/application_connection.h" 10 #include "mojo/application/public/cpp/application_connection.h"
(...skipping 674 matching lines...) Expand 10 before | Expand all | Expand 10 after
685 EXPECT_TRUE(DoRunLoopWithTimeout()); 685 EXPECT_TRUE(DoRunLoopWithTimeout());
686 EXPECT_TRUE(got_destroy); 686 EXPECT_TRUE(got_destroy);
687 } 687 }
688 688
689 // Verifies an embed root sees views created beneath it from another 689 // Verifies an embed root sees views created beneath it from another
690 // connection. 690 // connection.
691 TEST_F(ViewManagerTest, EmbedRootSeesHierarchyChanged) { 691 TEST_F(ViewManagerTest, EmbedRootSeesHierarchyChanged) {
692 View* embed_view = window_manager()->CreateView(); 692 View* embed_view = window_manager()->CreateView();
693 window_manager()->GetRoot()->AddChild(embed_view); 693 window_manager()->GetRoot()->AddChild(embed_view);
694 694
695 embed_view->SetAccessPolicy(ViewTree::ACCESS_POLICY_EMBED_ROOT);
695 ViewTreeConnection* vm2 = Embed(embed_view); 696 ViewTreeConnection* vm2 = Embed(embed_view);
696 vm2->SetEmbedRoot();
697 View* vm2_v1 = vm2->CreateView(); 697 View* vm2_v1 = vm2->CreateView();
698 vm2->GetRoot()->AddChild(vm2_v1); 698 vm2->GetRoot()->AddChild(vm2_v1);
699 699
700 ViewTreeConnection* vm3 = Embed(vm2_v1); 700 ViewTreeConnection* vm3 = Embed(vm2_v1);
701 View* vm3_v1 = vm3->CreateView(); 701 View* vm3_v1 = vm3->CreateView();
702 vm3->GetRoot()->AddChild(vm3_v1); 702 vm3->GetRoot()->AddChild(vm3_v1);
703 703
704 // As |vm2| is an embed root it should get notified about |vm3_v1|. 704 // As |vm2| is an embed root it should get notified about |vm3_v1|.
705 ASSERT_TRUE(WaitForTreeSizeToMatch(vm2_v1, 2)); 705 ASSERT_TRUE(WaitForTreeSizeToMatch(vm2_v1, 2));
706 } 706 }
707 707
708 TEST_F(ViewManagerTest, EmbedFromEmbedRoot) { 708 TEST_F(ViewManagerTest, EmbedFromEmbedRoot) {
709 View* embed_view = window_manager()->CreateView(); 709 View* embed_view = window_manager()->CreateView();
710 window_manager()->GetRoot()->AddChild(embed_view); 710 window_manager()->GetRoot()->AddChild(embed_view);
711 711
712 embed_view->SetAccessPolicy(ViewTree::ACCESS_POLICY_EMBED_ROOT);
712 ViewTreeConnection* vm2 = Embed(embed_view); 713 ViewTreeConnection* vm2 = Embed(embed_view);
713 vm2->SetEmbedRoot();
714 View* vm2_v1 = vm2->CreateView(); 714 View* vm2_v1 = vm2->CreateView();
715 vm2->GetRoot()->AddChild(vm2_v1); 715 vm2->GetRoot()->AddChild(vm2_v1);
716 716
717 ViewTreeConnection* vm3 = Embed(vm2_v1); 717 ViewTreeConnection* vm3 = Embed(vm2_v1);
718 View* vm3_v1 = vm3->CreateView(); 718 View* vm3_v1 = vm3->CreateView();
719 vm3->GetRoot()->AddChild(vm3_v1); 719 vm3->GetRoot()->AddChild(vm3_v1);
720 720
721 // As |vm2| is an embed root it should get notified about |vm3_v1|. 721 // As |vm2| is an embed root it should get notified about |vm3_v1|.
722 ASSERT_TRUE(WaitForTreeSizeToMatch(vm2_v1, 2)); 722 ASSERT_TRUE(WaitForTreeSizeToMatch(vm2_v1, 2));
723 723
724 // Embed() from vm2 in vm3_v1. This is allowed as vm2 is an embed root. 724 // Embed() from vm2 in vm3_v1. This is allowed as vm2 is an embed root.
725 ASSERT_EQ(1u, vm2_v1->children().size()); 725 ASSERT_EQ(1u, vm2_v1->children().size());
726 View* vm3_v1_in_vm2 = vm2_v1->children()[0]; 726 View* vm3_v1_in_vm2 = vm2_v1->children()[0];
727 ASSERT_TRUE(Embed(vm3_v1_in_vm2)); 727 ASSERT_TRUE(Embed(vm3_v1_in_vm2));
728 } 728 }
729 729
730 } // namespace mojo 730 } // namespace mojo
OLDNEW
« no previous file with comments | « components/view_manager/server_view.cc ('k') | components/view_manager/view_tree_apptest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698