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

Side by Side Diff: services/ui/ws/user_display_manager_unittest.cc

Issue 2696963003: Split cursor location from UserDisplayManager. (Closed)
Patch Set: Fix nits. Created 3 years, 10 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
« no previous file with comments | « services/ui/ws/user_display_manager.cc ('k') | services/ui/ws/window_manager_state.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #include "services/ui/ws/user_display_manager.h" 5 #include "services/ui/ws/user_display_manager.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <string> 9 #include <string>
10 10
11 #include "base/atomicops.h"
12 #include "base/macros.h" 11 #include "base/macros.h"
13 #include "base/message_loop/message_loop.h" 12 #include "base/message_loop/message_loop.h"
14 #include "base/strings/string_number_conversions.h" 13 #include "base/strings/string_number_conversions.h"
15 #include "mojo/public/cpp/bindings/binding.h" 14 #include "mojo/public/cpp/bindings/binding.h"
16 #include "mojo/public/cpp/bindings/interface_request.h" 15 #include "mojo/public/cpp/bindings/interface_request.h"
17 #include "services/ui/common/task_runner_test_base.h" 16 #include "services/ui/common/task_runner_test_base.h"
18 #include "services/ui/common/types.h" 17 #include "services/ui/common/types.h"
19 #include "services/ui/common/util.h" 18 #include "services/ui/common/util.h"
20 #include "services/ui/display/screen_manager.h" 19 #include "services/ui/display/screen_manager.h"
21 #include "services/ui/ws/display_manager.h" 20 #include "services/ui/ws/display_manager.h"
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 display_manager_observer1.GetAndClearObserverCalls()); 202 display_manager_observer1.GetAndClearObserverCalls());
204 203
205 // Remove the display and verify observer is notified. 204 // Remove the display and verify observer is notified.
206 screen_manager().RemoveDisplay(second_display_id); 205 screen_manager().RemoveDisplay(second_display_id);
207 RunUntilIdle(); 206 RunUntilIdle();
208 207
209 EXPECT_EQ("OnDisplayRemoved 2", 208 EXPECT_EQ("OnDisplayRemoved 2",
210 display_manager_observer1.GetAndClearObserverCalls()); 209 display_manager_observer1.GetAndClearObserverCalls());
211 } 210 }
212 211
213 TEST_F(UserDisplayManagerTest, NegativeCoordinates) {
214 screen_manager().AddDisplay();
215
216 TestDisplayManagerObserver display_manager_observer1;
217 DisplayManager* display_manager = window_server()->display_manager();
218 AddWindowManager(window_server(), kUserId1);
219 UserDisplayManager* user_display_manager1 =
220 display_manager->GetUserDisplayManager(kUserId1);
221 ASSERT_TRUE(user_display_manager1);
222
223 user_display_manager1->OnMouseCursorLocationChanged(gfx::Point(-10, -11));
224
225 base::subtle::Atomic32* cursor_location_memory = nullptr;
226 mojo::ScopedSharedBufferHandle handle =
227 user_display_manager1->GetCursorLocationMemory();
228 mojo::ScopedSharedBufferMapping cursor_location_mapping =
229 handle->Map(sizeof(base::subtle::Atomic32));
230 ASSERT_TRUE(cursor_location_mapping);
231 cursor_location_memory =
232 reinterpret_cast<base::subtle::Atomic32*>(cursor_location_mapping.get());
233
234 base::subtle::Atomic32 location =
235 base::subtle::NoBarrier_Load(cursor_location_memory);
236 EXPECT_EQ(gfx::Point(static_cast<int16_t>(location >> 16),
237 static_cast<int16_t>(location & 0xFFFF)),
238 gfx::Point(-10, -11));
239 }
240
241 } // namespace test 212 } // namespace test
242 } // namespace ws 213 } // namespace ws
243 } // namespace ui 214 } // namespace ui
OLDNEW
« no previous file with comments | « services/ui/ws/user_display_manager.cc ('k') | services/ui/ws/window_manager_state.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698