Index: mojo/common/test/test_utils_posix.cc |
diff --git a/mojo/common/test/test_utils_posix.cc b/mojo/common/test/test_utils_posix.cc |
index b99ad3b636e2eaa97588dcb83d96aed1254290ae..0072d0a597144602ed7d2213e5d4ad0a725799a4 100644 |
--- a/mojo/common/test/test_utils_posix.cc |
+++ b/mojo/common/test/test_utils_posix.cc |
@@ -10,7 +10,6 @@ |
#include "base/base_paths.h" |
#include "base/path_service.h" |
#include "base/posix/eintr_wrapper.h" |
-#include "mojo/embedder/platform_handle.h" |
namespace mojo { |
namespace test { |
@@ -75,6 +74,21 @@ bool NonBlockingRead(const embedder::PlatformHandle& handle, |
return true; |
} |
+embedder::ScopedPlatformHandle PlatformHandleFromFILE(base::ScopedFILE fp) { |
+ CHECK(fp); |
+ int rv = dup(fileno(fp.get())); |
+ PCHECK(rv != -1) << "dup"; |
+ return embedder::ScopedPlatformHandle(embedder::PlatformHandle(rv)); |
+} |
+ |
+base::ScopedFILE FILEFromPlatformHandle(embedder::ScopedPlatformHandle h, |
+ const char* mode) { |
+ CHECK(h.is_valid()); |
+ base::ScopedFILE rv(fdopen(h.release().fd, mode)); |
+ PCHECK(rv) << "fdopen"; |
+ return rv.Pass(); |
+} |
+ |
base::FilePath GetFilePathForJSResource(const std::string& path) { |
std::string binding_path = "gen/" + path + ".js"; |
base::FilePath exe_dir; |