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

Unified Diff: mojo/common/test/test_utils_posix.cc

Issue 273023003: Mojo: Add test utils to go between a ScopedPlatformHandle and a ScopedFILE. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix win Created 6 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 | « mojo/common/test/test_utils.h ('k') | mojo/common/test/test_utils_win.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
« no previous file with comments | « mojo/common/test/test_utils.h ('k') | mojo/common/test/test_utils_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698