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

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

Issue 1554443003: Stop linking in the old Mojo EDK. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: merge and fix new flaky test 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/core_test_base.cc ('k') | mojo/edk/test/BUILD.gn » ('j') | 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..4cf8e4ac3dbbb35353cc73a022596dac2f802273 100644
--- a/mojo/edk/system/data_pipe_unittest.cc
+++ b/mojo/edk/system/data_pipe_unittest.cc
@@ -35,10 +35,12 @@ const uint32_t kSizeOfOptions =
// TODO(vtl): Get rid of this.
const size_t kMaxPoll = 100;
+#if !defined(OS_IOS)
// Used in Multiprocess test.
const size_t kMultiprocessCapacity = 37;
const char kMultiprocessTestData[] = "hello i'm a string that is 36 bytes";
const int kMultiprocessMaxIter = 513;
+#endif
class DataPipeTest : public testing::Test {
public:
@@ -1633,6 +1635,8 @@ TEST_F(DataPipeTest, ConsumerWithClosedProducerSent) {
ASSERT_EQ(MOJO_RESULT_OK, MojoClose(pipe1));
}
+#if !defined(OS_IOS)
+
bool WriteAllData(MojoHandle producer,
const void* elements,
uint32_t num_bytes) {
@@ -1777,6 +1781,11 @@ TEST_F(DataPipeTest, MAYBE_Multiprocess) {
}
// Don't have to close the consumer here because it will be done for us.
+ std::string quitquitquit("quitquitquit");
+ ASSERT_EQ(MOJO_RESULT_OK,
+ MojoWriteMessage(server_mp, quitquitquit.data(),
+ static_cast<uint32_t>(quitquitquit.size()),
+ nullptr, 0u, MOJO_WRITE_MESSAGE_FLAG_NONE));
EXPECT_EQ(MOJO_RESULT_OK, MojoClose(server_mp));
EXPECT_TRUE(multiprocess_test_helper.WaitForChildTestShutdown());
}
@@ -1842,11 +1851,24 @@ MOJO_MULTIPROCESS_TEST_CHILD_TEST(MultiprocessClient) {
// Write the test string one more time.
EXPECT_TRUE(WriteAllData(producer, kMultiprocessTestData, kTestDataSize));
+ std::string quitquitquit("quitquitquit");
+ ASSERT_EQ(MOJO_RESULT_OK, MojoWait(client_mp, MOJO_HANDLE_SIGNAL_READABLE,
+ MOJO_DEADLINE_INDEFINITE, &hss));
+ std::string read_buffer(1000, '\0');
+ uint32_t read_buffer_size = static_cast<uint32_t>(read_buffer.size());
+ ASSERT_EQ(MOJO_RESULT_OK,
+ MojoReadMessage(client_mp, &read_buffer[0], &read_buffer_size,
+ nullptr, 0, MOJO_READ_MESSAGE_FLAG_NONE));
+ read_buffer.resize(read_buffer_size);
+ ASSERT_EQ(quitquitquit, read_buffer);
+
// We swapped ends, so close the producer.
EXPECT_EQ(MOJO_RESULT_OK, MojoClose(producer));
EXPECT_EQ(MOJO_RESULT_OK, MojoClose(client_mp));
}
+#endif // !defined(OS_IOS)
+
} // namespace
} // namespace edk
} // namespace mojo
« no previous file with comments | « mojo/edk/system/core_test_base.cc ('k') | mojo/edk/test/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698