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

Side by Side 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "components/mus/public/cpp/lib/window_tree_client_impl.h" 5 #include "components/mus/public/cpp/lib/window_tree_client_impl.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after
485 // Destroying the window triggers 485 // Destroying the window triggers
486 // ToggleVisibilityFromDestroyedObserver::OnWindowDestroyed(), which toggles 486 // ToggleVisibilityFromDestroyedObserver::OnWindowDestroyed(), which toggles
487 // the visibility of the window. Ack the change, which should not crash or 487 // the visibility of the window. Ack the change, which should not crash or
488 // trigger DCHECKs. 488 // trigger DCHECKs.
489 child1->Destroy(); 489 child1->Destroy();
490 uint32_t change_id; 490 uint32_t change_id;
491 ASSERT_TRUE(setup.window_tree()->GetAndClearChangeId(&change_id)); 491 ASSERT_TRUE(setup.window_tree()->GetAndClearChangeId(&change_id));
492 setup.window_tree_client()->OnChangeCompleted(change_id, true); 492 setup.window_tree_client()->OnChangeCompleted(change_id, true);
493 } 493 }
494 494
495 TEST_F(WindowTreeClientImplTest, NewTopLevelWindow) {
496 WindowTreeSetup setup;
497 Window* root1 = setup.GetFirstRoot();
498 ASSERT_TRUE(root1);
499 Window* root2 = setup.window_tree_connection()->NewTopLevelWindow(nullptr);
500 ASSERT_TRUE(root2);
501 ASSERT_NE(root2, root1);
502 EXPECT_NE(root2->id(), root1->id());
503 EXPECT_EQ(2u, setup.window_tree_connection()->GetRoots().size());
504 EXPECT_TRUE(setup.window_tree_connection()->GetRoots().count(root1) > 0u);
505 EXPECT_TRUE(setup.window_tree_connection()->GetRoots().count(root2) > 0u);
506
507 // Ack the request to the windowtree to create the new window.
508 uint32_t change_id;
509 ASSERT_TRUE(setup.window_tree()->GetAndClearChangeId(&change_id));
510 EXPECT_EQ(setup.window_tree()->window_id(), root2->id());
511 setup.window_tree_client()->OnChangeCompleted(change_id, true);
512
513 // Should not be able to add a top level as a child of another window.
514 root1->AddChild(root2);
515 ASSERT_EQ(nullptr, root2->parent());
516
517 // Destroy the first root, shouldn't initiate tear down.
518 root1->Destroy();
519 root1 = nullptr;
520 EXPECT_EQ(1u, setup.window_tree_connection()->GetRoots().size());
521 EXPECT_TRUE(setup.window_tree_connection()->GetRoots().count(root2) > 0u);
522 }
523
495 } // namespace mus 524 } // namespace mus
OLDNEW
« 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