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

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

Issue 2974233002: VM: Re-format to use at most one newline between functions (Closed)
Patch Set: Rebase and merge Created 3 years, 5 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
« no previous file with comments | « runtime/vm/message_handler_test.cc ('k') | runtime/vm/method_recognizer.h » ('j') | 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) 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.h"
5 #include "platform/assert.h" 6 #include "platform/assert.h"
6 #include "vm/message.h"
7 #include "vm/unit_test.h" 7 #include "vm/unit_test.h"
8 8
9 namespace dart { 9 namespace dart {
10 10
11
12 static uint8_t* AllocMsg(const char* str) { 11 static uint8_t* AllocMsg(const char* str) {
13 return reinterpret_cast<uint8_t*>(strdup(str)); 12 return reinterpret_cast<uint8_t*>(strdup(str));
14 } 13 }
15 14
16
17 TEST_CASE(MessageQueue_BasicOperations) { 15 TEST_CASE(MessageQueue_BasicOperations) {
18 MessageQueue queue; 16 MessageQueue queue;
19 EXPECT(queue.IsEmpty()); 17 EXPECT(queue.IsEmpty());
20 MessageQueue::Iterator it(&queue); 18 MessageQueue::Iterator it(&queue);
21 // Queue is empty. 19 // Queue is empty.
22 EXPECT(!it.HasNext()); 20 EXPECT(!it.HasNext());
23 21
24 Dart_Port port = 1; 22 Dart_Port port = 1;
25 23
26 const char* str1 = "msg1"; 24 const char* str1 = "msg1";
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 EXPECT(queue.IsEmpty()); 115 EXPECT(queue.IsEmpty());
118 116
119 delete msg1; 117 delete msg1;
120 delete msg2; 118 delete msg2;
121 delete msg3; 119 delete msg3;
122 delete msg4; 120 delete msg4;
123 delete msg5; 121 delete msg5;
124 delete msg6; 122 delete msg6;
125 } 123 }
126 124
127
128 TEST_CASE(MessageQueue_Clear) { 125 TEST_CASE(MessageQueue_Clear) {
129 MessageQueue queue; 126 MessageQueue queue;
130 Dart_Port port1 = 1; 127 Dart_Port port1 = 1;
131 Dart_Port port2 = 2; 128 Dart_Port port2 = 2;
132 129
133 const char* str1 = "msg1"; 130 const char* str1 = "msg1";
134 const char* str2 = "msg2"; 131 const char* str2 = "msg2";
135 132
136 // Add two messages. 133 // Add two messages.
137 Message* msg1 = new Message(port1, AllocMsg(str1), strlen(str1) + 1, 134 Message* msg1 = new Message(port1, AllocMsg(str1), strlen(str1) + 1,
138 Message::kNormalPriority); 135 Message::kNormalPriority);
139 queue.Enqueue(msg1, false); 136 queue.Enqueue(msg1, false);
140 Message* msg2 = new Message(port2, AllocMsg(str2), strlen(str2) + 1, 137 Message* msg2 = new Message(port2, AllocMsg(str2), strlen(str2) + 1,
141 Message::kNormalPriority); 138 Message::kNormalPriority);
142 queue.Enqueue(msg2, false); 139 queue.Enqueue(msg2, false);
143 140
144 EXPECT(!queue.IsEmpty()); 141 EXPECT(!queue.IsEmpty());
145 queue.Clear(); 142 queue.Clear();
146 EXPECT(queue.IsEmpty()); 143 EXPECT(queue.IsEmpty());
147 144
148 // msg1 and msg2 already delete by FlushAll. 145 // msg1 and msg2 already delete by FlushAll.
149 } 146 }
150 147
151 } // namespace dart 148 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/message_handler_test.cc ('k') | runtime/vm/method_recognizer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698