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

Side by Side Diff: services/ui/ws/window_manager_client_unittest.cc

Issue 2567293004: Makes WindowTreeHost::InitHost() not Show the window (Closed)
Patch Set: WTF::Show shows window Created 4 years 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 686 matching lines...) Expand 10 before | Expand all | Expand 10 after
697 DISALLOW_COPY_AND_ASSIGN(EstablishConnectionViaFactoryDelegate); 697 DISALLOW_COPY_AND_ASSIGN(EstablishConnectionViaFactoryDelegate);
698 }; 698 };
699 699
700 TEST_F(WindowServerTest, EstablishConnectionViaFactory) { 700 TEST_F(WindowServerTest, EstablishConnectionViaFactory) {
701 EstablishConnectionViaFactoryDelegate delegate(window_manager()); 701 EstablishConnectionViaFactoryDelegate delegate(window_manager());
702 set_window_manager_delegate(&delegate); 702 set_window_manager_delegate(&delegate);
703 aura::WindowTreeClient second_client(connector(), this); 703 aura::WindowTreeClient second_client(connector(), this);
704 second_client.ConnectViaWindowTreeFactory(); 704 second_client.ConnectViaWindowTreeFactory();
705 aura::WindowTreeHostMus window_tree_host_in_second_client(&second_client); 705 aura::WindowTreeHostMus window_tree_host_in_second_client(&second_client);
706 window_tree_host_in_second_client.InitHost(); 706 window_tree_host_in_second_client.InitHost();
707 window_tree_host_in_second_client.window()->Show();
707 ASSERT_TRUE(second_client.GetRoots().count( 708 ASSERT_TRUE(second_client.GetRoots().count(
708 window_tree_host_in_second_client.window()) > 0); 709 window_tree_host_in_second_client.window()) > 0);
709 // Wait for the window to appear in the wm. 710 // Wait for the window to appear in the wm.
710 ASSERT_TRUE(delegate.QuitOnCreate()); 711 ASSERT_TRUE(delegate.QuitOnCreate());
711 712
712 aura::Window* window_in_wm = delegate.created_window(); 713 aura::Window* window_in_wm = delegate.created_window();
713 ASSERT_TRUE(window_in_wm); 714 ASSERT_TRUE(window_in_wm);
714 715
715 // Change the bounds in the wm, and make sure the child sees it. 716 // Change the bounds in the wm, and make sure the child sees it.
716 const gfx::Rect window_bounds(1, 11, 12, 101); 717 const gfx::Rect window_bounds(1, 11, 12, 101);
717 window_in_wm->SetBounds(window_bounds); 718 window_in_wm->SetBounds(window_bounds);
718 ASSERT_TRUE( 719 ASSERT_TRUE(
719 WaitForBoundsToChange(window_tree_host_in_second_client.window())); 720 WaitForBoundsToChange(window_tree_host_in_second_client.window()));
720 EXPECT_EQ(window_bounds, 721 EXPECT_EQ(window_bounds,
721 window_tree_host_in_second_client.GetBoundsInPixels()); 722 window_tree_host_in_second_client.GetBoundsInPixels());
722 } 723 }
723 724
724 TEST_F(WindowServerTest, OnWindowHierarchyChangedIncludesTransientParent) { 725 TEST_F(WindowServerTest, OnWindowHierarchyChangedIncludesTransientParent) {
725 // Create a second connection. In the second connection create a window, 726 // 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 727 // parent it to the root, create another window, mark it as a transient parent
727 // of the first window and then add it. 728 // of the first window and then add it.
728 EstablishConnectionViaFactoryDelegate delegate(window_manager()); 729 EstablishConnectionViaFactoryDelegate delegate(window_manager());
729 set_window_manager_delegate(&delegate); 730 set_window_manager_delegate(&delegate);
730 aura::WindowTreeClient second_client(connector(), this); 731 aura::WindowTreeClient second_client(connector(), this);
731 second_client.ConnectViaWindowTreeFactory(); 732 second_client.ConnectViaWindowTreeFactory();
732 aura::WindowTreeHostMus window_tree_host_in_second_client(&second_client); 733 aura::WindowTreeHostMus window_tree_host_in_second_client(&second_client);
733 window_tree_host_in_second_client.InitHost(); 734 window_tree_host_in_second_client.InitHost();
735 window_tree_host_in_second_client.window()->Show();
734 aura::Window* second_client_child = NewVisibleWindow( 736 aura::Window* second_client_child = NewVisibleWindow(
735 window_tree_host_in_second_client.window(), &second_client); 737 window_tree_host_in_second_client.window(), &second_client);
736 std::unique_ptr<aura::WindowPortMus> window_port_mus = 738 std::unique_ptr<aura::WindowPortMus> window_port_mus =
737 base::MakeUnique<aura::WindowPortMus>(&second_client, 739 base::MakeUnique<aura::WindowPortMus>(&second_client,
738 aura::WindowMusType::LOCAL); 740 aura::WindowMusType::LOCAL);
739 // Create the transient without a parent, set transient parent, then add. 741 // Create the transient without a parent, set transient parent, then add.
740 aura::Window* transient = NewVisibleWindow(nullptr, &second_client); 742 aura::Window* transient = NewVisibleWindow(nullptr, &second_client);
741 aura::client::TransientWindowClient* transient_window_client = 743 aura::client::TransientWindowClient* transient_window_client =
742 aura::client::GetTransientWindowClient(); 744 aura::client::GetTransientWindowClient();
743 transient_window_client->AddTransientChild(second_client_child, transient); 745 transient_window_client->AddTransientChild(second_client_child, transient);
744 second_client_child->AddChild(transient); 746 second_client_child->AddChild(transient);
745 747
746 // Wait for the top-level to appear in the window manager. 748 // Wait for the top-level to appear in the window manager.
747 ASSERT_TRUE(delegate.QuitOnCreate()); 749 ASSERT_TRUE(delegate.QuitOnCreate());
748 aura::Window* top_level_in_wm = delegate.created_window(); 750 aura::Window* top_level_in_wm = delegate.created_window();
749 751
750 // Makes sure the window manager sees the same structure and the transient 752 // Makes sure the window manager sees the same structure and the transient
751 // parent is connected correctly. 753 // parent is connected correctly.
752 ASSERT_TRUE(WaitForTreeSizeToMatch(top_level_in_wm, 3u)); 754 ASSERT_TRUE(WaitForTreeSizeToMatch(top_level_in_wm, 3u));
753 ASSERT_EQ(1u, top_level_in_wm->children().size()); 755 ASSERT_EQ(1u, top_level_in_wm->children().size());
754 aura::Window* second_client_child_in_wm = top_level_in_wm->children()[0]; 756 aura::Window* second_client_child_in_wm = top_level_in_wm->children()[0];
755 ASSERT_EQ(1u, second_client_child_in_wm->children().size()); 757 ASSERT_EQ(1u, second_client_child_in_wm->children().size());
756 aura::Window* transient_in_wm = second_client_child_in_wm->children()[0]; 758 aura::Window* transient_in_wm = second_client_child_in_wm->children()[0];
757 ASSERT_EQ(second_client_child_in_wm, 759 ASSERT_EQ(second_client_child_in_wm,
758 transient_window_client->GetTransientParent(transient_in_wm)); 760 transient_window_client->GetTransientParent(transient_in_wm));
759 } 761 }
760 762
761 } // namespace ws 763 } // namespace ws
762 } // namespace ui 764 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698