Chromium Code Reviews| 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 529 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 540 ChangesToDescription1(*tracker->changes())[0]); | 540 ChangesToDescription1(*tracker->changes())[0]); |
| 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 TestScreenManager screen_manager; |
|
msw
2016/12/01 20:01:19
optional nit: explicit include?
kylechar
2016/12/01 21:08:21
It has an #include to services/ui/ws/test_utils.h
| |
| 551 platform_screen.Init(window_server->display_manager()); | 551 screen_manager.Init(window_server->display_manager()); |
| 552 platform_screen.AddDisplay(); | 552 screen_manager.AddDisplay(); |
| 553 const UserId kUserId1 = "2"; | 553 const UserId kUserId1 = "2"; |
| 554 AddWindowManager(window_server, kUserId1); | 554 AddWindowManager(window_server, kUserId1); |
| 555 ASSERT_EQ(1u, window_server->display_manager()->displays().size()); | 555 ASSERT_EQ(1u, window_server->display_manager()->displays().size()); |
| 556 Display* display = *(window_server->display_manager()->displays().begin()); | 556 Display* display = *(window_server->display_manager()->displays().begin()); |
| 557 WindowManagerDisplayRoot* window_manager_display_root = | 557 WindowManagerDisplayRoot* window_manager_display_root = |
| 558 display->GetWindowManagerDisplayRootForUser(kUserId1); | 558 display->GetWindowManagerDisplayRootForUser(kUserId1); |
| 559 ASSERT_TRUE(window_manager_display_root); | 559 ASSERT_TRUE(window_manager_display_root); |
| 560 WindowTree* tree = | 560 WindowTree* tree = |
| 561 window_manager_display_root->window_manager_state()->window_tree(); | 561 window_manager_display_root->window_manager_state()->window_tree(); |
| 562 ASSERT_EQ(1u, tree->roots().size()); | 562 ASSERT_EQ(1u, tree->roots().size()); |
| 563 ClientWindowId root_client_id; | 563 ClientWindowId root_client_id; |
| 564 ASSERT_TRUE(tree->IsWindowKnown(*(tree->roots().begin()), &root_client_id)); | 564 ASSERT_TRUE(tree->IsWindowKnown(*(tree->roots().begin()), &root_client_id)); |
| 565 EXPECT_TRUE(tree->DeleteWindow(root_client_id)); | 565 EXPECT_TRUE(tree->DeleteWindow(root_client_id)); |
| 566 window_server->DestroyTree(tree); | 566 window_server->DestroyTree(tree); |
| 567 } | 567 } |
| 568 | 568 |
| 569 } // namespace test | 569 } // namespace test |
| 570 } // namespace ws | 570 } // namespace ws |
| 571 } // namespace ui | 571 } // namespace ui |
| OLD | NEW |