| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 <stdint.h> | 5 #include <stdint.h> |
| 6 #include <string.h> | 6 #include <string.h> |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 359 MOJO_READ_MESSAGE_FLAG_NONE)); | 359 MOJO_READ_MESSAGE_FLAG_NONE)); |
| 360 | 360 |
| 361 buffer_size = static_cast<uint32_t>(sizeof(buffer)); | 361 buffer_size = static_cast<uint32_t>(sizeof(buffer)); |
| 362 EXPECT_EQ(MOJO_RESULT_OK, | 362 EXPECT_EQ(MOJO_RESULT_OK, |
| 363 mp1->ReadMessage(1, | 363 mp1->ReadMessage(1, |
| 364 buffer, &buffer_size, | 364 buffer, &buffer_size, |
| 365 NULL, NULL, | 365 NULL, NULL, |
| 366 MOJO_READ_MESSAGE_FLAG_NONE)); | 366 MOJO_READ_MESSAGE_FLAG_NONE)); |
| 367 EXPECT_EQ(sizeof(world), static_cast<size_t>(buffer_size)); | 367 EXPECT_EQ(sizeof(world), static_cast<size_t>(buffer_size)); |
| 368 EXPECT_STREQ(world, buffer); | 368 EXPECT_STREQ(world, buffer); |
| 369 |
| 370 mp0->Close(0); |
| 371 mp1->Close(1); |
| 372 mp2->Close(0); |
| 373 mp3->Close(1); |
| 369 } | 374 } |
| 370 | 375 |
| 371 TEST_F(RemoteMessagePipeTest, CloseBeforeConnect) { | 376 TEST_F(RemoteMessagePipeTest, CloseBeforeConnect) { |
| 372 const char hello[] = "hello"; | 377 const char hello[] = "hello"; |
| 373 char buffer[100] = { 0 }; | 378 char buffer[100] = { 0 }; |
| 374 uint32_t buffer_size = static_cast<uint32_t>(sizeof(buffer)); | 379 uint32_t buffer_size = static_cast<uint32_t>(sizeof(buffer)); |
| 375 Waiter waiter; | 380 Waiter waiter; |
| 376 | 381 |
| 377 // Connect message pipes. MP 0, port 1 will be attached to channel 0 and | 382 // Connect message pipes. MP 0, port 1 will be attached to channel 0 and |
| 378 // connected to MP 1, port 0, which will be attached to channel 1. This leaves | 383 // connected to MP 1, port 0, which will be attached to channel 1. This leaves |
| (...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 585 | 590 |
| 586 mp1->Close(1); | 591 mp1->Close(1); |
| 587 | 592 |
| 588 RestoreInitialState(); | 593 RestoreInitialState(); |
| 589 } | 594 } |
| 590 } | 595 } |
| 591 | 596 |
| 592 } // namespace | 597 } // namespace |
| 593 } // namespace system | 598 } // namespace system |
| 594 } // namespace mojo | 599 } // namespace mojo |
| OLD | NEW |