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/bind.h" | 9 #include "base/bind.h" |
10 #include "base/file_path.h" | 10 #include "base/file_path.h" |
(...skipping 1422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1433 EXPECT_EQ(base::PLATFORM_FILE_OK, | 1433 EXPECT_EQ(base::PLATFORM_FILE_OK, |
1434 ofu()->GetLocalFilePath(context.get(), kPath[0], &local_path)); | 1434 ofu()->GetLocalFilePath(context.get(), kPath[0], &local_path)); |
1435 EXPECT_TRUE(file_util::Delete(local_path, false)); | 1435 EXPECT_TRUE(file_util::Delete(local_path, false)); |
1436 | 1436 |
1437 context.reset(NewContext(NULL)); | 1437 context.reset(NewContext(NULL)); |
1438 entries.clear(); | 1438 entries.clear(); |
1439 EXPECT_EQ(base::PLATFORM_FILE_OK, | 1439 EXPECT_EQ(base::PLATFORM_FILE_OK, |
1440 ofu()->ReadDirectory(context.get(), FilePath(), &entries)); | 1440 ofu()->ReadDirectory(context.get(), FilePath(), &entries)); |
1441 EXPECT_EQ(ARRAYSIZE_UNSAFE(kPath) - 1, entries.size()); | 1441 EXPECT_EQ(ARRAYSIZE_UNSAFE(kPath) - 1, entries.size()); |
1442 } | 1442 } |
1443 | |
1444 TEST_F(ObfuscatedFileUtilTest, TestDirectoryTimestamp) { | |
1445 scoped_ptr<FileSystemOperationContext> context(NewContext(NULL)); | |
1446 const FilePath dir_path(FILE_PATH_LITERAL("foo_dir")); | |
1447 | |
1448 // Create working directory. | |
1449 EXPECT_EQ(base::PLATFORM_FILE_OK, | |
1450 ofu()->CreateDirectory(context.get(), dir_path, false, false)); | |
1451 | |
1452 // Reset modification time. | |
1453 context.reset(NewContext(NULL)); | |
1454 EXPECT_EQ(base::PLATFORM_FILE_OK, | |
1455 ofu()->Touch(context.get(), dir_path, base::Time(), base::Time())); | |
ericu
2011/11/30 19:16:04
I'm not sure the round-trip from base::Time to wha
tzik
2011/12/01 16:28:46
Done.
| |
1456 | |
1457 // Create a file in the working directory. | |
1458 bool created = false; | |
1459 context.reset(NewContext(NULL)); | |
1460 EXPECT_EQ(base::PLATFORM_FILE_OK, | |
1461 ofu()->EnsureFileExists(context.get(), | |
1462 dir_path.AppendASCII("bar file"), | |
1463 &created)); | |
1464 EXPECT_TRUE(created); | |
1465 | |
1466 // Ensure modification time of the parent directory changed. | |
1467 base::PlatformFileInfo file_info; | |
1468 FilePath path; | |
1469 context.reset(NewContext(NULL)); | |
1470 EXPECT_EQ(base::PLATFORM_FILE_OK, | |
1471 ofu()->GetFileInfo(context.get(), dir_path, &file_info, &path)); | |
1472 EXPECT_NE(base::Time(), file_info.last_modified); | |
ericu
2011/11/30 19:16:04
Please also add tests for move, mkdir, copy, etc.,
tzik
2011/12/01 16:28:46
Done.
| |
1473 } | |
OLD | NEW |