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

Unified Diff: components/mus/ws/user_display_manager_unittest.cc

Issue 1881253002: mus: Implement ScreenMus::GetCursorScreenPoint(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Merge with tot Created 4 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/mus/ws/user_display_manager.cc ('k') | components/mus/ws/window_manager_state.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/mus/ws/user_display_manager_unittest.cc
diff --git a/components/mus/ws/user_display_manager_unittest.cc b/components/mus/ws/user_display_manager_unittest.cc
index f21c84aaa027a0fe7e3f016e061d90198f9fef97..549312fbe43213d272eea8f59daf1a839b62ff00 100644
--- a/components/mus/ws/user_display_manager_unittest.cc
+++ b/components/mus/ws/user_display_manager_unittest.cc
@@ -6,6 +6,7 @@
#include <string>
+#include "base/atomicops.h"
#include "base/macros.h"
#include "base/message_loop/message_loop.h"
#include "base/strings/string_number_conversions.h"
@@ -227,6 +228,38 @@ TEST_F(UserDisplayManagerTest, AddRemoveDisplay) {
UserDisplayManagerTestApi(user_display_manager1).SetTestObserver(nullptr);
}
+TEST_F(UserDisplayManagerTest, NegativeCoordinates) {
+ window_server_delegate_.set_num_displays_to_create(1);
+
+ const UserId kUserId1 = "2";
+ TestDisplayManagerObserver display_manager_observer1;
+ DisplayManager* display_manager = window_server_->display_manager();
+ WindowManagerFactoryRegistryTestApi(
+ window_server_->window_manager_factory_registry())
+ .AddService(kUserId1, &test_window_manager_factory_);
+ UserDisplayManager* user_display_manager1 =
+ display_manager->GetUserDisplayManager(kUserId1);
+ ASSERT_TRUE(user_display_manager1);
+
+ user_display_manager1->OnMouseCursorLocationChanged(gfx::Point(-10, -11));
+
+ base::subtle::Atomic32* cursor_location_memory = nullptr;
+ mojo::ScopedSharedBufferHandle handle =
+ user_display_manager1->GetCursorLocationMemory();
+ MojoResult result = mojo::MapBuffer(
+ handle.get(), 0,
+ sizeof(base::subtle::Atomic32),
+ reinterpret_cast<void**>(&cursor_location_memory),
+ MOJO_MAP_BUFFER_FLAG_NONE);
+ ASSERT_EQ(MOJO_RESULT_OK, result);
+
+ base::subtle::Atomic32 location =
+ base::subtle::NoBarrier_Load(cursor_location_memory);
+ EXPECT_EQ(gfx::Point(static_cast<int16_t>(location >> 16),
+ static_cast<int16_t>(location & 0xFFFF)),
+ gfx::Point(-10, -11));
+}
+
} // namespace test
} // namespace ws
} // namespace mus
« no previous file with comments | « components/mus/ws/user_display_manager.cc ('k') | components/mus/ws/window_manager_state.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698