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

Side by Side Diff: mojo/system/message_pipe_unittest.cc

Issue 64623003: Fix win64 build failure on size truncation (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 7 years, 1 month 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "mojo/system/message_pipe.h" 5 #include "mojo/system/message_pipe.h"
6 6
7 #include "base/memory/ref_counted.h" 7 #include "base/memory/ref_counted.h"
8 #include "base/threading/platform_thread.h" // For |Sleep()|. 8 #include "base/threading/platform_thread.h" // For |Sleep()|.
9 #include "base/time/time.h" 9 #include "base/time/time.h"
10 #include "mojo/system/waiter.h" 10 #include "mojo/system/waiter.h"
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 } 207 }
208 208
209 TEST(MessagePipeTest, CloseWithQueuedIncomingMessages) { 209 TEST(MessagePipeTest, CloseWithQueuedIncomingMessages) {
210 scoped_refptr<MessagePipe> mp(new MessagePipe()); 210 scoped_refptr<MessagePipe> mp(new MessagePipe());
211 211
212 int32_t buffer[1]; 212 int32_t buffer[1];
213 const uint32_t kBufferSize = static_cast<uint32_t>(sizeof(buffer)); 213 const uint32_t kBufferSize = static_cast<uint32_t>(sizeof(buffer));
214 uint32_t buffer_size; 214 uint32_t buffer_size;
215 215
216 // Write some messages from port 1 (to port 0). 216 // Write some messages from port 1 (to port 0).
217 for (size_t i = 0; i < 5; i++) { 217 for (int32_t i = 0; i < 5; i++) {
viettrungluu 2013/11/08 19:02:10 Hey, this was actually me! Oops.
218 buffer[0] = i; 218 buffer[0] = i;
219 EXPECT_EQ(MOJO_RESULT_OK, 219 EXPECT_EQ(MOJO_RESULT_OK,
220 mp->WriteMessage(1, 220 mp->WriteMessage(1,
221 buffer, kBufferSize, 221 buffer, kBufferSize,
222 NULL, 0, 222 NULL, 0,
223 MOJO_WRITE_MESSAGE_FLAG_NONE)); 223 MOJO_WRITE_MESSAGE_FLAG_NONE));
224 } 224 }
225 225
226 // Port 0 shouldn't be empty. 226 // Port 0 shouldn't be empty.
227 buffer_size = 0; 227 buffer_size = 0;
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after
507 507
508 mp->CancelAllWaiters(1); 508 mp->CancelAllWaiters(1);
509 mp->Close(1); 509 mp->Close(1);
510 } // Joins |thread|. 510 } // Joins |thread|.
511 EXPECT_EQ(MOJO_RESULT_FAILED_PRECONDITION, result); 511 EXPECT_EQ(MOJO_RESULT_FAILED_PRECONDITION, result);
512 } 512 }
513 513
514 } // namespace 514 } // namespace
515 } // namespace system 515 } // namespace system
516 } // namespace mojo 516 } // namespace mojo
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698