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 <errno.h> | 5 #include <errno.h> |
6 #include <string> | 6 #include <string> |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
(...skipping 2345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2356 const FilePath kFilePath(FILE_PATH_LITERAL("drive/File 1.txt")); | 2356 const FilePath kFilePath(FILE_PATH_LITERAL("drive/File 1.txt")); |
2357 const std::string kResourceId("file:2_file_resource_id"); | 2357 const std::string kResourceId("file:2_file_resource_id"); |
2358 const std::string kMd5("3b4382ebefec6e743578c76bbd0575ce"); | 2358 const std::string kMd5("3b4382ebefec6e743578c76bbd0575ce"); |
2359 | 2359 |
2360 // Pin the file so it'll be store in "persistent" directory. | 2360 // Pin the file so it'll be store in "persistent" directory. |
2361 EXPECT_CALL(*mock_sync_client_, OnCachePinned(kResourceId, kMd5)).Times(1); | 2361 EXPECT_CALL(*mock_sync_client_, OnCachePinned(kResourceId, kMd5)).Times(1); |
2362 TestPin(kResourceId, | 2362 TestPin(kResourceId, |
2363 kMd5, | 2363 kMd5, |
2364 base::PLATFORM_FILE_OK, | 2364 base::PLATFORM_FILE_OK, |
2365 GDataCache::CACHE_STATE_PINNED, | 2365 GDataCache::CACHE_STATE_PINNED, |
2366 GDataCache::CACHE_TYPE_PINNED); | 2366 GDataCache::CACHE_TYPE_TMP); |
2367 | 2367 |
2368 // First store a file to cache. A cache file will be created at: | 2368 // First store a file to cache. A cache file will be created at: |
2369 // GCache/v1/persistent/<kResourceId>.<kMd5> | 2369 // GCache/v1/persistent/<kResourceId>.<kMd5> |
2370 const FilePath original_cache_file_path = | 2370 const FilePath original_cache_file_path = |
2371 GDataCache::GetCacheRootPath(profile_.get()) | 2371 GDataCache::GetCacheRootPath(profile_.get()) |
2372 .AppendASCII("persistent") | 2372 .AppendASCII("persistent") |
2373 .AppendASCII(kResourceId + "." + kMd5); | 2373 .AppendASCII(kResourceId + "." + kMd5); |
2374 TestStoreToCache(kResourceId, | 2374 TestStoreToCache(kResourceId, |
2375 kMd5, | 2375 kMd5, |
2376 GetTestFilePath("root_feed.json"), // Anything works. | 2376 GetTestFilePath("root_feed.json"), // Anything works. |
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2621 | 2621 |
2622 // Try to close the same file twice. | 2622 // Try to close the same file twice. |
2623 file_system_->CloseFile(kFileInRoot, close_file_callback); | 2623 file_system_->CloseFile(kFileInRoot, close_file_callback); |
2624 message_loop_.Run(); | 2624 message_loop_.Run(); |
2625 | 2625 |
2626 // It must fail. | 2626 // It must fail. |
2627 EXPECT_EQ(base::PLATFORM_FILE_ERROR_NOT_FOUND, callback_helper_->last_error_); | 2627 EXPECT_EQ(base::PLATFORM_FILE_ERROR_NOT_FOUND, callback_helper_->last_error_); |
2628 } | 2628 } |
2629 | 2629 |
2630 } // namespace gdata | 2630 } // namespace gdata |
OLD | NEW |