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

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

Issue 973513004: Allow data pipe producer/consumer handles to be re-sent. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: review comments Created 5 years, 9 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
« no previous file with comments | « mojo/edk/system/data_pipe_impl.cc ('k') | mojo/edk/system/local_data_pipe_impl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 // This file contains tests that are shared between different implementations of 5 // This file contains tests that are shared between different implementations of
6 // |DataPipeImpl|. 6 // |DataPipeImpl|.
7 7
8 #include "mojo/edk/system/data_pipe_impl.h" 8 #include "mojo/edk/system/data_pipe_impl.h"
9 9
10 #include <stdint.h> 10 #include <stdint.h>
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 FROM_HERE, base::Bind(&RemoteDataPipeImplTestHelper::TearDownOnIOThread, 157 FROM_HERE, base::Bind(&RemoteDataPipeImplTestHelper::TearDownOnIOThread,
158 base::Unretained(this))); 158 base::Unretained(this)));
159 } 159 }
160 160
161 void Create(const MojoCreateDataPipeOptions& validated_options) override { 161 void Create(const MojoCreateDataPipeOptions& validated_options) override {
162 CHECK(!dp_); 162 CHECK(!dp_);
163 dp_ = DataPipe::CreateLocal(validated_options); 163 dp_ = DataPipe::CreateLocal(validated_options);
164 } 164 }
165 165
166 protected: 166 protected:
167 void SendDispatcher(size_t source_i,
168 scoped_refptr<Dispatcher> to_send,
169 scoped_refptr<Dispatcher>* to_receive) {
170 DCHECK(source_i == 0 || source_i == 1);
171 size_t dest_i = source_i ^ 1;
172
173 // Write the dispatcher to MP |source_i| (port 0). Wait and receive on MP
174 // |dest_i| (port 0). (Add the waiter first, to avoid any handling the case
175 // where it's already readable.)
176 Waiter waiter;
177 waiter.Init();
178 ASSERT_EQ(MOJO_RESULT_OK,
179 message_pipe(dest_i)->AddAwakable(
180 0, &waiter, MOJO_HANDLE_SIGNAL_READABLE, 987, nullptr));
181 {
182 DispatcherTransport transport(
183 test::DispatcherTryStartTransport(to_send.get()));
184 ASSERT_TRUE(transport.is_valid());
185
186 std::vector<DispatcherTransport> transports;
187 transports.push_back(transport);
188 ASSERT_EQ(MOJO_RESULT_OK, message_pipe(source_i)->WriteMessage(
189 0, NullUserPointer(), 0, &transports,
190 MOJO_WRITE_MESSAGE_FLAG_NONE));
191 transport.End();
192 }
193 uint32_t context = 0;
194 ASSERT_EQ(MOJO_RESULT_OK, waiter.Wait(test::ActionDeadline(), &context));
195 EXPECT_EQ(987u, context);
196 HandleSignalsState hss = HandleSignalsState();
197 message_pipe(dest_i)->RemoveAwakable(0, &waiter, &hss);
198 EXPECT_EQ(MOJO_HANDLE_SIGNAL_READABLE | MOJO_HANDLE_SIGNAL_WRITABLE,
199 hss.satisfied_signals);
200 EXPECT_EQ(kAllSignals, hss.satisfiable_signals);
201 char read_buffer[100] = {};
202 uint32_t read_buffer_size = static_cast<uint32_t>(sizeof(read_buffer));
203 DispatcherVector read_dispatchers;
204 uint32_t read_num_dispatchers = 10; // Maximum to get.
205 ASSERT_EQ(MOJO_RESULT_OK,
206 message_pipe(dest_i)->ReadMessage(
207 0, UserPointer<void>(read_buffer),
208 MakeUserPointer(&read_buffer_size), &read_dispatchers,
209 &read_num_dispatchers, MOJO_READ_MESSAGE_FLAG_NONE));
210 EXPECT_EQ(0u, static_cast<size_t>(read_buffer_size));
211 ASSERT_EQ(1u, read_dispatchers.size());
212 ASSERT_EQ(1u, read_num_dispatchers);
213 ASSERT_TRUE(read_dispatchers[0]);
214 EXPECT_TRUE(read_dispatchers[0]->HasOneRef());
215
216 *to_receive = read_dispatchers[0];
217 }
218
167 scoped_refptr<MessagePipe> message_pipe(size_t i) { 219 scoped_refptr<MessagePipe> message_pipe(size_t i) {
168 return message_pipes_[i]; 220 return message_pipes_[i];
169 } 221 }
222 scoped_refptr<DataPipe> dp() { return dp_; }
170 223
224 private:
171 void EnsureMessagePipeClosed(size_t i) { 225 void EnsureMessagePipeClosed(size_t i) {
172 if (!message_pipes_[i]) 226 if (!message_pipes_[i])
173 return; 227 return;
174 message_pipes_[i]->Close(0); 228 message_pipes_[i]->Close(0);
175 message_pipes_[i] = nullptr; 229 message_pipes_[i] = nullptr;
176 } 230 }
177 231
178 void SetUpOnIOThread(scoped_refptr<ChannelEndpoint> ep0, 232 void SetUpOnIOThread(scoped_refptr<ChannelEndpoint> ep0,
179 scoped_refptr<ChannelEndpoint> ep1) { 233 scoped_refptr<ChannelEndpoint> ep1) {
180 CHECK_EQ(base::MessageLoop::current(), io_thread_.message_loop()); 234 CHECK_EQ(base::MessageLoop::current(), io_thread_.message_loop());
(...skipping 25 matching lines...) Expand all
206 scoped_refptr<Channel> channels_[2]; 260 scoped_refptr<Channel> channels_[2];
207 scoped_refptr<MessagePipe> message_pipes_[2]; 261 scoped_refptr<MessagePipe> message_pipes_[2];
208 262
209 scoped_refptr<DataPipe> dp_; 263 scoped_refptr<DataPipe> dp_;
210 264
211 DISALLOW_COPY_AND_ASSIGN(RemoteDataPipeImplTestHelper); 265 DISALLOW_COPY_AND_ASSIGN(RemoteDataPipeImplTestHelper);
212 }; 266 };
213 267
214 // RemoteProducerDataPipeImplTestHelper ---------------------------------------- 268 // RemoteProducerDataPipeImplTestHelper ----------------------------------------
215 269
270 // Note about naming confusion: This class is named after the "local" class,
271 // i.e., |dp_| will have a |RemoteProducerDataPipeImpl|. The remote side, of
272 // course, will have a |RemoteConsumerDataPipeImpl|.
216 class RemoteProducerDataPipeImplTestHelper 273 class RemoteProducerDataPipeImplTestHelper
217 : public RemoteDataPipeImplTestHelper { 274 : public RemoteDataPipeImplTestHelper {
218 public: 275 public:
219 RemoteProducerDataPipeImplTestHelper() {} 276 RemoteProducerDataPipeImplTestHelper() {}
220 ~RemoteProducerDataPipeImplTestHelper() override {} 277 ~RemoteProducerDataPipeImplTestHelper() override {}
221 278
222 void DoTransfer() override { 279 void DoTransfer() override {
223 // Write the producer to MP 0 (port 0). Wait and receive on MP 1 (port 0). 280 // This is the producer dispatcher we'll send.
224 // (Add the waiter first, to avoid any handling the case where it's already 281 scoped_refptr<DataPipeProducerDispatcher> to_send =
225 // readable.) 282 new DataPipeProducerDispatcher();
226 Waiter waiter; 283 to_send->Init(dp());
227 waiter.Init(); 284 scoped_refptr<Dispatcher> to_receive;
228 ASSERT_EQ(MOJO_RESULT_OK, 285 SendDispatcher(0, to_send, &to_receive);
229 message_pipe(1)->AddAwakable( 286 // |to_send| should have been closed. This is |DCHECK()|ed when it is
230 0, &waiter, MOJO_HANDLE_SIGNAL_READABLE, 987, nullptr)); 287 // destroyed.
231 { 288 EXPECT_TRUE(to_send->HasOneRef());
232 // This is the producer dispatcher we'll send. 289 to_send = nullptr;
233 scoped_refptr<DataPipeProducerDispatcher> to_send =
234 new DataPipeProducerDispatcher();
235 to_send->Init(dp_);
236 290
237 DispatcherTransport transport( 291 ASSERT_EQ(Dispatcher::kTypeDataPipeProducer, to_receive->GetType());
238 test::DispatcherTryStartTransport(to_send.get()));
239 ASSERT_TRUE(transport.is_valid());
240
241 std::vector<DispatcherTransport> transports;
242 transports.push_back(transport);
243 ASSERT_EQ(MOJO_RESULT_OK, message_pipe(0)->WriteMessage(
244 0, NullUserPointer(), 0, &transports,
245 MOJO_WRITE_MESSAGE_FLAG_NONE));
246 transport.End();
247
248 // |to_send| should have been closed. This is |DCHECK()|ed when it is
249 // destroyed.
250 EXPECT_TRUE(to_send->HasOneRef());
251 }
252 uint32_t context = 0;
253 ASSERT_EQ(MOJO_RESULT_OK, waiter.Wait(test::ActionDeadline(), &context));
254 EXPECT_EQ(987u, context);
255 HandleSignalsState hss = HandleSignalsState();
256 message_pipe(1)->RemoveAwakable(0, &waiter, &hss);
257 EXPECT_EQ(MOJO_HANDLE_SIGNAL_READABLE | MOJO_HANDLE_SIGNAL_WRITABLE,
258 hss.satisfied_signals);
259 EXPECT_EQ(kAllSignals, hss.satisfiable_signals);
260 char read_buffer[100] = {};
261 uint32_t read_buffer_size = static_cast<uint32_t>(sizeof(read_buffer));
262 DispatcherVector read_dispatchers;
263 uint32_t read_num_dispatchers = 10; // Maximum to get.
264 ASSERT_EQ(MOJO_RESULT_OK,
265 message_pipe(1)->ReadMessage(
266 0, UserPointer<void>(read_buffer),
267 MakeUserPointer(&read_buffer_size), &read_dispatchers,
268 &read_num_dispatchers, MOJO_READ_MESSAGE_FLAG_NONE));
269 EXPECT_EQ(0u, static_cast<size_t>(read_buffer_size));
270 ASSERT_EQ(1u, read_dispatchers.size());
271 ASSERT_EQ(1u, read_num_dispatchers);
272 ASSERT_TRUE(read_dispatchers[0]);
273 EXPECT_TRUE(read_dispatchers[0]->HasOneRef());
274
275 ASSERT_EQ(Dispatcher::kTypeDataPipeProducer,
276 read_dispatchers[0]->GetType());
277 producer_dispatcher_ = 292 producer_dispatcher_ =
278 static_cast<DataPipeProducerDispatcher*>(read_dispatchers[0].get()); 293 static_cast<DataPipeProducerDispatcher*>(to_receive.get());
279 } 294 }
280 295
281 DataPipe* dpp() override { 296 DataPipe* dpp() override {
282 if (producer_dispatcher_) 297 if (producer_dispatcher_)
283 return producer_dispatcher_->GetDataPipeForTest(); 298 return producer_dispatcher_->GetDataPipeForTest();
284 return dp_.get(); 299 return dp().get();
285 } 300 }
286 DataPipe* dpc() override { return dp_.get(); } 301 DataPipe* dpc() override { return dp().get(); }
287 302
288 void ProducerClose() override { 303 void ProducerClose() override {
289 if (producer_dispatcher_) 304 if (producer_dispatcher_)
290 ASSERT_EQ(MOJO_RESULT_OK, producer_dispatcher_->Close()); 305 ASSERT_EQ(MOJO_RESULT_OK, producer_dispatcher_->Close());
291 else 306 else
292 dp_->ProducerClose(); 307 dp()->ProducerClose();
293 } 308 }
294 void ConsumerClose() override { dp_->ConsumerClose(); } 309 void ConsumerClose() override { dp()->ConsumerClose(); }
310
311 protected:
312 scoped_refptr<DataPipeProducerDispatcher> producer_dispatcher_;
295 313
296 private: 314 private:
297 scoped_refptr<DataPipeProducerDispatcher> producer_dispatcher_;
298
299 DISALLOW_COPY_AND_ASSIGN(RemoteProducerDataPipeImplTestHelper); 315 DISALLOW_COPY_AND_ASSIGN(RemoteProducerDataPipeImplTestHelper);
300 }; 316 };
301 317
302 // RemoteConsumerDataPipeImplTestHelper ---------------------------------------- 318 // RemoteConsumerDataPipeImplTestHelper ----------------------------------------
303 319
320 // Note about naming confusion: This class is named after the "local" class,
321 // i.e., |dp_| will have a |RemoteConsumerDataPipeImpl|. The remote side, of
322 // course, will have a |RemoteProducerDataPipeImpl|.
304 class RemoteConsumerDataPipeImplTestHelper 323 class RemoteConsumerDataPipeImplTestHelper
305 : public RemoteDataPipeImplTestHelper { 324 : public RemoteDataPipeImplTestHelper {
306 public: 325 public:
307 RemoteConsumerDataPipeImplTestHelper() {} 326 RemoteConsumerDataPipeImplTestHelper() {}
308 ~RemoteConsumerDataPipeImplTestHelper() override {} 327 ~RemoteConsumerDataPipeImplTestHelper() override {}
309 328
310 void DoTransfer() override { 329 void DoTransfer() override {
311 // Write the consumer to MP 0 (port 0). Wait and receive on MP 1 (port 0). 330 // This is the consumer dispatcher we'll send.
312 // (Add the waiter first, to avoid any handling the case where it's already 331 scoped_refptr<DataPipeConsumerDispatcher> to_send =
313 // readable.) 332 new DataPipeConsumerDispatcher();
314 Waiter waiter; 333 to_send->Init(dp());
315 waiter.Init(); 334 scoped_refptr<Dispatcher> to_receive;
316 ASSERT_EQ(MOJO_RESULT_OK, 335 SendDispatcher(0, to_send, &to_receive);
317 message_pipe(1)->AddAwakable( 336 // |to_send| should have been closed. This is |DCHECK()|ed when it is
318 0, &waiter, MOJO_HANDLE_SIGNAL_READABLE, 987, nullptr)); 337 // destroyed.
319 { 338 EXPECT_TRUE(to_send->HasOneRef());
320 // This is the consumer dispatcher we'll send. 339 to_send = nullptr;
321 scoped_refptr<DataPipeConsumerDispatcher> to_send =
322 new DataPipeConsumerDispatcher();
323 to_send->Init(dp_);
324 340
325 DispatcherTransport transport( 341 ASSERT_EQ(Dispatcher::kTypeDataPipeConsumer, to_receive->GetType());
326 test::DispatcherTryStartTransport(to_send.get()));
327 ASSERT_TRUE(transport.is_valid());
328
329 std::vector<DispatcherTransport> transports;
330 transports.push_back(transport);
331 ASSERT_EQ(MOJO_RESULT_OK, message_pipe(0)->WriteMessage(
332 0, NullUserPointer(), 0, &transports,
333 MOJO_WRITE_MESSAGE_FLAG_NONE));
334 transport.End();
335
336 // |to_send| should have been closed. This is |DCHECK()|ed when it is
337 // destroyed.
338 EXPECT_TRUE(to_send->HasOneRef());
339 }
340 uint32_t context = 0;
341 ASSERT_EQ(MOJO_RESULT_OK, waiter.Wait(test::ActionDeadline(), &context));
342 EXPECT_EQ(987u, context);
343 HandleSignalsState hss = HandleSignalsState();
344 message_pipe(1)->RemoveAwakable(0, &waiter, &hss);
345 EXPECT_EQ(MOJO_HANDLE_SIGNAL_READABLE | MOJO_HANDLE_SIGNAL_WRITABLE,
346 hss.satisfied_signals);
347 EXPECT_EQ(kAllSignals, hss.satisfiable_signals);
348 char read_buffer[100] = {};
349 uint32_t read_buffer_size = static_cast<uint32_t>(sizeof(read_buffer));
350 DispatcherVector read_dispatchers;
351 uint32_t read_num_dispatchers = 10; // Maximum to get.
352 ASSERT_EQ(MOJO_RESULT_OK,
353 message_pipe(1)->ReadMessage(
354 0, UserPointer<void>(read_buffer),
355 MakeUserPointer(&read_buffer_size), &read_dispatchers,
356 &read_num_dispatchers, MOJO_READ_MESSAGE_FLAG_NONE));
357 EXPECT_EQ(0u, static_cast<size_t>(read_buffer_size));
358 ASSERT_EQ(1u, read_dispatchers.size());
359 ASSERT_EQ(1u, read_num_dispatchers);
360 ASSERT_TRUE(read_dispatchers[0]);
361 EXPECT_TRUE(read_dispatchers[0]->HasOneRef());
362
363 ASSERT_EQ(Dispatcher::kTypeDataPipeConsumer,
364 read_dispatchers[0]->GetType());
365 consumer_dispatcher_ = 342 consumer_dispatcher_ =
366 static_cast<DataPipeConsumerDispatcher*>(read_dispatchers[0].get()); 343 static_cast<DataPipeConsumerDispatcher*>(to_receive.get());
367 } 344 }
368 345
369 DataPipe* dpp() override { return dp_.get(); } 346 DataPipe* dpp() override { return dp().get(); }
370 DataPipe* dpc() override { 347 DataPipe* dpc() override {
371 if (consumer_dispatcher_) 348 if (consumer_dispatcher_)
372 return consumer_dispatcher_->GetDataPipeForTest(); 349 return consumer_dispatcher_->GetDataPipeForTest();
373 return dp_.get(); 350 return dp().get();
374 } 351 }
375 352
376 void ProducerClose() override { dp_->ProducerClose(); } 353 void ProducerClose() override { dp()->ProducerClose(); }
377 void ConsumerClose() override { 354 void ConsumerClose() override {
378 if (consumer_dispatcher_) 355 if (consumer_dispatcher_)
379 ASSERT_EQ(MOJO_RESULT_OK, consumer_dispatcher_->Close()); 356 ASSERT_EQ(MOJO_RESULT_OK, consumer_dispatcher_->Close());
380 else 357 else
381 dp_->ConsumerClose(); 358 dp()->ConsumerClose();
359 }
360
361 protected:
362 scoped_refptr<DataPipeConsumerDispatcher> consumer_dispatcher_;
363
364 private:
365 DISALLOW_COPY_AND_ASSIGN(RemoteConsumerDataPipeImplTestHelper);
366 };
367
368 // RemoteProducerDataPipeImplTestHelper2 ---------------------------------------
369
370 // This is like |RemoteProducerDataPipeImplTestHelper|, but |DoTransfer()| does
371 // a second transfer. This thus tests passing a producer handle twice, and in
372 // particular tests (some of) |RemoteConsumerDataPipeImpl|'s
373 // |ProducerEndSerialize()| (instead of |LocalDataPipeImpl|'s).
374 //
375 // Note about naming confusion: This class is named after the "local" class,
376 // i.e., |dp_| will have a |RemoteProducerDataPipeImpl|. The remote side, of
377 // course, will have a |RemoteConsumerDataPipeImpl|.
378 class RemoteProducerDataPipeImplTestHelper2
379 : public RemoteProducerDataPipeImplTestHelper {
380 public:
381 RemoteProducerDataPipeImplTestHelper2() {}
382 ~RemoteProducerDataPipeImplTestHelper2() override {}
383
384 void DoTransfer() override {
385 // This is the producer dispatcher we'll send.
386 scoped_refptr<DataPipeProducerDispatcher> to_send =
387 new DataPipeProducerDispatcher();
388 to_send->Init(dp());
389 scoped_refptr<Dispatcher> to_receive;
390 SendDispatcher(0, to_send, &to_receive);
391 // |to_send| should have been closed. This is |DCHECK()|ed when it is
392 // destroyed.
393 EXPECT_TRUE(to_send->HasOneRef());
394 to_send = nullptr;
395 ASSERT_EQ(Dispatcher::kTypeDataPipeProducer, to_receive->GetType());
396 to_send = static_cast<DataPipeProducerDispatcher*>(to_receive.get());
397 to_receive = nullptr;
398
399 // Now send it back the other way.
400 SendDispatcher(1, to_send, &to_receive);
401 // |producer_dispatcher_| should have been closed. This is |DCHECK()|ed when
402 // it is destroyed.
403 EXPECT_TRUE(to_send->HasOneRef());
404 to_send = nullptr;
405
406 ASSERT_EQ(Dispatcher::kTypeDataPipeProducer, to_receive->GetType());
407 producer_dispatcher_ =
408 static_cast<DataPipeProducerDispatcher*>(to_receive.get());
382 } 409 }
383 410
384 private: 411 private:
385 scoped_refptr<DataPipeConsumerDispatcher> consumer_dispatcher_; 412 DISALLOW_COPY_AND_ASSIGN(RemoteProducerDataPipeImplTestHelper2);
413 };
386 414
387 DISALLOW_COPY_AND_ASSIGN(RemoteConsumerDataPipeImplTestHelper); 415 // RemoteConsumerDataPipeImplTestHelper2 ---------------------------------------
416
417 // This is like |RemoteConsumerDataPipeImplTestHelper|, but |DoTransfer()| does
418 // a second transfer. This thus tests passing a consumer handle twice, and in
419 // particular tests (some of) |RemoteProducerDataPipeImpl|'s
420 // |ConsumerEndSerialize()| (instead of |LocalDataPipeImpl|'s).
421 //
422 // Note about naming confusion: This class is named after the "local" class,
423 // i.e., |dp_| will have a |RemoteConsumerDataPipeImpl|. The remote side, of
424 // course, will have a |RemoteProducerDataPipeImpl|.
425 class RemoteConsumerDataPipeImplTestHelper2
426 : public RemoteConsumerDataPipeImplTestHelper {
427 public:
428 RemoteConsumerDataPipeImplTestHelper2() {}
429 ~RemoteConsumerDataPipeImplTestHelper2() override {}
430
431 void DoTransfer() override {
432 // This is the consumer dispatcher we'll send.
433 scoped_refptr<DataPipeConsumerDispatcher> to_send =
434 new DataPipeConsumerDispatcher();
435 to_send->Init(dp());
436 scoped_refptr<Dispatcher> to_receive;
437 SendDispatcher(0, to_send, &to_receive);
438 // |to_send| should have been closed. This is |DCHECK()|ed when it is
439 // destroyed.
440 EXPECT_TRUE(to_send->HasOneRef());
441 to_send = nullptr;
442 ASSERT_EQ(Dispatcher::kTypeDataPipeConsumer, to_receive->GetType());
443 to_send = static_cast<DataPipeConsumerDispatcher*>(to_receive.get());
444 to_receive = nullptr;
445
446 // Now send it back the other way.
447 SendDispatcher(1, to_send, &to_receive);
448 // |consumer_dispatcher_| should have been closed. This is |DCHECK()|ed when
449 // it is destroyed.
450 EXPECT_TRUE(to_send->HasOneRef());
451 to_send = nullptr;
452
453 ASSERT_EQ(Dispatcher::kTypeDataPipeConsumer, to_receive->GetType());
454 consumer_dispatcher_ =
455 static_cast<DataPipeConsumerDispatcher*>(to_receive.get());
456 }
457
458 private:
459 DISALLOW_COPY_AND_ASSIGN(RemoteConsumerDataPipeImplTestHelper2);
388 }; 460 };
389 461
390 // Test case instantiation ----------------------------------------------------- 462 // Test case instantiation -----------------------------------------------------
391 463
392 typedef testing::Types<LocalDataPipeImplTestHelper, 464 typedef testing::Types<LocalDataPipeImplTestHelper,
393 RemoteProducerDataPipeImplTestHelper, 465 RemoteProducerDataPipeImplTestHelper,
394 RemoteConsumerDataPipeImplTestHelper> HelperTypes; 466 RemoteConsumerDataPipeImplTestHelper,
467 RemoteProducerDataPipeImplTestHelper2,
468 RemoteConsumerDataPipeImplTestHelper2> HelperTypes;
395 469
396 TYPED_TEST_CASE(DataPipeImplTest, HelperTypes); 470 TYPED_TEST_CASE(DataPipeImplTest, HelperTypes);
397 471
398 // Tests ----------------------------------------------------------------------- 472 // Tests -----------------------------------------------------------------------
399 473
400 TYPED_TEST(DataPipeImplTest, SimpleReadWrite) { 474 TYPED_TEST(DataPipeImplTest, SimpleReadWrite) {
401 const MojoCreateDataPipeOptions options = { 475 const MojoCreateDataPipeOptions options = {
402 kSizeOfOptions, // |struct_size|. 476 kSizeOfOptions, // |struct_size|.
403 MOJO_CREATE_DATA_PIPE_OPTIONS_FLAG_NONE, // |flags|. 477 MOJO_CREATE_DATA_PIPE_OPTIONS_FLAG_NONE, // |flags|.
404 static_cast<uint32_t>(sizeof(int32_t)), // |element_num_bytes|. 478 static_cast<uint32_t>(sizeof(int32_t)), // |element_num_bytes|.
(...skipping 1232 matching lines...) Expand 10 before | Expand all | Expand 10 after
1637 EXPECT_EQ(MOJO_RESULT_FAILED_PRECONDITION, 1711 EXPECT_EQ(MOJO_RESULT_FAILED_PRECONDITION,
1638 this->dpc()->ConsumerBeginReadData( 1712 this->dpc()->ConsumerBeginReadData(
1639 MakeUserPointer(&read_ptr), MakeUserPointer(&num_bytes), true)); 1713 MakeUserPointer(&read_ptr), MakeUserPointer(&num_bytes), true));
1640 1714
1641 this->ConsumerClose(); 1715 this->ConsumerClose();
1642 } 1716 }
1643 1717
1644 } // namespace 1718 } // namespace
1645 } // namespace system 1719 } // namespace system
1646 } // namespace mojo 1720 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/edk/system/data_pipe_impl.cc ('k') | mojo/edk/system/local_data_pipe_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698