Upstream version 7.36.149.0
[platform/framework/web/crosswalk.git] / src / base / platform_file_unittest.cc
index 9cf66a9..8088383 100644 (file)
@@ -25,6 +25,26 @@ int WriteFully(PlatformFile file, int64 offset,
   return WritePlatformFile(file, offset, data, size);
 }
 
+PlatformFile CreatePlatformFile(const FilePath& path,
+                                int flags,
+                                bool* created,
+                                PlatformFileError* error) {
+  File file(path, flags);
+  if (!file.IsValid()) {
+    if (error)
+      *error = static_cast<PlatformFileError>(file.error_details());
+    return kInvalidPlatformFileValue;
+  }
+
+  if (created)
+    *created = file.created();
+
+  if (error)
+    *error = PLATFORM_FILE_OK;
+
+  return file.TakePlatformFile();
+}
+
 } // namespace
 
 TEST(PlatformFile, CreatePlatformFile) {