| 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 712 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 723 | 723 |
| 724 TEST_F(WindowServerTest, OnWindowHierarchyChangedIncludesTransientParent) { | 724 TEST_F(WindowServerTest, OnWindowHierarchyChangedIncludesTransientParent) { |
| 725 // Create a second connection. In the second connection create a window, | 725 // Create a second connection. In the second connection create a window, |
| 726 // parent it to the root, create another window, mark it as a transient parent | 726 // parent it to the root, create another window, mark it as a transient parent |
| 727 // of the first window and then add it. | 727 // of the first window and then add it. |
| 728 EstablishConnectionViaFactoryDelegate delegate(window_manager()); | 728 EstablishConnectionViaFactoryDelegate delegate(window_manager()); |
| 729 set_window_manager_delegate(&delegate); | 729 set_window_manager_delegate(&delegate); |
| 730 aura::WindowTreeClient second_client(connector(), this); | 730 aura::WindowTreeClient second_client(connector(), this); |
| 731 second_client.ConnectViaWindowTreeFactory(); | 731 second_client.ConnectViaWindowTreeFactory(); |
| 732 aura::WindowTreeHostMus window_tree_host_in_second_client(&second_client); | 732 aura::WindowTreeHostMus window_tree_host_in_second_client(&second_client); |
| 733 window_tree_host_in_second_client.InitHost(); |
| 733 aura::Window* second_client_child = NewVisibleWindow( | 734 aura::Window* second_client_child = NewVisibleWindow( |
| 734 window_tree_host_in_second_client.window(), &second_client); | 735 window_tree_host_in_second_client.window(), &second_client); |
| 735 std::unique_ptr<aura::WindowPortMus> window_port_mus = | 736 std::unique_ptr<aura::WindowPortMus> window_port_mus = |
| 736 base::MakeUnique<aura::WindowPortMus>(&second_client, | 737 base::MakeUnique<aura::WindowPortMus>(&second_client, |
| 737 aura::WindowMusType::LOCAL); | 738 aura::WindowMusType::LOCAL); |
| 738 // Create the transient without a parent, set transient parent, then add. | 739 // Create the transient without a parent, set transient parent, then add. |
| 739 aura::Window* transient = NewVisibleWindow(nullptr, &second_client); | 740 aura::Window* transient = NewVisibleWindow(nullptr, &second_client); |
| 740 aura::client::TransientWindowClient* transient_window_client = | 741 aura::client::TransientWindowClient* transient_window_client = |
| 741 aura::client::GetTransientWindowClient(); | 742 aura::client::GetTransientWindowClient(); |
| 742 transient_window_client->AddTransientChild(second_client_child, transient); | 743 transient_window_client->AddTransientChild(second_client_child, transient); |
| 743 second_client_child->AddChild(transient); | 744 second_client_child->AddChild(transient); |
| 744 | 745 |
| 745 // Wait for the top-level to appear in the window manager. | 746 // Wait for the top-level to appear in the window manager. |
| 746 ASSERT_TRUE(delegate.QuitOnCreate()); | 747 ASSERT_TRUE(delegate.QuitOnCreate()); |
| 747 aura::Window* top_level_in_wm = delegate.created_window(); | 748 aura::Window* top_level_in_wm = delegate.created_window(); |
| 748 | 749 |
| 749 // Makes sure the window manager sees the same structure and the transient | 750 // Makes sure the window manager sees the same structure and the transient |
| 750 // parent is connected correctly. | 751 // parent is connected correctly. |
| 751 ASSERT_TRUE(WaitForTreeSizeToMatch(top_level_in_wm, 3u)); | 752 ASSERT_TRUE(WaitForTreeSizeToMatch(top_level_in_wm, 3u)); |
| 752 ASSERT_EQ(1u, top_level_in_wm->children().size()); | 753 ASSERT_EQ(1u, top_level_in_wm->children().size()); |
| 753 aura::Window* second_client_child_in_wm = top_level_in_wm->children()[0]; | 754 aura::Window* second_client_child_in_wm = top_level_in_wm->children()[0]; |
| 754 ASSERT_EQ(1u, second_client_child_in_wm->children().size()); | 755 ASSERT_EQ(1u, second_client_child_in_wm->children().size()); |
| 755 aura::Window* transient_in_wm = second_client_child_in_wm->children()[0]; | 756 aura::Window* transient_in_wm = second_client_child_in_wm->children()[0]; |
| 756 ASSERT_EQ(second_client_child_in_wm, | 757 ASSERT_EQ(second_client_child_in_wm, |
| 757 transient_window_client->GetTransientParent(transient_in_wm)); | 758 transient_window_client->GetTransientParent(transient_in_wm)); |
| 758 } | 759 } |
| 759 | 760 |
| 760 } // namespace ws | 761 } // namespace ws |
| 761 } // namespace ui | 762 } // namespace ui |
| OLD | NEW |