| 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 "services/ui/public/cpp/tests/test_window_tree.h" | |
| 6 | |
| 7 #include "testing/gtest/include/gtest/gtest.h" | |
| 8 | |
| 9 namespace ui { | |
| 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 const base::Optional<std::unordered_map<std::string, std::vector<uint8_t>>>& | |
| 34 properties) {} | |
| 35 | |
| 36 void TestWindowTree::NewTopLevelWindow( | |
| 37 uint32_t change_id, | |
| 38 uint32_t window_id, | |
| 39 const std::unordered_map<std::string, std::vector<uint8_t>>& properties) { | |
| 40 got_change_ = true; | |
| 41 change_id_ = change_id; | |
| 42 window_id_ = window_id; | |
| 43 } | |
| 44 | |
| 45 void TestWindowTree::DeleteWindow(uint32_t change_id, uint32_t window_id) {} | |
| 46 | |
| 47 void TestWindowTree::SetWindowBounds(uint32_t change_id, | |
| 48 uint32_t window_id, | |
| 49 const gfx::Rect& bounds) { | |
| 50 got_change_ = true; | |
| 51 change_id_ = change_id; | |
| 52 } | |
| 53 | |
| 54 void TestWindowTree::SetClientArea( | |
| 55 uint32_t window_id, | |
| 56 const gfx::Insets& insets, | |
| 57 const base::Optional<std::vector<gfx::Rect>>& additional_client_areas) {} | |
| 58 | |
| 59 void TestWindowTree::SetHitTestMask(uint32_t window_id, | |
| 60 const base::Optional<gfx::Rect>& mask) {} | |
| 61 | |
| 62 void TestWindowTree::SetCanAcceptDrops(uint32_t window_id, bool accepts_drops) { | |
| 63 } | |
| 64 | |
| 65 void TestWindowTree::SetWindowVisibility(uint32_t change_id, | |
| 66 uint32_t window_id, | |
| 67 bool visible) { | |
| 68 got_change_ = true; | |
| 69 change_id_ = change_id; | |
| 70 } | |
| 71 | |
| 72 void TestWindowTree::SetWindowProperty( | |
| 73 uint32_t change_id, | |
| 74 uint32_t window_id, | |
| 75 const std::string& name, | |
| 76 const base::Optional<std::vector<uint8_t>>& value) { | |
| 77 got_change_ = true; | |
| 78 change_id_ = change_id; | |
| 79 } | |
| 80 | |
| 81 void TestWindowTree::SetWindowOpacity(uint32_t change_id, | |
| 82 uint32_t window_id, | |
| 83 float opacity) { | |
| 84 got_change_ = true; | |
| 85 change_id_ = change_id; | |
| 86 } | |
| 87 | |
| 88 void TestWindowTree::AttachCompositorFrameSink( | |
| 89 uint32_t window_id, | |
| 90 mojo::InterfaceRequest<cc::mojom::MojoCompositorFrameSink> surface, | |
| 91 cc::mojom::MojoCompositorFrameSinkClientPtr client) {} | |
| 92 | |
| 93 void TestWindowTree::AddWindow(uint32_t change_id, | |
| 94 uint32_t parent, | |
| 95 uint32_t child) {} | |
| 96 | |
| 97 void TestWindowTree::RemoveWindowFromParent(uint32_t change_id, | |
| 98 uint32_t window_id) {} | |
| 99 | |
| 100 void TestWindowTree::AddTransientWindow(uint32_t change_id, | |
| 101 uint32_t window_id, | |
| 102 uint32_t transient_window_id) {} | |
| 103 | |
| 104 void TestWindowTree::RemoveTransientWindowFromParent( | |
| 105 uint32_t change_id, | |
| 106 uint32_t transient_window_id) {} | |
| 107 | |
| 108 void TestWindowTree::SetModal(uint32_t change_id, uint32_t window_id) { | |
| 109 got_change_ = true; | |
| 110 change_id_ = change_id; | |
| 111 } | |
| 112 | |
| 113 void TestWindowTree::ReorderWindow(uint32_t change_id, | |
| 114 uint32_t window_id, | |
| 115 uint32_t relative_window_id, | |
| 116 mojom::OrderDirection direction) {} | |
| 117 | |
| 118 void TestWindowTree::GetWindowTree(uint32_t window_id, | |
| 119 const GetWindowTreeCallback& callback) {} | |
| 120 | |
| 121 void TestWindowTree::SetCapture(uint32_t change_id, uint32_t window_id) { | |
| 122 got_change_ = true; | |
| 123 change_id_ = change_id; | |
| 124 } | |
| 125 | |
| 126 void TestWindowTree::ReleaseCapture(uint32_t change_id, uint32_t window_id) { | |
| 127 got_change_ = true; | |
| 128 change_id_ = change_id; | |
| 129 } | |
| 130 | |
| 131 void TestWindowTree::StartPointerWatcher(bool want_moves) {} | |
| 132 | |
| 133 void TestWindowTree::StopPointerWatcher() {} | |
| 134 | |
| 135 void TestWindowTree::Embed(uint32_t window_id, | |
| 136 mojom::WindowTreeClientPtr client, | |
| 137 uint32_t flags, | |
| 138 const EmbedCallback& callback) {} | |
| 139 | |
| 140 void TestWindowTree::SetFocus(uint32_t change_id, uint32_t window_id) { | |
| 141 got_change_ = true; | |
| 142 change_id_ = change_id; | |
| 143 } | |
| 144 | |
| 145 void TestWindowTree::SetCanFocus(uint32_t window_id, bool can_focus) {} | |
| 146 | |
| 147 void TestWindowTree::SetCanAcceptEvents(uint32_t window_id, | |
| 148 bool can_accept_events) {} | |
| 149 | |
| 150 void TestWindowTree::SetPredefinedCursor(uint32_t change_id, | |
| 151 uint32_t window_id, | |
| 152 ui::mojom::Cursor cursor_id) {} | |
| 153 | |
| 154 void TestWindowTree::SetWindowTextInputState(uint32_t window_id, | |
| 155 mojo::TextInputStatePtr state) {} | |
| 156 | |
| 157 void TestWindowTree::SetImeVisibility(uint32_t window_id, | |
| 158 bool visible, | |
| 159 mojo::TextInputStatePtr state) {} | |
| 160 | |
| 161 void TestWindowTree::OnWindowInputEventAck(uint32_t event_id, | |
| 162 ui::mojom::EventResult result) { | |
| 163 EXPECT_FALSE(acked_events_.count(event_id)); | |
| 164 acked_events_.insert(event_id); | |
| 165 } | |
| 166 | |
| 167 void TestWindowTree::DeactivateWindow(uint32_t window_id) {} | |
| 168 | |
| 169 void TestWindowTree::StackAtTop(uint32_t change_id, uint32_t window_id) {} | |
| 170 | |
| 171 void TestWindowTree::GetWindowManagerClient( | |
| 172 mojo::AssociatedInterfaceRequest<mojom::WindowManagerClient> internal) {} | |
| 173 | |
| 174 void TestWindowTree::GetCursorLocationMemory( | |
| 175 const GetCursorLocationMemoryCallback& callback) { | |
| 176 callback.Run(mojo::ScopedSharedBufferHandle()); | |
| 177 } | |
| 178 | |
| 179 void TestWindowTree::PerformDragDrop( | |
| 180 uint32_t change_id, | |
| 181 uint32_t source_window_id, | |
| 182 const std::unordered_map<std::string, std::vector<uint8_t>>& drag_data, | |
| 183 uint32_t drag_operation) {} | |
| 184 | |
| 185 void TestWindowTree::CancelDragDrop(uint32_t window_id) {} | |
| 186 | |
| 187 void TestWindowTree::PerformWindowMove(uint32_t change_id, | |
| 188 uint32_t window_id, | |
| 189 mojom::MoveLoopSource source, | |
| 190 const gfx::Point& cursor_location) {} | |
| 191 | |
| 192 void TestWindowTree::CancelWindowMove(uint32_t window_id) {} | |
| 193 | |
| 194 } // namespace ui | |
| OLD | NEW |