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 #include "components/mus/public/cpp/tests/test_window_tree.h" | |
6 | |
7 #include "testing/gtest/include/gtest/gtest.h" | |
8 | |
9 namespace mus { | |
10 | |
11 TestWindowTree::TestWindowTree() | |
12 : got_change_(false), change_id_(0), window_id_(0u) {} | |
13 | |
14 TestWindowTree::~TestWindowTree() {} | |
15 | |
16 bool TestWindowTree::GetAndClearChangeId(uint32_t* change_id) { | |
17 if (!got_change_) | |
18 return false; | |
19 | |
20 if (change_id) | |
21 *change_id = change_id_; | |
22 got_change_ = false; | |
23 return true; | |
24 } | |
25 | |
26 bool TestWindowTree::WasEventAcked(uint32_t event_id) const { | |
27 return acked_events_.count(event_id); | |
28 } | |
29 | |
30 void TestWindowTree::NewWindow( | |
31 uint32_t change_id, | |
32 uint32_t window_id, | |
33 mojo::Map<mojo::String, mojo::Array<uint8_t>> properties) {} | |
34 | |
35 void TestWindowTree::NewTopLevelWindow( | |
36 uint32_t change_id, | |
37 uint32_t window_id, | |
38 mojo::Map<mojo::String, mojo::Array<uint8_t>> properties) { | |
39 got_change_ = true; | |
40 change_id_ = change_id; | |
41 window_id_ = window_id; | |
42 } | |
43 | |
44 void TestWindowTree::DeleteWindow(uint32_t change_id, uint32_t window_id) {} | |
45 | |
46 void TestWindowTree::SetWindowBounds(uint32_t change_id, | |
47 uint32_t window_id, | |
48 const gfx::Rect& bounds) { | |
49 got_change_ = true; | |
50 change_id_ = change_id; | |
51 } | |
52 | |
53 void TestWindowTree::SetClientArea( | |
54 uint32_t window_id, | |
55 const gfx::Insets& insets, | |
56 mojo::Array<gfx::Rect> additional_client_areas) {} | |
57 | |
58 void TestWindowTree::SetHitTestMask(uint32_t window_id, const gfx::Rect& mask) { | |
59 } | |
60 | |
61 void TestWindowTree::SetWindowVisibility(uint32_t change_id, | |
62 uint32_t window_id, | |
63 bool visible) { | |
64 got_change_ = true; | |
65 change_id_ = change_id; | |
66 } | |
67 | |
68 void TestWindowTree::SetWindowProperty(uint32_t change_id, | |
69 uint32_t window_id, | |
70 const mojo::String& name, | |
71 mojo::Array<uint8_t> value) { | |
72 got_change_ = true; | |
73 change_id_ = change_id; | |
74 } | |
75 | |
76 void TestWindowTree::SetWindowOpacity(uint32_t change_id, | |
77 uint32_t window_id, | |
78 float opacity) { | |
79 got_change_ = true; | |
80 change_id_ = change_id; | |
81 } | |
82 | |
83 void TestWindowTree::AttachSurface( | |
84 uint32_t window_id, | |
85 mojom::SurfaceType type, | |
86 mojo::InterfaceRequest<mojom::Surface> surface, | |
87 mojom::SurfaceClientPtr client) {} | |
88 | |
89 void TestWindowTree::AddWindow(uint32_t change_id, | |
90 uint32_t parent, | |
91 uint32_t child) {} | |
92 | |
93 void TestWindowTree::RemoveWindowFromParent(uint32_t change_id, | |
94 uint32_t window_id) {} | |
95 | |
96 void TestWindowTree::AddTransientWindow(uint32_t change_id, | |
97 uint32_t window_id, | |
98 uint32_t transient_window_id) {} | |
99 | |
100 void TestWindowTree::RemoveTransientWindowFromParent( | |
101 uint32_t change_id, | |
102 uint32_t transient_window_id) {} | |
103 | |
104 void TestWindowTree::SetModal(uint32_t change_id, uint32_t window_id) { | |
105 got_change_ = true; | |
106 change_id_ = change_id; | |
107 } | |
108 | |
109 void TestWindowTree::ReorderWindow(uint32_t change_id, | |
110 uint32_t window_id, | |
111 uint32_t relative_window_id, | |
112 mojom::OrderDirection direction) {} | |
113 | |
114 void TestWindowTree::GetWindowTree(uint32_t window_id, | |
115 const GetWindowTreeCallback& callback) {} | |
116 | |
117 void TestWindowTree::SetCapture(uint32_t change_id, uint32_t window_id) { | |
118 got_change_ = true; | |
119 change_id_ = change_id; | |
120 } | |
121 | |
122 void TestWindowTree::ReleaseCapture(uint32_t change_id, uint32_t window_id) { | |
123 got_change_ = true; | |
124 change_id_ = change_id; | |
125 } | |
126 | |
127 void TestWindowTree::SetEventObserver(mojom::EventMatcherPtr matcher, | |
128 uint32_t observer_id) {} | |
129 | |
130 void TestWindowTree::Embed(uint32_t window_id, | |
131 mojom::WindowTreeClientPtr client, | |
132 uint32_t flags, | |
133 const EmbedCallback& callback) {} | |
134 | |
135 void TestWindowTree::SetFocus(uint32_t change_id, uint32_t window_id) { | |
136 got_change_ = true; | |
137 change_id_ = change_id; | |
138 } | |
139 | |
140 void TestWindowTree::SetCanFocus(uint32_t window_id, bool can_focus) {} | |
141 | |
142 void TestWindowTree::SetPredefinedCursor(uint32_t change_id, | |
143 uint32_t window_id, | |
144 mus::mojom::Cursor cursor_id) {} | |
145 | |
146 void TestWindowTree::SetWindowTextInputState(uint32_t window_id, | |
147 mojo::TextInputStatePtr state) {} | |
148 | |
149 void TestWindowTree::SetImeVisibility(uint32_t window_id, | |
150 bool visible, | |
151 mojo::TextInputStatePtr state) {} | |
152 | |
153 void TestWindowTree::OnWindowInputEventAck(uint32_t event_id, | |
154 mus::mojom::EventResult result) { | |
155 EXPECT_FALSE(acked_events_.count(event_id)); | |
156 acked_events_.insert(event_id); | |
157 } | |
158 | |
159 void TestWindowTree::GetWindowManagerClient( | |
160 mojo::AssociatedInterfaceRequest<mojom::WindowManagerClient> internal) {} | |
161 | |
162 void TestWindowTree::GetCursorLocationMemory( | |
163 const GetCursorLocationMemoryCallback& callback) { | |
164 callback.Run(mojo::ScopedSharedBufferHandle()); | |
165 } | |
166 | |
167 } // namespace mus | |
OLD | NEW |