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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 internal::Connector* connector_; | 75 internal::Connector* connector_; |
76 int number_of_calls_; | 76 int number_of_calls_; |
77 }; | 77 }; |
78 | 78 |
79 class ConnectorTest : public testing::Test { | 79 class ConnectorTest : public testing::Test { |
80 public: | 80 public: |
81 ConnectorTest() { | 81 ConnectorTest() { |
82 } | 82 } |
83 | 83 |
84 virtual void SetUp() override { | 84 virtual void SetUp() override { |
85 CreateMessagePipe(NULL, &handle0_, &handle1_); | 85 CreateMessagePipe(nullptr, &handle0_, &handle1_); |
86 } | 86 } |
87 | 87 |
88 virtual void TearDown() override {} | 88 virtual void TearDown() override {} |
89 | 89 |
90 void AllocMessage(const char* text, Message* message) { | 90 void AllocMessage(const char* text, Message* message) { |
91 size_t payload_size = strlen(text) + 1; // Plus null terminator. | 91 size_t payload_size = strlen(text) + 1; // Plus null terminator. |
92 internal::MessageBuilder builder(1, payload_size); | 92 internal::MessageBuilder builder(1, payload_size); |
93 memcpy(builder.buffer()->Allocate(payload_size), text, payload_size); | 93 memcpy(builder.buffer()->Allocate(payload_size), text, payload_size); |
94 builder.Finish(message); | 94 builder.Finish(message); |
95 } | 95 } |
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
393 std::string(kText[i]), | 393 std::string(kText[i]), |
394 std::string(reinterpret_cast<const char*>(message_received.payload()))); | 394 std::string(reinterpret_cast<const char*>(message_received.payload()))); |
395 } | 395 } |
396 | 396 |
397 ASSERT_EQ(2, accumulator.number_of_calls()); | 397 ASSERT_EQ(2, accumulator.number_of_calls()); |
398 } | 398 } |
399 | 399 |
400 } // namespace | 400 } // namespace |
401 } // namespace test | 401 } // namespace test |
402 } // namespace mojo | 402 } // namespace mojo |
OLD | NEW |