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

Unified Diff: base/files/scoped_temp_dir_unittest.cc

Issue 125643002: Convert most of base and net to use base::File (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Use error_details() Created 6 years, 11 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
Index: base/files/scoped_temp_dir_unittest.cc
diff --git a/base/files/scoped_temp_dir_unittest.cc b/base/files/scoped_temp_dir_unittest.cc
index fe243ce2ee5691c60e9664355e7033860286eafa..da222304a09b1f8d6d5a324d2799b388d4912f1d 100644
--- a/base/files/scoped_temp_dir_unittest.cc
+++ b/base/files/scoped_temp_dir_unittest.cc
@@ -5,8 +5,8 @@
#include <string>
#include "base/file_util.h"
+#include "base/files/file.h"
#include "base/files/scoped_temp_dir.h"
-#include "base/platform_file.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace base {
@@ -98,17 +98,13 @@ TEST(ScopedTempDir, MultipleInvocations) {
TEST(ScopedTempDir, LockedTempDir) {
ScopedTempDir dir;
EXPECT_TRUE(dir.CreateUniqueTempDir());
- int file_flags = base::PLATFORM_FILE_CREATE_ALWAYS |
- base::PLATFORM_FILE_WRITE;
- base::PlatformFileError error_code = base::PLATFORM_FILE_OK;
- FilePath file_path(dir.path().Append(FILE_PATH_LITERAL("temp")));
- base::PlatformFile file = base::CreatePlatformFile(file_path, file_flags,
- NULL, &error_code);
- EXPECT_NE(base::kInvalidPlatformFileValue, file);
- EXPECT_EQ(base::PLATFORM_FILE_OK, error_code);
+ base::File file(dir.path().Append(FILE_PATH_LITERAL("temp")),
+ base::File::FLAG_CREATE_ALWAYS | base::File::FLAG_WRITE);
+ EXPECT_TRUE(file.IsValid());
+ EXPECT_EQ(base::File::FILE_OK, file.error_details());
EXPECT_FALSE(dir.Delete()); // We should not be able to delete.
EXPECT_FALSE(dir.path().empty()); // We should still have a valid path.
- EXPECT_TRUE(base::ClosePlatformFile(file));
+ file.Close();
// Now, we should be able to delete.
EXPECT_TRUE(dir.Delete());
}
« no previous file with comments | « no previous file | net/android/cert_verify_result_android.h » ('j') | net/disk_cache/simple/simple_synchronous_entry.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698