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

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

Issue 2680883002: Fixes bugs in cursor handling (Closed)
Patch Set: Created 3 years, 10 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
« no previous file with comments | « services/ui/ws/test_utils.h ('k') | services/ui/ws/window_manager_state_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/test_utils.h" 5 #include "services/ui/ws/test_utils.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/memory/ptr_util.h" 9 #include "base/memory/ptr_util.h"
10 #include "cc/output/copy_output_request.h" 10 #include "cc/output/copy_output_request.h"
(...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after
506 wm_client_ = ws_test_helper_.window_server_delegate()->last_client(); 506 wm_client_ = ws_test_helper_.window_server_delegate()->last_client();
507 wm_client_->tracker()->changes()->clear(); 507 wm_client_->tracker()->changes()->clear();
508 } 508 }
509 509
510 WindowEventTargetingHelper::~WindowEventTargetingHelper() {} 510 WindowEventTargetingHelper::~WindowEventTargetingHelper() {}
511 511
512 ServerWindow* WindowEventTargetingHelper::CreatePrimaryTree( 512 ServerWindow* WindowEventTargetingHelper::CreatePrimaryTree(
513 const gfx::Rect& root_window_bounds, 513 const gfx::Rect& root_window_bounds,
514 const gfx::Rect& window_bounds) { 514 const gfx::Rect& window_bounds) {
515 WindowTree* wm_tree = window_server()->GetTreeWithId(1); 515 WindowTree* wm_tree = window_server()->GetTreeWithId(1);
516 const ClientWindowId embed_window_id( 516 const ClientWindowId embed_window_id(WindowIdToTransportId(
517 WindowIdToTransportId(WindowId(wm_tree->id(), 1))); 517 WindowId(wm_tree->id(), next_primary_tree_window_id_++)));
518 EXPECT_TRUE(wm_tree->NewWindow(embed_window_id, ServerWindow::Properties())); 518 EXPECT_TRUE(wm_tree->NewWindow(embed_window_id, ServerWindow::Properties()));
519 EXPECT_TRUE(wm_tree->SetWindowVisibility(embed_window_id, true)); 519 EXPECT_TRUE(wm_tree->SetWindowVisibility(embed_window_id, true));
520 EXPECT_TRUE(wm_tree->AddWindow(FirstRootId(wm_tree), embed_window_id)); 520 EXPECT_TRUE(wm_tree->AddWindow(FirstRootId(wm_tree), embed_window_id));
521 display_->root_window()->SetBounds(root_window_bounds); 521 display_->root_window()->SetBounds(root_window_bounds);
522 mojom::WindowTreeClientPtr client; 522 mojom::WindowTreeClientPtr client;
523 mojom::WindowTreeClientRequest client_request(&client); 523 mojom::WindowTreeClientRequest client_request(&client);
524 wm_client_->Bind(std::move(client_request)); 524 ws_test_helper_.window_server_delegate()->last_client()->Bind(
525 std::move(client_request));
525 const uint32_t embed_flags = 0; 526 const uint32_t embed_flags = 0;
526 wm_tree->Embed(embed_window_id, std::move(client), embed_flags); 527 wm_tree->Embed(embed_window_id, std::move(client), embed_flags);
527 ServerWindow* embed_window = wm_tree->GetWindowByClientId(embed_window_id); 528 ServerWindow* embed_window = wm_tree->GetWindowByClientId(embed_window_id);
528 embed_window->set_event_targeting_policy( 529 embed_window->set_event_targeting_policy(
529 mojom::EventTargetingPolicy::DESCENDANTS_ONLY); 530 mojom::EventTargetingPolicy::DESCENDANTS_ONLY);
530 WindowTree* tree1 = window_server()->GetTreeWithRoot(embed_window); 531 WindowTree* tree1 = window_server()->GetTreeWithRoot(embed_window);
531 EXPECT_NE(nullptr, tree1); 532 EXPECT_NE(nullptr, tree1);
532 EXPECT_NE(tree1, wm_tree); 533 EXPECT_NE(tree1, wm_tree);
533 WindowTreeTestApi(tree1).set_user_id(wm_tree->user_id()); 534 WindowTreeTestApi(tree1).set_user_id(wm_tree->user_id());
534 535
535 embed_window->SetBounds(window_bounds); 536 embed_window->SetBounds(window_bounds);
536 537
537 return embed_window; 538 return embed_window;
538 } 539 }
539 540
540 void WindowEventTargetingHelper::CreateSecondaryTree( 541 void WindowEventTargetingHelper::CreateSecondaryTree(
541 ServerWindow* embed_window, 542 ServerWindow* embed_window,
542 const gfx::Rect& window_bounds, 543 const gfx::Rect& window_bounds,
543 TestWindowTreeClient** out_client, 544 TestWindowTreeClient** out_client,
544 WindowTree** window_tree, 545 WindowTree** window_tree,
545 ServerWindow** window) { 546 ServerWindow** window) {
546 WindowTree* tree1 = window_server()->GetTreeWithRoot(embed_window); 547 WindowTree* tree1 = window_server()->GetTreeWithRoot(embed_window);
547 ASSERT_TRUE(tree1 != nullptr); 548 ASSERT_TRUE(tree1 != nullptr);
548 const ClientWindowId child1_id( 549 const ClientWindowId child1_id(
549 WindowIdToTransportId(WindowId(tree1->id(), 1))); 550 WindowIdToTransportId(WindowId(tree1->id(), 1)));
550 EXPECT_TRUE(tree1->NewWindow(child1_id, ServerWindow::Properties())); 551 ASSERT_TRUE(tree1->NewWindow(child1_id, ServerWindow::Properties()));
551 ServerWindow* child1 = tree1->GetWindowByClientId(child1_id); 552 ServerWindow* child1 = tree1->GetWindowByClientId(child1_id);
552 ASSERT_TRUE(child1); 553 ASSERT_TRUE(child1);
553 EXPECT_TRUE(tree1->AddWindow(ClientWindowIdForWindow(tree1, embed_window), 554 EXPECT_TRUE(tree1->AddWindow(ClientWindowIdForWindow(tree1, embed_window),
554 child1_id)); 555 child1_id));
555 tree1->GetDisplay(embed_window)->AddActivationParent(embed_window); 556 tree1->GetDisplay(embed_window)->AddActivationParent(embed_window);
556 557
557 child1->SetVisible(true); 558 child1->SetVisible(true);
558 child1->SetBounds(window_bounds); 559 child1->SetBounds(window_bounds);
559 560
560 TestWindowTreeClient* embed_client = 561 TestWindowTreeClient* embed_client =
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
627 ClientWindowId parent_client_id; 628 ClientWindowId parent_client_id;
628 if (!tree->IsWindowKnown(parent, &parent_client_id)) 629 if (!tree->IsWindowKnown(parent, &parent_client_id))
629 return nullptr; 630 return nullptr;
630 ClientWindowId client_window_id = NextUnusedClientWindowId(tree); 631 ClientWindowId client_window_id = NextUnusedClientWindowId(tree);
631 if (!tree->NewWindow(client_window_id, ServerWindow::Properties())) 632 if (!tree->NewWindow(client_window_id, ServerWindow::Properties()))
632 return nullptr; 633 return nullptr;
633 if (!tree->SetWindowVisibility(client_window_id, true)) 634 if (!tree->SetWindowVisibility(client_window_id, true))
634 return nullptr; 635 return nullptr;
635 if (!tree->AddWindow(parent_client_id, client_window_id)) 636 if (!tree->AddWindow(parent_client_id, client_window_id))
636 return nullptr; 637 return nullptr;
637 *client_id = client_window_id; 638 if (client_id)
639 *client_id = client_window_id;
638 return tree->GetWindowByClientId(client_window_id); 640 return tree->GetWindowByClientId(client_window_id);
639 } 641 }
640 642
641 } // namespace test 643 } // namespace test
642 } // namespace ws 644 } // namespace ws
643 } // namespace ui 645 } // namespace ui
OLDNEW
« no previous file with comments | « services/ui/ws/test_utils.h ('k') | services/ui/ws/window_manager_state_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698