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

Unified Diff: net/disk_cache/simple/simple_index_file_unittest.cc

Issue 145303002: Convert Media Galleries to use base::File (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase 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
« no previous file with comments | « net/base/net_errors.cc ('k') | net/disk_cache/simple/simple_synchronous_entry.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/disk_cache/simple/simple_index_file_unittest.cc
diff --git a/net/disk_cache/simple/simple_index_file_unittest.cc b/net/disk_cache/simple/simple_index_file_unittest.cc
index 17aa595bba98e949b90195ba4ce8bdc188ddd02f..3f4b56f376a9af537f09fa60e263a6ec230547c8 100644
--- a/net/disk_cache/simple/simple_index_file_unittest.cc
+++ b/net/disk_cache/simple/simple_index_file_unittest.cc
@@ -3,6 +3,7 @@
// found in the LICENSE file.
#include "base/file_util.h"
+#include "base/files/file.h"
#include "base/files/scoped_temp_dir.h"
#include "base/hash.h"
#include "base/logging.h"
@@ -269,19 +270,16 @@ TEST_F(SimpleIndexFileTest, SimpleCacheUpgrade) {
const base::FilePath cache_path = cache_dir.path();
// Write an old fake index file.
- base::PlatformFileError error;
- base::PlatformFile file = base::CreatePlatformFile(
- cache_path.AppendASCII("index"),
- base::PLATFORM_FILE_CREATE | base::PLATFORM_FILE_WRITE,
- NULL,
- &error);
+ base::File file(cache_path.AppendASCII("index"),
+ base::File::FLAG_CREATE | base::File::FLAG_WRITE);
+ ASSERT_TRUE(file.IsValid());
disk_cache::FakeIndexData file_contents;
file_contents.initial_magic_number = disk_cache::kSimpleInitialMagicNumber;
file_contents.version = 5;
- int bytes_written = base::WritePlatformFile(
- file, 0, reinterpret_cast<char*>(&file_contents), sizeof(file_contents));
- ASSERT_TRUE(base::ClosePlatformFile(file));
+ int bytes_written = file.Write(0, reinterpret_cast<char*>(&file_contents),
+ sizeof(file_contents));
ASSERT_EQ((int)sizeof(file_contents), bytes_written);
+ file.Close();
// Write the index file. The format is incorrect, but for transitioning from
// v5 it does not matter.
« no previous file with comments | « net/base/net_errors.cc ('k') | net/disk_cache/simple/simple_synchronous_entry.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698