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

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

Issue 2667073002: mash: changes can_accept_events to an enum (Closed)
Patch Set: merge 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_finder.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 507 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 wm_client_->Bind(std::move(client_request));
525 const uint32_t embed_flags = 0; 525 const uint32_t embed_flags = 0;
526 wm_tree->Embed(embed_window_id, std::move(client), embed_flags); 526 wm_tree->Embed(embed_window_id, std::move(client), embed_flags);
527 ServerWindow* embed_window = wm_tree->GetWindowByClientId(embed_window_id); 527 ServerWindow* embed_window = wm_tree->GetWindowByClientId(embed_window_id);
528 embed_window->set_event_targeting_policy(
529 mojom::EventTargetingPolicy::DESCENDANTS_ONLY);
528 WindowTree* tree1 = window_server()->GetTreeWithRoot(embed_window); 530 WindowTree* tree1 = window_server()->GetTreeWithRoot(embed_window);
529 EXPECT_NE(nullptr, tree1); 531 EXPECT_NE(nullptr, tree1);
530 EXPECT_NE(tree1, wm_tree); 532 EXPECT_NE(tree1, wm_tree);
531 WindowTreeTestApi(tree1).set_user_id(wm_tree->user_id()); 533 WindowTreeTestApi(tree1).set_user_id(wm_tree->user_id());
532 534
533 embed_window->SetBounds(window_bounds); 535 embed_window->SetBounds(window_bounds);
534 536
535 return embed_window; 537 return embed_window;
536 } 538 }
537 539
538 void WindowEventTargetingHelper::CreateSecondaryTree( 540 void WindowEventTargetingHelper::CreateSecondaryTree(
539 ServerWindow* embed_window, 541 ServerWindow* embed_window,
540 const gfx::Rect& window_bounds, 542 const gfx::Rect& window_bounds,
541 TestWindowTreeClient** out_client, 543 TestWindowTreeClient** out_client,
542 WindowTree** window_tree, 544 WindowTree** window_tree,
543 ServerWindow** window) { 545 ServerWindow** window) {
544 WindowTree* tree1 = window_server()->GetTreeWithRoot(embed_window); 546 WindowTree* tree1 = window_server()->GetTreeWithRoot(embed_window);
545 ASSERT_TRUE(tree1 != nullptr); 547 ASSERT_TRUE(tree1 != nullptr);
546 const ClientWindowId child1_id( 548 const ClientWindowId child1_id(
547 WindowIdToTransportId(WindowId(tree1->id(), 1))); 549 WindowIdToTransportId(WindowId(tree1->id(), 1)));
548 EXPECT_TRUE(tree1->NewWindow(child1_id, ServerWindow::Properties())); 550 EXPECT_TRUE(tree1->NewWindow(child1_id, ServerWindow::Properties()));
549 ServerWindow* child1 = tree1->GetWindowByClientId(child1_id); 551 ServerWindow* child1 = tree1->GetWindowByClientId(child1_id);
550 ASSERT_TRUE(child1); 552 ASSERT_TRUE(child1);
551 EXPECT_TRUE(tree1->AddWindow(ClientWindowIdForWindow(tree1, embed_window), 553 EXPECT_TRUE(tree1->AddWindow(ClientWindowIdForWindow(tree1, embed_window),
552 child1_id)); 554 child1_id));
553 tree1->GetDisplay(embed_window)->AddActivationParent(embed_window); 555 tree1->GetDisplay(embed_window)->AddActivationParent(embed_window);
554 556
555 child1->SetVisible(true); 557 child1->SetVisible(true);
556 child1->SetBounds(window_bounds); 558 child1->SetBounds(window_bounds);
557 EnableHitTest(child1);
558 559
559 TestWindowTreeClient* embed_client = 560 TestWindowTreeClient* embed_client =
560 ws_test_helper_.window_server_delegate()->last_client(); 561 ws_test_helper_.window_server_delegate()->last_client();
561 embed_client->tracker()->changes()->clear(); 562 embed_client->tracker()->changes()->clear();
562 wm_client_->tracker()->changes()->clear(); 563 wm_client_->tracker()->changes()->clear();
563 564
564 *out_client = embed_client; 565 *out_client = embed_client;
565 *window_tree = tree1; 566 *window_tree = tree1;
566 *window = child1; 567 *window = child1;
567 } 568 }
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
633 return nullptr; 634 return nullptr;
634 if (!tree->AddWindow(parent_client_id, client_window_id)) 635 if (!tree->AddWindow(parent_client_id, client_window_id))
635 return nullptr; 636 return nullptr;
636 *client_id = client_window_id; 637 *client_id = client_window_id;
637 return tree->GetWindowByClientId(client_window_id); 638 return tree->GetWindowByClientId(client_window_id);
638 } 639 }
639 640
640 } // namespace test 641 } // namespace test
641 } // namespace ws 642 } // namespace ws
642 } // namespace ui 643 } // namespace ui
OLDNEW
« no previous file with comments | « services/ui/ws/test_utils.h ('k') | services/ui/ws/window_finder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698