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 465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
476 dispatcher = NULL; | 476 dispatcher = NULL; |
477 } | 477 } |
478 | 478 |
479 // Wait. | 479 // Wait. |
480 EXPECT_EQ(123, waiter.Wait(MOJO_DEADLINE_INDEFINITE)); | 480 EXPECT_EQ(123, waiter.Wait(MOJO_DEADLINE_INDEFINITE)); |
481 mp1->RemoveWaiter(1, &waiter); | 481 mp1->RemoveWaiter(1, &waiter); |
482 | 482 |
483 // Read from MP 1, port 1. | 483 // Read from MP 1, port 1. |
484 char read_buffer[100] = { 0 }; | 484 char read_buffer[100] = { 0 }; |
485 uint32_t read_buffer_size = static_cast<uint32_t>(sizeof(read_buffer)); | 485 uint32_t read_buffer_size = static_cast<uint32_t>(sizeof(read_buffer)); |
486 std::vector<scoped_refptr<Dispatcher> > read_dispatchers; | 486 DispatcherVector read_dispatchers; |
487 uint32_t read_num_dispatchers = 10; // Maximum to get. | 487 uint32_t read_num_dispatchers = 10; // Maximum to get. |
488 EXPECT_EQ(MOJO_RESULT_OK, | 488 EXPECT_EQ(MOJO_RESULT_OK, |
489 mp1->ReadMessage(1, read_buffer, &read_buffer_size, | 489 mp1->ReadMessage(1, read_buffer, &read_buffer_size, |
490 &read_dispatchers, &read_num_dispatchers, | 490 &read_dispatchers, &read_num_dispatchers, |
491 MOJO_READ_MESSAGE_FLAG_NONE)); | 491 MOJO_READ_MESSAGE_FLAG_NONE)); |
492 EXPECT_EQ(sizeof(hello), static_cast<size_t>(read_buffer_size)); | 492 EXPECT_EQ(sizeof(hello), static_cast<size_t>(read_buffer_size)); |
493 EXPECT_STREQ(hello, read_buffer); | 493 EXPECT_STREQ(hello, read_buffer); |
494 EXPECT_EQ(1u, read_dispatchers.size()); | 494 EXPECT_EQ(1u, read_dispatchers.size()); |
495 EXPECT_EQ(1u, read_num_dispatchers); | 495 EXPECT_EQ(1u, read_num_dispatchers); |
496 ASSERT_TRUE(read_dispatchers[0].get()); | 496 ASSERT_TRUE(read_dispatchers[0].get()); |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
594 | 594 |
595 mp1->Close(1); | 595 mp1->Close(1); |
596 | 596 |
597 RestoreInitialState(); | 597 RestoreInitialState(); |
598 } | 598 } |
599 } | 599 } |
600 | 600 |
601 } // namespace | 601 } // namespace |
602 } // namespace system | 602 } // namespace system |
603 } // namespace mojo | 603 } // namespace mojo |
OLD | NEW |