OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/public/cpp/bindings/lib/synchronous_connector.h" | 5 #include "mojo/public/cpp/bindings/lib/synchronous_connector.h" |
6 | 6 |
7 #include <string.h> | 7 #include <string.h> |
| 8 |
8 #include <string> | 9 #include <string> |
9 #include <utility> | 10 #include <utility> |
10 | 11 |
| 12 #include "gtest/gtest.h" |
11 #include "mojo/public/cpp/bindings/lib/message_builder.h" | 13 #include "mojo/public/cpp/bindings/lib/message_builder.h" |
12 #include "mojo/public/cpp/bindings/message.h" | 14 #include "mojo/public/cpp/bindings/message.h" |
13 #include "testing/gtest/include/gtest/gtest.h" | |
14 | 15 |
15 namespace mojo { | 16 namespace mojo { |
16 namespace test { | 17 namespace test { |
17 namespace { | 18 namespace { |
18 | 19 |
19 void AllocMessage(const std::string& text, Message* message) { | 20 void AllocMessage(const std::string& text, Message* message) { |
20 size_t payload_size = text.length() + 1; // Plus null terminator. | 21 size_t payload_size = text.length() + 1; // Plus null terminator. |
21 MessageBuilder builder(1, payload_size); | 22 MessageBuilder builder(1, payload_size); |
22 memcpy(builder.buffer()->Allocate(payload_size), text.c_str(), payload_size); | 23 memcpy(builder.buffer()->Allocate(payload_size), text.c_str(), payload_size); |
23 | 24 |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 // Close the other end of the pipe. | 65 // Close the other end of the pipe. |
65 pipe.handle1.reset(); | 66 pipe.handle1.reset(); |
66 | 67 |
67 Message message; | 68 Message message; |
68 EXPECT_FALSE(connector0.BlockingRead(&message)); | 69 EXPECT_FALSE(connector0.BlockingRead(&message)); |
69 } | 70 } |
70 | 71 |
71 } // namespace | 72 } // namespace |
72 } // namespace test | 73 } // namespace test |
73 } // namespace mojo | 74 } // namespace mojo |
OLD | NEW |