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

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

Issue 8345013: Add a sleep at the end of MessageQueue_WaitNotify to give the spawned (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 9 years, 2 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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/assert.h" 5 #include "vm/assert.h"
6 #include "vm/message_queue.h" 6 #include "vm/message_queue.h"
7 #include "vm/unit_test.h" 7 #include "vm/unit_test.h"
8 8
9 namespace dart { 9 namespace dart {
10 10
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 OS::Sleep(5); 130 OS::Sleep(5);
131 for (int i = 0; i < 3; i++) { 131 for (int i = 0; i < 3; i++) {
132 int* data = reinterpret_cast<int*>(malloc(sizeof(*data))); 132 int* data = reinterpret_cast<int*>(malloc(sizeof(*data)));
133 *data = i+2000; 133 *data = i+2000;
134 PortMessage* msg = new PortMessage(i+20, i+200, data); 134 PortMessage* msg = new PortMessage(i+20, i+200, data);
135 shared_queue->Enqueue(msg); 135 shared_queue->Enqueue(msg);
136 } 136 }
137 137
138 sync = NULL; 138 sync = NULL;
139 delete sync; 139 delete sync;
140
141 // Give the spawned thread enough time to properly exit.
142 OS::Sleep(20);
140 } 143 }
141 144
142 145
143 TEST_CASE(MessageQueue_FlushAll) { 146 TEST_CASE(MessageQueue_FlushAll) {
144 MessageQueue queue; 147 MessageQueue queue;
145 MessageQueueTestPeer queue_peer(&queue); 148 MessageQueueTestPeer queue_peer(&queue);
146 Dart_Port port1 = 1; 149 Dart_Port port1 = 1;
147 Dart_Port port2 = 2; 150 Dart_Port port2 = 2;
148 151
149 // Add two messages. 152 // Add two messages.
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 217
215 EXPECT(!queue_peer.HasMessage()); 218 EXPECT(!queue_peer.HasMessage());
216 queue.Flush(port1); 219 queue.Flush(port1);
217 220
218 // Queue is still empty. 221 // Queue is still empty.
219 EXPECT(!queue_peer.HasMessage()); 222 EXPECT(!queue_peer.HasMessage());
220 } 223 }
221 224
222 225
223 } // namespace dart 226 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698