| 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 686 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 697 aura::WindowTreeClient* client_; | 697 aura::WindowTreeClient* client_; |
| 698 std::unique_ptr<base::RunLoop> run_loop_; | 698 std::unique_ptr<base::RunLoop> run_loop_; |
| 699 aura::Window* created_window_; | 699 aura::Window* created_window_; |
| 700 | 700 |
| 701 DISALLOW_COPY_AND_ASSIGN(EstablishConnectionViaFactoryDelegate); | 701 DISALLOW_COPY_AND_ASSIGN(EstablishConnectionViaFactoryDelegate); |
| 702 }; | 702 }; |
| 703 | 703 |
| 704 TEST_F(WindowServerTest, EstablishConnectionViaFactory) { | 704 TEST_F(WindowServerTest, EstablishConnectionViaFactory) { |
| 705 EstablishConnectionViaFactoryDelegate delegate(window_manager()); | 705 EstablishConnectionViaFactoryDelegate delegate(window_manager()); |
| 706 set_window_manager_delegate(&delegate); | 706 set_window_manager_delegate(&delegate); |
| 707 aura::WindowTreeClient second_client(connector(), this); | 707 aura::WindowTreeClient second_client(connector(), nullptr, this); |
| 708 second_client.ConnectViaWindowTreeFactory(); | 708 second_client.ConnectViaWindowTreeFactory(); |
| 709 aura::WindowTreeHostMus window_tree_host_in_second_client(&second_client); | 709 aura::WindowTreeHostMus window_tree_host_in_second_client(&second_client); |
| 710 window_tree_host_in_second_client.InitHost(); | 710 window_tree_host_in_second_client.InitHost(); |
| 711 window_tree_host_in_second_client.window()->Show(); | 711 window_tree_host_in_second_client.window()->Show(); |
| 712 ASSERT_TRUE(second_client.GetRoots().count( | 712 ASSERT_TRUE(second_client.GetRoots().count( |
| 713 window_tree_host_in_second_client.window()) > 0); | 713 window_tree_host_in_second_client.window()) > 0); |
| 714 // Wait for the window to appear in the wm. | 714 // Wait for the window to appear in the wm. |
| 715 ASSERT_TRUE(delegate.QuitOnCreate()); | 715 ASSERT_TRUE(delegate.QuitOnCreate()); |
| 716 | 716 |
| 717 aura::Window* window_in_wm = delegate.created_window(); | 717 aura::Window* window_in_wm = delegate.created_window(); |
| 718 ASSERT_TRUE(window_in_wm); | 718 ASSERT_TRUE(window_in_wm); |
| 719 | 719 |
| 720 // Change the bounds in the wm, and make sure the child sees it. | 720 // Change the bounds in the wm, and make sure the child sees it. |
| 721 const gfx::Rect window_bounds(1, 11, 12, 101); | 721 const gfx::Rect window_bounds(1, 11, 12, 101); |
| 722 window_in_wm->SetBounds(window_bounds); | 722 window_in_wm->SetBounds(window_bounds); |
| 723 ASSERT_TRUE( | 723 ASSERT_TRUE( |
| 724 WaitForBoundsToChange(window_tree_host_in_second_client.window())); | 724 WaitForBoundsToChange(window_tree_host_in_second_client.window())); |
| 725 EXPECT_EQ(window_bounds, | 725 EXPECT_EQ(window_bounds, |
| 726 window_tree_host_in_second_client.GetBoundsInPixels()); | 726 window_tree_host_in_second_client.GetBoundsInPixels()); |
| 727 } | 727 } |
| 728 | 728 |
| 729 TEST_F(WindowServerTest, OnWindowHierarchyChangedIncludesTransientParent) { | 729 TEST_F(WindowServerTest, OnWindowHierarchyChangedIncludesTransientParent) { |
| 730 // Create a second connection. In the second connection create a window, | 730 // Create a second connection. In the second connection create a window, |
| 731 // parent it to the root, create another window, mark it as a transient parent | 731 // parent it to the root, create another window, mark it as a transient parent |
| 732 // of the first window and then add it. | 732 // of the first window and then add it. |
| 733 EstablishConnectionViaFactoryDelegate delegate(window_manager()); | 733 EstablishConnectionViaFactoryDelegate delegate(window_manager()); |
| 734 set_window_manager_delegate(&delegate); | 734 set_window_manager_delegate(&delegate); |
| 735 aura::WindowTreeClient second_client(connector(), this); | 735 aura::WindowTreeClient second_client(connector(), nullptr, this); |
| 736 second_client.ConnectViaWindowTreeFactory(); | 736 second_client.ConnectViaWindowTreeFactory(); |
| 737 aura::WindowTreeHostMus window_tree_host_in_second_client(&second_client); | 737 aura::WindowTreeHostMus window_tree_host_in_second_client(&second_client); |
| 738 window_tree_host_in_second_client.InitHost(); | 738 window_tree_host_in_second_client.InitHost(); |
| 739 window_tree_host_in_second_client.window()->Show(); | 739 window_tree_host_in_second_client.window()->Show(); |
| 740 aura::Window* second_client_child = NewVisibleWindow( | 740 aura::Window* second_client_child = NewVisibleWindow( |
| 741 window_tree_host_in_second_client.window(), &second_client); | 741 window_tree_host_in_second_client.window(), &second_client); |
| 742 std::unique_ptr<aura::WindowPortMus> window_port_mus = | 742 std::unique_ptr<aura::WindowPortMus> window_port_mus = |
| 743 base::MakeUnique<aura::WindowPortMus>(&second_client, | 743 base::MakeUnique<aura::WindowPortMus>(&second_client, |
| 744 aura::WindowMusType::LOCAL); | 744 aura::WindowMusType::LOCAL); |
| 745 // Create the transient without a parent, set transient parent, then add. | 745 // Create the transient without a parent, set transient parent, then add. |
| (...skipping 13 matching lines...) Expand all Loading... |
| 759 ASSERT_EQ(1u, top_level_in_wm->children().size()); | 759 ASSERT_EQ(1u, top_level_in_wm->children().size()); |
| 760 aura::Window* second_client_child_in_wm = top_level_in_wm->children()[0]; | 760 aura::Window* second_client_child_in_wm = top_level_in_wm->children()[0]; |
| 761 ASSERT_EQ(1u, second_client_child_in_wm->children().size()); | 761 ASSERT_EQ(1u, second_client_child_in_wm->children().size()); |
| 762 aura::Window* transient_in_wm = second_client_child_in_wm->children()[0]; | 762 aura::Window* transient_in_wm = second_client_child_in_wm->children()[0]; |
| 763 ASSERT_EQ(second_client_child_in_wm, | 763 ASSERT_EQ(second_client_child_in_wm, |
| 764 transient_window_client->GetTransientParent(transient_in_wm)); | 764 transient_window_client->GetTransientParent(transient_in_wm)); |
| 765 } | 765 } |
| 766 | 766 |
| 767 } // namespace ws | 767 } // namespace ws |
| 768 } // namespace ui | 768 } // namespace ui |
| OLD | NEW |