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

Unified Diff: mojo/edk/system/data_pipe_unittest.cc

Issue 1526923006: [mojo] Implement data pipe using a shared buffer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « mojo/edk/system/data_pipe_producer_dispatcher.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/edk/system/data_pipe_unittest.cc
diff --git a/mojo/edk/system/data_pipe_unittest.cc b/mojo/edk/system/data_pipe_unittest.cc
index af2cf3e6e815170e5c929df195fc2fd8c46a65dc..76df3579673ce9b67847e3f290a3c181ca2742b9 100644
--- a/mojo/edk/system/data_pipe_unittest.cc
+++ b/mojo/edk/system/data_pipe_unittest.cc
@@ -374,6 +374,14 @@ TEST_F(DataPipeTest, BasicProducerWaiting) {
ASSERT_EQ(123, elements[0]);
ASSERT_EQ(-1, elements[1]);
+ // Wait until we can write.
+ hss = MojoHandleSignalsState();
+ ASSERT_EQ(MOJO_RESULT_OK, MojoWait(producer_, MOJO_HANDLE_SIGNAL_WRITABLE,
+ MOJO_DEADLINE_INDEFINITE, &hss));
+ EXPECT_EQ(MOJO_HANDLE_SIGNAL_WRITABLE, hss.satisfied_signals);
+ EXPECT_EQ(MOJO_HANDLE_SIGNAL_WRITABLE | MOJO_HANDLE_SIGNAL_PEER_CLOSED,
+ hss.satisfiable_signals);
+
// Try writing, using a two-phase write.
void* buffer = nullptr;
num_bytes = static_cast<uint32_t>(3u * sizeof(elements[0]));
@@ -399,6 +407,14 @@ TEST_F(DataPipeTest, BasicProducerWaiting) {
ASSERT_EQ(MOJO_RESULT_OK, EndReadData(static_cast<uint32_t>(
1u * sizeof(elements[0]))));
+ // Wait until we can write.
+ hss = MojoHandleSignalsState();
+ ASSERT_EQ(MOJO_RESULT_OK, MojoWait(producer_, MOJO_HANDLE_SIGNAL_WRITABLE,
+ MOJO_DEADLINE_INDEFINITE, &hss));
+ EXPECT_EQ(MOJO_HANDLE_SIGNAL_WRITABLE, hss.satisfied_signals);
+ EXPECT_EQ(MOJO_HANDLE_SIGNAL_WRITABLE | MOJO_HANDLE_SIGNAL_PEER_CLOSED,
+ hss.satisfiable_signals);
+
// Write one element.
elements[0] = 123;
num_bytes = static_cast<uint32_t>(1u * sizeof(elements[0]));
@@ -569,7 +585,7 @@ TEST_F(DataPipeTest, BasicConsumerWaiting) {
ASSERT_EQ(MOJO_RESULT_OK,
MojoWait(consumer_, MOJO_HANDLE_SIGNAL_PEER_CLOSED,
MOJO_DEADLINE_INDEFINITE, &hss));
- ASSERT_TRUE((hss.satisfied_signals & MOJO_HANDLE_SIGNAL_PEER_CLOSED) != 0);
+ ASSERT_NE(0u, hss.satisfied_signals & MOJO_HANDLE_SIGNAL_PEER_CLOSED);
ASSERT_EQ(MOJO_HANDLE_SIGNAL_READABLE | MOJO_HANDLE_SIGNAL_PEER_CLOSED,
hss.satisfiable_signals);
« no previous file with comments | « mojo/edk/system/data_pipe_producer_dispatcher.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698