| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "chrome/browser/chromeos/drive/file_system/download_operation.h" | 5 #include "chrome/browser/chromeos/drive/file_system/download_operation.h" |
| 6 | 6 |
| 7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
| 8 #include "base/task_runner_util.h" | 8 #include "base/task_runner_util.h" |
| 9 #include "chrome/browser/chromeos/drive/fake_free_disk_space_getter.h" | 9 #include "chrome/browser/chromeos/drive/fake_free_disk_space_getter.h" |
| 10 #include "chrome/browser/chromeos/drive/file_cache.h" | 10 #include "chrome/browser/chromeos/drive/file_cache.h" |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 ASSERT_TRUE(entry); | 57 ASSERT_TRUE(entry); |
| 58 EXPECT_FALSE(entry->file_specific_info().is_hosted_document()); | 58 EXPECT_FALSE(entry->file_specific_info().is_hosted_document()); |
| 59 | 59 |
| 60 // The transfered file is cached and the change of "offline available" | 60 // The transfered file is cached and the change of "offline available" |
| 61 // attribute is notified. | 61 // attribute is notified. |
| 62 EXPECT_EQ(1U, observer()->get_changed_paths().size()); | 62 EXPECT_EQ(1U, observer()->get_changed_paths().size()); |
| 63 EXPECT_EQ(1U, observer()->get_changed_paths().count(file_in_root.DirName())); | 63 EXPECT_EQ(1U, observer()->get_changed_paths().count(file_in_root.DirName())); |
| 64 | 64 |
| 65 // Verify that readable permission is set. | 65 // Verify that readable permission is set. |
| 66 int permission = 0; | 66 int permission = 0; |
| 67 EXPECT_TRUE(file_util::GetPosixFilePermissions(file_path, &permission)); | 67 EXPECT_TRUE(base::GetPosixFilePermissions(file_path, &permission)); |
| 68 EXPECT_EQ(file_util::FILE_PERMISSION_READ_BY_USER | | 68 EXPECT_EQ(base::FILE_PERMISSION_READ_BY_USER | |
| 69 file_util::FILE_PERMISSION_WRITE_BY_USER | | 69 base::FILE_PERMISSION_WRITE_BY_USER | |
| 70 file_util::FILE_PERMISSION_READ_BY_GROUP | | 70 base::FILE_PERMISSION_READ_BY_GROUP | |
| 71 file_util::FILE_PERMISSION_READ_BY_OTHERS, permission); | 71 base::FILE_PERMISSION_READ_BY_OTHERS, permission); |
| 72 } | 72 } |
| 73 | 73 |
| 74 TEST_F(DownloadOperationTest, | 74 TEST_F(DownloadOperationTest, |
| 75 EnsureFileDownloadedByPath_FromServer_NoSpaceAtAll) { | 75 EnsureFileDownloadedByPath_FromServer_NoSpaceAtAll) { |
| 76 base::FilePath file_in_root(FILE_PATH_LITERAL("drive/root/File 1.txt")); | 76 base::FilePath file_in_root(FILE_PATH_LITERAL("drive/root/File 1.txt")); |
| 77 | 77 |
| 78 // Pretend we have no space at all. | 78 // Pretend we have no space at all. |
| 79 fake_free_disk_space_getter()->set_default_value(0); | 79 fake_free_disk_space_getter()->set_default_value(0); |
| 80 | 80 |
| 81 FileError error = FILE_ERROR_OK; | 81 FileError error = FILE_ERROR_OK; |
| (...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 460 test_util::RunBlockingPoolTask(); | 460 test_util::RunBlockingPoolTask(); |
| 461 | 461 |
| 462 EXPECT_EQ(FILE_ERROR_OK, error); | 462 EXPECT_EQ(FILE_ERROR_OK, error); |
| 463 // Check that the result of local modification is propagated. | 463 // Check that the result of local modification is propagated. |
| 464 EXPECT_EQ(static_cast<int64>(dirty_size), init_entry->file_info().size()); | 464 EXPECT_EQ(static_cast<int64>(dirty_size), init_entry->file_info().size()); |
| 465 EXPECT_EQ(static_cast<int64>(dirty_size), entry->file_info().size()); | 465 EXPECT_EQ(static_cast<int64>(dirty_size), entry->file_info().size()); |
| 466 } | 466 } |
| 467 | 467 |
| 468 } // namespace file_system | 468 } // namespace file_system |
| 469 } // namespace drive | 469 } // namespace drive |
| OLD | NEW |