| OLD | NEW |
| (Empty) |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef SERVICES_UI_PUBLIC_CPP_TESTS_TEST_WINDOW_TREE_H_ | |
| 6 #define SERVICES_UI_PUBLIC_CPP_TESTS_TEST_WINDOW_TREE_H_ | |
| 7 | |
| 8 #include <stdint.h> | |
| 9 | |
| 10 #include <set> | |
| 11 | |
| 12 #include "base/macros.h" | |
| 13 #include "services/ui/public/interfaces/window_tree.mojom.h" | |
| 14 | |
| 15 namespace ui { | |
| 16 | |
| 17 // Testing WindowTree implementation. | |
| 18 class TestWindowTree : public mojom::WindowTree { | |
| 19 public: | |
| 20 TestWindowTree(); | |
| 21 ~TestWindowTree() override; | |
| 22 | |
| 23 // Returns the most recent change_id supplied to one of the WindowTree | |
| 24 // functions. Returns false if one of the WindowTree functions has not been | |
| 25 // invoked since the last GetAndClearChangeId(). | |
| 26 bool GetAndClearChangeId(uint32_t* change_id); | |
| 27 | |
| 28 uint32_t window_id() const { return window_id_; } | |
| 29 | |
| 30 bool WasEventAcked(uint32_t event_id) const; | |
| 31 | |
| 32 private: | |
| 33 // mojom::WindowTree: | |
| 34 void NewWindow(uint32_t change_id, | |
| 35 uint32_t window_id, | |
| 36 const base::Optional< | |
| 37 std::unordered_map<std::string, std::vector<uint8_t>>>& | |
| 38 properties) override; | |
| 39 void NewTopLevelWindow( | |
| 40 uint32_t change_id, | |
| 41 uint32_t window_id, | |
| 42 const std::unordered_map<std::string, std::vector<uint8_t>>& properties) | |
| 43 override; | |
| 44 void DeleteWindow(uint32_t change_id, uint32_t window_id) override; | |
| 45 void SetWindowBounds(uint32_t change_id, | |
| 46 uint32_t window_id, | |
| 47 const gfx::Rect& bounds) override; | |
| 48 void SetClientArea(uint32_t window_id, | |
| 49 const gfx::Insets& insets, | |
| 50 const base::Optional<std::vector<gfx::Rect>>& | |
| 51 additional_client_areas) override; | |
| 52 void SetHitTestMask(uint32_t window_id, | |
| 53 const base::Optional<gfx::Rect>& mask) override; | |
| 54 void SetCanAcceptDrops(uint32_t window_id, bool accepts_drags) override; | |
| 55 void SetWindowVisibility(uint32_t change_id, | |
| 56 uint32_t window_id, | |
| 57 bool visible) override; | |
| 58 void SetWindowProperty( | |
| 59 uint32_t change_id, | |
| 60 uint32_t window_id, | |
| 61 const std::string& name, | |
| 62 const base::Optional<std::vector<uint8_t>>& value) override; | |
| 63 void SetWindowOpacity(uint32_t change_id, | |
| 64 uint32_t window_id, | |
| 65 float opacity) override; | |
| 66 void AttachCompositorFrameSink( | |
| 67 uint32_t window_id, | |
| 68 mojo::InterfaceRequest<cc::mojom::MojoCompositorFrameSink> surface, | |
| 69 cc::mojom::MojoCompositorFrameSinkClientPtr client) override; | |
| 70 void AddWindow(uint32_t change_id, uint32_t parent, uint32_t child) override; | |
| 71 void RemoveWindowFromParent(uint32_t change_id, uint32_t window_id) override; | |
| 72 void AddTransientWindow(uint32_t change_id, | |
| 73 uint32_t window_id, | |
| 74 uint32_t transient_window_id) override; | |
| 75 void RemoveTransientWindowFromParent(uint32_t change_id, | |
| 76 uint32_t window_id) override; | |
| 77 void SetModal(uint32_t change_id, uint32_t window_id) override; | |
| 78 void ReorderWindow(uint32_t change_id, | |
| 79 uint32_t window_id, | |
| 80 uint32_t relative_window_id, | |
| 81 mojom::OrderDirection direction) override; | |
| 82 void GetWindowTree(uint32_t window_id, | |
| 83 const GetWindowTreeCallback& callback) override; | |
| 84 void SetCapture(uint32_t change_id, uint32_t window_id) override; | |
| 85 void ReleaseCapture(uint32_t change_id, uint32_t window_id) override; | |
| 86 void StartPointerWatcher(bool want_moves) override; | |
| 87 void StopPointerWatcher() override; | |
| 88 void Embed(uint32_t window_id, | |
| 89 mojom::WindowTreeClientPtr client, | |
| 90 uint32_t flags, | |
| 91 const EmbedCallback& callback) override; | |
| 92 void SetFocus(uint32_t change_id, uint32_t window_id) override; | |
| 93 void SetCanFocus(uint32_t window_id, bool can_focus) override; | |
| 94 void SetCanAcceptEvents(uint32_t window_id, bool can_accept_events) override; | |
| 95 void SetPredefinedCursor(uint32_t change_id, | |
| 96 uint32_t window_id, | |
| 97 ui::mojom::Cursor cursor_id) override; | |
| 98 void SetWindowTextInputState(uint32_t window_id, | |
| 99 mojo::TextInputStatePtr state) override; | |
| 100 void SetImeVisibility(uint32_t window_id, | |
| 101 bool visible, | |
| 102 mojo::TextInputStatePtr state) override; | |
| 103 void OnWindowInputEventAck(uint32_t event_id, | |
| 104 ui::mojom::EventResult result) override; | |
| 105 void DeactivateWindow(uint32_t window_id) override; | |
| 106 void StackAtTop(uint32_t change_id, uint32_t window_id) override; | |
| 107 void GetWindowManagerClient( | |
| 108 mojo::AssociatedInterfaceRequest<mojom::WindowManagerClient> internal) | |
| 109 override; | |
| 110 void GetCursorLocationMemory(const GetCursorLocationMemoryCallback& callback) | |
| 111 override; | |
| 112 void PerformDragDrop( | |
| 113 uint32_t change_id, | |
| 114 uint32_t source_window_id, | |
| 115 const std::unordered_map<std::string, std::vector<uint8_t>>& drag_data, | |
| 116 uint32_t drag_operation) override; | |
| 117 void CancelDragDrop(uint32_t window_id) override; | |
| 118 void PerformWindowMove(uint32_t change_id, | |
| 119 uint32_t window_id, | |
| 120 mojom::MoveLoopSource source, | |
| 121 const gfx::Point& cursor_location) override; | |
| 122 void CancelWindowMove(uint32_t window_id) override; | |
| 123 | |
| 124 bool got_change_; | |
| 125 uint32_t change_id_; | |
| 126 std::set<uint32_t> acked_events_; | |
| 127 uint32_t window_id_; | |
| 128 | |
| 129 DISALLOW_COPY_AND_ASSIGN(TestWindowTree); | |
| 130 }; | |
| 131 | |
| 132 } // namespace ui | |
| 133 | |
| 134 #endif // SERVICES_UI_PUBLIC_CPP_TESTS_TEST_WINDOW_TREE_H_ | |
| OLD | NEW |