| 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/test/test_utils.h" | 5 #include "mojo/edk/test/test_utils.h" |
| 6 | 6 |
| 7 #include <fcntl.h> | 7 #include <fcntl.h> |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <unistd.h> | 9 #include <unistd.h> |
| 10 | 10 |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 } else { | 70 } else { |
| 71 *bytes_read = result; | 71 *bytes_read = result; |
| 72 } | 72 } |
| 73 | 73 |
| 74 return true; | 74 return true; |
| 75 } | 75 } |
| 76 | 76 |
| 77 ScopedPlatformHandle PlatformHandleFromFILE(base::ScopedFILE fp) { | 77 ScopedPlatformHandle PlatformHandleFromFILE(base::ScopedFILE fp) { |
| 78 CHECK(fp); | 78 CHECK(fp); |
| 79 int rv = dup(fileno(fp.get())); | 79 int rv = dup(fileno(fp.get())); |
| 80 PCHECK(rv != -1) << "dup"; | 80 // dup |
| 81 CHECK(rv != -1); |
| 81 return ScopedPlatformHandle(PlatformHandle(rv)); | 82 return ScopedPlatformHandle(PlatformHandle(rv)); |
| 82 } | 83 } |
| 83 | 84 |
| 84 base::ScopedFILE FILEFromPlatformHandle(ScopedPlatformHandle h, | 85 base::ScopedFILE FILEFromPlatformHandle(ScopedPlatformHandle h, |
| 85 const char* mode) { | 86 const char* mode) { |
| 86 CHECK(h.is_valid()); | 87 CHECK(h.is_valid()); |
| 87 base::ScopedFILE rv(fdopen(h.release().handle, mode)); | 88 base::ScopedFILE rv(fdopen(h.release().handle, mode)); |
| 88 PCHECK(rv) << "fdopen"; | 89 // fdopen |
| 90 CHECK(rv); |
| 89 return rv; | 91 return rv; |
| 90 } | 92 } |
| 91 | 93 |
| 92 } // namespace test | 94 } // namespace test |
| 93 } // namespace edk | 95 } // namespace edk |
| 94 } // namespace mojo | 96 } // namespace mojo |
| OLD | NEW |