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

Side by Side Diff: webkit/browser/fileapi/obfuscated_file_util_unittest.cc

Issue 16950028: Move file_util::Delete to the base namespace (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 5 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <set> 5 #include <set>
6 #include <string> 6 #include <string>
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/file_util.h" 10 #include "base/file_util.h"
(...skipping 849 matching lines...) Expand 10 before | Expand all | Expand 10 after
860 ASSERT_EQ(1019, ComputeTotalFileSize()); 860 ASSERT_EQ(1019, ComputeTotalFileSize());
861 } 861 }
862 862
863 // Delete backing file to make following truncation fail. 863 // Delete backing file to make following truncation fail.
864 base::FilePath local_path; 864 base::FilePath local_path;
865 ASSERT_EQ(base::PLATFORM_FILE_OK, 865 ASSERT_EQ(base::PLATFORM_FILE_OK,
866 ofu()->GetLocalFilePath( 866 ofu()->GetLocalFilePath(
867 UnlimitedContext().get(), 867 UnlimitedContext().get(),
868 url, &local_path)); 868 url, &local_path));
869 ASSERT_FALSE(local_path.empty()); 869 ASSERT_FALSE(local_path.empty());
870 ASSERT_TRUE(file_util::Delete(local_path, false)); 870 ASSERT_TRUE(base::Delete(local_path, false));
871 871
872 EXPECT_EQ(base::PLATFORM_FILE_ERROR_NOT_FOUND, 872 EXPECT_EQ(base::PLATFORM_FILE_ERROR_NOT_FOUND,
873 ofu()->Truncate( 873 ofu()->Truncate(
874 LimitedContext(1234).get(), 874 LimitedContext(1234).get(),
875 url, 1234)); 875 url, 1234));
876 ASSERT_EQ(0, ComputeTotalFileSize()); 876 ASSERT_EQ(0, ComputeTotalFileSize());
877 } 877 }
878 878
879 TEST_F(ObfuscatedFileUtilTest, TestEnsureFileExists) { 879 TEST_F(ObfuscatedFileUtilTest, TestEnsureFileExists) {
880 FileSystemURL url = CreateURLFromUTF8("fake/file"); 880 FileSystemURL url = CreateURLFromUTF8("fake/file");
(...skipping 782 matching lines...) Expand 10 before | Expand all | Expand 10 after
1663 1663
1664 std::vector<DirectoryEntry> entries; 1664 std::vector<DirectoryEntry> entries;
1665 EXPECT_EQ(base::PLATFORM_FILE_OK, 1665 EXPECT_EQ(base::PLATFORM_FILE_OK,
1666 AsyncFileTestHelper::ReadDirectory( 1666 AsyncFileTestHelper::ReadDirectory(
1667 file_system_context(), empty_path, &entries)); 1667 file_system_context(), empty_path, &entries));
1668 EXPECT_EQ(3u, entries.size()); 1668 EXPECT_EQ(3u, entries.size());
1669 1669
1670 base::FilePath local_path; 1670 base::FilePath local_path;
1671 EXPECT_EQ(base::PLATFORM_FILE_OK, 1671 EXPECT_EQ(base::PLATFORM_FILE_OK,
1672 ofu()->GetLocalFilePath(context.get(), kPath[0], &local_path)); 1672 ofu()->GetLocalFilePath(context.get(), kPath[0], &local_path));
1673 EXPECT_TRUE(file_util::Delete(local_path, false)); 1673 EXPECT_TRUE(base::Delete(local_path, false));
1674 1674
1675 entries.clear(); 1675 entries.clear();
1676 EXPECT_EQ(base::PLATFORM_FILE_OK, 1676 EXPECT_EQ(base::PLATFORM_FILE_OK,
1677 AsyncFileTestHelper::ReadDirectory( 1677 AsyncFileTestHelper::ReadDirectory(
1678 file_system_context(), empty_path, &entries)); 1678 file_system_context(), empty_path, &entries));
1679 EXPECT_EQ(ARRAYSIZE_UNSAFE(kPath) - 1, entries.size()); 1679 EXPECT_EQ(ARRAYSIZE_UNSAFE(kPath) - 1, entries.size());
1680 } 1680 }
1681 1681
1682 TEST_F(ObfuscatedFileUtilTest, TestDirectoryTimestampForCreation) { 1682 TEST_F(ObfuscatedFileUtilTest, TestDirectoryTimestampForCreation) {
1683 scoped_ptr<FileSystemOperationContext> context(NewContext(NULL)); 1683 scoped_ptr<FileSystemOperationContext> context(NewContext(NULL));
(...skipping 637 matching lines...) Expand 10 before | Expand all | Expand 10 after
2321 // Remove isolated. 2321 // Remove isolated.
2322 storage_policy_->RemoveIsolated(origin_); 2322 storage_policy_->RemoveIsolated(origin_);
2323 2323
2324 // This should still get the same database. 2324 // This should still get the same database.
2325 SandboxDirectoryDatabase* db2 = file_util.GetDirectoryDatabase( 2325 SandboxDirectoryDatabase* db2 = file_util.GetDirectoryDatabase(
2326 origin_, kFileSystemTypePersistent, false /* create */); 2326 origin_, kFileSystemTypePersistent, false /* create */);
2327 ASSERT_EQ(db, db2); 2327 ASSERT_EQ(db, db2);
2328 } 2328 }
2329 2329
2330 } // namespace fileapi 2330 } // namespace fileapi
OLDNEW
« no previous file with comments | « webkit/browser/fileapi/obfuscated_file_util.cc ('k') | webkit/browser/fileapi/sandbox_database_test_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698