summaryrefslogtreecommitdiffstats
path: root/net/disk_cache
diff options
context:
space:
mode:
authorbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-03-06 20:42:30 +0000
committerbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-03-06 20:42:30 +0000
commite5c2a22eb106e0fef92bbf80ac8bf2429980cc4e (patch)
tree480bf91e3cf64d69f837a2f22f8fc868bf17dfdc /net/disk_cache
parent06b1d42b0ceadd4a70b7462c5c7e6adeb5a18ca4 (diff)
downloadchromium_src-e5c2a22eb106e0fef92bbf80ac8bf2429980cc4e.zip
chromium_src-e5c2a22eb106e0fef92bbf80ac8bf2429980cc4e.tar.gz
chromium_src-e5c2a22eb106e0fef92bbf80ac8bf2429980cc4e.tar.bz2
Move WriteFile and WriteFileDescriptor from file_util to base namespace.
R=viettrungluu@chromium.org TBR=viettrungluu Review URL: https://codereview.chromium.org/184563006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@255418 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/disk_cache')
-rw-r--r--net/disk_cache/backend_unittest.cc6
-rw-r--r--net/disk_cache/blockfile/block_files_unittest.cc2
-rw-r--r--net/disk_cache/simple/simple_index_file.cc2
-rw-r--r--net/disk_cache/simple/simple_index_file_unittest.cc13
-rw-r--r--net/disk_cache/simple/simple_version_upgrade_unittest.cc10
5 files changed, 16 insertions, 17 deletions
diff --git a/net/disk_cache/backend_unittest.cc b/net/disk_cache/backend_unittest.cc
index 35fdebc..68da572 100644
--- a/net/disk_cache/backend_unittest.cc
+++ b/net/disk_cache/backend_unittest.cc
@@ -482,7 +482,7 @@ TEST_F(DiskCacheBackendTest, ExternalFiles) {
const int kSize = 50;
scoped_refptr<net::IOBuffer> buffer1(new net::IOBuffer(kSize));
CacheTestFillBuffer(buffer1->data(), kSize, false);
- ASSERT_EQ(kSize, file_util::WriteFile(filename, buffer1->data(), kSize));
+ ASSERT_EQ(kSize, base::WriteFile(filename, buffer1->data(), kSize));
// Now let's create a file with the cache.
disk_cache::Entry* entry;
@@ -671,7 +671,7 @@ TEST_F(DiskCacheBackendTest, ShutdownWithPendingCreate_Fast) {
TEST_F(DiskCacheTest, TruncatedIndex) {
ASSERT_TRUE(CleanupCacheDir());
base::FilePath index = cache_path_.AppendASCII("index");
- ASSERT_EQ(5, file_util::WriteFile(index, "hello", 5));
+ ASSERT_EQ(5, base::WriteFile(index, "hello", 5));
base::Thread cache_thread("CacheThread");
ASSERT_TRUE(cache_thread.StartWithOptions(
@@ -3317,7 +3317,7 @@ TEST_F(DiskCacheBackendTest, SimpleCacheOpenBadFile) {
header.initial_magic_number = GG_UINT64_C(0xbadf00d);
EXPECT_EQ(
implicit_cast<int>(sizeof(header)),
- file_util::WriteFile(entry_file1_path, reinterpret_cast<char*>(&header),
+ base::WriteFile(entry_file1_path, reinterpret_cast<char*>(&header),
sizeof(header)));
ASSERT_EQ(net::ERR_FAILED, OpenEntry(key, &entry));
}
diff --git a/net/disk_cache/blockfile/block_files_unittest.cc b/net/disk_cache/blockfile/block_files_unittest.cc
index 8e2995d..bbd8981 100644
--- a/net/disk_cache/blockfile/block_files_unittest.cc
+++ b/net/disk_cache/blockfile/block_files_unittest.cc
@@ -270,7 +270,7 @@ TEST_F(DiskCacheTest, BlockFiles_InvalidFile) {
char header[kBlockHeaderSize];
memset(header, 'a', kBlockHeaderSize);
EXPECT_EQ(kBlockHeaderSize,
- file_util::WriteFile(filename, header, kBlockHeaderSize));
+ base::WriteFile(filename, header, kBlockHeaderSize));
EXPECT_TRUE(NULL == files.GetFile(addr));
diff --git a/net/disk_cache/simple/simple_index_file.cc b/net/disk_cache/simple/simple_index_file.cc
index 9e28a12..0b375f4 100644
--- a/net/disk_cache/simple/simple_index_file.cc
+++ b/net/disk_cache/simple/simple_index_file.cc
@@ -66,7 +66,7 @@ void UmaRecordIndexInitMethod(IndexInitMethod method,
}
bool WritePickleFile(Pickle* pickle, const base::FilePath& file_name) {
- int bytes_written = file_util::WriteFile(
+ int bytes_written = base::WriteFile(
file_name, static_cast<const char*>(pickle->data()), pickle->size());
if (bytes_written != implicit_cast<int>(pickle->size())) {
base::DeleteFile(file_name, /* recursive = */ false);
diff --git a/net/disk_cache/simple/simple_index_file_unittest.cc b/net/disk_cache/simple/simple_index_file_unittest.cc
index 3f4b56f..212320b 100644
--- a/net/disk_cache/simple/simple_index_file_unittest.cc
+++ b/net/disk_cache/simple/simple_index_file_unittest.cc
@@ -170,9 +170,8 @@ TEST_F(SimpleIndexFileTest, LegacyIsIndexFileStale) {
WrappedSimpleIndexFile::LegacyIsIndexFileStale(cache_mtime, index_path));
const std::string kDummyData = "nothing to be seen here";
EXPECT_EQ(static_cast<int>(kDummyData.size()),
- file_util::WriteFile(index_path,
- kDummyData.data(),
- kDummyData.size()));
+ base::WriteFile(index_path,
+ kDummyData.data(), kDummyData.size()));
ASSERT_TRUE(simple_util::GetMTime(cache_path, &cache_mtime));
EXPECT_FALSE(
WrappedSimpleIndexFile::LegacyIsIndexFileStale(cache_mtime, index_path));
@@ -244,7 +243,7 @@ TEST_F(SimpleIndexFileTest, LoadCorruptIndex) {
const std::string kDummyData = "nothing to be seen here";
EXPECT_EQ(
implicit_cast<int>(kDummyData.size()),
- file_util::WriteFile(index_path, kDummyData.data(), kDummyData.size()));
+ base::WriteFile(index_path, kDummyData.data(), kDummyData.size()));
base::Time fake_cache_mtime;
ASSERT_TRUE(simple_util::GetMTime(simple_index_file.GetIndexFilePath(),
&fake_cache_mtime));
@@ -287,9 +286,9 @@ TEST_F(SimpleIndexFileTest, SimpleCacheUpgrade) {
const base::FilePath old_index_file =
cache_path.AppendASCII("the-real-index");
ASSERT_EQ(implicit_cast<int>(index_file_contents.size()),
- file_util::WriteFile(old_index_file,
- index_file_contents.data(),
- index_file_contents.size()));
+ base::WriteFile(old_index_file,
+ index_file_contents.data(),
+ index_file_contents.size()));
// Upgrade the cache.
ASSERT_TRUE(disk_cache::UpgradeSimpleCacheOnDisk(cache_path));
diff --git a/net/disk_cache/simple/simple_version_upgrade_unittest.cc b/net/disk_cache/simple/simple_version_upgrade_unittest.cc
index a5493f7..15f4fa1 100644
--- a/net/disk_cache/simple/simple_version_upgrade_unittest.cc
+++ b/net/disk_cache/simple/simple_version_upgrade_unittest.cc
@@ -39,7 +39,7 @@ bool WriteFakeIndexFileV5(const base::FilePath& cache_path) {
data.unused_must_be_zero2 = 0;
const base::FilePath file_name = cache_path.AppendASCII("index");
return sizeof(data) ==
- file_util::WriteFile(
+ base::WriteFile(
file_name, reinterpret_cast<const char*>(&data), sizeof(data));
}
@@ -55,7 +55,7 @@ TEST(SimpleVersionUpgradeTest, FailsToMigrateBackwards) {
data.unused_must_be_zero2 = 0;
const base::FilePath file_name = cache_path.AppendASCII(kFakeIndexFileName);
ASSERT_EQ(implicit_cast<int>(sizeof(data)),
- file_util::WriteFile(
+ base::WriteFile(
file_name, reinterpret_cast<const char*>(&data), sizeof(data)));
EXPECT_FALSE(disk_cache::UpgradeSimpleCacheOnDisk(cache_dir.path()));
}
@@ -69,7 +69,7 @@ TEST(SimpleVersionUpgradeTest, FakeIndexVersionGetsUpdated) {
const std::string file_contents("incorrectly serialized data");
const base::FilePath index_file = cache_path.AppendASCII(kIndexFileName);
ASSERT_EQ(implicit_cast<int>(file_contents.size()),
- file_util::WriteFile(
+ base::WriteFile(
index_file, file_contents.data(), file_contents.size()));
// Upgrade.
@@ -96,7 +96,7 @@ TEST(SimpleVersionUpgradeTest, UpgradeV5V6IndexMustDisappear) {
const std::string file_contents("incorrectly serialized data");
const base::FilePath index_file = cache_path.AppendASCII(kIndexFileName);
ASSERT_EQ(implicit_cast<int>(file_contents.size()),
- file_util::WriteFile(
+ base::WriteFile(
index_file, file_contents.data(), file_contents.size()));
// Create a few entry-like files.
@@ -109,7 +109,7 @@ TEST(SimpleVersionUpgradeTest, UpgradeV5V6IndexMustDisappear) {
file_contents +
base::StringPrintf(" %" PRIx64, implicit_cast<uint64>(entry_hash));
ASSERT_EQ(implicit_cast<int>(entry_contents.size()),
- file_util::WriteFile(cache_path.AppendASCII(file_name),
+ base::WriteFile(cache_path.AppendASCII(file_name),
entry_contents.data(),
entry_contents.size()));
}