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

Unified Diff: mojo/edk/embedder/platform_channel_pair_posix_unittest.cc

Issue 1152623006: Limit the behavior of some tests to avoid OS X flake (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 7 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 | « no previous file | mojo/edk/system/multiprocess_message_pipe_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/edk/embedder/platform_channel_pair_posix_unittest.cc
diff --git a/mojo/edk/embedder/platform_channel_pair_posix_unittest.cc b/mojo/edk/embedder/platform_channel_pair_posix_unittest.cc
index 56540d79c106a835d349d29fbac2e6670b14b8dc..107406e20e859523de7e38f5d8f82d8f3380fb96 100644
--- a/mojo/edk/embedder/platform_channel_pair_posix_unittest.cc
+++ b/mojo/edk/embedder/platform_channel_pair_posix_unittest.cc
@@ -137,7 +137,14 @@ TEST_F(PlatformChannelPairPosixTest, SendReceiveFDs) {
ScopedPlatformHandle server_handle = channel_pair.PassServerHandle().Pass();
ScopedPlatformHandle client_handle = channel_pair.PassClientHandle().Pass();
- for (size_t i = 1; i < kPlatformChannelMaxNumHandles; i++) {
+// Reduce the number of FDs opened on OS X to avoid test flake.
+#if defined(OS_MACOSX)
+ const size_t kNumHandlesToSend = kPlatformChannelMaxNumHandles / 2;
+#else
+ const size_t kNumHandlesToSend = kPlatformChannelMaxNumHandles;
+#endif
+
+ for (size_t i = 1; i < kNumHandlesToSend; i++) {
// Make |i| files, with the j-th file consisting of j copies of the digit
// |c|.
const char c = '0' + (i % 10);
@@ -178,7 +185,7 @@ TEST_F(PlatformChannelPairPosixTest, SendReceiveFDs) {
received_handles.pop_front();
ASSERT_TRUE(fp);
rewind(fp.get());
- char read_buf[kPlatformChannelMaxNumHandles];
+ char read_buf[kNumHandlesToSend];
size_t bytes_read = fread(read_buf, 1, sizeof(read_buf), fp.get());
EXPECT_EQ(j + 1, bytes_read);
EXPECT_EQ(std::string(j + 1, c), std::string(read_buf, bytes_read));
« no previous file with comments | « no previous file | mojo/edk/system/multiprocess_message_pipe_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698