Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(360)

Side by Side Diff: chrome/browser/chromeos/drive/file_system_unittest.cc

Issue 15060002: drive: Rename FileCache methods in a blocking pool centric manner (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: remove virtual Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 263 matching lines...) Expand 10 before | Expand all | Expand 10 after
274 return entry->resource_id(); 274 return entry->resource_id();
275 else 275 else
276 return ""; 276 return "";
277 } 277 }
278 278
279 // Helper function to call GetCacheEntry from origin thread. 279 // Helper function to call GetCacheEntry from origin thread.
280 bool GetCacheEntryFromOriginThread(const std::string& resource_id, 280 bool GetCacheEntryFromOriginThread(const std::string& resource_id,
281 const std::string& md5, 281 const std::string& md5,
282 FileCacheEntry* cache_entry) { 282 FileCacheEntry* cache_entry) {
283 bool result = false; 283 bool result = false;
284 cache_->GetCacheEntry(resource_id, md5, 284 cache_->GetCacheEntryOnUIThread(
285 google_apis::test_util::CreateCopyResultCallback( 285 resource_id, md5,
286 &result, cache_entry)); 286 google_apis::test_util::CreateCopyResultCallback(&result, cache_entry));
287 google_apis::test_util::RunBlockingPoolTask(); 287 google_apis::test_util::RunBlockingPoolTask();
288 return result; 288 return result;
289 } 289 }
290 290
291 // Returns true if the cache entry exists for the given resource ID and MD5. 291 // Returns true if the cache entry exists for the given resource ID and MD5.
292 bool CacheEntryExists(const std::string& resource_id, 292 bool CacheEntryExists(const std::string& resource_id,
293 const std::string& md5) { 293 const std::string& md5) {
294 FileCacheEntry cache_entry; 294 FileCacheEntry cache_entry;
295 return GetCacheEntryFromOriginThread(resource_id, md5, &cache_entry); 295 return GetCacheEntryFromOriginThread(resource_id, md5, &cache_entry);
296 } 296 }
(...skipping 758 matching lines...) Expand 10 before | Expand all | Expand 10 after
1055 file_system_->TransferFileFromRemoteToLocal( 1055 file_system_->TransferFileFromRemoteToLocal(
1056 remote_src_file_path, 1056 remote_src_file_path,
1057 local_dest_file_path, 1057 local_dest_file_path,
1058 google_apis::test_util::CreateCopyResultCallback(&error)); 1058 google_apis::test_util::CreateCopyResultCallback(&error));
1059 google_apis::test_util::RunBlockingPoolTask(); 1059 google_apis::test_util::RunBlockingPoolTask();
1060 1060
1061 EXPECT_EQ(FILE_ERROR_OK, error); 1061 EXPECT_EQ(FILE_ERROR_OK, error);
1062 1062
1063 // The content is "x"s of the file size. 1063 // The content is "x"s of the file size.
1064 base::FilePath cache_file_path; 1064 base::FilePath cache_file_path;
1065 cache_->GetFile(file->resource_id(), 1065 cache_->GetFileOnUIThread(file->resource_id(),
1066 file->file_specific_info().file_md5(), 1066 file->file_specific_info().file_md5(),
1067 google_apis::test_util::CreateCopyResultCallback( 1067 google_apis::test_util::CreateCopyResultCallback(
1068 &error, &cache_file_path)); 1068 &error, &cache_file_path));
1069 google_apis::test_util::RunBlockingPoolTask(); 1069 google_apis::test_util::RunBlockingPoolTask();
1070 EXPECT_EQ(FILE_ERROR_OK, error); 1070 EXPECT_EQ(FILE_ERROR_OK, error);
1071 1071
1072 const std::string kExpectedContent = "xxxxxxxxxx"; 1072 const std::string kExpectedContent = "xxxxxxxxxx";
1073 std::string cache_file_data; 1073 std::string cache_file_data;
1074 EXPECT_TRUE(file_util::ReadFileToString(cache_file_path, &cache_file_data)); 1074 EXPECT_TRUE(file_util::ReadFileToString(cache_file_path, &cache_file_data));
1075 EXPECT_EQ(kExpectedContent, cache_file_data); 1075 EXPECT_EQ(kExpectedContent, cache_file_data);
1076 1076
1077 std::string local_dest_file_data; 1077 std::string local_dest_file_data;
1078 EXPECT_TRUE(file_util::ReadFileToString(local_dest_file_path, 1078 EXPECT_TRUE(file_util::ReadFileToString(local_dest_file_path,
(...skipping 593 matching lines...) Expand 10 before | Expand all | Expand 10 after
1672 1672
1673 // Store something of the file size in the temporary cache directory. 1673 // Store something of the file size in the temporary cache directory.
1674 const std::string content(file_size, 'x'); 1674 const std::string content(file_size, 'x');
1675 base::ScopedTempDir temp_dir; 1675 base::ScopedTempDir temp_dir;
1676 ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); 1676 ASSERT_TRUE(temp_dir.CreateUniqueTempDir());
1677 const base::FilePath tmp_file = 1677 const base::FilePath tmp_file =
1678 temp_dir.path().AppendASCII("something.txt"); 1678 temp_dir.path().AppendASCII("something.txt");
1679 ASSERT_TRUE(google_apis::test_util::WriteStringToFile(tmp_file, content)); 1679 ASSERT_TRUE(google_apis::test_util::WriteStringToFile(tmp_file, content));
1680 1680
1681 FileError error = FILE_ERROR_FAILED; 1681 FileError error = FILE_ERROR_FAILED;
1682 cache_->Store("<resource_id>", "<md5>", tmp_file, 1682 cache_->StoreOnUIThread(
1683 internal::FileCache::FILE_OPERATION_COPY, 1683 "<resource_id>", "<md5>", tmp_file,
1684 google_apis::test_util::CreateCopyResultCallback(&error)); 1684 internal::FileCache::FILE_OPERATION_COPY,
1685 google_apis::test_util::CreateCopyResultCallback(&error));
1685 google_apis::test_util::RunBlockingPoolTask(); 1686 google_apis::test_util::RunBlockingPoolTask();
1686 EXPECT_EQ(FILE_ERROR_OK, error); 1687 EXPECT_EQ(FILE_ERROR_OK, error);
1687 ASSERT_TRUE(CacheEntryExists("<resource_id>", "<md5>")); 1688 ASSERT_TRUE(CacheEntryExists("<resource_id>", "<md5>"));
1688 1689
1689 base::FilePath file_path; 1690 base::FilePath file_path;
1690 entry.reset(); 1691 entry.reset();
1691 file_system_->GetFileByPath(file_in_root, 1692 file_system_->GetFileByPath(file_in_root,
1692 google_apis::test_util::CreateCopyResultCallback( 1693 google_apis::test_util::CreateCopyResultCallback(
1693 &error, &file_path, &entry)); 1694 &error, &file_path, &entry));
1694 google_apis::test_util::RunBlockingPoolTask(); 1695 google_apis::test_util::RunBlockingPoolTask();
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
1733 TEST_F(DriveFileSystemTest, GetFileByPath_FromCache) { 1734 TEST_F(DriveFileSystemTest, GetFileByPath_FromCache) {
1734 fake_free_disk_space_getter_->set_fake_free_disk_space(kLotsOfSpace); 1735 fake_free_disk_space_getter_->set_fake_free_disk_space(kLotsOfSpace);
1735 1736
1736 ASSERT_TRUE(LoadRootFeedDocument()); 1737 ASSERT_TRUE(LoadRootFeedDocument());
1737 1738
1738 base::FilePath file_in_root(FILE_PATH_LITERAL("drive/root/File 1.txt")); 1739 base::FilePath file_in_root(FILE_PATH_LITERAL("drive/root/File 1.txt"));
1739 scoped_ptr<ResourceEntry> entry(GetEntryInfoByPathSync(file_in_root)); 1740 scoped_ptr<ResourceEntry> entry(GetEntryInfoByPathSync(file_in_root));
1740 1741
1741 // Store something as cached version of this file. 1742 // Store something as cached version of this file.
1742 FileError error = FILE_ERROR_OK; 1743 FileError error = FILE_ERROR_OK;
1743 cache_->Store(entry->resource_id(), 1744 cache_->StoreOnUIThread(
1744 entry->file_specific_info().file_md5(), 1745 entry->resource_id(),
1745 google_apis::test_util::GetTestFilePath( 1746 entry->file_specific_info().file_md5(),
1746 "chromeos/gdata/root_feed.json"), 1747 google_apis::test_util::GetTestFilePath("chromeos/gdata/root_feed.json"),
1747 internal::FileCache::FILE_OPERATION_COPY, 1748 internal::FileCache::FILE_OPERATION_COPY,
1748 google_apis::test_util::CreateCopyResultCallback(&error)); 1749 google_apis::test_util::CreateCopyResultCallback(&error));
1749 google_apis::test_util::RunBlockingPoolTask(); 1750 google_apis::test_util::RunBlockingPoolTask();
1750 EXPECT_EQ(FILE_ERROR_OK, error); 1751 EXPECT_EQ(FILE_ERROR_OK, error);
1751 1752
1752 base::FilePath file_path; 1753 base::FilePath file_path;
1753 entry.reset(); 1754 entry.reset();
1754 file_system_->GetFileByPath(file_in_root, 1755 file_system_->GetFileByPath(file_in_root,
1755 google_apis::test_util::CreateCopyResultCallback( 1756 google_apis::test_util::CreateCopyResultCallback(
1756 &error, &file_path, &entry)); 1757 &error, &file_path, &entry));
1757 google_apis::test_util::RunBlockingPoolTask(); 1758 google_apis::test_util::RunBlockingPoolTask();
1758 1759
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
1899 TEST_F(DriveFileSystemTest, GetFileByResourceId_FromCache) { 1900 TEST_F(DriveFileSystemTest, GetFileByResourceId_FromCache) {
1900 fake_free_disk_space_getter_->set_fake_free_disk_space(kLotsOfSpace); 1901 fake_free_disk_space_getter_->set_fake_free_disk_space(kLotsOfSpace);
1901 1902
1902 ASSERT_TRUE(LoadRootFeedDocument()); 1903 ASSERT_TRUE(LoadRootFeedDocument());
1903 1904
1904 base::FilePath file_in_root(FILE_PATH_LITERAL("drive/root/File 1.txt")); 1905 base::FilePath file_in_root(FILE_PATH_LITERAL("drive/root/File 1.txt"));
1905 scoped_ptr<ResourceEntry> entry(GetEntryInfoByPathSync(file_in_root)); 1906 scoped_ptr<ResourceEntry> entry(GetEntryInfoByPathSync(file_in_root));
1906 1907
1907 // Store something as cached version of this file. 1908 // Store something as cached version of this file.
1908 FileError error = FILE_ERROR_FAILED; 1909 FileError error = FILE_ERROR_FAILED;
1909 cache_->Store(entry->resource_id(), 1910 cache_->StoreOnUIThread(
1910 entry->file_specific_info().file_md5(), 1911 entry->resource_id(),
1911 google_apis::test_util::GetTestFilePath( 1912 entry->file_specific_info().file_md5(),
1912 "chromeos/gdata/root_feed.json"), 1913 google_apis::test_util::GetTestFilePath("chromeos/gdata/root_feed.json"),
1913 internal::FileCache::FILE_OPERATION_COPY, 1914 internal::FileCache::FILE_OPERATION_COPY,
1914 google_apis::test_util::CreateCopyResultCallback(&error)); 1915 google_apis::test_util::CreateCopyResultCallback(&error));
1915 google_apis::test_util::RunBlockingPoolTask(); 1916 google_apis::test_util::RunBlockingPoolTask();
1916 EXPECT_EQ(FILE_ERROR_OK, error); 1917 EXPECT_EQ(FILE_ERROR_OK, error);
1917 1918
1918 // The file is obtained from the cache. 1919 // The file is obtained from the cache.
1919 // Hence the downloading should work even if the drive service is offline. 1920 // Hence the downloading should work even if the drive service is offline.
1920 fake_drive_service_->set_offline(true); 1921 fake_drive_service_->set_offline(true);
1921 1922
1922 std::string resource_id = entry->resource_id(); 1923 std::string resource_id = entry->resource_id();
1923 base::FilePath file_path; 1924 base::FilePath file_path;
1924 entry.reset(); 1925 entry.reset();
(...skipping 16 matching lines...) Expand all
1941 ASSERT_TRUE(LoadRootFeedDocument()); 1942 ASSERT_TRUE(LoadRootFeedDocument());
1942 1943
1943 // This is a file defined in root_feed.json. 1944 // This is a file defined in root_feed.json.
1944 const base::FilePath kFilePath(FILE_PATH_LITERAL("drive/root/File 1.txt")); 1945 const base::FilePath kFilePath(FILE_PATH_LITERAL("drive/root/File 1.txt"));
1945 const std::string kResourceId("file:2_file_resource_id"); 1946 const std::string kResourceId("file:2_file_resource_id");
1946 const std::string kMd5("3b4382ebefec6e743578c76bbd0575ce"); 1947 const std::string kMd5("3b4382ebefec6e743578c76bbd0575ce");
1947 1948
1948 // Pin the file so it'll be store in "persistent" directory. 1949 // Pin the file so it'll be store in "persistent" directory.
1949 EXPECT_CALL(*mock_cache_observer_, OnCachePinned(kResourceId, kMd5)).Times(1); 1950 EXPECT_CALL(*mock_cache_observer_, OnCachePinned(kResourceId, kMd5)).Times(1);
1950 FileError error = FILE_ERROR_OK; 1951 FileError error = FILE_ERROR_OK;
1951 cache_->Pin(kResourceId, kMd5, 1952 cache_->PinOnUIThread(
1952 google_apis::test_util::CreateCopyResultCallback(&error)); 1953 kResourceId, kMd5,
1954 google_apis::test_util::CreateCopyResultCallback(&error));
1953 google_apis::test_util::RunBlockingPoolTask(); 1955 google_apis::test_util::RunBlockingPoolTask();
1954 EXPECT_EQ(FILE_ERROR_OK, error); 1956 EXPECT_EQ(FILE_ERROR_OK, error);
1955 1957
1956 // First store a file to cache. 1958 // First store a file to cache.
1957 cache_->Store(kResourceId, 1959 cache_->StoreOnUIThread(
1958 kMd5, 1960 kResourceId,
1959 // Anything works. 1961 kMd5,
1960 google_apis::test_util::GetTestFilePath( 1962 // Anything works.
1961 "chromeos/gdata/root_feed.json"), 1963 google_apis::test_util::GetTestFilePath("chromeos/gdata/root_feed.json"),
1962 internal::FileCache::FILE_OPERATION_COPY, 1964 internal::FileCache::FILE_OPERATION_COPY,
1963 google_apis::test_util::CreateCopyResultCallback(&error)); 1965 google_apis::test_util::CreateCopyResultCallback(&error));
1964 google_apis::test_util::RunBlockingPoolTask(); 1966 google_apis::test_util::RunBlockingPoolTask();
1965 EXPECT_EQ(FILE_ERROR_OK, error); 1967 EXPECT_EQ(FILE_ERROR_OK, error);
1966 1968
1967 // Add the dirty bit. 1969 // Add the dirty bit.
1968 cache_->MarkDirty(kResourceId, kMd5, 1970 cache_->MarkDirtyOnUIThread(
1969 google_apis::test_util::CreateCopyResultCallback(&error)); 1971 kResourceId, kMd5,
1972 google_apis::test_util::CreateCopyResultCallback(&error));
1970 google_apis::test_util::RunBlockingPoolTask(); 1973 google_apis::test_util::RunBlockingPoolTask();
1971 EXPECT_EQ(FILE_ERROR_OK, error); 1974 EXPECT_EQ(FILE_ERROR_OK, error);
1972 1975
1973 // Commit the dirty bit. 1976 // Commit the dirty bit.
1974 EXPECT_CALL(*mock_cache_observer_, OnCacheCommitted(kResourceId)).Times(1); 1977 EXPECT_CALL(*mock_cache_observer_, OnCacheCommitted(kResourceId)).Times(1);
1975 cache_->CommitDirty(kResourceId, kMd5, 1978 cache_->CommitDirtyOnUIThread(
1976 google_apis::test_util::CreateCopyResultCallback(&error)); 1979 kResourceId, kMd5,
1980 google_apis::test_util::CreateCopyResultCallback(&error));
1977 google_apis::test_util::RunBlockingPoolTask(); 1981 google_apis::test_util::RunBlockingPoolTask();
1978 EXPECT_EQ(FILE_ERROR_OK, error); 1982 EXPECT_EQ(FILE_ERROR_OK, error);
1979 1983
1980 // We'll notify the directory change to the observer upon completion. 1984 // We'll notify the directory change to the observer upon completion.
1981 EXPECT_CALL(*mock_directory_observer_, 1985 EXPECT_CALL(*mock_directory_observer_,
1982 OnDirectoryChanged(Eq(util::GetDriveMyDriveRootPath()))) 1986 OnDirectoryChanged(Eq(util::GetDriveMyDriveRootPath())))
1983 .Times(1); 1987 .Times(1);
1984 1988
1985 // Check the number of files in the root directory. We'll compare the 1989 // Check the number of files in the root directory. We'll compare the
1986 // number after updating a file. 1990 // number after updating a file.
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
2180 EXPECT_EQ(kExpectedContent, cache_file_data); 2184 EXPECT_EQ(kExpectedContent, cache_file_data);
2181 2185
2182 FileCacheEntry cache_entry; 2186 FileCacheEntry cache_entry;
2183 EXPECT_TRUE(GetCacheEntryFromOriginThread(file_resource_id, file_md5, 2187 EXPECT_TRUE(GetCacheEntryFromOriginThread(file_resource_id, file_md5,
2184 &cache_entry)); 2188 &cache_entry));
2185 EXPECT_TRUE(cache_entry.is_present()); 2189 EXPECT_TRUE(cache_entry.is_present());
2186 EXPECT_TRUE(cache_entry.is_dirty()); 2190 EXPECT_TRUE(cache_entry.is_dirty());
2187 EXPECT_TRUE(cache_entry.is_persistent()); 2191 EXPECT_TRUE(cache_entry.is_persistent());
2188 2192
2189 base::FilePath cache_file_path; 2193 base::FilePath cache_file_path;
2190 cache_->GetFile(file_resource_id, file_md5, 2194 cache_->GetFileOnUIThread(file_resource_id, file_md5,
2191 google_apis::test_util::CreateCopyResultCallback( 2195 google_apis::test_util::CreateCopyResultCallback(
2192 &error, &cache_file_path)); 2196 &error, &cache_file_path));
2193 google_apis::test_util::RunBlockingPoolTask(); 2197 google_apis::test_util::RunBlockingPoolTask();
2194 EXPECT_EQ(FILE_ERROR_OK, error); 2198 EXPECT_EQ(FILE_ERROR_OK, error);
2195 EXPECT_EQ(cache_file_path, opened_file_path); 2199 EXPECT_EQ(cache_file_path, opened_file_path);
2196 2200
2197 // Close kFileInRoot ("drive/root/File 1.txt"). 2201 // Close kFileInRoot ("drive/root/File 1.txt").
2198 file_system_->CloseFile( 2202 file_system_->CloseFile(
2199 kFileInRoot, 2203 kFileInRoot,
2200 google_apis::test_util::CreateCopyResultCallback(&error)); 2204 google_apis::test_util::CreateCopyResultCallback(&error));
2201 google_apis::test_util::RunBlockingPoolTask(); 2205 google_apis::test_util::RunBlockingPoolTask();
2202 2206
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
2249 TEST_F(DriveFileSystemTest, MarkCacheFileAsMountedAndUnmounted) { 2253 TEST_F(DriveFileSystemTest, MarkCacheFileAsMountedAndUnmounted) {
2250 fake_free_disk_space_getter_->set_fake_free_disk_space(kLotsOfSpace); 2254 fake_free_disk_space_getter_->set_fake_free_disk_space(kLotsOfSpace);
2251 ASSERT_TRUE(LoadRootFeedDocument()); 2255 ASSERT_TRUE(LoadRootFeedDocument());
2252 2256
2253 base::FilePath file_in_root(FILE_PATH_LITERAL("drive/root/File 1.txt")); 2257 base::FilePath file_in_root(FILE_PATH_LITERAL("drive/root/File 1.txt"));
2254 scoped_ptr<ResourceEntry> entry(GetEntryInfoByPathSync(file_in_root)); 2258 scoped_ptr<ResourceEntry> entry(GetEntryInfoByPathSync(file_in_root));
2255 ASSERT_TRUE(entry); 2259 ASSERT_TRUE(entry);
2256 2260
2257 // Write to cache. 2261 // Write to cache.
2258 FileError error = FILE_ERROR_FAILED; 2262 FileError error = FILE_ERROR_FAILED;
2259 cache_->Store(entry->resource_id(), 2263 cache_->StoreOnUIThread(
2260 entry->file_specific_info().file_md5(), 2264 entry->resource_id(),
2261 google_apis::test_util::GetTestFilePath( 2265 entry->file_specific_info().file_md5(),
2262 "chromeos/gdata/root_feed.json"), 2266 google_apis::test_util::GetTestFilePath("chromeos/gdata/root_feed.json"),
2263 internal::FileCache::FILE_OPERATION_COPY, 2267 internal::FileCache::FILE_OPERATION_COPY,
2264 google_apis::test_util::CreateCopyResultCallback(&error)); 2268 google_apis::test_util::CreateCopyResultCallback(&error));
2265 google_apis::test_util::RunBlockingPoolTask(); 2269 google_apis::test_util::RunBlockingPoolTask();
2266 ASSERT_EQ(FILE_ERROR_OK, error); 2270 ASSERT_EQ(FILE_ERROR_OK, error);
2267 2271
2268 // Test for mounting. 2272 // Test for mounting.
2269 base::FilePath file_path; 2273 base::FilePath file_path;
2270 file_system_->MarkCacheFileAsMounted( 2274 file_system_->MarkCacheFileAsMounted(
2271 file_in_root, 2275 file_in_root,
2272 google_apis::test_util::CreateCopyResultCallback(&error, &file_path)); 2276 google_apis::test_util::CreateCopyResultCallback(&error, &file_path));
2273 google_apis::test_util::RunBlockingPoolTask(); 2277 google_apis::test_util::RunBlockingPoolTask();
2274 EXPECT_EQ(FILE_ERROR_OK, error); 2278 EXPECT_EQ(FILE_ERROR_OK, error);
2275 2279
2276 bool success = false; 2280 bool success = false;
2277 FileCacheEntry cache_entry; 2281 FileCacheEntry cache_entry;
2278 cache_->GetCacheEntry( 2282 cache_->GetCacheEntryOnUIThread(
2279 entry->resource_id(), 2283 entry->resource_id(),
2280 entry->file_specific_info().file_md5(), 2284 entry->file_specific_info().file_md5(),
2281 google_apis::test_util::CreateCopyResultCallback(&success, &cache_entry)); 2285 google_apis::test_util::CreateCopyResultCallback(&success, &cache_entry));
2282 google_apis::test_util::RunBlockingPoolTask(); 2286 google_apis::test_util::RunBlockingPoolTask();
2283 2287
2284 EXPECT_TRUE(success); 2288 EXPECT_TRUE(success);
2285 EXPECT_TRUE(cache_entry.is_mounted()); 2289 EXPECT_TRUE(cache_entry.is_mounted());
2286 2290
2287 // Test for unmounting. 2291 // Test for unmounting.
2288 error = FILE_ERROR_FAILED; 2292 error = FILE_ERROR_FAILED;
2289 file_system_->MarkCacheFileAsUnmounted( 2293 file_system_->MarkCacheFileAsUnmounted(
2290 file_path, 2294 file_path,
2291 google_apis::test_util::CreateCopyResultCallback(&error)); 2295 google_apis::test_util::CreateCopyResultCallback(&error));
2292 google_apis::test_util::RunBlockingPoolTask(); 2296 google_apis::test_util::RunBlockingPoolTask();
2293 2297
2294 EXPECT_EQ(FILE_ERROR_OK, error); 2298 EXPECT_EQ(FILE_ERROR_OK, error);
2295 2299
2296 success = false; 2300 success = false;
2297 cache_->GetCacheEntry( 2301 cache_->GetCacheEntryOnUIThread(
2298 entry->resource_id(), 2302 entry->resource_id(),
2299 entry->file_specific_info().file_md5(), 2303 entry->file_specific_info().file_md5(),
2300 google_apis::test_util::CreateCopyResultCallback(&success, &cache_entry)); 2304 google_apis::test_util::CreateCopyResultCallback(&success, &cache_entry));
2301 google_apis::test_util::RunBlockingPoolTask(); 2305 google_apis::test_util::RunBlockingPoolTask();
2302 2306
2303 EXPECT_TRUE(success); 2307 EXPECT_TRUE(success);
2304 EXPECT_FALSE(cache_entry.is_mounted()); 2308 EXPECT_FALSE(cache_entry.is_mounted());
2305 } 2309 }
2306 2310
2307 // TODO(kinaba): crbug.com/237066 2311 // TODO(kinaba): crbug.com/237066
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
2357 2361
2358 // Create fails if the parent directory does not exist. 2362 // Create fails if the parent directory does not exist.
2359 file_system_->CreateFile( 2363 file_system_->CreateFile(
2360 kFileInNonExistingDirectory, false, 2364 kFileInNonExistingDirectory, false,
2361 google_apis::test_util::CreateCopyResultCallback(&error)); 2365 google_apis::test_util::CreateCopyResultCallback(&error));
2362 google_apis::test_util::RunBlockingPoolTask(); 2366 google_apis::test_util::RunBlockingPoolTask();
2363 EXPECT_EQ(FILE_ERROR_NOT_A_DIRECTORY, error); 2367 EXPECT_EQ(FILE_ERROR_NOT_A_DIRECTORY, error);
2364 } 2368 }
2365 2369
2366 } // namespace drive 2370 } // namespace drive
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698