Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(701)

Side by Side Diff: mojo/edk/system/multiprocess_message_pipe_unittest.cc

Issue 1352913002: Remove Windows support from the EDK. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <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 <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 CHECK_EQ(mp->WriteMessage(0, UserPointer<const void>(write_buffer.data()), 87 CHECK_EQ(mp->WriteMessage(0, UserPointer<const void>(write_buffer.data()),
88 static_cast<uint32_t>(write_buffer.size()), 88 static_cast<uint32_t>(write_buffer.size()),
89 nullptr, MOJO_WRITE_MESSAGE_FLAG_NONE), 89 nullptr, MOJO_WRITE_MESSAGE_FLAG_NONE),
90 MOJO_RESULT_OK); 90 MOJO_RESULT_OK);
91 } 91 }
92 92
93 mp->Close(0); 93 mp->Close(0);
94 return rv; 94 return rv;
95 } 95 }
96 96
97 // Sends "hello" to child, and expects "hellohello" back.
98 #if defined(OS_ANDROID) 97 #if defined(OS_ANDROID)
99 // Android multi-process tests are not executing the new process. This is flaky. 98 // Android multi-process tests are not executing the new process. This is flaky.
100 #define MAYBE_Basic DISABLED_Basic 99 #define MAYBE_Basic DISABLED_Basic
101 #else 100 #else
102 #define MAYBE_Basic Basic 101 #define MAYBE_Basic Basic
103 #endif // defined(OS_ANDROID) 102 #endif
103 // Sends "hello" to child, and expects "hellohello" back.
104 TEST_F(MultiprocessMessagePipeTest, MAYBE_Basic) { 104 TEST_F(MultiprocessMessagePipeTest, MAYBE_Basic) {
105 helper()->StartChild("EchoEcho"); 105 helper()->StartChild("EchoEcho");
106 106
107 scoped_refptr<ChannelEndpoint> ep; 107 scoped_refptr<ChannelEndpoint> ep;
108 scoped_refptr<MessagePipe> mp(MessagePipe::CreateLocalProxy(&ep)); 108 scoped_refptr<MessagePipe> mp(MessagePipe::CreateLocalProxy(&ep));
109 Init(ep); 109 Init(ep);
110 110
111 std::string hello("hello"); 111 std::string hello("hello");
112 EXPECT_EQ(MOJO_RESULT_OK, 112 EXPECT_EQ(MOJO_RESULT_OK,
113 mp->WriteMessage(0, UserPointer<const void>(hello.data()), 113 mp->WriteMessage(0, UserPointer<const void>(hello.data()),
(...skipping 18 matching lines...) Expand all
132 read_buffer.resize(read_buffer_size); 132 read_buffer.resize(read_buffer_size);
133 VLOG(2) << "Parent got: " << read_buffer; 133 VLOG(2) << "Parent got: " << read_buffer;
134 EXPECT_EQ(hello + hello, read_buffer); 134 EXPECT_EQ(hello + hello, read_buffer);
135 135
136 mp->Close(0); 136 mp->Close(0);
137 137
138 // We sent one message. 138 // We sent one message.
139 EXPECT_EQ(1 % 100, helper()->WaitForChildShutdown()); 139 EXPECT_EQ(1 % 100, helper()->WaitForChildShutdown());
140 } 140 }
141 141
142 // Sends a bunch of messages to the child. Expects them "repeated" back. Waits
143 // for the child to close its end before quitting.
144 #if defined(OS_ANDROID) 142 #if defined(OS_ANDROID)
145 // Android multi-process tests are not executing the new process. This is flaky. 143 // Android multi-process tests are not executing the new process. This is flaky.
146 #define MAYBE_QueueMessages DISABLED_QueueMessages 144 #define MAYBE_QueueMessages DISABLED_QueueMessages
147 #else 145 #else
148 #define MAYBE_QueueMessages QueueMessages 146 #define MAYBE_QueueMessages QueueMessages
149 #endif // defined(OS_ANDROID) 147 #endif
148 // Sends a bunch of messages to the child. Expects them "repeated" back. Waits
149 // for the child to close its end before quitting.
150 TEST_F(MultiprocessMessagePipeTest, DISABLED_QueueMessages) { 150 TEST_F(MultiprocessMessagePipeTest, DISABLED_QueueMessages) {
151 helper()->StartChild("EchoEcho"); 151 helper()->StartChild("EchoEcho");
152 152
153 scoped_refptr<ChannelEndpoint> ep; 153 scoped_refptr<ChannelEndpoint> ep;
154 scoped_refptr<MessagePipe> mp(MessagePipe::CreateLocalProxy(&ep)); 154 scoped_refptr<MessagePipe> mp(MessagePipe::CreateLocalProxy(&ep));
155 Init(ep); 155 Init(ep);
156 156
157 static const size_t kNumMessages = 1001; 157 static const size_t kNumMessages = 1001;
158 for (size_t i = 0; i < kNumMessages; i++) { 158 for (size_t i = 0; i < kNumMessages; i++) {
159 std::string write_buffer(i, 'A' + (i % 26)); 159 std::string write_buffer(i, 'A' + (i % 26));
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
288 // It should have written something to the shared buffer. 288 // It should have written something to the shared buffer.
289 static const char kWorld[] = "world!!!"; 289 static const char kWorld[] = "world!!!";
290 CHECK_EQ(memcmp(mapping->GetBase(), kWorld, sizeof(kWorld)), 0); 290 CHECK_EQ(memcmp(mapping->GetBase(), kWorld, sizeof(kWorld)), 0);
291 291
292 // And we're done. 292 // And we're done.
293 mp->Close(0); 293 mp->Close(0);
294 294
295 return 0; 295 return 0;
296 } 296 }
297 297
298 #if defined(OS_POSIX) && !defined(OS_ANDROID) 298 #if defined(OS_ANDROID)
299 #define MAYBE_SharedBufferPassing SharedBufferPassing
300 #else
301 // Not yet implemented (on Windows).
302 // Android multi-process tests are not executing the new process. This is flaky. 299 // Android multi-process tests are not executing the new process. This is flaky.
303 #define MAYBE_SharedBufferPassing DISABLED_SharedBufferPassing 300 #define MAYBE_SharedBufferPassing DISABLED_SharedBufferPassing
301 #else
302 #define MAYBE_SharedBufferPassing SharedBufferPassing
304 #endif 303 #endif
305 TEST_F(MultiprocessMessagePipeTest, MAYBE_SharedBufferPassing) { 304 TEST_F(MultiprocessMessagePipeTest, MAYBE_SharedBufferPassing) {
306 helper()->StartChild("CheckSharedBuffer"); 305 helper()->StartChild("CheckSharedBuffer");
307 306
308 scoped_refptr<ChannelEndpoint> ep; 307 scoped_refptr<ChannelEndpoint> ep;
309 scoped_refptr<MessagePipe> mp(MessagePipe::CreateLocalProxy(&ep)); 308 scoped_refptr<MessagePipe> mp(MessagePipe::CreateLocalProxy(&ep));
310 Init(ep); 309 Init(ep);
311 310
312 // Make a shared buffer. 311 // Make a shared buffer.
313 scoped_refptr<SharedBufferDispatcher> dispatcher; 312 scoped_refptr<SharedBufferDispatcher> dispatcher;
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
499 EXPECT_EQ(MOJO_RESULT_FAILED_PRECONDITION, 498 EXPECT_EQ(MOJO_RESULT_FAILED_PRECONDITION,
500 test::WaitIfNecessary(mp, MOJO_HANDLE_SIGNAL_READABLE, &hss)); 499 test::WaitIfNecessary(mp, MOJO_HANDLE_SIGNAL_READABLE, &hss));
501 EXPECT_EQ(MOJO_HANDLE_SIGNAL_PEER_CLOSED, hss.satisfied_signals); 500 EXPECT_EQ(MOJO_HANDLE_SIGNAL_PEER_CLOSED, hss.satisfied_signals);
502 EXPECT_EQ(MOJO_HANDLE_SIGNAL_PEER_CLOSED, hss.satisfiable_signals); 501 EXPECT_EQ(MOJO_HANDLE_SIGNAL_PEER_CLOSED, hss.satisfiable_signals);
503 502
504 mp->Close(0); 503 mp->Close(0);
505 504
506 EXPECT_EQ(0, helper()->WaitForChildShutdown()); 505 EXPECT_EQ(0, helper()->WaitForChildShutdown());
507 } 506 }
508 507
509 // Not yet implemented (on Windows).
510 // Android multi-process tests are not executing the new process. This is flaky. 508 // Android multi-process tests are not executing the new process. This is flaky.
511 #if defined(OS_POSIX) && !defined(OS_ANDROID) 509 #if !defined(OS_ANDROID)
512 INSTANTIATE_TEST_CASE_P(PipeCount, 510 INSTANTIATE_TEST_CASE_P(PipeCount,
513 MultiprocessMessagePipeTestWithPipeCount, 511 MultiprocessMessagePipeTestWithPipeCount,
514 testing::Values(1u, 128u, 140u)); 512 testing::Values(1u, 128u, 140u));
515 #endif 513 #endif
516 514
517 } // namespace 515 } // namespace
518 } // namespace system 516 } // namespace system
519 } // namespace mojo 517 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/edk/system/message_pipe_dispatcher_unittest.cc ('k') | mojo/edk/system/raw_channel_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698