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(); |