| 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 836 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 847 &error, &bytes_total, &bytes_used)); | 847 &error, &bytes_total, &bytes_used)); |
| 848 test_util::RunBlockingPoolTask(); | 848 test_util::RunBlockingPoolTask(); |
| 849 EXPECT_EQ(6789012345LL, bytes_used); | 849 EXPECT_EQ(6789012345LL, bytes_used); |
| 850 EXPECT_EQ(9876543210LL, bytes_total); | 850 EXPECT_EQ(9876543210LL, bytes_total); |
| 851 } | 851 } |
| 852 | 852 |
| 853 TEST_F(FileSystemTest, MarkCacheFileAsMountedAndUnmounted) { | 853 TEST_F(FileSystemTest, MarkCacheFileAsMountedAndUnmounted) { |
| 854 ASSERT_TRUE(LoadFullResourceList()); | 854 ASSERT_TRUE(LoadFullResourceList()); |
| 855 | 855 |
| 856 base::FilePath file_in_root(FILE_PATH_LITERAL("drive/root/File 1.txt")); | 856 base::FilePath file_in_root(FILE_PATH_LITERAL("drive/root/File 1.txt")); |
| 857 scoped_ptr<ResourceEntry> entry(GetResourceEntrySync(file_in_root)); | |
| 858 ASSERT_TRUE(entry); | |
| 859 | 857 |
| 860 // Write to cache. | 858 // Make the file cached. |
| 861 ASSERT_EQ(FILE_ERROR_OK, cache_->Store( | 859 FileError error = FILE_ERROR_FAILED; |
| 862 entry->local_id(), | 860 base::FilePath file_path; |
| 863 entry->file_specific_info().md5(), | 861 scoped_ptr<ResourceEntry> entry; |
| 864 google_apis::test_util::GetTestFilePath("gdata/root_feed.json"), | 862 file_system_->GetFile( |
| 865 internal::FileCache::FILE_OPERATION_COPY)); | 863 file_in_root, |
| 864 google_apis::test_util::CreateCopyResultCallback( |
| 865 &error, &file_path, &entry)); |
| 866 test_util::RunBlockingPoolTask(); |
| 867 EXPECT_EQ(FILE_ERROR_OK, error); |
| 866 | 868 |
| 867 // Test for mounting. | 869 // Test for mounting. |
| 868 FileError error = FILE_ERROR_FAILED; | 870 error = FILE_ERROR_FAILED; |
| 869 base::FilePath file_path; | 871 file_path.clear(); |
| 870 file_system_->MarkCacheFileAsMounted( | 872 file_system_->MarkCacheFileAsMounted( |
| 871 file_in_root, | 873 file_in_root, |
| 872 google_apis::test_util::CreateCopyResultCallback(&error, &file_path)); | 874 google_apis::test_util::CreateCopyResultCallback(&error, &file_path)); |
| 873 test_util::RunBlockingPoolTask(); | 875 test_util::RunBlockingPoolTask(); |
| 874 EXPECT_EQ(FILE_ERROR_OK, error); | 876 EXPECT_EQ(FILE_ERROR_OK, error); |
| 875 | 877 |
| 876 // Cannot remove a cache entry while it's being mounted. | 878 // Cannot remove a cache entry while it's being mounted. |
| 877 EXPECT_EQ(FILE_ERROR_IN_USE, cache_->Remove(entry->local_id())); | 879 EXPECT_EQ(FILE_ERROR_IN_USE, cache_->Remove(entry->local_id())); |
| 878 | 880 |
| 879 // Test for unmounting. | 881 // Test for unmounting. |
| (...skipping 22 matching lines...) Expand all Loading... |
| 902 kEmbedOrigin, | 904 kEmbedOrigin, |
| 903 google_apis::test_util::CreateCopyResultCallback(&error, &share_url)); | 905 google_apis::test_util::CreateCopyResultCallback(&error, &share_url)); |
| 904 test_util::RunBlockingPoolTask(); | 906 test_util::RunBlockingPoolTask(); |
| 905 | 907 |
| 906 // Verify the share url to the sharing dialog. | 908 // Verify the share url to the sharing dialog. |
| 907 EXPECT_EQ(FILE_ERROR_OK, error); | 909 EXPECT_EQ(FILE_ERROR_OK, error); |
| 908 EXPECT_TRUE(share_url.is_valid()); | 910 EXPECT_TRUE(share_url.is_valid()); |
| 909 } | 911 } |
| 910 | 912 |
| 911 } // namespace drive | 913 } // namespace drive |
| OLD | NEW |