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

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

Issue 2481013008: Delete WindowManagerWindowTreeFactorySetTestApi. (Closed)
Patch Set: Make const ref. Created 4 years, 1 month 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/user_display_manager_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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 // Used the id of the client in the upper bits to simplify things. 81 // Used the id of the client in the upper bits to simplify things.
82 const ClientWindowId client_id = 82 const ClientWindowId client_id =
83 ClientWindowId(WindowIdToTransportId(WindowId(tree->id(), id))); 83 ClientWindowId(WindowIdToTransportId(WindowId(tree->id(), id)));
84 if (!tree->GetWindowByClientId(client_id)) 84 if (!tree->GetWindowByClientId(client_id))
85 return client_id; 85 return client_id;
86 } 86 }
87 } 87 }
88 88
89 } // namespace 89 } // namespace
90 90
91 // WindowManagerWindowTreeFactorySetTestApi ------------------------------------
92
93 WindowManagerWindowTreeFactorySetTestApi::
94 WindowManagerWindowTreeFactorySetTestApi(
95 WindowManagerWindowTreeFactorySet*
96 window_manager_window_tree_factory_set)
97 : window_manager_window_tree_factory_set_(
98 window_manager_window_tree_factory_set) {}
99
100 WindowManagerWindowTreeFactorySetTestApi::
101 ~WindowManagerWindowTreeFactorySetTestApi() {}
102
103 void WindowManagerWindowTreeFactorySetTestApi::Add(const UserId& user_id) {
104 WindowManagerWindowTreeFactory* factory =
105 window_manager_window_tree_factory_set_->Add(user_id, nullptr);
106 factory->CreateWindowTree(nullptr, nullptr);
107 }
108
109 // TestPlatformDisplayFactory ------------------------------------------------- 91 // TestPlatformDisplayFactory -------------------------------------------------
110 92
111 const int64_t TestPlatformDisplayFactory::kFirstDisplayId = 1; 93 const int64_t TestPlatformDisplayFactory::kFirstDisplayId = 1;
112 94
113 TestPlatformDisplayFactory::TestPlatformDisplayFactory( 95 TestPlatformDisplayFactory::TestPlatformDisplayFactory(
114 mojom::Cursor* cursor_storage) 96 mojom::Cursor* cursor_storage)
115 : cursor_storage_(cursor_storage), 97 : cursor_storage_(cursor_storage),
116 next_display_id_(kFirstDisplayId) {} 98 next_display_id_(kFirstDisplayId) {}
117 99
118 TestPlatformDisplayFactory::~TestPlatformDisplayFactory() {} 100 TestPlatformDisplayFactory::~TestPlatformDisplayFactory() {}
(...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after
542 *window = child1; 524 *window = child1;
543 } 525 }
544 526
545 void WindowEventTargetingHelper::SetTaskRunner( 527 void WindowEventTargetingHelper::SetTaskRunner(
546 scoped_refptr<base::SingleThreadTaskRunner> task_runner) { 528 scoped_refptr<base::SingleThreadTaskRunner> task_runner) {
547 ws_test_helper_.message_loop()->SetTaskRunner(task_runner); 529 ws_test_helper_.message_loop()->SetTaskRunner(task_runner);
548 } 530 }
549 531
550 // ---------------------------------------------------------------------------- 532 // ----------------------------------------------------------------------------
551 533
534 void AddWindowManager(WindowServer* window_server, const UserId& user_id) {
535 window_server->window_manager_window_tree_factory_set()
536 ->Add(user_id, nullptr)
537 ->CreateWindowTree(nullptr, nullptr);
538 }
539
552 ServerWindow* FirstRoot(WindowTree* tree) { 540 ServerWindow* FirstRoot(WindowTree* tree) {
553 return tree->roots().size() == 1u 541 return tree->roots().size() == 1u
554 ? tree->GetWindow((*tree->roots().begin())->id()) 542 ? tree->GetWindow((*tree->roots().begin())->id())
555 : nullptr; 543 : nullptr;
556 } 544 }
557 545
558 ClientWindowId FirstRootId(WindowTree* tree) { 546 ClientWindowId FirstRootId(WindowTree* tree) {
559 ServerWindow* first_root = FirstRoot(tree); 547 ServerWindow* first_root = FirstRoot(tree);
560 return first_root ? ClientWindowIdForWindow(tree, first_root) 548 return first_root ? ClientWindowIdForWindow(tree, first_root)
561 : ClientWindowId(); 549 : ClientWindowId();
(...skipping 26 matching lines...) Expand all
588 return nullptr; 576 return nullptr;
589 if (!tree->AddWindow(parent_client_id, client_window_id)) 577 if (!tree->AddWindow(parent_client_id, client_window_id))
590 return nullptr; 578 return nullptr;
591 *client_id = client_window_id; 579 *client_id = client_window_id;
592 return tree->GetWindowByClientId(client_window_id); 580 return tree->GetWindowByClientId(client_window_id);
593 } 581 }
594 582
595 } // namespace test 583 } // namespace test
596 } // namespace ws 584 } // namespace ws
597 } // namespace ui 585 } // namespace ui
OLDNEW
« no previous file with comments | « services/ui/ws/test_utils.h ('k') | services/ui/ws/user_display_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698