| OLD | NEW |
| 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 923 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 934 bool exclusive = false; | 934 bool exclusive = false; |
| 935 bool recursive = false; | 935 bool recursive = false; |
| 936 FileSystemURL url = CreateURLFromUTF8("foo/bar"); | 936 FileSystemURL url = CreateURLFromUTF8("foo/bar"); |
| 937 EXPECT_EQ(base::PLATFORM_FILE_ERROR_NOT_FOUND, ofu()->CreateDirectory( | 937 EXPECT_EQ(base::PLATFORM_FILE_ERROR_NOT_FOUND, ofu()->CreateDirectory( |
| 938 context.get(), url, exclusive, recursive)); | 938 context.get(), url, exclusive, recursive)); |
| 939 | 939 |
| 940 context.reset(NewContext(NULL)); | 940 context.reset(NewContext(NULL)); |
| 941 EXPECT_EQ(base::PLATFORM_FILE_ERROR_NOT_FOUND, | 941 EXPECT_EQ(base::PLATFORM_FILE_ERROR_NOT_FOUND, |
| 942 ofu()->DeleteDirectory(context.get(), url)); | 942 ofu()->DeleteDirectory(context.get(), url)); |
| 943 | 943 |
| 944 FileSystemURL root = CreateURLFromUTF8(""); | 944 FileSystemURL root = CreateURLFromUTF8(std::string()); |
| 945 EXPECT_FALSE(DirectoryExists(url)); | 945 EXPECT_FALSE(DirectoryExists(url)); |
| 946 EXPECT_FALSE(PathExists(url)); | 946 EXPECT_FALSE(PathExists(url)); |
| 947 context.reset(NewContext(NULL)); | 947 context.reset(NewContext(NULL)); |
| 948 EXPECT_TRUE(ofu()->IsDirectoryEmpty(context.get(), root)); | 948 EXPECT_TRUE(ofu()->IsDirectoryEmpty(context.get(), root)); |
| 949 | 949 |
| 950 context.reset(NewContext(NULL)); | 950 context.reset(NewContext(NULL)); |
| 951 exclusive = false; | 951 exclusive = false; |
| 952 recursive = true; | 952 recursive = true; |
| 953 EXPECT_EQ(base::PLATFORM_FILE_OK, ofu()->CreateDirectory( | 953 EXPECT_EQ(base::PLATFORM_FILE_OK, ofu()->CreateDirectory( |
| 954 context.get(), url, exclusive, recursive)); | 954 context.get(), url, exclusive, recursive)); |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1074 scoped_ptr<FileSystemOperationContext> context(NewContext(NULL)); | 1074 scoped_ptr<FileSystemOperationContext> context(NewContext(NULL)); |
| 1075 bool exclusive = true; | 1075 bool exclusive = true; |
| 1076 bool recursive = true; | 1076 bool recursive = true; |
| 1077 FileSystemURL url = CreateURLFromUTF8("directory/to/use"); | 1077 FileSystemURL url = CreateURLFromUTF8("directory/to/use"); |
| 1078 EXPECT_EQ(base::PLATFORM_FILE_OK, ofu()->CreateDirectory( | 1078 EXPECT_EQ(base::PLATFORM_FILE_OK, ofu()->CreateDirectory( |
| 1079 context.get(), url, exclusive, recursive)); | 1079 context.get(), url, exclusive, recursive)); |
| 1080 TestReadDirectoryHelper(url); | 1080 TestReadDirectoryHelper(url); |
| 1081 } | 1081 } |
| 1082 | 1082 |
| 1083 TEST_F(ObfuscatedFileUtilTest, TestReadRootWithSlash) { | 1083 TEST_F(ObfuscatedFileUtilTest, TestReadRootWithSlash) { |
| 1084 TestReadDirectoryHelper(CreateURLFromUTF8("")); | 1084 TestReadDirectoryHelper(CreateURLFromUTF8(std::string())); |
| 1085 } | 1085 } |
| 1086 | 1086 |
| 1087 TEST_F(ObfuscatedFileUtilTest, TestReadRootWithEmptyString) { | 1087 TEST_F(ObfuscatedFileUtilTest, TestReadRootWithEmptyString) { |
| 1088 TestReadDirectoryHelper(CreateURLFromUTF8("/")); | 1088 TestReadDirectoryHelper(CreateURLFromUTF8("/")); |
| 1089 } | 1089 } |
| 1090 | 1090 |
| 1091 TEST_F(ObfuscatedFileUtilTest, TestReadDirectoryOnFile) { | 1091 TEST_F(ObfuscatedFileUtilTest, TestReadDirectoryOnFile) { |
| 1092 FileSystemURL url = CreateURLFromUTF8("file"); | 1092 FileSystemURL url = CreateURLFromUTF8("file"); |
| 1093 scoped_ptr<FileSystemOperationContext> context(NewContext(NULL)); | 1093 scoped_ptr<FileSystemOperationContext> context(NewContext(NULL)); |
| 1094 | 1094 |
| (...skipping 1150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2245 ASSERT_EQ(base::PLATFORM_FILE_OK, | 2245 ASSERT_EQ(base::PLATFORM_FILE_OK, |
| 2246 ofu()->CreateOrOpen( | 2246 ofu()->CreateOrOpen( |
| 2247 AllowUsageIncrease(-length)->context(), file, | 2247 AllowUsageIncrease(-length)->context(), file, |
| 2248 base::PLATFORM_FILE_OPEN_TRUNCATED | base::PLATFORM_FILE_WRITE, | 2248 base::PLATFORM_FILE_OPEN_TRUNCATED | base::PLATFORM_FILE_WRITE, |
| 2249 &file_handle, &created)); | 2249 &file_handle, &created)); |
| 2250 ASSERT_EQ(0, ComputeTotalFileSize()); | 2250 ASSERT_EQ(0, ComputeTotalFileSize()); |
| 2251 EXPECT_TRUE(base::ClosePlatformFile(file_handle)); | 2251 EXPECT_TRUE(base::ClosePlatformFile(file_handle)); |
| 2252 } | 2252 } |
| 2253 | 2253 |
| 2254 } // namespace fileapi | 2254 } // namespace fileapi |
| OLD | NEW |