| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #include "mojo/embedder/platform_channel_pair.h" | 5 #include "mojo/embedder/platform_channel_pair.h" |
| 6 | 6 |
| 7 #include <errno.h> | 7 #include <errno.h> |
| 8 #include <poll.h> | 8 #include <poll.h> |
| 9 #include <signal.h> | 9 #include <signal.h> |
| 10 #include <stdio.h> | 10 #include <stdio.h> |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 pfds.fd = h.fd; | 37 pfds.fd = h.fd; |
| 38 pfds.events = POLLIN; | 38 pfds.events = POLLIN; |
| 39 CHECK_EQ(poll(&pfds, 1, -1), 1); | 39 CHECK_EQ(poll(&pfds, 1, -1), 1); |
| 40 } | 40 } |
| 41 | 41 |
| 42 class PlatformChannelPairPosixTest : public testing::Test { | 42 class PlatformChannelPairPosixTest : public testing::Test { |
| 43 public: | 43 public: |
| 44 PlatformChannelPairPosixTest() {} | 44 PlatformChannelPairPosixTest() {} |
| 45 virtual ~PlatformChannelPairPosixTest() {} | 45 virtual ~PlatformChannelPairPosixTest() {} |
| 46 | 46 |
| 47 virtual void SetUp() OVERRIDE { | 47 virtual void SetUp() override { |
| 48 // Make sure |SIGPIPE| isn't being ignored. | 48 // Make sure |SIGPIPE| isn't being ignored. |
| 49 struct sigaction action = {}; | 49 struct sigaction action = {}; |
| 50 action.sa_handler = SIG_DFL; | 50 action.sa_handler = SIG_DFL; |
| 51 ASSERT_EQ(0, sigaction(SIGPIPE, &action, &old_action_)); | 51 ASSERT_EQ(0, sigaction(SIGPIPE, &action, &old_action_)); |
| 52 } | 52 } |
| 53 | 53 |
| 54 virtual void TearDown() OVERRIDE { | 54 virtual void TearDown() override { |
| 55 // Restore the |SIGPIPE| handler. | 55 // Restore the |SIGPIPE| handler. |
| 56 ASSERT_EQ(0, sigaction(SIGPIPE, &old_action_, nullptr)); | 56 ASSERT_EQ(0, sigaction(SIGPIPE, &old_action_, nullptr)); |
| 57 } | 57 } |
| 58 | 58 |
| 59 private: | 59 private: |
| 60 struct sigaction old_action_; | 60 struct sigaction old_action_; |
| 61 | 61 |
| 62 DISALLOW_COPY_AND_ASSIGN(PlatformChannelPairPosixTest); | 62 DISALLOW_COPY_AND_ASSIGN(PlatformChannelPairPosixTest); |
| 63 }; | 63 }; |
| 64 | 64 |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 246 char read_buf[100]; | 246 char read_buf[100]; |
| 247 size_t bytes_read = fread(read_buf, 1, sizeof(read_buf), fp.get()); | 247 size_t bytes_read = fread(read_buf, 1, sizeof(read_buf), fp.get()); |
| 248 EXPECT_EQ(file_contents.size(), bytes_read); | 248 EXPECT_EQ(file_contents.size(), bytes_read); |
| 249 EXPECT_EQ(file_contents, std::string(read_buf, bytes_read)); | 249 EXPECT_EQ(file_contents, std::string(read_buf, bytes_read)); |
| 250 } | 250 } |
| 251 } | 251 } |
| 252 | 252 |
| 253 } // namespace | 253 } // namespace |
| 254 } // namespace embedder | 254 } // namespace embedder |
| 255 } // namespace mojo | 255 } // namespace mojo |
| OLD | NEW |