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

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

Issue 1909733002: mus: Add EventObserver to allow passively listening to UI events (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 8 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 #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/window_manager_factory_registry.h" 22 #include "components/mus/ws/window_manager_factory_registry.h"
22 #include "components/mus/ws/window_manager_state.h" 23 #include "components/mus/ws/window_manager_state.h"
23 #include "components/mus/ws/window_server_delegate.h" 24 #include "components/mus/ws/window_server_delegate.h"
24 #include "components/mus/ws/window_tree.h" 25 #include "components/mus/ws/window_tree.h"
25 #include "components/mus/ws/window_tree_binding.h" 26 #include "components/mus/ws/window_tree_binding.h"
26 27
27 namespace mus { 28 namespace mus {
28 namespace ws { 29 namespace ws {
29 namespace test { 30 namespace test {
30 31
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 DISALLOW_COPY_AND_ASSIGN(UserDisplayManagerTestApi); 63 DISALLOW_COPY_AND_ASSIGN(UserDisplayManagerTestApi);
63 }; 64 };
64 65
65 // ----------------------------------------------------------------------------- 66 // -----------------------------------------------------------------------------
66 67
67 class WindowTreeTestApi { 68 class WindowTreeTestApi {
68 public: 69 public:
69 WindowTreeTestApi(WindowTree* tree); 70 WindowTreeTestApi(WindowTree* tree);
70 ~WindowTreeTestApi(); 71 ~WindowTreeTestApi();
71 72
73 void set_user_id(const UserId& user_id) { tree_->user_id_ = user_id; }
72 void set_window_manager_internal(mojom::WindowManager* wm_internal) { 74 void set_window_manager_internal(mojom::WindowManager* wm_internal) {
73 tree_->window_manager_internal_ = wm_internal; 75 tree_->window_manager_internal_ = wm_internal;
74 } 76 }
75 77
76 void ClearAck() { tree_->event_ack_id_ = 0; } 78 void ClearAck() { tree_->event_ack_id_ = 0; }
77 void EnableCapture() { tree_->event_ack_id_ = 1u; } 79 void EnableCapture() { tree_->event_ack_id_ = 1u; }
78 80
81 void SetEventObserver(mojom::EventMatcherPtr matcher,
82 uint32_t event_observer_id);
83
79 private: 84 private:
80 WindowTree* tree_; 85 WindowTree* tree_;
81 86
82 DISALLOW_COPY_AND_ASSIGN(WindowTreeTestApi); 87 DISALLOW_COPY_AND_ASSIGN(WindowTreeTestApi);
83 }; 88 };
84 89
85 // ----------------------------------------------------------------------------- 90 // -----------------------------------------------------------------------------
86 91
87 class DisplayTestApi { 92 class DisplayTestApi {
88 public: 93 public:
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
282 void OnWindowVisibilityChanged(uint32_t window, bool visible) override; 287 void OnWindowVisibilityChanged(uint32_t window, bool visible) override;
283 void OnWindowOpacityChanged(uint32_t window, 288 void OnWindowOpacityChanged(uint32_t window,
284 float old_opacity, 289 float old_opacity,
285 float new_opacity) override; 290 float new_opacity) override;
286 void OnWindowParentDrawnStateChanged(uint32_t window, bool drawn) override; 291 void OnWindowParentDrawnStateChanged(uint32_t window, bool drawn) override;
287 void OnWindowSharedPropertyChanged(uint32_t window, 292 void OnWindowSharedPropertyChanged(uint32_t window,
288 const mojo::String& name, 293 const mojo::String& name,
289 mojo::Array<uint8_t> new_data) override; 294 mojo::Array<uint8_t> new_data) override;
290 void OnWindowInputEvent(uint32_t event_id, 295 void OnWindowInputEvent(uint32_t event_id,
291 uint32_t window, 296 uint32_t window,
292 mojom::EventPtr event) override; 297 mojom::EventPtr event,
298 uint32_t event_observer_id) override;
299 void OnEventObserved(mojom::EventPtr event,
300 uint32_t event_observer_id) override;
293 void OnWindowFocused(uint32_t focused_window_id) override; 301 void OnWindowFocused(uint32_t focused_window_id) override;
294 void OnWindowPredefinedCursorChanged(uint32_t window_id, 302 void OnWindowPredefinedCursorChanged(uint32_t window_id,
295 mojom::Cursor cursor_id) override; 303 mojom::Cursor cursor_id) override;
296 void OnChangeCompleted(uint32_t change_id, bool success) override; 304 void OnChangeCompleted(uint32_t change_id, bool success) override;
297 void RequestClose(uint32_t window_id) override; 305 void RequestClose(uint32_t window_id) override;
298 void GetWindowManager( 306 void GetWindowManager(
299 mojo::AssociatedInterfaceRequest<mojom::WindowManager> internal) override; 307 mojo::AssociatedInterfaceRequest<mojom::WindowManager> internal) override;
300 308
301 TestChangeTracker tracker_; 309 TestChangeTracker tracker_;
302 mojo::Binding<mojom::WindowTreeClient> binding_; 310 mojo::Binding<mojom::WindowTreeClient> binding_;
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
401 409
402 // Creates a new visible window as a child of the single root of |tree|. 410 // Creates a new visible window as a child of the single root of |tree|.
403 // |client_id| set to the ClientWindowId of the new window. 411 // |client_id| set to the ClientWindowId of the new window.
404 ServerWindow* NewWindowInTree(WindowTree* tree, ClientWindowId* client_id); 412 ServerWindow* NewWindowInTree(WindowTree* tree, ClientWindowId* client_id);
405 413
406 } // namespace test 414 } // namespace test
407 } // namespace ws 415 } // namespace ws
408 } // namespace mus 416 } // namespace mus
409 417
410 #endif // COMPONENTS_MUS_WS_TEST_UTILS_H_ 418 #endif // COMPONENTS_MUS_WS_TEST_UTILS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698