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 "mojo/edk/system/raw_channel.h" | 5 #include "mojo/system/raw_channel.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/bind.h" | 11 #include "base/bind.h" |
12 #include "base/location.h" | 12 #include "base/location.h" |
13 #include "base/logging.h" | 13 #include "base/logging.h" |
14 #include "base/macros.h" | 14 #include "base/macros.h" |
15 #include "base/memory/scoped_ptr.h" | 15 #include "base/memory/scoped_ptr.h" |
16 #include "base/memory/scoped_vector.h" | 16 #include "base/memory/scoped_vector.h" |
17 #include "base/rand_util.h" | 17 #include "base/rand_util.h" |
18 #include "base/synchronization/lock.h" | 18 #include "base/synchronization/lock.h" |
19 #include "base/synchronization/waitable_event.h" | 19 #include "base/synchronization/waitable_event.h" |
20 #include "base/test/test_io_thread.h" | 20 #include "base/test/test_io_thread.h" |
21 #include "base/threading/platform_thread.h" // For |Sleep()|. | 21 #include "base/threading/platform_thread.h" // For |Sleep()|. |
22 #include "base/threading/simple_thread.h" | 22 #include "base/threading/simple_thread.h" |
23 #include "base/time/time.h" | 23 #include "base/time/time.h" |
24 #include "build/build_config.h" | 24 #include "build/build_config.h" |
25 #include "mojo/edk/embedder/platform_channel_pair.h" | 25 #include "mojo/common/test/test_utils.h" |
26 #include "mojo/edk/embedder/platform_handle.h" | 26 #include "mojo/embedder/platform_channel_pair.h" |
27 #include "mojo/edk/embedder/scoped_platform_handle.h" | 27 #include "mojo/embedder/platform_handle.h" |
28 #include "mojo/edk/system/message_in_transit.h" | 28 #include "mojo/embedder/scoped_platform_handle.h" |
29 #include "mojo/edk/system/test_utils.h" | 29 #include "mojo/system/message_in_transit.h" |
30 #include "mojo/edk/test/test_utils.h" | 30 #include "mojo/system/test_utils.h" |
31 #include "testing/gtest/include/gtest/gtest.h" | 31 #include "testing/gtest/include/gtest/gtest.h" |
32 | 32 |
33 namespace mojo { | 33 namespace mojo { |
34 namespace system { | 34 namespace system { |
35 namespace { | 35 namespace { |
36 | 36 |
37 scoped_ptr<MessageInTransit> MakeTestMessage(uint32_t num_bytes) { | 37 scoped_ptr<MessageInTransit> MakeTestMessage(uint32_t num_bytes) { |
38 std::vector<unsigned char> bytes(num_bytes, 0); | 38 std::vector<unsigned char> bytes(num_bytes, 0); |
39 for (size_t i = 0; i < num_bytes; i++) | 39 for (size_t i = 0; i < num_bytes; i++) |
40 bytes[i] = static_cast<unsigned char>(i + num_bytes); | 40 bytes[i] = static_cast<unsigned char>(i + num_bytes); |
(...skipping 638 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
679 | 679 |
680 EXPECT_FALSE(rc->WriteMessage(MakeTestMessage(1))); | 680 EXPECT_FALSE(rc->WriteMessage(MakeTestMessage(1))); |
681 | 681 |
682 // Wait for the delegate, which will shut the |RawChannel| down. | 682 // Wait for the delegate, which will shut the |RawChannel| down. |
683 delegate.Wait(); | 683 delegate.Wait(); |
684 } | 684 } |
685 | 685 |
686 } // namespace | 686 } // namespace |
687 } // namespace system | 687 } // namespace system |
688 } // namespace mojo | 688 } // namespace mojo |
OLD | NEW |