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

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: review comments 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
79 private: 83 private:
80 WindowTree* tree_; 84 WindowTree* tree_;
81 85
82 DISALLOW_COPY_AND_ASSIGN(WindowTreeTestApi); 86 DISALLOW_COPY_AND_ASSIGN(WindowTreeTestApi);
83 }; 87 };
84 88
85 // ----------------------------------------------------------------------------- 89 // -----------------------------------------------------------------------------
86 90
87 class DisplayTestApi { 91 class DisplayTestApi {
88 public: 92 public:
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
282 void OnWindowVisibilityChanged(uint32_t window, bool visible) override; 286 void OnWindowVisibilityChanged(uint32_t window, bool visible) override;
283 void OnWindowOpacityChanged(uint32_t window, 287 void OnWindowOpacityChanged(uint32_t window,
284 float old_opacity, 288 float old_opacity,
285 float new_opacity) override; 289 float new_opacity) override;
286 void OnWindowParentDrawnStateChanged(uint32_t window, bool drawn) override; 290 void OnWindowParentDrawnStateChanged(uint32_t window, bool drawn) override;
287 void OnWindowSharedPropertyChanged(uint32_t window, 291 void OnWindowSharedPropertyChanged(uint32_t window,
288 const mojo::String& name, 292 const mojo::String& name,
289 mojo::Array<uint8_t> new_data) override; 293 mojo::Array<uint8_t> new_data) override;
290 void OnWindowInputEvent(uint32_t event_id, 294 void OnWindowInputEvent(uint32_t event_id,
291 uint32_t window, 295 uint32_t window,
292 mojom::EventPtr event) override; 296 mojom::EventPtr event,
297 bool matched_observer) override;
298 void OnEventObserved(mojom::EventPtr event) override;
293 void OnWindowFocused(uint32_t focused_window_id) override; 299 void OnWindowFocused(uint32_t focused_window_id) override;
294 void OnWindowPredefinedCursorChanged(uint32_t window_id, 300 void OnWindowPredefinedCursorChanged(uint32_t window_id,
295 mojom::Cursor cursor_id) override; 301 mojom::Cursor cursor_id) override;
296 void OnChangeCompleted(uint32_t change_id, bool success) override; 302 void OnChangeCompleted(uint32_t change_id, bool success) override;
297 void RequestClose(uint32_t window_id) override; 303 void RequestClose(uint32_t window_id) override;
298 void GetWindowManager( 304 void GetWindowManager(
299 mojo::AssociatedInterfaceRequest<mojom::WindowManager> internal) override; 305 mojo::AssociatedInterfaceRequest<mojom::WindowManager> internal) override;
300 306
301 TestChangeTracker tracker_; 307 TestChangeTracker tracker_;
302 mojo::Binding<mojom::WindowTreeClient> binding_; 308 mojo::Binding<mojom::WindowTreeClient> binding_;
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
400 406
401 // Creates a new visible window as a child of the single root of |tree|. 407 // Creates a new visible window as a child of the single root of |tree|.
402 // |client_id| set to the ClientWindowId of the new window. 408 // |client_id| set to the ClientWindowId of the new window.
403 ServerWindow* NewWindowInTree(WindowTree* tree, ClientWindowId* client_id); 409 ServerWindow* NewWindowInTree(WindowTree* tree, ClientWindowId* client_id);
404 410
405 } // namespace test 411 } // namespace test
406 } // namespace ws 412 } // namespace ws
407 } // namespace mus 413 } // namespace mus
408 414
409 #endif // COMPONENTS_MUS_WS_TEST_UTILS_H_ 415 #endif // COMPONENTS_MUS_WS_TEST_UTILS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698