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

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

Issue 2503923003: Demonstrate external-window-mode in mus-demo (Closed)
Patch Set: Determine external window mode in mus-ws based on if a WM is connected Created 4 years, 1 month 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "services/ui/ws/window_manager_state.h" 5 #include "services/ui/ws/window_manager_state.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
(...skipping 531 matching lines...) Expand 10 before | Expand all | Expand 10 after
542 WindowTreeTestApi(window_tree()).AckLastEvent(mojom::EventResult::UNHANDLED); 542 WindowTreeTestApi(window_tree()).AckLastEvent(mojom::EventResult::UNHANDLED);
543 EXPECT_FALSE(window_manager()->on_accelerator_called()); 543 EXPECT_FALSE(window_manager()->on_accelerator_called());
544 } 544 }
545 545
546 // Verifies there is no crash if the WindowTree of a window manager is destroyed 546 // Verifies there is no crash if the WindowTree of a window manager is destroyed
547 // with no roots. 547 // with no roots.
548 TEST(WindowManagerStateShutdownTest, DestroyTreeBeforeDisplay) { 548 TEST(WindowManagerStateShutdownTest, DestroyTreeBeforeDisplay) {
549 WindowServerTestHelper ws_test_helper; 549 WindowServerTestHelper ws_test_helper;
550 WindowServer* window_server = ws_test_helper.window_server(); 550 WindowServer* window_server = ws_test_helper.window_server();
551 TestPlatformScreen platform_screen; 551 TestPlatformScreen platform_screen;
552 platform_screen.Init(window_server->display_manager()); 552 platform_screen.Init(window_server->display_manager(), false);
553 platform_screen.AddDisplay(); 553 platform_screen.AddDisplay();
554 const UserId kUserId1 = "2"; 554 const UserId kUserId1 = "2";
555 AddWindowManager(window_server, kUserId1); 555 AddWindowManager(window_server, kUserId1);
556 ASSERT_EQ(1u, window_server->display_manager()->displays().size()); 556 ASSERT_EQ(1u, window_server->display_manager()->displays().size());
557 Display* display = *(window_server->display_manager()->displays().begin()); 557 Display* display = *(window_server->display_manager()->displays().begin());
558 WindowManagerDisplayRoot* window_manager_display_root = 558 WindowManagerDisplayRoot* window_manager_display_root =
559 display->GetWindowManagerDisplayRootForUser(kUserId1); 559 display->GetWindowManagerDisplayRootForUser(kUserId1);
560 ASSERT_TRUE(window_manager_display_root); 560 ASSERT_TRUE(window_manager_display_root);
561 WindowTree* tree = 561 WindowTree* tree =
562 window_manager_display_root->window_manager_state()->window_tree(); 562 window_manager_display_root->window_manager_state()->window_tree();
563 ASSERT_EQ(1u, tree->roots().size()); 563 ASSERT_EQ(1u, tree->roots().size());
564 ClientWindowId root_client_id; 564 ClientWindowId root_client_id;
565 ASSERT_TRUE(tree->IsWindowKnown(*(tree->roots().begin()), &root_client_id)); 565 ASSERT_TRUE(tree->IsWindowKnown(*(tree->roots().begin()), &root_client_id));
566 EXPECT_TRUE(tree->DeleteWindow(root_client_id)); 566 EXPECT_TRUE(tree->DeleteWindow(root_client_id));
567 window_server->DestroyTree(tree); 567 window_server->DestroyTree(tree);
568 } 568 }
569 569
570 } // namespace test 570 } // namespace test
571 } // namespace ws 571 } // namespace ws
572 } // namespace ui 572 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698