| 77 | const uint64 BufRendezvousTest::kDefaultIncarnation = 12345; |
| 78 | |
| 79 | TEST_F(BufRendezvousTest, CorrectUseProducerFirst) { |
| 80 | Status prod_status; |
| 81 | Status cons_status; |
| 82 | bool prod_callback_called = false; |
| 83 | bool cons_callback_called = false; |
| 84 | Notification note; |
| 85 | br_->ProvideBuf( |
| 86 | *kDefaultKey, default_device_, fake_device_context_, &a_, aa_, |
| 87 | [¬e, &prod_status, &prod_callback_called](const Status& s) { |
| 88 | prod_status = s; |
| 89 | prod_callback_called = true; |
| 90 | note.Notify(); |
| 91 | }); |
| 92 | EXPECT_FALSE(prod_callback_called); |
| 93 | br_->ConsumeBuf(*kDefaultKey, *kDefaultDeviceName, kDefaultIncarnation, |
| 94 | [this, &cons_status, &cons_callback_called]( |
| 95 | const Status& s, BufRendezvous::Hook* h) { |
| 96 | cons_status = s; |
| 97 | cons_callback_called = true; |
| 98 | ASSERT_TRUE(h != nullptr); |
| 99 | EXPECT_EQ(h->prod_dev, default_device_); |
| 100 | EXPECT_EQ(h->prod_ctx, fake_device_context_); |
| 101 | EXPECT_EQ(h->prod_value, &a_); |
| 102 | br_->DoneWithHook(h); |
| 103 | }); |
| 104 | EXPECT_TRUE(cons_callback_called); |
| 105 | note.WaitForNotification(); |
| 106 | EXPECT_TRUE(prod_callback_called); |
| 107 | TF_EXPECT_OK(cons_status); |
| 108 | TF_EXPECT_OK(prod_status); |
| 109 | } |
| 110 | |
| 111 | TEST_F(BufRendezvousTest, CorrectUseConsumerFirst) { |
| 112 | Status prod_status; |
nothing calls this directly
no test coverage detected