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 <stdio.h> | 6 #include <stdio.h> |
7 #include <string.h> | 7 #include <string.h> |
8 | 8 |
| 9 #include <memory> |
9 #include <string> | 10 #include <string> |
10 #include <vector> | 11 #include <vector> |
11 | 12 |
12 #include "base/bind.h" | 13 #include "base/bind.h" |
13 #include "base/location.h" | 14 #include "base/location.h" |
14 #include "base/logging.h" | 15 #include "base/logging.h" |
15 #include "base/strings/stringprintf.h" | 16 #include "base/strings/stringprintf.h" |
16 #include "base/test/perf_time_logger.h" | 17 #include "base/test/perf_time_logger.h" |
17 #include "mojo/edk/embedder/scoped_platform_handle.h" | 18 #include "mojo/edk/embedder/scoped_platform_handle.h" |
18 #include "mojo/edk/system/channel.h" | 19 #include "mojo/edk/system/channel.h" |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 WriteWaitThenRead(mp); | 78 WriteWaitThenRead(mp); |
78 | 79 |
79 logger.Done(); | 80 logger.Done(); |
80 } | 81 } |
81 | 82 |
82 private: | 83 private: |
83 int message_count_; | 84 int message_count_; |
84 size_t message_size_; | 85 size_t message_size_; |
85 std::string payload_; | 86 std::string payload_; |
86 std::string read_buffer_; | 87 std::string read_buffer_; |
87 scoped_ptr<base::PerfTimeLogger> perf_logger_; | 88 std::unique_ptr<base::PerfTimeLogger> perf_logger_; |
88 }; | 89 }; |
89 | 90 |
90 // For each message received, sends a reply message with the same contents | 91 // For each message received, sends a reply message with the same contents |
91 // repeated twice, until the other end is closed or it receives "quitquitquit" | 92 // repeated twice, until the other end is closed or it receives "quitquitquit" |
92 // (which it doesn't reply to). It'll return the number of messages received, | 93 // (which it doesn't reply to). It'll return the number of messages received, |
93 // not including any "quitquitquit" message, modulo 100. | 94 // not including any "quitquitquit" message, modulo 100. |
94 MOJO_MULTIPROCESS_TEST_CHILD_MAIN(PingPongClient) { | 95 MOJO_MULTIPROCESS_TEST_CHILD_MAIN(PingPongClient) { |
95 embedder::SimplePlatformSupport platform_support; | 96 embedder::SimplePlatformSupport platform_support; |
96 test::ChannelThread channel_thread(&platform_support); | 97 test::ChannelThread channel_thread(&platform_support); |
97 embedder::ScopedPlatformHandle client_platform_handle = | 98 embedder::ScopedPlatformHandle client_platform_handle = |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 } | 160 } |
160 | 161 |
161 SendQuitMessage(mp); | 162 SendQuitMessage(mp); |
162 mp->Close(0); | 163 mp->Close(0); |
163 EXPECT_EQ(0, helper()->WaitForChildShutdown()); | 164 EXPECT_EQ(0, helper()->WaitForChildShutdown()); |
164 } | 165 } |
165 | 166 |
166 } // namespace | 167 } // namespace |
167 } // namespace system | 168 } // namespace system |
168 } // namespace mojo | 169 } // namespace mojo |
OLD | NEW |