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

Side by Side Diff: components/mus/ws/test_utils.cc

Issue 2068093002: mus: Allow embedder to intercept events. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 years, 6 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
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 "components/mus/ws/test_utils.h" 5 #include "components/mus/ws/test_utils.h"
6 6
7 #include "base/memory/ptr_util.h" 7 #include "base/memory/ptr_util.h"
8 #include "cc/output/copy_output_request.h" 8 #include "cc/output/copy_output_request.h"
9 #include "components/mus/surfaces/surfaces_state.h" 9 #include "components/mus/surfaces/surfaces_state.h"
10 #include "components/mus/ws/display_binding.h" 10 #include "components/mus/ws/display_binding.h"
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 int count = 0; 136 int count = 0;
137 for (const auto& pair : ed_->pointer_targets_) 137 for (const auto& pair : ed_->pointer_targets_)
138 if (pair.second.window == window) 138 if (pair.second.window == window)
139 count++; 139 count++;
140 return count; 140 return count;
141 } 141 }
142 142
143 // TestDisplayBinding --------------------------------------------------------- 143 // TestDisplayBinding ---------------------------------------------------------
144 144
145 WindowTree* TestDisplayBinding::CreateWindowTree(ServerWindow* root) { 145 WindowTree* TestDisplayBinding::CreateWindowTree(ServerWindow* root) {
146 const uint32_t embed_flags = 0;
146 return window_server_->EmbedAtWindow( 147 return window_server_->EmbedAtWindow(
147 root, shell::mojom::kRootUserID, mus::mojom::WindowTreeClientPtr(), 148 root, shell::mojom::kRootUserID, mus::mojom::WindowTreeClientPtr(),
148 base::WrapUnique(new WindowManagerAccessPolicy)); 149 embed_flags, base::WrapUnique(new WindowManagerAccessPolicy));
149 } 150 }
150 151
151 // TestWindowManager ---------------------------------------------------------- 152 // TestWindowManager ----------------------------------------------------------
152 153
153 void TestWindowManager::WmCreateTopLevelWindow( 154 void TestWindowManager::WmCreateTopLevelWindow(
154 uint32_t change_id, 155 uint32_t change_id,
155 ClientSpecificId requesting_client_id, 156 ClientSpecificId requesting_client_id,
156 mojo::Map<mojo::String, mojo::Array<uint8_t>> properties) { 157 mojo::Map<mojo::String, mojo::Array<uint8_t>> properties) {
157 got_create_top_level_window_ = true; 158 got_create_top_level_window_ = true;
158 change_id_ = change_id; 159 change_id_ = change_id;
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
385 WindowTree* wm_tree = window_server_->GetTreeWithId(1); 386 WindowTree* wm_tree = window_server_->GetTreeWithId(1);
386 const ClientWindowId embed_window_id( 387 const ClientWindowId embed_window_id(
387 WindowIdToTransportId(WindowId(wm_tree->id(), 1))); 388 WindowIdToTransportId(WindowId(wm_tree->id(), 1)));
388 EXPECT_TRUE(wm_tree->NewWindow(embed_window_id, ServerWindow::Properties())); 389 EXPECT_TRUE(wm_tree->NewWindow(embed_window_id, ServerWindow::Properties()));
389 EXPECT_TRUE(wm_tree->SetWindowVisibility(embed_window_id, true)); 390 EXPECT_TRUE(wm_tree->SetWindowVisibility(embed_window_id, true));
390 EXPECT_TRUE(wm_tree->AddWindow(FirstRootId(wm_tree), embed_window_id)); 391 EXPECT_TRUE(wm_tree->AddWindow(FirstRootId(wm_tree), embed_window_id));
391 display_->root_window()->SetBounds(root_window_bounds); 392 display_->root_window()->SetBounds(root_window_bounds);
392 mojom::WindowTreeClientPtr client; 393 mojom::WindowTreeClientPtr client;
393 mojom::WindowTreeClientRequest client_request = GetProxy(&client); 394 mojom::WindowTreeClientRequest client_request = GetProxy(&client);
394 wm_client_->Bind(std::move(client_request)); 395 wm_client_->Bind(std::move(client_request));
395 wm_tree->Embed(embed_window_id, std::move(client)); 396 const uint32_t embed_flags = 0;
397 wm_tree->Embed(embed_window_id, std::move(client), embed_flags);
396 ServerWindow* embed_window = wm_tree->GetWindowByClientId(embed_window_id); 398 ServerWindow* embed_window = wm_tree->GetWindowByClientId(embed_window_id);
397 WindowTree* tree1 = window_server_->GetTreeWithRoot(embed_window); 399 WindowTree* tree1 = window_server_->GetTreeWithRoot(embed_window);
398 EXPECT_NE(nullptr, tree1); 400 EXPECT_NE(nullptr, tree1);
399 EXPECT_NE(tree1, wm_tree); 401 EXPECT_NE(tree1, wm_tree);
400 WindowTreeTestApi(tree1).set_user_id(wm_tree->user_id()); 402 WindowTreeTestApi(tree1).set_user_id(wm_tree->user_id());
401 403
402 embed_window->SetBounds(window_bounds); 404 embed_window->SetBounds(window_bounds);
403 405
404 return embed_window; 406 return embed_window;
405 } 407 }
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
486 return nullptr; 488 return nullptr;
487 if (!tree->AddWindow(parent_client_id, client_window_id)) 489 if (!tree->AddWindow(parent_client_id, client_window_id))
488 return nullptr; 490 return nullptr;
489 *client_id = client_window_id; 491 *client_id = client_window_id;
490 return tree->GetWindowByClientId(client_window_id); 492 return tree->GetWindowByClientId(client_window_id);
491 } 493 }
492 494
493 } // namespace test 495 } // namespace test
494 } // namespace ws 496 } // namespace ws
495 } // namespace mus 497 } // namespace mus
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698