OLD | NEW |
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 <stdlib.h> | 5 #include <stdlib.h> |
6 #include <string.h> | 6 #include <string.h> |
7 | 7 |
8 #include "mojo/public/cpp/bindings/lib/connector.h" | 8 #include "mojo/public/cpp/bindings/lib/connector.h" |
9 #include "mojo/public/cpp/bindings/lib/message_builder.h" | 9 #include "mojo/public/cpp/bindings/lib/message_builder.h" |
10 #include "mojo/public/cpp/bindings/lib/message_queue.h" | 10 #include "mojo/public/cpp/bindings/lib/message_queue.h" |
(...skipping 27 matching lines...) Expand all Loading... |
38 private: | 38 private: |
39 internal::MessageQueue queue_; | 39 internal::MessageQueue queue_; |
40 }; | 40 }; |
41 | 41 |
42 class ConnectorTest : public testing::Test { | 42 class ConnectorTest : public testing::Test { |
43 public: | 43 public: |
44 ConnectorTest() { | 44 ConnectorTest() { |
45 } | 45 } |
46 | 46 |
47 virtual void SetUp() MOJO_OVERRIDE { | 47 virtual void SetUp() MOJO_OVERRIDE { |
48 CreateMessagePipe(&handle0_, &handle1_); | 48 CreateMessagePipe(NULL, &handle0_, &handle1_); |
49 } | 49 } |
50 | 50 |
51 virtual void TearDown() MOJO_OVERRIDE { | 51 virtual void TearDown() MOJO_OVERRIDE { |
52 } | 52 } |
53 | 53 |
54 void AllocMessage(const char* text, Message* message) { | 54 void AllocMessage(const char* text, Message* message) { |
55 size_t payload_size = strlen(text) + 1; // Plus null terminator. | 55 size_t payload_size = strlen(text) + 1; // Plus null terminator. |
56 internal::MessageBuilder builder(1, payload_size); | 56 internal::MessageBuilder builder(1, payload_size); |
57 memcpy(builder.buffer()->Allocate(payload_size), text, payload_size); | 57 memcpy(builder.buffer()->Allocate(payload_size), text, payload_size); |
58 builder.Finish(message); | 58 builder.Finish(message); |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
235 accumulator.Pop(&message_received); | 235 accumulator.Pop(&message_received); |
236 | 236 |
237 EXPECT_EQ( | 237 EXPECT_EQ( |
238 std::string(kText), | 238 std::string(kText), |
239 std::string(reinterpret_cast<const char*>(message_received.payload()))); | 239 std::string(reinterpret_cast<const char*>(message_received.payload()))); |
240 } | 240 } |
241 | 241 |
242 } // namespace | 242 } // namespace |
243 } // namespace test | 243 } // namespace test |
244 } // namespace mojo | 244 } // namespace mojo |
OLD | NEW |