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

Unified Diff: runtime/vm/message_test.cc

Issue 749373002: - Implement Isolate.ping. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 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
« no previous file with comments | « runtime/vm/message_handler.cc ('k') | tests/isolate/isolate.status » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/message_test.cc
===================================================================
--- runtime/vm/message_test.cc (revision 42173)
+++ runtime/vm/message_test.cc (working copy)
@@ -22,19 +22,20 @@
const char* str1 = "msg1";
const char* str2 = "msg2";
+ const char* str3 = "msg3";
+ const char* str4 = "msg4";
+ const char* str5 = "msg5";
+ const char* str6 = "msg6";
// Add two messages.
- Message* msg1 =
- new Message(port, AllocMsg(str1), strlen(str1) + 1,
- Message::kNormalPriority);
- queue.Enqueue(msg1);
+ Message* msg1 = new Message(
+ port, AllocMsg(str1), strlen(str1) + 1, Message::kNormalPriority);
+ queue.Enqueue(msg1, false);
EXPECT(!queue.IsEmpty());
- Message* msg2 =
- new Message(port, AllocMsg(str2), strlen(str2) + 1,
- Message::kNormalPriority);
-
- queue.Enqueue(msg2);
+ Message* msg2 = new Message(
+ port, AllocMsg(str2), strlen(str2) + 1, Message::kNormalPriority);
+ queue.Enqueue(msg2, false);
EXPECT(!queue.IsEmpty());
// Remove two messages.
@@ -48,8 +49,55 @@
EXPECT_STREQ(str2, reinterpret_cast<char*>(msg->data()));
EXPECT(queue.IsEmpty());
+ Message* msg3 = new Message(Message::kIllegalPort,
+ AllocMsg(str3), strlen(str3) + 1,
+ Message::kNormalPriority);
+ queue.Enqueue(msg3, true);
+ EXPECT(!queue.IsEmpty());
+
+ Message* msg4 = new Message(Message::kIllegalPort,
+ AllocMsg(str4), strlen(str4) + 1,
+ Message::kNormalPriority);
+ queue.Enqueue(msg4, true);
+ EXPECT(!queue.IsEmpty());
+
+ Message* msg5 = new Message(
+ port, AllocMsg(str5), strlen(str5) + 1, Message::kNormalPriority);
+ queue.Enqueue(msg5, false);
+ EXPECT(!queue.IsEmpty());
+
+ Message* msg6 = new Message(Message::kIllegalPort,
+ AllocMsg(str6), strlen(str6) + 1,
+ Message::kNormalPriority);
+ queue.Enqueue(msg6, true);
+ EXPECT(!queue.IsEmpty());
+
+ msg = queue.Dequeue();
+ EXPECT(msg != NULL);
+ EXPECT_STREQ(str3, reinterpret_cast<char*>(msg->data()));
+ EXPECT(!queue.IsEmpty());
+
+ msg = queue.Dequeue();
+ EXPECT(msg != NULL);
+ EXPECT_STREQ(str4, reinterpret_cast<char*>(msg->data()));
+ EXPECT(!queue.IsEmpty());
+
+ msg = queue.Dequeue();
+ EXPECT(msg != NULL);
+ EXPECT_STREQ(str6, reinterpret_cast<char*>(msg->data()));
+ EXPECT(!queue.IsEmpty());
+
+ msg = queue.Dequeue();
+ EXPECT(msg != NULL);
+ EXPECT_STREQ(str5, reinterpret_cast<char*>(msg->data()));
+ EXPECT(queue.IsEmpty());
+
delete msg1;
delete msg2;
+ delete msg3;
+ delete msg4;
+ delete msg5;
+ delete msg6;
}
@@ -65,11 +113,11 @@
Message* msg1 =
new Message(port1, AllocMsg(str1), strlen(str1) + 1,
Message::kNormalPriority);
- queue.Enqueue(msg1);
+ queue.Enqueue(msg1, false);
Message* msg2 =
new Message(port2, AllocMsg(str2), strlen(str2) + 1,
Message::kNormalPriority);
- queue.Enqueue(msg2);
+ queue.Enqueue(msg2, false);
EXPECT(!queue.IsEmpty());
queue.Clear();
« no previous file with comments | « runtime/vm/message_handler.cc ('k') | tests/isolate/isolate.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698