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

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

Issue 1639093002: Add //mojo/edk/platform/thread_utils.* containing "yield" and "sleep". (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 4 years, 10 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/remote_message_pipe_unittest.cc ('k') | mojo/edk/system/test/BUILD.gn » ('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 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 // NOTE(vtl): Some of these tests are inherently flaky (e.g., if run on a 5 // NOTE(vtl): Some of these tests are inherently flaky (e.g., if run on a
6 // heavily-loaded system). Sorry. |test::EpsilonTimeout()| may be increased to 6 // heavily-loaded system). Sorry. |test::EpsilonTimeout()| may be increased to
7 // increase tolerance and reduce observed flakiness (though doing so reduces the 7 // increase tolerance and reduce observed flakiness (though doing so reduces the
8 // meaningfulness of the test). 8 // meaningfulness of the test).
9 9
10 #include "mojo/edk/system/simple_dispatcher.h" 10 #include "mojo/edk/system/simple_dispatcher.h"
11 11
12 #include <memory> 12 #include <memory>
13 #include <vector> 13 #include <vector>
14 14
15 #include "base/logging.h" 15 #include "base/logging.h"
16 #include "mojo/edk/system/test/sleep.h" 16 #include "mojo/edk/platform/thread_utils.h"
17 #include "mojo/edk/system/test/stopwatch.h" 17 #include "mojo/edk/system/test/stopwatch.h"
18 #include "mojo/edk/system/test/timeouts.h" 18 #include "mojo/edk/system/test/timeouts.h"
19 #include "mojo/edk/system/waiter.h" 19 #include "mojo/edk/system/waiter.h"
20 #include "mojo/edk/system/waiter_test_utils.h" 20 #include "mojo/edk/system/waiter_test_utils.h"
21 #include "mojo/edk/util/make_unique.h" 21 #include "mojo/edk/util/make_unique.h"
22 #include "mojo/edk/util/ref_ptr.h" 22 #include "mojo/edk/util/ref_ptr.h"
23 #include "mojo/edk/util/thread_annotations.h" 23 #include "mojo/edk/util/thread_annotations.h"
24 #include "mojo/public/cpp/system/macros.h" 24 #include "mojo/public/cpp/system/macros.h"
25 #include "testing/gtest/include/gtest/gtest.h" 25 #include "testing/gtest/include/gtest/gtest.h"
26 26
27 using mojo::platform::ThreadSleep;
27 using mojo::util::MakeRefCounted; 28 using mojo::util::MakeRefCounted;
28 using mojo::util::MakeUnique; 29 using mojo::util::MakeUnique;
29 using mojo::util::MutexLocker; 30 using mojo::util::MutexLocker;
30 using mojo::util::RefPtr; 31 using mojo::util::RefPtr;
31 32
32 namespace mojo { 33 namespace mojo {
33 namespace system { 34 namespace system {
34 namespace { 35 namespace {
35 36
36 class MockSimpleDispatcher final : public SimpleDispatcher { 37 class MockSimpleDispatcher final : public SimpleDispatcher {
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after
357 358
358 // Wait for readable and becomes readable after some time. 359 // Wait for readable and becomes readable after some time.
359 { 360 {
360 auto d = MakeRefCounted<MockSimpleDispatcher>(); 361 auto d = MakeRefCounted<MockSimpleDispatcher>();
361 { 362 {
362 test::WaiterThread thread(d, MOJO_HANDLE_SIGNAL_READABLE, 363 test::WaiterThread thread(d, MOJO_HANDLE_SIGNAL_READABLE,
363 MOJO_DEADLINE_INDEFINITE, 2, &did_wait, &result, 364 MOJO_DEADLINE_INDEFINITE, 2, &did_wait, &result,
364 &context, &hss); 365 &context, &hss);
365 stopwatch.Start(); 366 stopwatch.Start();
366 thread.Start(); 367 thread.Start();
367 test::Sleep(2 * test::EpsilonTimeout()); 368 ThreadSleep(2 * test::EpsilonTimeout());
368 d->SetSatisfiedSignals(MOJO_HANDLE_SIGNAL_READABLE); 369 d->SetSatisfiedSignals(MOJO_HANDLE_SIGNAL_READABLE);
369 } // Joins the thread. 370 } // Joins the thread.
370 EXPECT_EQ(MOJO_RESULT_OK, d->Close()); 371 EXPECT_EQ(MOJO_RESULT_OK, d->Close());
371 } 372 }
372 MojoDeadline elapsed = stopwatch.Elapsed(); 373 MojoDeadline elapsed = stopwatch.Elapsed();
373 EXPECT_GT(elapsed, (2 - 1) * test::EpsilonTimeout()); 374 EXPECT_GT(elapsed, (2 - 1) * test::EpsilonTimeout());
374 EXPECT_LT(elapsed, (2 + 1) * test::EpsilonTimeout()); 375 EXPECT_LT(elapsed, (2 + 1) * test::EpsilonTimeout());
375 EXPECT_TRUE(did_wait); 376 EXPECT_TRUE(did_wait);
376 EXPECT_EQ(MOJO_RESULT_OK, result); 377 EXPECT_EQ(MOJO_RESULT_OK, result);
377 EXPECT_EQ(2u, context); 378 EXPECT_EQ(2u, context);
378 EXPECT_EQ(MOJO_HANDLE_SIGNAL_READABLE, hss.satisfied_signals); 379 EXPECT_EQ(MOJO_HANDLE_SIGNAL_READABLE, hss.satisfied_signals);
379 EXPECT_EQ(MOJO_HANDLE_SIGNAL_READABLE | MOJO_HANDLE_SIGNAL_WRITABLE, 380 EXPECT_EQ(MOJO_HANDLE_SIGNAL_READABLE | MOJO_HANDLE_SIGNAL_WRITABLE,
380 hss.satisfiable_signals); 381 hss.satisfiable_signals);
381 382
382 // Wait for readable and becomes never-readable after some time. 383 // Wait for readable and becomes never-readable after some time.
383 { 384 {
384 auto d = MakeRefCounted<MockSimpleDispatcher>(); 385 auto d = MakeRefCounted<MockSimpleDispatcher>();
385 { 386 {
386 test::WaiterThread thread(d, MOJO_HANDLE_SIGNAL_READABLE, 387 test::WaiterThread thread(d, MOJO_HANDLE_SIGNAL_READABLE,
387 MOJO_DEADLINE_INDEFINITE, 3, &did_wait, &result, 388 MOJO_DEADLINE_INDEFINITE, 3, &did_wait, &result,
388 &context, &hss); 389 &context, &hss);
389 stopwatch.Start(); 390 stopwatch.Start();
390 thread.Start(); 391 thread.Start();
391 test::Sleep(2 * test::EpsilonTimeout()); 392 ThreadSleep(2 * test::EpsilonTimeout());
392 d->SetSatisfiableSignals(MOJO_HANDLE_SIGNAL_NONE); 393 d->SetSatisfiableSignals(MOJO_HANDLE_SIGNAL_NONE);
393 } // Joins the thread. 394 } // Joins the thread.
394 EXPECT_EQ(MOJO_RESULT_OK, d->Close()); 395 EXPECT_EQ(MOJO_RESULT_OK, d->Close());
395 } 396 }
396 elapsed = stopwatch.Elapsed(); 397 elapsed = stopwatch.Elapsed();
397 EXPECT_GT(elapsed, (2 - 1) * test::EpsilonTimeout()); 398 EXPECT_GT(elapsed, (2 - 1) * test::EpsilonTimeout());
398 EXPECT_LT(elapsed, (2 + 1) * test::EpsilonTimeout()); 399 EXPECT_LT(elapsed, (2 + 1) * test::EpsilonTimeout());
399 EXPECT_TRUE(did_wait); 400 EXPECT_TRUE(did_wait);
400 EXPECT_EQ(MOJO_RESULT_FAILED_PRECONDITION, result); 401 EXPECT_EQ(MOJO_RESULT_FAILED_PRECONDITION, result);
401 EXPECT_EQ(3u, context); 402 EXPECT_EQ(3u, context);
402 EXPECT_EQ(0u, hss.satisfied_signals); 403 EXPECT_EQ(0u, hss.satisfied_signals);
403 EXPECT_EQ(0u, hss.satisfiable_signals); 404 EXPECT_EQ(0u, hss.satisfiable_signals);
404 405
405 // Wait for readable and dispatcher gets closed. 406 // Wait for readable and dispatcher gets closed.
406 { 407 {
407 auto d = MakeRefCounted<MockSimpleDispatcher>(); 408 auto d = MakeRefCounted<MockSimpleDispatcher>();
408 test::WaiterThread thread(d, MOJO_HANDLE_SIGNAL_READABLE, 409 test::WaiterThread thread(d, MOJO_HANDLE_SIGNAL_READABLE,
409 MOJO_DEADLINE_INDEFINITE, 4, &did_wait, &result, 410 MOJO_DEADLINE_INDEFINITE, 4, &did_wait, &result,
410 &context, &hss); 411 &context, &hss);
411 stopwatch.Start(); 412 stopwatch.Start();
412 thread.Start(); 413 thread.Start();
413 test::Sleep(2 * test::EpsilonTimeout()); 414 ThreadSleep(2 * test::EpsilonTimeout());
414 EXPECT_EQ(MOJO_RESULT_OK, d->Close()); 415 EXPECT_EQ(MOJO_RESULT_OK, d->Close());
415 } // Joins the thread. 416 } // Joins the thread.
416 elapsed = stopwatch.Elapsed(); 417 elapsed = stopwatch.Elapsed();
417 EXPECT_GT(elapsed, (2 - 1) * test::EpsilonTimeout()); 418 EXPECT_GT(elapsed, (2 - 1) * test::EpsilonTimeout());
418 EXPECT_LT(elapsed, (2 + 1) * test::EpsilonTimeout()); 419 EXPECT_LT(elapsed, (2 + 1) * test::EpsilonTimeout());
419 EXPECT_TRUE(did_wait); 420 EXPECT_TRUE(did_wait);
420 EXPECT_EQ(MOJO_RESULT_CANCELLED, result); 421 EXPECT_EQ(MOJO_RESULT_CANCELLED, result);
421 EXPECT_EQ(4u, context); 422 EXPECT_EQ(4u, context);
422 EXPECT_EQ(0u, hss.satisfied_signals); 423 EXPECT_EQ(0u, hss.satisfied_signals);
423 EXPECT_EQ(0u, hss.satisfiable_signals); 424 EXPECT_EQ(0u, hss.satisfiable_signals);
424 425
425 // Wait for readable and times out. 426 // Wait for readable and times out.
426 { 427 {
427 auto d = MakeRefCounted<MockSimpleDispatcher>(); 428 auto d = MakeRefCounted<MockSimpleDispatcher>();
428 { 429 {
429 test::WaiterThread thread(d, MOJO_HANDLE_SIGNAL_READABLE, 430 test::WaiterThread thread(d, MOJO_HANDLE_SIGNAL_READABLE,
430 2 * test::EpsilonTimeout(), 5, &did_wait, 431 2 * test::EpsilonTimeout(), 5, &did_wait,
431 &result, &context, &hss); 432 &result, &context, &hss);
432 stopwatch.Start(); 433 stopwatch.Start();
433 thread.Start(); 434 thread.Start();
434 test::Sleep(1 * test::EpsilonTimeout()); 435 ThreadSleep(1 * test::EpsilonTimeout());
435 // Not what we're waiting for. 436 // Not what we're waiting for.
436 d->SetSatisfiedSignals(MOJO_HANDLE_SIGNAL_WRITABLE); 437 d->SetSatisfiedSignals(MOJO_HANDLE_SIGNAL_WRITABLE);
437 } // Joins the thread (after its wait times out). 438 } // Joins the thread (after its wait times out).
438 // If we closed earlier, then probably we'd get a |MOJO_RESULT_CANCELLED|. 439 // If we closed earlier, then probably we'd get a |MOJO_RESULT_CANCELLED|.
439 EXPECT_EQ(MOJO_RESULT_OK, d->Close()); 440 EXPECT_EQ(MOJO_RESULT_OK, d->Close());
440 } 441 }
441 elapsed = stopwatch.Elapsed(); 442 elapsed = stopwatch.Elapsed();
442 EXPECT_GT(elapsed, (2 - 1) * test::EpsilonTimeout()); 443 EXPECT_GT(elapsed, (2 - 1) * test::EpsilonTimeout());
443 EXPECT_LT(elapsed, (2 + 1) * test::EpsilonTimeout()); 444 EXPECT_LT(elapsed, (2 + 1) * test::EpsilonTimeout());
444 EXPECT_TRUE(did_wait); 445 EXPECT_TRUE(did_wait);
(...skipping 14 matching lines...) Expand all
459 // All wait for readable and becomes readable after some time. 460 // All wait for readable and becomes readable after some time.
460 { 461 {
461 auto d = MakeRefCounted<MockSimpleDispatcher>(); 462 auto d = MakeRefCounted<MockSimpleDispatcher>();
462 std::vector<std::unique_ptr<test::WaiterThread>> threads; 463 std::vector<std::unique_ptr<test::WaiterThread>> threads;
463 for (uint32_t i = 0; i < kNumWaiters; i++) { 464 for (uint32_t i = 0; i < kNumWaiters; i++) {
464 threads.push_back(MakeUnique<test::WaiterThread>( 465 threads.push_back(MakeUnique<test::WaiterThread>(
465 d, MOJO_HANDLE_SIGNAL_READABLE, MOJO_DEADLINE_INDEFINITE, i, 466 d, MOJO_HANDLE_SIGNAL_READABLE, MOJO_DEADLINE_INDEFINITE, i,
466 &did_wait[i], &result[i], &context[i], &hss[i])); 467 &did_wait[i], &result[i], &context[i], &hss[i]));
467 threads.back()->Start(); 468 threads.back()->Start();
468 } 469 }
469 test::Sleep(2 * test::EpsilonTimeout()); 470 ThreadSleep(2 * test::EpsilonTimeout());
470 d->SetSatisfiedSignals(MOJO_HANDLE_SIGNAL_READABLE); 471 d->SetSatisfiedSignals(MOJO_HANDLE_SIGNAL_READABLE);
471 EXPECT_EQ(MOJO_RESULT_OK, d->Close()); 472 EXPECT_EQ(MOJO_RESULT_OK, d->Close());
472 } // Joins the threads. 473 } // Joins the threads.
473 for (uint32_t i = 0; i < kNumWaiters; i++) { 474 for (uint32_t i = 0; i < kNumWaiters; i++) {
474 EXPECT_TRUE(did_wait[i]) << i; 475 EXPECT_TRUE(did_wait[i]) << i;
475 EXPECT_EQ(MOJO_RESULT_OK, result[i]) << i; 476 EXPECT_EQ(MOJO_RESULT_OK, result[i]) << i;
476 EXPECT_EQ(i, context[i]) << i; 477 EXPECT_EQ(i, context[i]) << i;
477 // Since we closed before joining, we can't say much about what each thread 478 // Since we closed before joining, we can't say much about what each thread
478 // saw as the state. 479 // saw as the state.
479 } 480 }
480 481
481 // Some wait for readable, some for writable, and becomes readable after some 482 // Some wait for readable, some for writable, and becomes readable after some
482 // time. 483 // time.
483 { 484 {
484 auto d = MakeRefCounted<MockSimpleDispatcher>(); 485 auto d = MakeRefCounted<MockSimpleDispatcher>();
485 std::vector<std::unique_ptr<test::WaiterThread>> threads; 486 std::vector<std::unique_ptr<test::WaiterThread>> threads;
486 for (uint32_t i = 0; i < kNumWaiters / 2; i++) { 487 for (uint32_t i = 0; i < kNumWaiters / 2; i++) {
487 threads.push_back(MakeUnique<test::WaiterThread>( 488 threads.push_back(MakeUnique<test::WaiterThread>(
488 d, MOJO_HANDLE_SIGNAL_READABLE, MOJO_DEADLINE_INDEFINITE, i, 489 d, MOJO_HANDLE_SIGNAL_READABLE, MOJO_DEADLINE_INDEFINITE, i,
489 &did_wait[i], &result[i], &context[i], &hss[i])); 490 &did_wait[i], &result[i], &context[i], &hss[i]));
490 threads.back()->Start(); 491 threads.back()->Start();
491 } 492 }
492 for (uint32_t i = kNumWaiters / 2; i < kNumWaiters; i++) { 493 for (uint32_t i = kNumWaiters / 2; i < kNumWaiters; i++) {
493 threads.push_back(MakeUnique<test::WaiterThread>( 494 threads.push_back(MakeUnique<test::WaiterThread>(
494 d, MOJO_HANDLE_SIGNAL_WRITABLE, MOJO_DEADLINE_INDEFINITE, i, 495 d, MOJO_HANDLE_SIGNAL_WRITABLE, MOJO_DEADLINE_INDEFINITE, i,
495 &did_wait[i], &result[i], &context[i], &hss[i])); 496 &did_wait[i], &result[i], &context[i], &hss[i]));
496 threads.back()->Start(); 497 threads.back()->Start();
497 } 498 }
498 test::Sleep(2 * test::EpsilonTimeout()); 499 ThreadSleep(2 * test::EpsilonTimeout());
499 d->SetSatisfiedSignals(MOJO_HANDLE_SIGNAL_READABLE); 500 d->SetSatisfiedSignals(MOJO_HANDLE_SIGNAL_READABLE);
500 // This will wake up the ones waiting to write. 501 // This will wake up the ones waiting to write.
501 EXPECT_EQ(MOJO_RESULT_OK, d->Close()); 502 EXPECT_EQ(MOJO_RESULT_OK, d->Close());
502 } // Joins the threads. 503 } // Joins the threads.
503 for (uint32_t i = 0; i < kNumWaiters / 2; i++) { 504 for (uint32_t i = 0; i < kNumWaiters / 2; i++) {
504 EXPECT_TRUE(did_wait[i]) << i; 505 EXPECT_TRUE(did_wait[i]) << i;
505 EXPECT_EQ(MOJO_RESULT_OK, result[i]) << i; 506 EXPECT_EQ(MOJO_RESULT_OK, result[i]) << i;
506 EXPECT_EQ(i, context[i]) << i; 507 EXPECT_EQ(i, context[i]) << i;
507 // Since we closed before joining, we can't say much about what each thread 508 // Since we closed before joining, we can't say much about what each thread
508 // saw as the state. 509 // saw as the state.
(...skipping 16 matching lines...) Expand all
525 d, MOJO_HANDLE_SIGNAL_READABLE, MOJO_DEADLINE_INDEFINITE, i, 526 d, MOJO_HANDLE_SIGNAL_READABLE, MOJO_DEADLINE_INDEFINITE, i,
526 &did_wait[i], &result[i], &context[i], &hss[i])); 527 &did_wait[i], &result[i], &context[i], &hss[i]));
527 threads.back()->Start(); 528 threads.back()->Start();
528 } 529 }
529 for (uint32_t i = kNumWaiters / 2; i < kNumWaiters; i++) { 530 for (uint32_t i = kNumWaiters / 2; i < kNumWaiters; i++) {
530 threads.push_back(MakeUnique<test::WaiterThread>( 531 threads.push_back(MakeUnique<test::WaiterThread>(
531 d, MOJO_HANDLE_SIGNAL_WRITABLE, MOJO_DEADLINE_INDEFINITE, i, 532 d, MOJO_HANDLE_SIGNAL_WRITABLE, MOJO_DEADLINE_INDEFINITE, i,
532 &did_wait[i], &result[i], &context[i], &hss[i])); 533 &did_wait[i], &result[i], &context[i], &hss[i]));
533 threads.back()->Start(); 534 threads.back()->Start();
534 } 535 }
535 test::Sleep(1 * test::EpsilonTimeout()); 536 ThreadSleep(1 * test::EpsilonTimeout());
536 d->SetSatisfiableSignals(MOJO_HANDLE_SIGNAL_READABLE); 537 d->SetSatisfiableSignals(MOJO_HANDLE_SIGNAL_READABLE);
537 test::Sleep(1 * test::EpsilonTimeout()); 538 ThreadSleep(1 * test::EpsilonTimeout());
538 d->SetSatisfiedSignals(MOJO_HANDLE_SIGNAL_READABLE); 539 d->SetSatisfiedSignals(MOJO_HANDLE_SIGNAL_READABLE);
539 EXPECT_EQ(MOJO_RESULT_OK, d->Close()); 540 EXPECT_EQ(MOJO_RESULT_OK, d->Close());
540 } // Joins the threads. 541 } // Joins the threads.
541 for (uint32_t i = 0; i < kNumWaiters / 2; i++) { 542 for (uint32_t i = 0; i < kNumWaiters / 2; i++) {
542 EXPECT_TRUE(did_wait[i]) << i; 543 EXPECT_TRUE(did_wait[i]) << i;
543 EXPECT_EQ(MOJO_RESULT_OK, result[i]) << i; 544 EXPECT_EQ(MOJO_RESULT_OK, result[i]) << i;
544 EXPECT_EQ(i, context[i]) << i; 545 EXPECT_EQ(i, context[i]) << i;
545 // Since we closed before joining, we can't say much about what each thread 546 // Since we closed before joining, we can't say much about what each thread
546 // saw as the state. 547 // saw as the state.
547 } 548 }
(...skipping 15 matching lines...) Expand all
563 d, MOJO_HANDLE_SIGNAL_READABLE, 3 * test::EpsilonTimeout(), i, 564 d, MOJO_HANDLE_SIGNAL_READABLE, 3 * test::EpsilonTimeout(), i,
564 &did_wait[i], &result[i], &context[i], &hss[i])); 565 &did_wait[i], &result[i], &context[i], &hss[i]));
565 threads.back()->Start(); 566 threads.back()->Start();
566 } 567 }
567 for (uint32_t i = kNumWaiters / 2; i < kNumWaiters; i++) { 568 for (uint32_t i = kNumWaiters / 2; i < kNumWaiters; i++) {
568 threads.push_back(MakeUnique<test::WaiterThread>( 569 threads.push_back(MakeUnique<test::WaiterThread>(
569 d, MOJO_HANDLE_SIGNAL_WRITABLE, 1 * test::EpsilonTimeout(), i, 570 d, MOJO_HANDLE_SIGNAL_WRITABLE, 1 * test::EpsilonTimeout(), i,
570 &did_wait[i], &result[i], &context[i], &hss[i])); 571 &did_wait[i], &result[i], &context[i], &hss[i]));
571 threads.back()->Start(); 572 threads.back()->Start();
572 } 573 }
573 test::Sleep(2 * test::EpsilonTimeout()); 574 ThreadSleep(2 * test::EpsilonTimeout());
574 d->SetSatisfiedSignals(MOJO_HANDLE_SIGNAL_READABLE); 575 d->SetSatisfiedSignals(MOJO_HANDLE_SIGNAL_READABLE);
575 // All those waiting for writable should have timed out. 576 // All those waiting for writable should have timed out.
576 EXPECT_EQ(MOJO_RESULT_OK, d->Close()); 577 EXPECT_EQ(MOJO_RESULT_OK, d->Close());
577 } // Joins the threads. 578 } // Joins the threads.
578 for (uint32_t i = 0; i < kNumWaiters / 2; i++) { 579 for (uint32_t i = 0; i < kNumWaiters / 2; i++) {
579 EXPECT_TRUE(did_wait[i]) << i; 580 EXPECT_TRUE(did_wait[i]) << i;
580 EXPECT_EQ(MOJO_RESULT_OK, result[i]) << i; 581 EXPECT_EQ(MOJO_RESULT_OK, result[i]) << i;
581 EXPECT_EQ(i, context[i]) << i; 582 EXPECT_EQ(i, context[i]) << i;
582 // Since we closed before joining, we can't say much about what each thread 583 // Since we closed before joining, we can't say much about what each thread
583 // saw as the state. 584 // saw as the state.
584 } 585 }
585 for (uint32_t i = kNumWaiters / 2; i < kNumWaiters; i++) { 586 for (uint32_t i = kNumWaiters / 2; i < kNumWaiters; i++) {
586 EXPECT_TRUE(did_wait[i]) << i; 587 EXPECT_TRUE(did_wait[i]) << i;
587 EXPECT_EQ(MOJO_RESULT_DEADLINE_EXCEEDED, result[i]) << i; 588 EXPECT_EQ(MOJO_RESULT_DEADLINE_EXCEEDED, result[i]) << i;
588 // Since we closed before joining, we can't say much about what each thread 589 // Since we closed before joining, we can't say much about what each thread
589 // saw as the state. 590 // saw as the state.
590 } 591 }
591 } 592 }
592 593
593 // TODO(vtl): Stress test? 594 // TODO(vtl): Stress test?
594 595
595 } // namespace 596 } // namespace
596 } // namespace system 597 } // namespace system
597 } // namespace mojo 598 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/edk/system/remote_message_pipe_unittest.cc ('k') | mojo/edk/system/test/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698