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

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

Issue 2741063002: Setup DiscardableMemory in the ash process (Closed)
Patch Set: Rebase Created 3 years, 9 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 | « ash/mus/window_manager_unittest.cc ('k') | services/ui/ws/window_server_test_base.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 <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 693 matching lines...) Expand 10 before | Expand all | Expand 10 after
704 aura::WindowTreeClient* client_; 704 aura::WindowTreeClient* client_;
705 std::unique_ptr<base::RunLoop> run_loop_; 705 std::unique_ptr<base::RunLoop> run_loop_;
706 aura::Window* created_window_; 706 aura::Window* created_window_;
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); 714 aura::WindowTreeClient second_client(connector(), this, nullptr, nullptr,
715 nullptr, false);
715 second_client.ConnectViaWindowTreeFactory(); 716 second_client.ConnectViaWindowTreeFactory();
716 aura::WindowTreeHostMus window_tree_host_in_second_client(&second_client); 717 aura::WindowTreeHostMus window_tree_host_in_second_client(&second_client);
717 window_tree_host_in_second_client.InitHost(); 718 window_tree_host_in_second_client.InitHost();
718 window_tree_host_in_second_client.window()->Show(); 719 window_tree_host_in_second_client.window()->Show();
719 ASSERT_TRUE(second_client.GetRoots().count( 720 ASSERT_TRUE(second_client.GetRoots().count(
720 window_tree_host_in_second_client.window()) > 0); 721 window_tree_host_in_second_client.window()) > 0);
721 // Wait for the window to appear in the wm. 722 // Wait for the window to appear in the wm.
722 ASSERT_TRUE(delegate.QuitOnCreate()); 723 ASSERT_TRUE(delegate.QuitOnCreate());
723 724
724 aura::Window* window_in_wm = delegate.created_window(); 725 aura::Window* window_in_wm = delegate.created_window();
725 ASSERT_TRUE(window_in_wm); 726 ASSERT_TRUE(window_in_wm);
726 727
727 // Change the bounds in the wm, and make sure the child sees it. 728 // Change the bounds in the wm, and make sure the child sees it.
728 const gfx::Rect window_bounds(1, 11, 12, 101); 729 const gfx::Rect window_bounds(1, 11, 12, 101);
729 window_in_wm->SetBounds(window_bounds); 730 window_in_wm->SetBounds(window_bounds);
730 ASSERT_TRUE( 731 ASSERT_TRUE(
731 WaitForBoundsToChange(window_tree_host_in_second_client.window())); 732 WaitForBoundsToChange(window_tree_host_in_second_client.window()));
732 EXPECT_EQ(window_bounds, 733 EXPECT_EQ(window_bounds,
733 window_tree_host_in_second_client.GetBoundsInPixels()); 734 window_tree_host_in_second_client.GetBoundsInPixels());
734 } 735 }
735 736
736 TEST_F(WindowServerTest, OnWindowHierarchyChangedIncludesTransientParent) { 737 TEST_F(WindowServerTest, OnWindowHierarchyChangedIncludesTransientParent) {
737 // Create a second connection. In the second connection create a window, 738 // Create a second connection. In the second connection create a window,
738 // parent it to the root, create another window, mark it as a transient parent 739 // parent it to the root, create another window, mark it as a transient parent
739 // of the first window and then add it. 740 // of the first window and then add it.
740 EstablishConnectionViaFactoryDelegate delegate(window_manager()); 741 EstablishConnectionViaFactoryDelegate delegate(window_manager());
741 set_window_manager_delegate(&delegate); 742 set_window_manager_delegate(&delegate);
742 aura::WindowTreeClient second_client(connector(), this); 743 aura::WindowTreeClient second_client(connector(), this, nullptr, nullptr,
744 nullptr, false);
743 second_client.ConnectViaWindowTreeFactory(); 745 second_client.ConnectViaWindowTreeFactory();
744 aura::WindowTreeHostMus window_tree_host_in_second_client(&second_client); 746 aura::WindowTreeHostMus window_tree_host_in_second_client(&second_client);
745 window_tree_host_in_second_client.InitHost(); 747 window_tree_host_in_second_client.InitHost();
746 window_tree_host_in_second_client.window()->Show(); 748 window_tree_host_in_second_client.window()->Show();
747 aura::Window* second_client_child = NewVisibleWindow( 749 aura::Window* second_client_child = NewVisibleWindow(
748 window_tree_host_in_second_client.window(), &second_client); 750 window_tree_host_in_second_client.window(), &second_client);
749 std::unique_ptr<aura::WindowPortMus> window_port_mus = 751 std::unique_ptr<aura::WindowPortMus> window_port_mus =
750 base::MakeUnique<aura::WindowPortMus>(&second_client, 752 base::MakeUnique<aura::WindowPortMus>(&second_client,
751 aura::WindowMusType::LOCAL); 753 aura::WindowMusType::LOCAL);
752 // Create the transient without a parent, set transient parent, then add. 754 // Create the transient without a parent, set transient parent, then add.
(...skipping 13 matching lines...) Expand all
766 ASSERT_EQ(1u, top_level_in_wm->children().size()); 768 ASSERT_EQ(1u, top_level_in_wm->children().size());
767 aura::Window* second_client_child_in_wm = top_level_in_wm->children()[0]; 769 aura::Window* second_client_child_in_wm = top_level_in_wm->children()[0];
768 ASSERT_EQ(1u, second_client_child_in_wm->children().size()); 770 ASSERT_EQ(1u, second_client_child_in_wm->children().size());
769 aura::Window* transient_in_wm = second_client_child_in_wm->children()[0]; 771 aura::Window* transient_in_wm = second_client_child_in_wm->children()[0];
770 ASSERT_EQ(second_client_child_in_wm, 772 ASSERT_EQ(second_client_child_in_wm,
771 transient_window_client->GetTransientParent(transient_in_wm)); 773 transient_window_client->GetTransientParent(transient_in_wm));
772 } 774 }
773 775
774 } // namespace ws 776 } // namespace ws
775 } // namespace ui 777 } // namespace ui
OLDNEW
« no previous file with comments | « ash/mus/window_manager_unittest.cc ('k') | services/ui/ws/window_server_test_base.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698