| 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/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 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 284 tracker_.OnCaptureChanged(new_capture_window_id, old_capture_window_id); | 284 tracker_.OnCaptureChanged(new_capture_window_id, old_capture_window_id); |
| 285 } | 285 } |
| 286 | 286 |
| 287 void TestWindowTreeClient::OnTopLevelCreated(uint32_t change_id, | 287 void TestWindowTreeClient::OnTopLevelCreated(uint32_t change_id, |
| 288 mojom::WindowDataPtr data, | 288 mojom::WindowDataPtr data, |
| 289 int64_t display_id, | 289 int64_t display_id, |
| 290 bool drawn) { | 290 bool drawn) { |
| 291 tracker_.OnTopLevelCreated(change_id, std::move(data), drawn); | 291 tracker_.OnTopLevelCreated(change_id, std::move(data), drawn); |
| 292 } | 292 } |
| 293 | 293 |
| 294 void TestWindowTreeClient::OnWindowBoundsChanged(uint32_t window, | 294 void TestWindowTreeClient::OnWindowBoundsChanged( |
| 295 const gfx::Rect& old_bounds, | 295 uint32_t window, |
| 296 const gfx::Rect& new_bounds) { | 296 const gfx::Rect& old_bounds, |
| 297 const gfx::Rect& new_bounds, |
| 298 const cc::LocalFrameId& local_frame_id) { |
| 297 tracker_.OnWindowBoundsChanged(window, std::move(old_bounds), | 299 tracker_.OnWindowBoundsChanged(window, std::move(old_bounds), |
| 298 std::move(new_bounds)); | 300 std::move(new_bounds)); |
| 299 } | 301 } |
| 300 | 302 |
| 301 void TestWindowTreeClient::OnClientAreaChanged( | 303 void TestWindowTreeClient::OnClientAreaChanged( |
| 302 uint32_t window_id, | 304 uint32_t window_id, |
| 303 const gfx::Insets& new_client_area, | 305 const gfx::Insets& new_client_area, |
| 304 const std::vector<gfx::Rect>& new_additional_client_areas) {} | 306 const std::vector<gfx::Rect>& new_additional_client_areas) {} |
| 305 | 307 |
| 306 void TestWindowTreeClient::OnTransientWindowAdded( | 308 void TestWindowTreeClient::OnTransientWindowAdded( |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 504 } | 506 } |
| 505 | 507 |
| 506 WindowEventTargetingHelper::~WindowEventTargetingHelper() {} | 508 WindowEventTargetingHelper::~WindowEventTargetingHelper() {} |
| 507 | 509 |
| 508 ServerWindow* WindowEventTargetingHelper::CreatePrimaryTree( | 510 ServerWindow* WindowEventTargetingHelper::CreatePrimaryTree( |
| 509 const gfx::Rect& root_window_bounds, | 511 const gfx::Rect& root_window_bounds, |
| 510 const gfx::Rect& window_bounds) { | 512 const gfx::Rect& window_bounds) { |
| 511 WindowTree* wm_tree = window_server()->GetTreeWithId(1); | 513 WindowTree* wm_tree = window_server()->GetTreeWithId(1); |
| 512 const ClientWindowId embed_window_id( | 514 const ClientWindowId embed_window_id( |
| 513 WindowIdToTransportId(WindowId(wm_tree->id(), 1))); | 515 WindowIdToTransportId(WindowId(wm_tree->id(), 1))); |
| 514 EXPECT_TRUE(wm_tree->NewWindow(embed_window_id, ServerWindow::Properties())); | 516 EXPECT_TRUE(wm_tree->NewWindow(embed_window_id, ServerWindow::Properties(), |
| 517 cc::LocalFrameId())); |
| 515 EXPECT_TRUE(wm_tree->SetWindowVisibility(embed_window_id, true)); | 518 EXPECT_TRUE(wm_tree->SetWindowVisibility(embed_window_id, true)); |
| 516 EXPECT_TRUE(wm_tree->AddWindow(FirstRootId(wm_tree), embed_window_id)); | 519 EXPECT_TRUE(wm_tree->AddWindow(FirstRootId(wm_tree), embed_window_id)); |
| 517 display_->root_window()->SetBounds(root_window_bounds); | 520 display_->root_window()->SetBounds(root_window_bounds, cc::LocalFrameId()); |
| 518 mojom::WindowTreeClientPtr client; | 521 mojom::WindowTreeClientPtr client; |
| 519 mojom::WindowTreeClientRequest client_request(&client); | 522 mojom::WindowTreeClientRequest client_request(&client); |
| 520 wm_client_->Bind(std::move(client_request)); | 523 wm_client_->Bind(std::move(client_request)); |
| 521 const uint32_t embed_flags = 0; | 524 const uint32_t embed_flags = 0; |
| 522 wm_tree->Embed(embed_window_id, std::move(client), embed_flags); | 525 wm_tree->Embed(embed_window_id, std::move(client), embed_flags); |
| 523 ServerWindow* embed_window = wm_tree->GetWindowByClientId(embed_window_id); | 526 ServerWindow* embed_window = wm_tree->GetWindowByClientId(embed_window_id); |
| 524 WindowTree* tree1 = window_server()->GetTreeWithRoot(embed_window); | 527 WindowTree* tree1 = window_server()->GetTreeWithRoot(embed_window); |
| 525 EXPECT_NE(nullptr, tree1); | 528 EXPECT_NE(nullptr, tree1); |
| 526 EXPECT_NE(tree1, wm_tree); | 529 EXPECT_NE(tree1, wm_tree); |
| 527 WindowTreeTestApi(tree1).set_user_id(wm_tree->user_id()); | 530 WindowTreeTestApi(tree1).set_user_id(wm_tree->user_id()); |
| 528 | 531 |
| 529 embed_window->SetBounds(window_bounds); | 532 embed_window->SetBounds(window_bounds, cc::LocalFrameId()); |
| 530 | 533 |
| 531 return embed_window; | 534 return embed_window; |
| 532 } | 535 } |
| 533 | 536 |
| 534 void WindowEventTargetingHelper::CreateSecondaryTree( | 537 void WindowEventTargetingHelper::CreateSecondaryTree( |
| 535 ServerWindow* embed_window, | 538 ServerWindow* embed_window, |
| 536 const gfx::Rect& window_bounds, | 539 const gfx::Rect& window_bounds, |
| 537 TestWindowTreeClient** out_client, | 540 TestWindowTreeClient** out_client, |
| 538 WindowTree** window_tree, | 541 WindowTree** window_tree, |
| 539 ServerWindow** window) { | 542 ServerWindow** window) { |
| 540 WindowTree* tree1 = window_server()->GetTreeWithRoot(embed_window); | 543 WindowTree* tree1 = window_server()->GetTreeWithRoot(embed_window); |
| 541 ASSERT_TRUE(tree1 != nullptr); | 544 ASSERT_TRUE(tree1 != nullptr); |
| 542 const ClientWindowId child1_id( | 545 const ClientWindowId child1_id( |
| 543 WindowIdToTransportId(WindowId(tree1->id(), 1))); | 546 WindowIdToTransportId(WindowId(tree1->id(), 1))); |
| 544 EXPECT_TRUE(tree1->NewWindow(child1_id, ServerWindow::Properties())); | 547 EXPECT_TRUE(tree1->NewWindow(child1_id, ServerWindow::Properties(), |
| 548 cc::LocalFrameId())); |
| 545 ServerWindow* child1 = tree1->GetWindowByClientId(child1_id); | 549 ServerWindow* child1 = tree1->GetWindowByClientId(child1_id); |
| 546 ASSERT_TRUE(child1); | 550 ASSERT_TRUE(child1); |
| 547 EXPECT_TRUE(tree1->AddWindow(ClientWindowIdForWindow(tree1, embed_window), | 551 EXPECT_TRUE(tree1->AddWindow(ClientWindowIdForWindow(tree1, embed_window), |
| 548 child1_id)); | 552 child1_id)); |
| 549 tree1->GetDisplay(embed_window)->AddActivationParent(embed_window); | 553 tree1->GetDisplay(embed_window)->AddActivationParent(embed_window); |
| 550 | 554 |
| 551 child1->SetVisible(true); | 555 child1->SetVisible(true); |
| 552 child1->SetBounds(window_bounds); | 556 child1->SetBounds(window_bounds, cc::LocalFrameId()); |
| 553 EnableHitTest(child1); | 557 EnableHitTest(child1); |
| 554 | 558 |
| 555 TestWindowTreeClient* embed_client = | 559 TestWindowTreeClient* embed_client = |
| 556 ws_test_helper_.window_server_delegate()->last_client(); | 560 ws_test_helper_.window_server_delegate()->last_client(); |
| 557 embed_client->tracker()->changes()->clear(); | 561 embed_client->tracker()->changes()->clear(); |
| 558 wm_client_->tracker()->changes()->clear(); | 562 wm_client_->tracker()->changes()->clear(); |
| 559 | 563 |
| 560 *out_client = embed_client; | 564 *out_client = embed_client; |
| 561 *window_tree = tree1; | 565 *window_tree = tree1; |
| 562 *window = child1; | 566 *window = child1; |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 616 | 620 |
| 617 ServerWindow* NewWindowInTreeWithParent(WindowTree* tree, | 621 ServerWindow* NewWindowInTreeWithParent(WindowTree* tree, |
| 618 ServerWindow* parent, | 622 ServerWindow* parent, |
| 619 ClientWindowId* client_id) { | 623 ClientWindowId* client_id) { |
| 620 if (!parent) | 624 if (!parent) |
| 621 return nullptr; | 625 return nullptr; |
| 622 ClientWindowId parent_client_id; | 626 ClientWindowId parent_client_id; |
| 623 if (!tree->IsWindowKnown(parent, &parent_client_id)) | 627 if (!tree->IsWindowKnown(parent, &parent_client_id)) |
| 624 return nullptr; | 628 return nullptr; |
| 625 ClientWindowId client_window_id = NextUnusedClientWindowId(tree); | 629 ClientWindowId client_window_id = NextUnusedClientWindowId(tree); |
| 626 if (!tree->NewWindow(client_window_id, ServerWindow::Properties())) | 630 if (!tree->NewWindow(client_window_id, ServerWindow::Properties(), |
| 631 cc::LocalFrameId())) |
| 627 return nullptr; | 632 return nullptr; |
| 628 if (!tree->SetWindowVisibility(client_window_id, true)) | 633 if (!tree->SetWindowVisibility(client_window_id, true)) |
| 629 return nullptr; | 634 return nullptr; |
| 630 if (!tree->AddWindow(parent_client_id, client_window_id)) | 635 if (!tree->AddWindow(parent_client_id, client_window_id)) |
| 631 return nullptr; | 636 return nullptr; |
| 632 *client_id = client_window_id; | 637 *client_id = client_window_id; |
| 633 return tree->GetWindowByClientId(client_window_id); | 638 return tree->GetWindowByClientId(client_window_id); |
| 634 } | 639 } |
| 635 | 640 |
| 636 } // namespace test | 641 } // namespace test |
| 637 } // namespace ws | 642 } // namespace ws |
| 638 } // namespace ui | 643 } // namespace ui |
| OLD | NEW |