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

Unified Diff: ui/events/mojo/struct_traits_unittest.cc

Issue 2765773002: Adds KeyEvent::properties (Closed)
Patch Set: Created 3 years, 9 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
« ui/events/mojo/BUILD.gn ('K') | « ui/events/mojo/latency_info.typemap ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/events/mojo/struct_traits_unittest.cc
diff --git a/ui/events/mojo/struct_traits_unittest.cc b/ui/events/mojo/struct_traits_unittest.cc
index ab44dbd54e304bb33ca9bc1fc5aa9ce83a203dad..be36023729c0a6242151e774ff16f5cebc5fda59 100644
--- a/ui/events/mojo/struct_traits_unittest.cc
+++ b/ui/events/mojo/struct_traits_unittest.cc
@@ -5,7 +5,11 @@
#include "base/message_loop/message_loop.h"
#include "mojo/public/cpp/bindings/binding_set.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "ui/events/event.h"
#include "ui/events/keycodes/dom/dom_code.h"
+#include "ui/events/mojo/event.mojom.h"
+#include "ui/events/mojo/event_struct_traits.h"
+#include "ui/events/mojo/latency_info_struct_traits.h"
#include "ui/events/mojo/traits_test_service.mojom.h"
namespace ui {
@@ -251,4 +255,21 @@ TEST_F(StructTraitsTest, PointerWheelEvent) {
}
}
+TEST_F(StructTraitsTest, KeyEventPropertiesSerialized) {
+ KeyEvent key_event(ET_KEY_PRESSED, VKEY_T, EF_NONE);
+ const std::string key = "key";
+ const std::vector<uint8_t> value(0xCD, 2);
+ KeyEvent::Properties properties;
+ properties[key] = value;
+ key_event.SetProperties(properties);
+
+ std::unique_ptr<Event> event_ptr = Event::Clone(key_event);
+ std::unique_ptr<Event> deserialized;
+ ASSERT_TRUE(mojom::Event::Deserialize(mojom::Event::Serialize(&event_ptr),
+ &deserialized));
+ ASSERT_TRUE(deserialized->IsKeyEvent());
+ ASSERT_TRUE(deserialized->AsKeyEvent()->properties());
+ EXPECT_EQ(properties, *(deserialized->AsKeyEvent()->properties()));
+}
+
} // namespace ui
« ui/events/mojo/BUILD.gn ('K') | « ui/events/mojo/latency_info.typemap ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698