| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 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 #include "ui/aura/test/mus/test_window_tree.h" | 5 #include "ui/aura/test/mus/test_window_tree.h" |
| 6 | 6 |
| 7 #include "testing/gtest/include/gtest/gtest.h" | 7 #include "testing/gtest/include/gtest/gtest.h" |
| 8 | 8 |
| 9 namespace aura { | 9 namespace aura { |
| 10 | 10 |
| 11 TestWindowTree::TestWindowTree() {} | 11 TestWindowTree::TestWindowTree() {} |
| 12 | 12 |
| 13 TestWindowTree::~TestWindowTree() {} | 13 TestWindowTree::~TestWindowTree() {} |
| 14 | 14 |
| 15 bool TestWindowTree::WasEventAcked(uint32_t event_id) const { | 15 bool TestWindowTree::WasEventAcked(uint32_t event_id) const { |
| 16 return acked_events_.count(event_id); | 16 for (const AckedEvent& acked_event : acked_events_) { |
| 17 if (acked_event.event_id == event_id) |
| 18 return true; |
| 19 } |
| 20 return false; |
| 21 } |
| 22 |
| 23 ui::mojom::EventResult TestWindowTree::GetEventResult(uint32_t event_id) const { |
| 24 for (const AckedEvent& acked_event : acked_events_) { |
| 25 if (acked_event.event_id == event_id) |
| 26 return acked_event.result; |
| 27 } |
| 28 return ui::mojom::EventResult::UNHANDLED; |
| 17 } | 29 } |
| 18 | 30 |
| 19 base::Optional<std::vector<uint8_t>> TestWindowTree::GetLastPropertyValue() { | 31 base::Optional<std::vector<uint8_t>> TestWindowTree::GetLastPropertyValue() { |
| 20 return std::move(last_property_value_); | 32 return std::move(last_property_value_); |
| 21 } | 33 } |
| 22 | 34 |
| 23 base::Optional<std::unordered_map<std::string, std::vector<uint8_t>>> | 35 base::Optional<std::unordered_map<std::string, std::vector<uint8_t>>> |
| 24 TestWindowTree::GetLastNewWindowProperties() { | 36 TestWindowTree::GetLastNewWindowProperties() { |
| 25 return std::move(last_new_window_properties_); | 37 return std::move(last_new_window_properties_); |
| 26 } | 38 } |
| (...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 244 | 256 |
| 245 void TestWindowTree::SetWindowTextInputState(uint32_t window_id, | 257 void TestWindowTree::SetWindowTextInputState(uint32_t window_id, |
| 246 mojo::TextInputStatePtr state) {} | 258 mojo::TextInputStatePtr state) {} |
| 247 | 259 |
| 248 void TestWindowTree::SetImeVisibility(uint32_t window_id, | 260 void TestWindowTree::SetImeVisibility(uint32_t window_id, |
| 249 bool visible, | 261 bool visible, |
| 250 mojo::TextInputStatePtr state) {} | 262 mojo::TextInputStatePtr state) {} |
| 251 | 263 |
| 252 void TestWindowTree::OnWindowInputEventAck(uint32_t event_id, | 264 void TestWindowTree::OnWindowInputEventAck(uint32_t event_id, |
| 253 ui::mojom::EventResult result) { | 265 ui::mojom::EventResult result) { |
| 254 EXPECT_FALSE(acked_events_.count(event_id)); | 266 EXPECT_FALSE(WasEventAcked(event_id)); |
| 255 acked_events_.insert(event_id); | 267 acked_events_.push_back({event_id, result}); |
| 256 } | 268 } |
| 257 | 269 |
| 258 void TestWindowTree::GetWindowManagerClient( | 270 void TestWindowTree::GetWindowManagerClient( |
| 259 mojo::AssociatedInterfaceRequest<ui::mojom::WindowManagerClient> internal) { | 271 mojo::AssociatedInterfaceRequest<ui::mojom::WindowManagerClient> internal) { |
| 260 } | 272 } |
| 261 | 273 |
| 262 void TestWindowTree::GetCursorLocationMemory( | 274 void TestWindowTree::GetCursorLocationMemory( |
| 263 const GetCursorLocationMemoryCallback& callback) { | 275 const GetCursorLocationMemoryCallback& callback) { |
| 264 callback.Run(mojo::ScopedSharedBufferHandle()); | 276 callback.Run(mojo::ScopedSharedBufferHandle()); |
| 265 } | 277 } |
| (...skipping 11 matching lines...) Expand all Loading... |
| 277 void TestWindowTree::PerformWindowMove(uint32_t change_id, | 289 void TestWindowTree::PerformWindowMove(uint32_t change_id, |
| 278 uint32_t window_id, | 290 uint32_t window_id, |
| 279 ui::mojom::MoveLoopSource source, | 291 ui::mojom::MoveLoopSource source, |
| 280 const gfx::Point& cursor_location) { | 292 const gfx::Point& cursor_location) { |
| 281 OnChangeReceived(change_id); | 293 OnChangeReceived(change_id); |
| 282 } | 294 } |
| 283 | 295 |
| 284 void TestWindowTree::CancelWindowMove(uint32_t window_id) {} | 296 void TestWindowTree::CancelWindowMove(uint32_t window_id) {} |
| 285 | 297 |
| 286 } // namespace aura | 298 } // namespace aura |
| OLD | NEW |