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

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

Issue 2352893002: Makes windowserver not send messages during shutdown (Closed)
Patch Set: merge Created 4 years, 3 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_server.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 377 matching lines...) Expand 10 before | Expand all | Expand 10 after
388 tracker_.OnChangeCompleted(change_id, success); 388 tracker_.OnChangeCompleted(change_id, success);
389 } 389 }
390 390
391 void TestWindowTreeClient::RequestClose(uint32_t window_id) {} 391 void TestWindowTreeClient::RequestClose(uint32_t window_id) {}
392 392
393 void TestWindowTreeClient::GetWindowManager( 393 void TestWindowTreeClient::GetWindowManager(
394 mojo::AssociatedInterfaceRequest<mojom::WindowManager> internal) {} 394 mojo::AssociatedInterfaceRequest<mojom::WindowManager> internal) {}
395 395
396 // TestWindowTreeBinding ------------------------------------------------------ 396 // TestWindowTreeBinding ------------------------------------------------------
397 397
398 TestWindowTreeBinding::TestWindowTreeBinding(WindowTree* tree) 398 TestWindowTreeBinding::TestWindowTreeBinding(
399 : WindowTreeBinding(&client_), tree_(tree) {} 399 WindowTree* tree,
400 std::unique_ptr<TestWindowTreeClient> client)
401 : WindowTreeBinding(client.get()),
402 tree_(tree),
403 client_(std::move(client)) {}
404
400 TestWindowTreeBinding::~TestWindowTreeBinding() {} 405 TestWindowTreeBinding::~TestWindowTreeBinding() {}
401 406
402 mojom::WindowManager* TestWindowTreeBinding::GetWindowManager() { 407 mojom::WindowManager* TestWindowTreeBinding::GetWindowManager() {
403 if (!window_manager_.get()) 408 if (!window_manager_.get())
404 window_manager_.reset(new TestWindowManager); 409 window_manager_.reset(new TestWindowManager);
405 return window_manager_.get(); 410 return window_manager_.get();
406 } 411 }
407 void TestWindowTreeBinding::SetIncomingMethodCallProcessingPaused(bool paused) { 412 void TestWindowTreeBinding::SetIncomingMethodCallProcessingPaused(bool paused) {
408 is_paused_ = paused; 413 is_paused_ = paused;
409 } 414 }
410 415
416 mojom::WindowTreeClient* TestWindowTreeBinding::CreateClientForShutdown() {
417 DCHECK(!client_after_reset_);
418 client_after_reset_ = base::MakeUnique<TestWindowTreeClient>();
419 return client_after_reset_.get();
420 }
421
411 // TestWindowServerDelegate ---------------------------------------------- 422 // TestWindowServerDelegate ----------------------------------------------
412 423
413 TestWindowServerDelegate::TestWindowServerDelegate() {} 424 TestWindowServerDelegate::TestWindowServerDelegate() {}
414 TestWindowServerDelegate::~TestWindowServerDelegate() {} 425 TestWindowServerDelegate::~TestWindowServerDelegate() {}
415 426
416 Display* TestWindowServerDelegate::AddDisplay() { 427 Display* TestWindowServerDelegate::AddDisplay() {
417 // Display manages its own lifetime. 428 // Display manages its own lifetime.
418 Display* display = new Display(window_server_, PlatformDisplayInitParams()); 429 Display* display = new Display(window_server_, PlatformDisplayInitParams());
419 display->Init(nullptr); 430 display->Init(nullptr);
420 return display; 431 return display;
421 } 432 }
422 433
423 void TestWindowServerDelegate::OnNoMoreDisplays() { 434 void TestWindowServerDelegate::OnNoMoreDisplays() {
424 got_on_no_more_displays_ = true; 435 got_on_no_more_displays_ = true;
425 } 436 }
426 437
427 std::unique_ptr<WindowTreeBinding> 438 std::unique_ptr<WindowTreeBinding>
428 TestWindowServerDelegate::CreateWindowTreeBinding( 439 TestWindowServerDelegate::CreateWindowTreeBinding(
429 BindingType type, 440 BindingType type,
430 ws::WindowServer* window_server, 441 ws::WindowServer* window_server,
431 ws::WindowTree* tree, 442 ws::WindowTree* tree,
432 mojom::WindowTreeRequest* tree_request, 443 mojom::WindowTreeRequest* tree_request,
433 mojom::WindowTreeClientPtr* client) { 444 mojom::WindowTreeClientPtr* client) {
434 std::unique_ptr<TestWindowTreeBinding> binding( 445 std::unique_ptr<TestWindowTreeBinding> binding =
435 new TestWindowTreeBinding(tree)); 446 base::MakeUnique<TestWindowTreeBinding>(tree);
436 bindings_.push_back(binding.get()); 447 bindings_.push_back(binding.get());
437 return std::move(binding); 448 return std::move(binding);
438 } 449 }
439 450
440 void TestWindowServerDelegate::CreateDefaultDisplays() { 451 void TestWindowServerDelegate::CreateDefaultDisplays() {
441 DCHECK(num_displays_to_create_); 452 DCHECK(num_displays_to_create_);
442 DCHECK(window_server_); 453 DCHECK(window_server_);
443 454
444 for (int i = 0; i < num_displays_to_create_; ++i) 455 for (int i = 0; i < num_displays_to_create_; ++i)
445 AddDisplay(); 456 AddDisplay();
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
584 return nullptr; 595 return nullptr;
585 if (!tree->AddWindow(parent_client_id, client_window_id)) 596 if (!tree->AddWindow(parent_client_id, client_window_id))
586 return nullptr; 597 return nullptr;
587 *client_id = client_window_id; 598 *client_id = client_window_id;
588 return tree->GetWindowByClientId(client_window_id); 599 return tree->GetWindowByClientId(client_window_id);
589 } 600 }
590 601
591 } // namespace test 602 } // namespace test
592 } // namespace ws 603 } // namespace ws
593 } // namespace ui 604 } // namespace ui
OLDNEW
« no previous file with comments | « services/ui/ws/test_utils.h ('k') | services/ui/ws/window_server.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698