| 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 "chrome/browser/chromeos/drive/file_system.h" | 5 #include "chrome/browser/chromeos/drive/file_system.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 1591 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1602 base::FilePath file_in_root(FILE_PATH_LITERAL("drive/root/File 1.txt")); | 1602 base::FilePath file_in_root(FILE_PATH_LITERAL("drive/root/File 1.txt")); |
| 1603 scoped_ptr<ResourceEntry> entry(GetEntryInfoByPathSync(file_in_root)); | 1603 scoped_ptr<ResourceEntry> entry(GetEntryInfoByPathSync(file_in_root)); |
| 1604 const int64 file_size = entry->file_info().size(); | 1604 const int64 file_size = entry->file_info().size(); |
| 1605 | 1605 |
| 1606 // Pretend we have enough space. | 1606 // Pretend we have enough space. |
| 1607 fake_free_disk_space_getter_->set_fake_free_disk_space( | 1607 fake_free_disk_space_getter_->set_fake_free_disk_space( |
| 1608 file_size + internal::kMinFreeSpace); | 1608 file_size + internal::kMinFreeSpace); |
| 1609 | 1609 |
| 1610 FileError error = FILE_ERROR_FAILED; | 1610 FileError error = FILE_ERROR_FAILED; |
| 1611 base::FilePath file_path; | 1611 base::FilePath file_path; |
| 1612 std::string mime_type; | 1612 entry.reset(); |
| 1613 DriveFileType file_type; | |
| 1614 file_system_->GetFileByPath(file_in_root, | 1613 file_system_->GetFileByPath(file_in_root, |
| 1615 google_apis::test_util::CreateCopyResultCallback( | 1614 google_apis::test_util::CreateCopyResultCallback( |
| 1616 &error, &file_path, &mime_type, &file_type)); | 1615 &error, &file_path, &entry)); |
| 1617 google_apis::test_util::RunBlockingPoolTask(); | 1616 google_apis::test_util::RunBlockingPoolTask(); |
| 1618 | 1617 |
| 1619 EXPECT_EQ(FILE_ERROR_OK, error); | 1618 EXPECT_EQ(FILE_ERROR_OK, error); |
| 1620 EXPECT_EQ(REGULAR_FILE, file_type); | 1619 ASSERT_TRUE(entry); |
| 1620 EXPECT_FALSE(entry->file_specific_info().is_hosted_document()); |
| 1621 | 1621 |
| 1622 // Verify that readable permission is set. | 1622 // Verify that readable permission is set. |
| 1623 int permission = 0; | 1623 int permission = 0; |
| 1624 EXPECT_TRUE(file_util::GetPosixFilePermissions(file_path, &permission)); | 1624 EXPECT_TRUE(file_util::GetPosixFilePermissions(file_path, &permission)); |
| 1625 EXPECT_EQ(file_util::FILE_PERMISSION_READ_BY_USER | | 1625 EXPECT_EQ(file_util::FILE_PERMISSION_READ_BY_USER | |
| 1626 file_util::FILE_PERMISSION_WRITE_BY_USER | | 1626 file_util::FILE_PERMISSION_WRITE_BY_USER | |
| 1627 file_util::FILE_PERMISSION_READ_BY_GROUP | | 1627 file_util::FILE_PERMISSION_READ_BY_GROUP | |
| 1628 file_util::FILE_PERMISSION_READ_BY_OTHERS, permission); | 1628 file_util::FILE_PERMISSION_READ_BY_OTHERS, permission); |
| 1629 } | 1629 } |
| 1630 | 1630 |
| 1631 TEST_F(DriveFileSystemTest, GetFileByPath_FromGData_NoSpaceAtAll) { | 1631 TEST_F(DriveFileSystemTest, GetFileByPath_FromGData_NoSpaceAtAll) { |
| 1632 ASSERT_TRUE(LoadRootFeedDocument()); | 1632 ASSERT_TRUE(LoadRootFeedDocument()); |
| 1633 | 1633 |
| 1634 base::FilePath file_in_root(FILE_PATH_LITERAL("drive/root/File 1.txt")); | 1634 base::FilePath file_in_root(FILE_PATH_LITERAL("drive/root/File 1.txt")); |
| 1635 scoped_ptr<ResourceEntry> entry(GetEntryInfoByPathSync(file_in_root)); | |
| 1636 | 1635 |
| 1637 // Pretend we have no space at all. | 1636 // Pretend we have no space at all. |
| 1638 fake_free_disk_space_getter_->set_fake_free_disk_space(0); | 1637 fake_free_disk_space_getter_->set_fake_free_disk_space(0); |
| 1639 | 1638 |
| 1640 FileError error = FILE_ERROR_OK; | 1639 FileError error = FILE_ERROR_OK; |
| 1641 base::FilePath file_path; | 1640 base::FilePath file_path; |
| 1642 std::string mime_type; | 1641 scoped_ptr<ResourceEntry> entry; |
| 1643 DriveFileType file_type; | |
| 1644 file_system_->GetFileByPath(file_in_root, | 1642 file_system_->GetFileByPath(file_in_root, |
| 1645 google_apis::test_util::CreateCopyResultCallback( | 1643 google_apis::test_util::CreateCopyResultCallback( |
| 1646 &error, &file_path, &mime_type, &file_type)); | 1644 &error, &file_path, &entry)); |
| 1647 google_apis::test_util::RunBlockingPoolTask(); | 1645 google_apis::test_util::RunBlockingPoolTask(); |
| 1648 | 1646 |
| 1649 EXPECT_EQ(FILE_ERROR_NO_SPACE, error); | 1647 EXPECT_EQ(FILE_ERROR_NO_SPACE, error); |
| 1650 } | 1648 } |
| 1651 | 1649 |
| 1652 TEST_F(DriveFileSystemTest, GetFileByPath_FromGData_NoEnoughSpaceButCanFreeUp) { | 1650 TEST_F(DriveFileSystemTest, GetFileByPath_FromGData_NoEnoughSpaceButCanFreeUp) { |
| 1653 ASSERT_TRUE(LoadRootFeedDocument()); | 1651 ASSERT_TRUE(LoadRootFeedDocument()); |
| 1654 | 1652 |
| 1655 // The transfered file is cached and the change of "offline available" | 1653 // The transfered file is cached and the change of "offline available" |
| 1656 // attribute is notified. | 1654 // attribute is notified. |
| (...skipping 25 matching lines...) Expand all Loading... |
| 1682 | 1680 |
| 1683 FileError error = FILE_ERROR_FAILED; | 1681 FileError error = FILE_ERROR_FAILED; |
| 1684 cache_->Store("<resource_id>", "<md5>", tmp_file, | 1682 cache_->Store("<resource_id>", "<md5>", tmp_file, |
| 1685 internal::FileCache::FILE_OPERATION_COPY, | 1683 internal::FileCache::FILE_OPERATION_COPY, |
| 1686 google_apis::test_util::CreateCopyResultCallback(&error)); | 1684 google_apis::test_util::CreateCopyResultCallback(&error)); |
| 1687 google_apis::test_util::RunBlockingPoolTask(); | 1685 google_apis::test_util::RunBlockingPoolTask(); |
| 1688 EXPECT_EQ(FILE_ERROR_OK, error); | 1686 EXPECT_EQ(FILE_ERROR_OK, error); |
| 1689 ASSERT_TRUE(CacheEntryExists("<resource_id>", "<md5>")); | 1687 ASSERT_TRUE(CacheEntryExists("<resource_id>", "<md5>")); |
| 1690 | 1688 |
| 1691 base::FilePath file_path; | 1689 base::FilePath file_path; |
| 1692 std::string mime_type; | 1690 entry.reset(); |
| 1693 DriveFileType file_type; | |
| 1694 file_system_->GetFileByPath(file_in_root, | 1691 file_system_->GetFileByPath(file_in_root, |
| 1695 google_apis::test_util::CreateCopyResultCallback( | 1692 google_apis::test_util::CreateCopyResultCallback( |
| 1696 &error, &file_path, &mime_type, &file_type)); | 1693 &error, &file_path, &entry)); |
| 1697 google_apis::test_util::RunBlockingPoolTask(); | 1694 google_apis::test_util::RunBlockingPoolTask(); |
| 1698 | 1695 |
| 1699 EXPECT_EQ(FILE_ERROR_OK, error); | 1696 EXPECT_EQ(FILE_ERROR_OK, error); |
| 1700 EXPECT_EQ(REGULAR_FILE, file_type); | 1697 ASSERT_TRUE(entry); |
| 1698 EXPECT_FALSE(entry->file_specific_info().is_hosted_document()); |
| 1701 | 1699 |
| 1702 // The cache entry should be removed in order to free up space. | 1700 // The cache entry should be removed in order to free up space. |
| 1703 ASSERT_FALSE(CacheEntryExists("<resource_id>", "<md5>")); | 1701 ASSERT_FALSE(CacheEntryExists("<resource_id>", "<md5>")); |
| 1704 } | 1702 } |
| 1705 | 1703 |
| 1706 TEST_F(DriveFileSystemTest, GetFileByPath_FromGData_EnoughSpaceButBecomeFull) { | 1704 TEST_F(DriveFileSystemTest, GetFileByPath_FromGData_EnoughSpaceButBecomeFull) { |
| 1707 ASSERT_TRUE(LoadRootFeedDocument()); | 1705 ASSERT_TRUE(LoadRootFeedDocument()); |
| 1708 | 1706 |
| 1709 base::FilePath file_in_root(FILE_PATH_LITERAL("drive/root/File 1.txt")); | 1707 base::FilePath file_in_root(FILE_PATH_LITERAL("drive/root/File 1.txt")); |
| 1710 scoped_ptr<ResourceEntry> entry(GetEntryInfoByPathSync(file_in_root)); | 1708 scoped_ptr<ResourceEntry> entry(GetEntryInfoByPathSync(file_in_root)); |
| 1711 const int64 file_size = entry->file_info().size(); | 1709 const int64 file_size = entry->file_info().size(); |
| 1712 | 1710 |
| 1713 // Pretend we have enough space first (checked before downloading a file), | 1711 // Pretend we have enough space first (checked before downloading a file), |
| 1714 // but then start reporting we have not enough space. This is to emulate that | 1712 // but then start reporting we have not enough space. This is to emulate that |
| 1715 // the disk space becomes full after the file is downloaded for some reason | 1713 // the disk space becomes full after the file is downloaded for some reason |
| 1716 // (ex. the actual file was larger than the expected size). | 1714 // (ex. the actual file was larger than the expected size). |
| 1717 fake_free_disk_space_getter_->set_fake_free_disk_space( | 1715 fake_free_disk_space_getter_->set_fake_free_disk_space( |
| 1718 file_size + internal::kMinFreeSpace); | 1716 file_size + internal::kMinFreeSpace); |
| 1719 fake_free_disk_space_getter_->set_fake_free_disk_space( | 1717 fake_free_disk_space_getter_->set_fake_free_disk_space( |
| 1720 internal::kMinFreeSpace - 1); | 1718 internal::kMinFreeSpace - 1); |
| 1721 fake_free_disk_space_getter_->set_fake_free_disk_space( | 1719 fake_free_disk_space_getter_->set_fake_free_disk_space( |
| 1722 internal::kMinFreeSpace - 1); | 1720 internal::kMinFreeSpace - 1); |
| 1723 | 1721 |
| 1724 FileError error = FILE_ERROR_OK; | 1722 FileError error = FILE_ERROR_OK; |
| 1725 base::FilePath file_path; | 1723 base::FilePath file_path; |
| 1726 std::string mime_type; | 1724 entry.reset(); |
| 1727 DriveFileType file_type; | |
| 1728 file_system_->GetFileByPath(file_in_root, | 1725 file_system_->GetFileByPath(file_in_root, |
| 1729 google_apis::test_util::CreateCopyResultCallback( | 1726 google_apis::test_util::CreateCopyResultCallback( |
| 1730 &error, &file_path, &mime_type, &file_type)); | 1727 &error, &file_path, &entry)); |
| 1731 google_apis::test_util::RunBlockingPoolTask(); | 1728 google_apis::test_util::RunBlockingPoolTask(); |
| 1732 | 1729 |
| 1733 EXPECT_EQ(FILE_ERROR_NO_SPACE, error); | 1730 EXPECT_EQ(FILE_ERROR_NO_SPACE, error); |
| 1734 } | 1731 } |
| 1735 | 1732 |
| 1736 TEST_F(DriveFileSystemTest, GetFileByPath_FromCache) { | 1733 TEST_F(DriveFileSystemTest, GetFileByPath_FromCache) { |
| 1737 fake_free_disk_space_getter_->set_fake_free_disk_space(kLotsOfSpace); | 1734 fake_free_disk_space_getter_->set_fake_free_disk_space(kLotsOfSpace); |
| 1738 | 1735 |
| 1739 ASSERT_TRUE(LoadRootFeedDocument()); | 1736 ASSERT_TRUE(LoadRootFeedDocument()); |
| 1740 | 1737 |
| 1741 base::FilePath file_in_root(FILE_PATH_LITERAL("drive/root/File 1.txt")); | 1738 base::FilePath file_in_root(FILE_PATH_LITERAL("drive/root/File 1.txt")); |
| 1742 scoped_ptr<ResourceEntry> entry(GetEntryInfoByPathSync(file_in_root)); | 1739 scoped_ptr<ResourceEntry> entry(GetEntryInfoByPathSync(file_in_root)); |
| 1743 | 1740 |
| 1744 // Store something as cached version of this file. | 1741 // Store something as cached version of this file. |
| 1745 FileError error = FILE_ERROR_OK; | 1742 FileError error = FILE_ERROR_OK; |
| 1746 cache_->Store(entry->resource_id(), | 1743 cache_->Store(entry->resource_id(), |
| 1747 entry->file_specific_info().file_md5(), | 1744 entry->file_specific_info().file_md5(), |
| 1748 google_apis::test_util::GetTestFilePath( | 1745 google_apis::test_util::GetTestFilePath( |
| 1749 "chromeos/gdata/root_feed.json"), | 1746 "chromeos/gdata/root_feed.json"), |
| 1750 internal::FileCache::FILE_OPERATION_COPY, | 1747 internal::FileCache::FILE_OPERATION_COPY, |
| 1751 google_apis::test_util::CreateCopyResultCallback(&error)); | 1748 google_apis::test_util::CreateCopyResultCallback(&error)); |
| 1752 google_apis::test_util::RunBlockingPoolTask(); | 1749 google_apis::test_util::RunBlockingPoolTask(); |
| 1753 EXPECT_EQ(FILE_ERROR_OK, error); | 1750 EXPECT_EQ(FILE_ERROR_OK, error); |
| 1754 | 1751 |
| 1755 base::FilePath file_path; | 1752 base::FilePath file_path; |
| 1756 std::string mime_type; | 1753 entry.reset(); |
| 1757 DriveFileType file_type; | |
| 1758 file_system_->GetFileByPath(file_in_root, | 1754 file_system_->GetFileByPath(file_in_root, |
| 1759 google_apis::test_util::CreateCopyResultCallback( | 1755 google_apis::test_util::CreateCopyResultCallback( |
| 1760 &error, &file_path, &mime_type, &file_type)); | 1756 &error, &file_path, &entry)); |
| 1761 google_apis::test_util::RunBlockingPoolTask(); | 1757 google_apis::test_util::RunBlockingPoolTask(); |
| 1762 | 1758 |
| 1763 EXPECT_EQ(FILE_ERROR_OK, error); | 1759 EXPECT_EQ(FILE_ERROR_OK, error); |
| 1764 EXPECT_EQ(REGULAR_FILE, file_type); | 1760 ASSERT_TRUE(entry); |
| 1761 EXPECT_FALSE(entry->file_specific_info().is_hosted_document()); |
| 1765 } | 1762 } |
| 1766 | 1763 |
| 1767 TEST_F(DriveFileSystemTest, GetFileByPath_HostedDocument) { | 1764 TEST_F(DriveFileSystemTest, GetFileByPath_HostedDocument) { |
| 1768 ASSERT_TRUE(LoadRootFeedDocument()); | 1765 ASSERT_TRUE(LoadRootFeedDocument()); |
| 1769 | 1766 |
| 1770 base::FilePath file_in_root(FILE_PATH_LITERAL( | 1767 base::FilePath file_in_root(FILE_PATH_LITERAL( |
| 1771 "drive/root/Document 1 excludeDir-test.gdoc")); | 1768 "drive/root/Document 1 excludeDir-test.gdoc")); |
| 1772 scoped_ptr<ResourceEntry> src_entry = | 1769 scoped_ptr<ResourceEntry> src_entry = |
| 1773 GetEntryInfoByPathSync(file_in_root); | 1770 GetEntryInfoByPathSync(file_in_root); |
| 1774 ASSERT_TRUE(src_entry); | 1771 ASSERT_TRUE(src_entry); |
| 1775 | 1772 |
| 1776 FileError error = FILE_ERROR_FAILED; | 1773 FileError error = FILE_ERROR_FAILED; |
| 1777 base::FilePath file_path; | 1774 base::FilePath file_path; |
| 1778 std::string mime_type; | 1775 scoped_ptr<ResourceEntry> entry; |
| 1779 DriveFileType file_type; | |
| 1780 file_system_->GetFileByPath(file_in_root, | 1776 file_system_->GetFileByPath(file_in_root, |
| 1781 google_apis::test_util::CreateCopyResultCallback( | 1777 google_apis::test_util::CreateCopyResultCallback( |
| 1782 &error, &file_path, &mime_type, &file_type)); | 1778 &error, &file_path, &entry)); |
| 1783 google_apis::test_util::RunBlockingPoolTask(); | 1779 google_apis::test_util::RunBlockingPoolTask(); |
| 1784 | 1780 |
| 1785 EXPECT_EQ(HOSTED_DOCUMENT, file_type); | 1781 EXPECT_EQ(FILE_ERROR_OK, error); |
| 1782 ASSERT_TRUE(entry); |
| 1783 EXPECT_TRUE(entry->file_specific_info().is_hosted_document()); |
| 1786 EXPECT_FALSE(file_path.empty()); | 1784 EXPECT_FALSE(file_path.empty()); |
| 1787 | 1785 |
| 1788 ASSERT_TRUE(src_entry); | 1786 ASSERT_TRUE(src_entry); |
| 1789 VerifyHostedDocumentJSONFile(*src_entry, file_path); | 1787 VerifyHostedDocumentJSONFile(*src_entry, file_path); |
| 1790 } | 1788 } |
| 1791 | 1789 |
| 1792 TEST_F(DriveFileSystemTest, GetFileByResourceId) { | 1790 TEST_F(DriveFileSystemTest, GetFileByResourceId) { |
| 1793 fake_free_disk_space_getter_->set_fake_free_disk_space(kLotsOfSpace); | 1791 fake_free_disk_space_getter_->set_fake_free_disk_space(kLotsOfSpace); |
| 1794 | 1792 |
| 1795 // The transfered file is cached and the change of "offline available" | 1793 // The transfered file is cached and the change of "offline available" |
| 1796 // attribute is notified. | 1794 // attribute is notified. |
| 1797 EXPECT_CALL(*mock_directory_observer_, OnDirectoryChanged( | 1795 EXPECT_CALL(*mock_directory_observer_, OnDirectoryChanged( |
| 1798 Eq(base::FilePath(FILE_PATH_LITERAL("drive/root"))))).Times(1); | 1796 Eq(base::FilePath(FILE_PATH_LITERAL("drive/root"))))).Times(1); |
| 1799 | 1797 |
| 1800 ASSERT_TRUE(LoadRootFeedDocument()); | 1798 ASSERT_TRUE(LoadRootFeedDocument()); |
| 1801 | 1799 |
| 1802 base::FilePath file_in_root(FILE_PATH_LITERAL("drive/root/File 1.txt")); | 1800 base::FilePath file_in_root(FILE_PATH_LITERAL("drive/root/File 1.txt")); |
| 1803 scoped_ptr<ResourceEntry> entry(GetEntryInfoByPathSync(file_in_root)); | 1801 scoped_ptr<ResourceEntry> entry(GetEntryInfoByPathSync(file_in_root)); |
| 1802 std::string resource_id = entry->resource_id(); |
| 1804 | 1803 |
| 1805 FileError error = FILE_ERROR_OK; | 1804 FileError error = FILE_ERROR_OK; |
| 1806 base::FilePath file_path; | 1805 base::FilePath file_path; |
| 1807 std::string mime_type; | 1806 entry.reset(); |
| 1808 DriveFileType file_type; | |
| 1809 file_system_->GetFileByResourceId( | 1807 file_system_->GetFileByResourceId( |
| 1810 entry->resource_id(), | 1808 resource_id, |
| 1811 DriveClientContext(USER_INITIATED), | 1809 DriveClientContext(USER_INITIATED), |
| 1812 google_apis::test_util::CreateCopyResultCallback( | 1810 google_apis::test_util::CreateCopyResultCallback( |
| 1813 &error, &file_path, &mime_type, &file_type), | 1811 &error, &file_path, &entry), |
| 1814 google_apis::GetContentCallback()); | 1812 google_apis::GetContentCallback()); |
| 1815 google_apis::test_util::RunBlockingPoolTask(); | 1813 google_apis::test_util::RunBlockingPoolTask(); |
| 1816 | 1814 |
| 1817 EXPECT_EQ(FILE_ERROR_OK, error); | 1815 EXPECT_EQ(FILE_ERROR_OK, error); |
| 1818 EXPECT_EQ(REGULAR_FILE, file_type); | 1816 ASSERT_TRUE(entry); |
| 1817 EXPECT_FALSE(entry->file_specific_info().is_hosted_document()); |
| 1819 } | 1818 } |
| 1820 | 1819 |
| 1821 TEST_F(DriveFileSystemTest, GetFileContentByPath) { | 1820 TEST_F(DriveFileSystemTest, GetFileContentByPath) { |
| 1822 fake_free_disk_space_getter_->set_fake_free_disk_space(kLotsOfSpace); | 1821 fake_free_disk_space_getter_->set_fake_free_disk_space(kLotsOfSpace); |
| 1823 | 1822 |
| 1824 // The transfered file is cached and the change of "offline available" | 1823 // The transfered file is cached and the change of "offline available" |
| 1825 // attribute is notified. | 1824 // attribute is notified. |
| 1826 EXPECT_CALL(*mock_directory_observer_, OnDirectoryChanged( | 1825 EXPECT_CALL(*mock_directory_observer_, OnDirectoryChanged( |
| 1827 Eq(base::FilePath(FILE_PATH_LITERAL("drive/root"))))).Times(1); | 1826 Eq(base::FilePath(FILE_PATH_LITERAL("drive/root"))))).Times(1); |
| 1828 | 1827 |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1913 "chromeos/gdata/root_feed.json"), | 1912 "chromeos/gdata/root_feed.json"), |
| 1914 internal::FileCache::FILE_OPERATION_COPY, | 1913 internal::FileCache::FILE_OPERATION_COPY, |
| 1915 google_apis::test_util::CreateCopyResultCallback(&error)); | 1914 google_apis::test_util::CreateCopyResultCallback(&error)); |
| 1916 google_apis::test_util::RunBlockingPoolTask(); | 1915 google_apis::test_util::RunBlockingPoolTask(); |
| 1917 EXPECT_EQ(FILE_ERROR_OK, error); | 1916 EXPECT_EQ(FILE_ERROR_OK, error); |
| 1918 | 1917 |
| 1919 // The file is obtained from the cache. | 1918 // The file is obtained from the cache. |
| 1920 // Hence the downloading should work even if the drive service is offline. | 1919 // Hence the downloading should work even if the drive service is offline. |
| 1921 fake_drive_service_->set_offline(true); | 1920 fake_drive_service_->set_offline(true); |
| 1922 | 1921 |
| 1922 std::string resource_id = entry->resource_id(); |
| 1923 base::FilePath file_path; | 1923 base::FilePath file_path; |
| 1924 std::string mime_type; | 1924 entry.reset(); |
| 1925 DriveFileType file_type; | |
| 1926 file_system_->GetFileByResourceId( | 1925 file_system_->GetFileByResourceId( |
| 1927 entry->resource_id(), | 1926 resource_id, |
| 1928 DriveClientContext(USER_INITIATED), | 1927 DriveClientContext(USER_INITIATED), |
| 1929 google_apis::test_util::CreateCopyResultCallback( | 1928 google_apis::test_util::CreateCopyResultCallback( |
| 1930 &error, &file_path, &mime_type, &file_type), | 1929 &error, &file_path, &entry), |
| 1931 google_apis::GetContentCallback()); | 1930 google_apis::GetContentCallback()); |
| 1932 google_apis::test_util::RunBlockingPoolTask(); | 1931 google_apis::test_util::RunBlockingPoolTask(); |
| 1933 | 1932 |
| 1934 EXPECT_EQ(FILE_ERROR_OK, error); | 1933 EXPECT_EQ(FILE_ERROR_OK, error); |
| 1935 EXPECT_EQ(REGULAR_FILE, file_type); | 1934 ASSERT_TRUE(entry); |
| 1935 EXPECT_FALSE(entry->file_specific_info().is_hosted_document()); |
| 1936 } | 1936 } |
| 1937 | 1937 |
| 1938 TEST_F(DriveFileSystemTest, UpdateFileByResourceId_PersistentFile) { | 1938 TEST_F(DriveFileSystemTest, UpdateFileByResourceId_PersistentFile) { |
| 1939 fake_free_disk_space_getter_->set_fake_free_disk_space(kLotsOfSpace); | 1939 fake_free_disk_space_getter_->set_fake_free_disk_space(kLotsOfSpace); |
| 1940 | 1940 |
| 1941 ASSERT_TRUE(LoadRootFeedDocument()); | 1941 ASSERT_TRUE(LoadRootFeedDocument()); |
| 1942 | 1942 |
| 1943 // This is a file defined in root_feed.json. | 1943 // This is a file defined in root_feed.json. |
| 1944 const base::FilePath kFilePath(FILE_PATH_LITERAL("drive/root/File 1.txt")); | 1944 const base::FilePath kFilePath(FILE_PATH_LITERAL("drive/root/File 1.txt")); |
| 1945 const std::string kResourceId("file:2_file_resource_id"); | 1945 const std::string kResourceId("file:2_file_resource_id"); |
| (...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2357 | 2357 |
| 2358 // Create fails if the parent directory does not exist. | 2358 // Create fails if the parent directory does not exist. |
| 2359 file_system_->CreateFile( | 2359 file_system_->CreateFile( |
| 2360 kFileInNonExistingDirectory, false, | 2360 kFileInNonExistingDirectory, false, |
| 2361 google_apis::test_util::CreateCopyResultCallback(&error)); | 2361 google_apis::test_util::CreateCopyResultCallback(&error)); |
| 2362 google_apis::test_util::RunBlockingPoolTask(); | 2362 google_apis::test_util::RunBlockingPoolTask(); |
| 2363 EXPECT_EQ(FILE_ERROR_NOT_A_DIRECTORY, error); | 2363 EXPECT_EQ(FILE_ERROR_NOT_A_DIRECTORY, error); |
| 2364 } | 2364 } |
| 2365 | 2365 |
| 2366 } // namespace drive | 2366 } // namespace drive |
| OLD | NEW |