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

Unified Diff: components/mus/public/cpp/tests/window_tree_client_impl_unittest.cc

Issue 1567623003: Adds remainder of support for multiple roots to WS (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix comment Created 4 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: components/mus/public/cpp/tests/window_tree_client_impl_unittest.cc
diff --git a/components/mus/public/cpp/tests/window_tree_client_impl_unittest.cc b/components/mus/public/cpp/tests/window_tree_client_impl_unittest.cc
index d9c8dbca5157c77abb2cff1e72fd481cd64eac43..e46f2cdfbc8130ddf2a341f443941d5870037533 100644
--- a/components/mus/public/cpp/tests/window_tree_client_impl_unittest.cc
+++ b/components/mus/public/cpp/tests/window_tree_client_impl_unittest.cc
@@ -492,4 +492,33 @@ TEST_F(WindowTreeClientImplTest, ToggleVisibilityFromWindowDestroyed) {
setup.window_tree_client()->OnChangeCompleted(change_id, true);
}
+TEST_F(WindowTreeClientImplTest, NewTopLevelWindow) {
+ WindowTreeSetup setup;
+ Window* root1 = setup.GetFirstRoot();
+ ASSERT_TRUE(root1);
+ Window* root2 = setup.window_tree_connection()->NewTopLevelWindow(nullptr);
+ ASSERT_TRUE(root2);
+ ASSERT_NE(root2, root1);
+ EXPECT_NE(root2->id(), root1->id());
+ EXPECT_EQ(2u, setup.window_tree_connection()->GetRoots().size());
+ EXPECT_TRUE(setup.window_tree_connection()->GetRoots().count(root1) > 0u);
+ EXPECT_TRUE(setup.window_tree_connection()->GetRoots().count(root2) > 0u);
+
+ // Ack the request to the windowtree to create the new window.
+ uint32_t change_id;
+ ASSERT_TRUE(setup.window_tree()->GetAndClearChangeId(&change_id));
+ EXPECT_EQ(setup.window_tree()->window_id(), root2->id());
+ setup.window_tree_client()->OnChangeCompleted(change_id, true);
+
+ // Should not be able to add a top level as a child of another window.
+ root1->AddChild(root2);
+ ASSERT_EQ(nullptr, root2->parent());
+
+ // Destroy the first root, shouldn't initiate tear down.
+ root1->Destroy();
+ root1 = nullptr;
+ EXPECT_EQ(1u, setup.window_tree_connection()->GetRoots().size());
+ EXPECT_TRUE(setup.window_tree_connection()->GetRoots().count(root2) > 0u);
+}
+
} // namespace mus
« no previous file with comments | « components/mus/public/cpp/tests/test_window_tree.cc ('k') | components/mus/public/cpp/window_manager_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698