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

Unified Diff: runtime/vm/port_test.cc

Issue 1499853004: Adds a special case for sending an int over a port with the native API. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Cleanup Created 5 years 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
Index: runtime/vm/port_test.cc
diff --git a/runtime/vm/port_test.cc b/runtime/vm/port_test.cc
index 165d19c13848c69935e66937b5b11ba3cfc84148..ee443cd83daaaaf261f09174bcadae9d8f516af1 100644
--- a/runtime/vm/port_test.cc
+++ b/runtime/vm/port_test.cc
@@ -151,6 +151,34 @@ TEST_CASE(PortMap_PostMessage) {
}
+TEST_CASE(PortMap_PostIntegerMessage) {
+ PortTestMessageHandler handler;
+ Dart_Port port = PortMap::CreatePort(&handler);
+ EXPECT_EQ(0, handler.notify_count);
+
+ EXPECT(PortMap::PostMessage(new Message(
+ port, Smi::New(42), Message::kNormalPriority)));
+
+ // Check that the message notify callback was called.
+ EXPECT_EQ(1, handler.notify_count);
+ PortMap::ClosePorts(&handler);
+}
+
+
+TEST_CASE(PortMap_PostNullMessage) {
+ PortTestMessageHandler handler;
+ Dart_Port port = PortMap::CreatePort(&handler);
+ EXPECT_EQ(0, handler.notify_count);
+
+ EXPECT(PortMap::PostMessage(new Message(
+ port, Object::null(), Message::kNormalPriority)));
+
+ // Check that the message notify callback was called.
+ EXPECT_EQ(1, handler.notify_count);
+ PortMap::ClosePorts(&handler);
+}
+
+
TEST_CASE(PortMap_PostMessageClosedPort) {
// Create a port id and make it invalid.
PortTestMessageHandler handler;

Powered by Google App Engine
This is Rietveld 408576698