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

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

Issue 2512593003: Cleanup display creation in mus tests. (Closed)
Patch Set: Make const. 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
« no previous file with comments | « services/ui/ws/user_display_manager_unittest.cc ('k') | services/ui/ws/window_tree_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 529 matching lines...) Expand 10 before | Expand all | Expand 10 after
540 EXPECT_EQ("InputEvent window=1,1 event_action=7", 540 EXPECT_EQ("InputEvent window=1,1 event_action=7",
541 ChangesToDescription1(*tracker->changes())[0]); 541 ChangesToDescription1(*tracker->changes())[0]);
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 ws_test_helper.window_server_delegate()->CreateDisplays(1);
551 WindowServer* window_server = ws_test_helper.window_server(); 550 WindowServer* window_server = ws_test_helper.window_server();
551 TestPlatformScreen platform_screen;
552 platform_screen.Init(window_server->display_manager());
553 platform_screen.AddDisplay();
552 const UserId kUserId1 = "2"; 554 const UserId kUserId1 = "2";
553 AddWindowManager(window_server, kUserId1); 555 AddWindowManager(window_server, kUserId1);
554 ASSERT_EQ(1u, window_server->display_manager()->displays().size()); 556 ASSERT_EQ(1u, window_server->display_manager()->displays().size());
555 Display* display = *(window_server->display_manager()->displays().begin()); 557 Display* display = *(window_server->display_manager()->displays().begin());
556 WindowManagerDisplayRoot* window_manager_display_root = 558 WindowManagerDisplayRoot* window_manager_display_root =
557 display->GetWindowManagerDisplayRootForUser(kUserId1); 559 display->GetWindowManagerDisplayRootForUser(kUserId1);
558 ASSERT_TRUE(window_manager_display_root); 560 ASSERT_TRUE(window_manager_display_root);
559 WindowTree* tree = 561 WindowTree* tree =
560 window_manager_display_root->window_manager_state()->window_tree(); 562 window_manager_display_root->window_manager_state()->window_tree();
561 ASSERT_EQ(1u, tree->roots().size()); 563 ASSERT_EQ(1u, tree->roots().size());
562 ClientWindowId root_client_id; 564 ClientWindowId root_client_id;
563 ASSERT_TRUE(tree->IsWindowKnown(*(tree->roots().begin()), &root_client_id)); 565 ASSERT_TRUE(tree->IsWindowKnown(*(tree->roots().begin()), &root_client_id));
564 EXPECT_TRUE(tree->DeleteWindow(root_client_id)); 566 EXPECT_TRUE(tree->DeleteWindow(root_client_id));
565 window_server->DestroyTree(tree); 567 window_server->DestroyTree(tree);
566 } 568 }
567 569
568 } // namespace test 570 } // namespace test
569 } // namespace ws 571 } // namespace ws
570 } // namespace ui 572 } // namespace ui
OLDNEW
« no previous file with comments | « services/ui/ws/user_display_manager_unittest.cc ('k') | services/ui/ws/window_tree_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698