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 696 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
707 | 707 |
708 DISALLOW_COPY_AND_ASSIGN(EstablishConnectionViaFactoryDelegate); | 708 DISALLOW_COPY_AND_ASSIGN(EstablishConnectionViaFactoryDelegate); |
709 }; | 709 }; |
710 | 710 |
711 TEST_F(WindowServerTest, EstablishConnectionViaFactory) { | 711 TEST_F(WindowServerTest, EstablishConnectionViaFactory) { |
712 EstablishConnectionViaFactoryDelegate delegate(window_manager()); | 712 EstablishConnectionViaFactoryDelegate delegate(window_manager()); |
713 set_window_manager_delegate(&delegate); | 713 set_window_manager_delegate(&delegate); |
714 aura::WindowTreeClient second_client(connector(), this, nullptr, nullptr, | 714 aura::WindowTreeClient second_client(connector(), this, nullptr, nullptr, |
715 nullptr, false); | 715 nullptr, false); |
716 second_client.ConnectViaWindowTreeFactory(); | 716 second_client.ConnectViaWindowTreeFactory(); |
717 aura::WindowTreeHostMus window_tree_host_in_second_client(&second_client); | 717 aura::WindowTreeHostMus window_tree_host_in_second_client( |
| 718 &second_client, cc::FrameSinkId(1, 1)); |
718 window_tree_host_in_second_client.InitHost(); | 719 window_tree_host_in_second_client.InitHost(); |
719 window_tree_host_in_second_client.window()->Show(); | 720 window_tree_host_in_second_client.window()->Show(); |
720 ASSERT_TRUE(second_client.GetRoots().count( | 721 ASSERT_TRUE(second_client.GetRoots().count( |
721 window_tree_host_in_second_client.window()) > 0); | 722 window_tree_host_in_second_client.window()) > 0); |
722 // Wait for the window to appear in the wm. | 723 // Wait for the window to appear in the wm. |
723 ASSERT_TRUE(delegate.QuitOnCreate()); | 724 ASSERT_TRUE(delegate.QuitOnCreate()); |
724 | 725 |
725 aura::Window* window_in_wm = delegate.created_window(); | 726 aura::Window* window_in_wm = delegate.created_window(); |
726 ASSERT_TRUE(window_in_wm); | 727 ASSERT_TRUE(window_in_wm); |
727 | 728 |
728 // Change the bounds in the wm, and make sure the child sees it. | 729 // Change the bounds in the wm, and make sure the child sees it. |
729 const gfx::Rect window_bounds(1, 11, 12, 101); | 730 const gfx::Rect window_bounds(1, 11, 12, 101); |
730 window_in_wm->SetBounds(window_bounds); | 731 window_in_wm->SetBounds(window_bounds); |
731 ASSERT_TRUE( | 732 ASSERT_TRUE( |
732 WaitForBoundsToChange(window_tree_host_in_second_client.window())); | 733 WaitForBoundsToChange(window_tree_host_in_second_client.window())); |
733 EXPECT_EQ(window_bounds, | 734 EXPECT_EQ(window_bounds, |
734 window_tree_host_in_second_client.GetBoundsInPixels()); | 735 window_tree_host_in_second_client.GetBoundsInPixels()); |
735 } | 736 } |
736 | 737 |
737 TEST_F(WindowServerTest, OnWindowHierarchyChangedIncludesTransientParent) { | 738 TEST_F(WindowServerTest, OnWindowHierarchyChangedIncludesTransientParent) { |
738 // Create a second connection. In the second connection create a window, | 739 // Create a second connection. In the second connection create a window, |
739 // parent it to the root, create another window, mark it as a transient parent | 740 // parent it to the root, create another window, mark it as a transient parent |
740 // of the first window and then add it. | 741 // of the first window and then add it. |
741 EstablishConnectionViaFactoryDelegate delegate(window_manager()); | 742 EstablishConnectionViaFactoryDelegate delegate(window_manager()); |
742 set_window_manager_delegate(&delegate); | 743 set_window_manager_delegate(&delegate); |
743 aura::WindowTreeClient second_client(connector(), this, nullptr, nullptr, | 744 aura::WindowTreeClient second_client(connector(), this, nullptr, nullptr, |
744 nullptr, false); | 745 nullptr, false); |
745 second_client.ConnectViaWindowTreeFactory(); | 746 second_client.ConnectViaWindowTreeFactory(); |
746 aura::WindowTreeHostMus window_tree_host_in_second_client(&second_client); | 747 aura::WindowTreeHostMus window_tree_host_in_second_client( |
| 748 &second_client, cc::FrameSinkId(1, 1)); |
747 window_tree_host_in_second_client.InitHost(); | 749 window_tree_host_in_second_client.InitHost(); |
748 window_tree_host_in_second_client.window()->Show(); | 750 window_tree_host_in_second_client.window()->Show(); |
749 aura::Window* second_client_child = NewVisibleWindow( | 751 aura::Window* second_client_child = NewVisibleWindow( |
750 window_tree_host_in_second_client.window(), &second_client); | 752 window_tree_host_in_second_client.window(), &second_client); |
751 std::unique_ptr<aura::WindowPortMus> window_port_mus = | 753 std::unique_ptr<aura::WindowPortMus> window_port_mus = |
752 base::MakeUnique<aura::WindowPortMus>(&second_client, | 754 base::MakeUnique<aura::WindowPortMus>(&second_client, |
753 aura::WindowMusType::LOCAL); | 755 aura::WindowMusType::LOCAL); |
754 // Create the transient without a parent, set transient parent, then add. | 756 // Create the transient without a parent, set transient parent, then add. |
755 aura::Window* transient = NewVisibleWindow(nullptr, &second_client); | 757 aura::Window* transient = NewVisibleWindow(nullptr, &second_client); |
756 aura::client::TransientWindowClient* transient_window_client = | 758 aura::client::TransientWindowClient* transient_window_client = |
(...skipping 11 matching lines...) Expand all Loading... |
768 ASSERT_EQ(1u, top_level_in_wm->children().size()); | 770 ASSERT_EQ(1u, top_level_in_wm->children().size()); |
769 aura::Window* second_client_child_in_wm = top_level_in_wm->children()[0]; | 771 aura::Window* second_client_child_in_wm = top_level_in_wm->children()[0]; |
770 ASSERT_EQ(1u, second_client_child_in_wm->children().size()); | 772 ASSERT_EQ(1u, second_client_child_in_wm->children().size()); |
771 aura::Window* transient_in_wm = second_client_child_in_wm->children()[0]; | 773 aura::Window* transient_in_wm = second_client_child_in_wm->children()[0]; |
772 ASSERT_EQ(second_client_child_in_wm, | 774 ASSERT_EQ(second_client_child_in_wm, |
773 transient_window_client->GetTransientParent(transient_in_wm)); | 775 transient_window_client->GetTransientParent(transient_in_wm)); |
774 } | 776 } |
775 | 777 |
776 } // namespace ws | 778 } // namespace ws |
777 } // namespace ui | 779 } // namespace ui |
OLD | NEW |