| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <algorithm> | 5 #include <algorithm> |
| 6 #include <set> | 6 #include <set> |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/file_path.h" | 9 #include "base/file_path.h" |
| 10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 201 EXPECT_EQ(base::PLATFORM_FILE_OK, ofsfu()->GetFileInfo( | 201 EXPECT_EQ(base::PLATFORM_FILE_OK, ofsfu()->GetFileInfo( |
| 202 context.get(), virtual_path, &file_info1, &data_path)); | 202 context.get(), virtual_path, &file_info1, &data_path)); |
| 203 EXPECT_EQ(data_path, local_path); | 203 EXPECT_EQ(data_path, local_path); |
| 204 | 204 |
| 205 EXPECT_FALSE(file_info0.is_directory); | 205 EXPECT_FALSE(file_info0.is_directory); |
| 206 EXPECT_FALSE(file_info1.is_directory); | 206 EXPECT_FALSE(file_info1.is_directory); |
| 207 EXPECT_FALSE(file_info0.is_symbolic_link); | 207 EXPECT_FALSE(file_info0.is_symbolic_link); |
| 208 EXPECT_FALSE(file_info1.is_symbolic_link); | 208 EXPECT_FALSE(file_info1.is_symbolic_link); |
| 209 EXPECT_EQ(0, file_info0.size); | 209 EXPECT_EQ(0, file_info0.size); |
| 210 EXPECT_EQ(length, file_info1.size); | 210 EXPECT_EQ(length, file_info1.size); |
| 211 EXPECT_LE(file_info0.last_accessed, file_info1.last_accessed); | |
| 212 EXPECT_LE(file_info0.last_modified, file_info1.last_modified); | 211 EXPECT_LE(file_info0.last_modified, file_info1.last_modified); |
| 213 EXPECT_EQ(file_info0.creation_time, file_info1.creation_time); | |
| 214 | 212 |
| 215 context.reset(NewContext()); | 213 context.reset(NewContext()); |
| 216 EXPECT_EQ(base::PLATFORM_FILE_OK, ofsfu()->Truncate( | 214 EXPECT_EQ(base::PLATFORM_FILE_OK, ofsfu()->Truncate( |
| 217 context.get(), virtual_path, length * 2)); | 215 context.get(), virtual_path, length * 2)); |
| 218 EXPECT_EQ(length * 2, GetSize(data_path)); | 216 EXPECT_EQ(length * 2, GetSize(data_path)); |
| 219 | 217 |
| 220 context.reset(NewContext()); | 218 context.reset(NewContext()); |
| 221 EXPECT_EQ(base::PLATFORM_FILE_OK, ofsfu()->Truncate( | 219 EXPECT_EQ(base::PLATFORM_FILE_OK, ofsfu()->Truncate( |
| 222 context.get(), virtual_path, 1)); | 220 context.get(), virtual_path, 1)); |
| 223 EXPECT_EQ(1, GetSize(data_path)); | 221 EXPECT_EQ(1, GetSize(data_path)); |
| (...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 723 FilePath source_path = UTF8ToFilePath(test_case.source_path); | 721 FilePath source_path = UTF8ToFilePath(test_case.source_path); |
| 724 FilePath dest_path = UTF8ToFilePath(test_case.dest_path); | 722 FilePath dest_path = UTF8ToFilePath(test_case.dest_path); |
| 725 | 723 |
| 726 context.reset(NewContext()); | 724 context.reset(NewContext()); |
| 727 ASSERT_EQ(base::PLATFORM_FILE_OK, ofsfu()->CreateDirectory( | 725 ASSERT_EQ(base::PLATFORM_FILE_OK, ofsfu()->CreateDirectory( |
| 728 context.get(), source_path.DirName(), exclusive, recursive)); | 726 context.get(), source_path.DirName(), exclusive, recursive)); |
| 729 context.reset(NewContext()); | 727 context.reset(NewContext()); |
| 730 ASSERT_EQ(base::PLATFORM_FILE_OK, ofsfu()->CreateDirectory( | 728 ASSERT_EQ(base::PLATFORM_FILE_OK, ofsfu()->CreateDirectory( |
| 731 context.get(), dest_path.DirName(), exclusive, recursive)); | 729 context.get(), dest_path.DirName(), exclusive, recursive)); |
| 732 | 730 |
| 733 base::Time last_access_time; | |
| 734 bool created = false; | 731 bool created = false; |
| 735 context.reset(NewContext()); | 732 context.reset(NewContext()); |
| 736 ASSERT_EQ(base::PLATFORM_FILE_OK, | 733 ASSERT_EQ(base::PLATFORM_FILE_OK, |
| 737 ofsfu()->EnsureFileExists(context.get(), source_path, &created)); | 734 ofsfu()->EnsureFileExists(context.get(), source_path, &created)); |
| 738 ASSERT_TRUE(created); | 735 ASSERT_TRUE(created); |
| 739 context.reset(NewContext()); | 736 context.reset(NewContext()); |
| 740 ASSERT_EQ(base::PLATFORM_FILE_OK, | 737 ASSERT_EQ(base::PLATFORM_FILE_OK, |
| 741 ofsfu()->Truncate(context.get(), source_path, kSourceLength)); | 738 ofsfu()->Truncate(context.get(), source_path, kSourceLength)); |
| 742 | 739 |
| 743 if (test_case.cause_overwrite) { | 740 if (test_case.cause_overwrite) { |
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 939 } | 936 } |
| 940 EXPECT_TRUE(found); | 937 EXPECT_TRUE(found); |
| 941 } | 938 } |
| 942 | 939 |
| 943 std::set<GURL> diff; | 940 std::set<GURL> diff; |
| 944 std::set_symmetric_difference(origins_expected.begin(), | 941 std::set_symmetric_difference(origins_expected.begin(), |
| 945 origins_expected.end(), origins_found.begin(), origins_found.end(), | 942 origins_expected.end(), origins_found.begin(), origins_found.end(), |
| 946 inserter(diff, diff.begin())); | 943 inserter(diff, diff.begin())); |
| 947 EXPECT_TRUE(diff.empty()); | 944 EXPECT_TRUE(diff.empty()); |
| 948 } | 945 } |
| OLD | NEW |