| 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/edk/embedder/platform_channel_pair.h" | 5 #include "mojo/edk/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> |
| 11 #include <sys/socket.h> | 11 #include <sys/socket.h> |
| 12 #include <sys/types.h> | 12 #include <sys/types.h> |
| 13 #include <sys/uio.h> | 13 #include <sys/uio.h> |
| 14 #include <unistd.h> | 14 #include <unistd.h> |
| 15 | 15 |
| 16 #include <deque> | 16 #include <deque> |
| 17 #include <utility> | 17 #include <utility> |
| 18 #include <vector> | 18 #include <vector> |
| 19 | 19 |
| 20 #include "base/logging.h" | 20 #include "base/logging.h" |
| 21 #include "build/build_config.h" | 21 #include "build/build_config.h" |
| 22 #include "mojo/edk/embedder/platform_channel_utils.h" | 22 #include "mojo/edk/embedder/platform_channel_utils.h" |
| 23 #include "mojo/edk/embedder/platform_handle.h" | 23 #include "mojo/edk/platform/platform_handle.h" |
| 24 #include "mojo/edk/embedder/scoped_platform_handle.h" | 24 #include "mojo/edk/platform/scoped_platform_handle.h" |
| 25 #include "mojo/edk/system/test/scoped_test_dir.h" | 25 #include "mojo/edk/system/test/scoped_test_dir.h" |
| 26 #include "mojo/edk/test/test_utils.h" | 26 #include "mojo/edk/test/test_utils.h" |
| 27 #include "mojo/edk/util/scoped_file.h" | 27 #include "mojo/edk/util/scoped_file.h" |
| 28 #include "mojo/public/cpp/system/macros.h" | 28 #include "mojo/public/cpp/system/macros.h" |
| 29 #include "testing/gtest/include/gtest/gtest.h" | 29 #include "testing/gtest/include/gtest/gtest.h" |
| 30 | 30 |
| 31 using mojo::platform::PlatformHandle; |
| 32 using mojo::platform::ScopedPlatformHandle; |
| 33 |
| 31 namespace mojo { | 34 namespace mojo { |
| 32 namespace embedder { | 35 namespace embedder { |
| 33 namespace { | 36 namespace { |
| 34 | 37 |
| 35 void WaitReadable(PlatformHandle h) { | 38 void WaitReadable(PlatformHandle h) { |
| 36 struct pollfd pfds = {}; | 39 struct pollfd pfds = {}; |
| 37 pfds.fd = h.fd; | 40 pfds.fd = h.fd; |
| 38 pfds.events = POLLIN; | 41 pfds.events = POLLIN; |
| 39 CHECK_EQ(poll(&pfds, 1, -1), 1); | 42 CHECK_EQ(poll(&pfds, 1, -1), 1); |
| 40 } | 43 } |
| (...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 244 char read_buf[100]; | 247 char read_buf[100]; |
| 245 size_t bytes_read = fread(read_buf, 1, sizeof(read_buf), fp.get()); | 248 size_t bytes_read = fread(read_buf, 1, sizeof(read_buf), fp.get()); |
| 246 EXPECT_EQ(file_contents.size(), bytes_read); | 249 EXPECT_EQ(file_contents.size(), bytes_read); |
| 247 EXPECT_EQ(file_contents, std::string(read_buf, bytes_read)); | 250 EXPECT_EQ(file_contents, std::string(read_buf, bytes_read)); |
| 248 } | 251 } |
| 249 } | 252 } |
| 250 | 253 |
| 251 } // namespace | 254 } // namespace |
| 252 } // namespace embedder | 255 } // namespace embedder |
| 253 } // namespace mojo | 256 } // namespace mojo |
| OLD | NEW |