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

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

Issue 2072343002: Changes how window manager obtains WindowTree from mus (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: include 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
« no previous file with comments | « components/mus/ws/display_unittest.cc ('k') | components/mus/ws/test_utils.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 #ifndef COMPONENTS_MUS_WS_TEST_UTILS_H_ 5 #ifndef COMPONENTS_MUS_WS_TEST_UTILS_H_
6 #define COMPONENTS_MUS_WS_TEST_UTILS_H_ 6 #define COMPONENTS_MUS_WS_TEST_UTILS_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <vector> 10 #include <vector>
11 11
12 #include "components/mus/public/interfaces/display.mojom.h" 12 #include "components/mus/public/interfaces/display.mojom.h"
13 #include "components/mus/public/interfaces/window_tree.mojom.h" 13 #include "components/mus/public/interfaces/window_tree.mojom.h"
14 #include "components/mus/ws/display.h" 14 #include "components/mus/ws/display.h"
15 #include "components/mus/ws/display_binding.h" 15 #include "components/mus/ws/display_binding.h"
16 #include "components/mus/ws/event_dispatcher.h" 16 #include "components/mus/ws/event_dispatcher.h"
17 #include "components/mus/ws/platform_display.h" 17 #include "components/mus/ws/platform_display.h"
18 #include "components/mus/ws/platform_display_factory.h" 18 #include "components/mus/ws/platform_display_factory.h"
19 #include "components/mus/ws/test_change_tracker.h" 19 #include "components/mus/ws/test_change_tracker.h"
20 #include "components/mus/ws/user_display_manager.h" 20 #include "components/mus/ws/user_display_manager.h"
21 #include "components/mus/ws/user_id.h" 21 #include "components/mus/ws/user_id.h"
22 #include "components/mus/ws/window_manager_factory_registry.h"
23 #include "components/mus/ws/window_manager_state.h" 22 #include "components/mus/ws/window_manager_state.h"
23 #include "components/mus/ws/window_manager_window_tree_factory_set.h"
24 #include "components/mus/ws/window_server_delegate.h" 24 #include "components/mus/ws/window_server_delegate.h"
25 #include "components/mus/ws/window_tree.h" 25 #include "components/mus/ws/window_tree.h"
26 #include "components/mus/ws/window_tree_binding.h" 26 #include "components/mus/ws/window_tree_binding.h"
27 27
28 namespace mus { 28 namespace mus {
29 namespace ws { 29 namespace ws {
30 namespace test { 30 namespace test {
31 31
32 // Collection of utilities useful in creating mus tests. 32 // Collection of utilities useful in creating mus tests.
33 33
34 class WindowManagerFactoryRegistryTestApi { 34 class WindowManagerWindowTreeFactorySetTestApi {
35 public: 35 public:
36 explicit WindowManagerFactoryRegistryTestApi( 36 explicit WindowManagerWindowTreeFactorySetTestApi(
37 WindowManagerFactoryRegistry* registry); 37 WindowManagerWindowTreeFactorySet*
38 ~WindowManagerFactoryRegistryTestApi(); 38 window_manager_window_tree_factory_set);
39 ~WindowManagerWindowTreeFactorySetTestApi();
39 40
40 void AddService(const UserId& user_id, mojom::WindowManagerFactory* factory); 41 void Add(const UserId& user_id);
41 42
42 private: 43 private:
43 WindowManagerFactoryRegistry* registry_; 44 WindowManagerWindowTreeFactorySet* window_manager_window_tree_factory_set_;
44 45
45 DISALLOW_COPY_AND_ASSIGN(WindowManagerFactoryRegistryTestApi); 46 DISALLOW_COPY_AND_ASSIGN(WindowManagerWindowTreeFactorySetTestApi);
46 }; 47 };
47 48
48 // ----------------------------------------------------------------------------- 49 // -----------------------------------------------------------------------------
49 50
50 class UserDisplayManagerTestApi { 51 class UserDisplayManagerTestApi {
51 public: 52 public:
52 explicit UserDisplayManagerTestApi(UserDisplayManager* udm) : udm_(udm) {} 53 explicit UserDisplayManagerTestApi(UserDisplayManager* udm) : udm_(udm) {}
53 ~UserDisplayManagerTestApi() {} 54 ~UserDisplayManagerTestApi() {}
54 55
55 void SetTestObserver(mojom::DisplayManagerObserver* observer) { 56 void SetTestObserver(mojom::DisplayManagerObserver* observer) {
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 got_create_top_level_window_ = false; 226 got_create_top_level_window_ = false;
226 *change_id = change_id_; 227 *change_id = change_id_;
227 return true; 228 return true;
228 } 229 }
229 230
230 bool on_accelerator_called() { return on_accelerator_called_; } 231 bool on_accelerator_called() { return on_accelerator_called_; }
231 uint32_t on_accelerator_id() { return on_accelerator_id_; } 232 uint32_t on_accelerator_id() { return on_accelerator_id_; }
232 233
233 private: 234 private:
234 // WindowManager: 235 // WindowManager:
236 void OnConnect(uint16_t client_id) override {}
237 void WmNewDisplayAdded(mus::mojom::DisplayPtr display,
238 mus::mojom::WindowDataPtr root,
239 bool drawn) override {}
235 void WmSetBounds(uint32_t change_id, 240 void WmSetBounds(uint32_t change_id,
236 uint32_t window_id, 241 uint32_t window_id,
237 const gfx::Rect& bounds) override {} 242 const gfx::Rect& bounds) override {}
238 void WmSetProperty(uint32_t change_id, 243 void WmSetProperty(uint32_t change_id,
239 uint32_t window_id, 244 uint32_t window_id,
240 const mojo::String& name, 245 const mojo::String& name,
241 mojo::Array<uint8_t> value) override {} 246 mojo::Array<uint8_t> value) override {}
242 void WmCreateTopLevelWindow( 247 void WmCreateTopLevelWindow(
243 uint32_t change_id, 248 uint32_t change_id,
244 ClientSpecificId requesting_client_id, 249 ClientSpecificId requesting_client_id,
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
465 scoped_refptr<SurfacesState> surfaces_state_; 470 scoped_refptr<SurfacesState> surfaces_state_;
466 std::unique_ptr<WindowServer> window_server_; 471 std::unique_ptr<WindowServer> window_server_;
467 // Needed to Bind to |wm_client_| 472 // Needed to Bind to |wm_client_|
468 base::MessageLoop message_loop_; 473 base::MessageLoop message_loop_;
469 474
470 DISALLOW_COPY_AND_ASSIGN(WindowEventTargetingHelper); 475 DISALLOW_COPY_AND_ASSIGN(WindowEventTargetingHelper);
471 }; 476 };
472 477
473 // ----------------------------------------------------------------------------- 478 // -----------------------------------------------------------------------------
474 479
475 class TestWindowManagerFactory : public mojom::WindowManagerFactory {
476 public:
477 TestWindowManagerFactory();
478 ~TestWindowManagerFactory() override;
479
480 // mojom::WindowManagerFactory:
481 void CreateWindowManager(mus::mojom::DisplayPtr display,
482 mus::mojom::WindowTreeClientRequest client) override;
483
484 private:
485 DISALLOW_COPY_AND_ASSIGN(TestWindowManagerFactory);
486 };
487
488 // -----------------------------------------------------------------------------
489
490 // Returns the first and only root of |tree|. If |tree| has zero or more than 480 // Returns the first and only root of |tree|. If |tree| has zero or more than
491 // one root returns null. 481 // one root returns null.
492 ServerWindow* FirstRoot(WindowTree* tree); 482 ServerWindow* FirstRoot(WindowTree* tree);
493 483
494 // Returns the ClientWindowId of the first root of |tree|, or an empty 484 // Returns the ClientWindowId of the first root of |tree|, or an empty
495 // ClientWindowId if |tree| has zero or more than one root. 485 // ClientWindowId if |tree| has zero or more than one root.
496 ClientWindowId FirstRootId(WindowTree* tree); 486 ClientWindowId FirstRootId(WindowTree* tree);
497 487
498 // Returns |tree|s ClientWindowId for |window|. 488 // Returns |tree|s ClientWindowId for |window|.
499 ClientWindowId ClientWindowIdForWindow(WindowTree* tree, 489 ClientWindowId ClientWindowIdForWindow(WindowTree* tree,
500 const ServerWindow* window); 490 const ServerWindow* window);
501 491
502 // Creates a new visible window as a child of the single root of |tree|. 492 // Creates a new visible window as a child of the single root of |tree|.
503 // |client_id| set to the ClientWindowId of the new window. 493 // |client_id| set to the ClientWindowId of the new window.
504 ServerWindow* NewWindowInTree(WindowTree* tree, ClientWindowId* client_id); 494 ServerWindow* NewWindowInTree(WindowTree* tree, ClientWindowId* client_id);
495 ServerWindow* NewWindowInTreeWithParent(WindowTree* tree,
496 ServerWindow* parent,
497 ClientWindowId* client_id);
505 498
506 } // namespace test 499 } // namespace test
507 } // namespace ws 500 } // namespace ws
508 } // namespace mus 501 } // namespace mus
509 502
510 #endif // COMPONENTS_MUS_WS_TEST_UTILS_H_ 503 #endif // COMPONENTS_MUS_WS_TEST_UTILS_H_
OLDNEW
« no previous file with comments | « components/mus/ws/display_unittest.cc ('k') | components/mus/ws/test_utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698