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

Side by Side Diff: runtime/vm/message_handler_test.cc

Issue 243973002: - Add a minimal implementation of Capability. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "vm/message_handler.h" 5 #include "vm/message_handler.h"
6 #include "vm/port.h" 6 #include "vm/port.h"
7 #include "vm/unit_test.h" 7 #include "vm/unit_test.h"
8 8
9 namespace dart { 9 namespace dart {
10 10
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 return (reinterpret_cast<TestMessageHandler*>(data))->End(); 116 return (reinterpret_cast<TestMessageHandler*>(data))->End();
117 } 117 }
118 118
119 119
120 UNIT_TEST_CASE(MessageHandler_PostMessage) { 120 UNIT_TEST_CASE(MessageHandler_PostMessage) {
121 TestMessageHandler handler; 121 TestMessageHandler handler;
122 MessageHandlerTestPeer handler_peer(&handler); 122 MessageHandlerTestPeer handler_peer(&handler);
123 EXPECT_EQ(0, handler.notify_count()); 123 EXPECT_EQ(0, handler.notify_count());
124 124
125 // Post a message. 125 // Post a message.
126 Message* message = new Message(0, NULL, 0, Message::kNormalPriority); 126 Message* message = new Message(1, NULL, 0, Message::kNormalPriority);
127 handler_peer.PostMessage(message); 127 handler_peer.PostMessage(message);
128 128
129 // The notify callback is called. 129 // The notify callback is called.
130 EXPECT_EQ(1, handler.notify_count()); 130 EXPECT_EQ(1, handler.notify_count());
131 131
132 // The message has been added to the correct queue. 132 // The message has been added to the correct queue.
133 EXPECT(message == handler_peer.queue()->Dequeue()); 133 EXPECT(message == handler_peer.queue()->Dequeue());
134 EXPECT(NULL == handler_peer.oob_queue()->Dequeue()); 134 EXPECT(NULL == handler_peer.oob_queue()->Dequeue());
135 delete message; 135 delete message;
136 136
137 // Post an oob message. 137 // Post an oob message.
138 message = new Message(0, NULL, 0, Message::kOOBPriority); 138 message = new Message(1, NULL, 0, Message::kOOBPriority);
139 handler_peer.PostMessage(message); 139 handler_peer.PostMessage(message);
140 140
141 // The notify callback is called. 141 // The notify callback is called.
142 EXPECT_EQ(2, handler.notify_count()); 142 EXPECT_EQ(2, handler.notify_count());
143 143
144 // The message has been added to the correct queue. 144 // The message has been added to the correct queue.
145 EXPECT(message == handler_peer.oob_queue()->Dequeue()); 145 EXPECT(message == handler_peer.oob_queue()->Dequeue());
146 EXPECT(NULL == handler_peer.queue()->Dequeue()); 146 EXPECT(NULL == handler_peer.queue()->Dequeue());
147 delete message; 147 delete message;
148 } 148 }
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
302 EXPECT_EQ(port, handler_ports[0]); 302 EXPECT_EQ(port, handler_ports[0]);
303 for (int i = 1; i < 11; i++) { 303 for (int i = 1; i < 11; i++) {
304 EXPECT_EQ(ports[i - 1], handler_ports[i]); 304 EXPECT_EQ(ports[i - 1], handler_ports[i]);
305 } 305 }
306 handler_peer.decrement_live_ports(); 306 handler_peer.decrement_live_ports();
307 EXPECT(!handler.HasLivePorts()); 307 EXPECT(!handler.HasLivePorts());
308 PortMap::ClosePorts(&handler); 308 PortMap::ClosePorts(&handler);
309 } 309 }
310 310
311 } // namespace dart 311 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698