OLD | NEW |
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 530 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
541 WindowTreeTestApi(window_tree()).AckLastEvent(mojom::EventResult::UNHANDLED); | 541 WindowTreeTestApi(window_tree()).AckLastEvent(mojom::EventResult::UNHANDLED); |
542 EXPECT_FALSE(window_manager()->on_accelerator_called()); | 542 EXPECT_FALSE(window_manager()->on_accelerator_called()); |
543 } | 543 } |
544 | 544 |
545 // Verifies there is no crash if the WindowTree of a window manager is destroyed | 545 // Verifies there is no crash if the WindowTree of a window manager is destroyed |
546 // with no roots. | 546 // with no roots. |
547 TEST(WindowManagerStateShutdownTest, DestroyTreeBeforeDisplay) { | 547 TEST(WindowManagerStateShutdownTest, DestroyTreeBeforeDisplay) { |
548 WindowServerTestHelper ws_test_helper; | 548 WindowServerTestHelper ws_test_helper; |
549 WindowServer* window_server = ws_test_helper.window_server(); | 549 WindowServer* window_server = ws_test_helper.window_server(); |
550 TestPlatformScreen platform_screen; | 550 TestPlatformScreen platform_screen; |
551 platform_screen.Init(window_server->display_manager()); | 551 platform_screen.Init(window_server->display_manager(), |
| 552 display::PlatformScreen::WINDOW_MODE_INTERNAL); |
552 platform_screen.AddDisplay(); | 553 platform_screen.AddDisplay(); |
553 const UserId kUserId1 = "2"; | 554 const UserId kUserId1 = "2"; |
554 AddWindowManager(window_server, kUserId1); | 555 AddWindowManager(window_server, kUserId1); |
555 ASSERT_EQ(1u, window_server->display_manager()->displays().size()); | 556 ASSERT_EQ(1u, window_server->display_manager()->displays().size()); |
556 Display* display = *(window_server->display_manager()->displays().begin()); | 557 Display* display = *(window_server->display_manager()->displays().begin()); |
557 WindowManagerDisplayRoot* window_manager_display_root = | 558 WindowManagerDisplayRoot* window_manager_display_root = |
558 display->GetWindowManagerDisplayRootForUser(kUserId1); | 559 display->GetWindowManagerDisplayRootForUser(kUserId1); |
559 ASSERT_TRUE(window_manager_display_root); | 560 ASSERT_TRUE(window_manager_display_root); |
560 WindowTree* tree = | 561 WindowTree* tree = |
561 window_manager_display_root->window_manager_state()->window_tree(); | 562 window_manager_display_root->window_manager_state()->window_tree(); |
562 ASSERT_EQ(1u, tree->roots().size()); | 563 ASSERT_EQ(1u, tree->roots().size()); |
563 ClientWindowId root_client_id; | 564 ClientWindowId root_client_id; |
564 ASSERT_TRUE(tree->IsWindowKnown(*(tree->roots().begin()), &root_client_id)); | 565 ASSERT_TRUE(tree->IsWindowKnown(*(tree->roots().begin()), &root_client_id)); |
565 EXPECT_TRUE(tree->DeleteWindow(root_client_id)); | 566 EXPECT_TRUE(tree->DeleteWindow(root_client_id)); |
566 window_server->DestroyTree(tree); | 567 window_server->DestroyTree(tree); |
567 } | 568 } |
568 | 569 |
569 } // namespace test | 570 } // namespace test |
570 } // namespace ws | 571 } // namespace ws |
571 } // namespace ui | 572 } // namespace ui |
OLD | NEW |