| 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 669 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 680 file_system_->Pin(file_path, | 680 file_system_->Pin(file_path, |
| 681 google_apis::test_util::CreateCopyResultCallback(&error)); | 681 google_apis::test_util::CreateCopyResultCallback(&error)); |
| 682 google_apis::test_util::RunBlockingPoolTask(); | 682 google_apis::test_util::RunBlockingPoolTask(); |
| 683 EXPECT_EQ(FILE_ERROR_OK, error); | 683 EXPECT_EQ(FILE_ERROR_OK, error); |
| 684 | 684 |
| 685 FileCacheEntry cache_entry; | 685 FileCacheEntry cache_entry; |
| 686 EXPECT_TRUE(GetCacheEntryFromOriginThread( | 686 EXPECT_TRUE(GetCacheEntryFromOriginThread( |
| 687 entry->resource_id(), std::string(), &cache_entry)); | 687 entry->resource_id(), std::string(), &cache_entry)); |
| 688 EXPECT_TRUE(cache_entry.is_pinned()); | 688 EXPECT_TRUE(cache_entry.is_pinned()); |
| 689 EXPECT_TRUE(cache_entry.is_present()); | 689 EXPECT_TRUE(cache_entry.is_present()); |
| 690 EXPECT_TRUE(cache_entry.is_persistent()); | |
| 691 | 690 |
| 692 // Unpin the file. | 691 // Unpin the file. |
| 693 error = FILE_ERROR_FAILED; | 692 error = FILE_ERROR_FAILED; |
| 694 file_system_->Unpin(file_path, | 693 file_system_->Unpin(file_path, |
| 695 google_apis::test_util::CreateCopyResultCallback(&error)); | 694 google_apis::test_util::CreateCopyResultCallback(&error)); |
| 696 google_apis::test_util::RunBlockingPoolTask(); | 695 google_apis::test_util::RunBlockingPoolTask(); |
| 697 EXPECT_EQ(FILE_ERROR_OK, error); | 696 EXPECT_EQ(FILE_ERROR_OK, error); |
| 698 | 697 |
| 699 EXPECT_TRUE(GetCacheEntryFromOriginThread( | 698 EXPECT_TRUE(GetCacheEntryFromOriginThread( |
| 700 entry->resource_id(), std::string(), &cache_entry)); | 699 entry->resource_id(), std::string(), &cache_entry)); |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 796 const std::string kExpectedContent = "This is some test content."; | 795 const std::string kExpectedContent = "This is some test content."; |
| 797 std::string cache_file_data; | 796 std::string cache_file_data; |
| 798 EXPECT_TRUE(file_util::ReadFileToString(opened_file_path, &cache_file_data)); | 797 EXPECT_TRUE(file_util::ReadFileToString(opened_file_path, &cache_file_data)); |
| 799 EXPECT_EQ(kExpectedContent, cache_file_data); | 798 EXPECT_EQ(kExpectedContent, cache_file_data); |
| 800 | 799 |
| 801 FileCacheEntry cache_entry; | 800 FileCacheEntry cache_entry; |
| 802 EXPECT_TRUE(GetCacheEntryFromOriginThread(file_resource_id, md5, | 801 EXPECT_TRUE(GetCacheEntryFromOriginThread(file_resource_id, md5, |
| 803 &cache_entry)); | 802 &cache_entry)); |
| 804 EXPECT_TRUE(cache_entry.is_present()); | 803 EXPECT_TRUE(cache_entry.is_present()); |
| 805 EXPECT_TRUE(cache_entry.is_dirty()); | 804 EXPECT_TRUE(cache_entry.is_dirty()); |
| 806 EXPECT_TRUE(cache_entry.is_persistent()); | |
| 807 | 805 |
| 808 base::FilePath cache_file_path; | 806 base::FilePath cache_file_path; |
| 809 cache_->GetFileOnUIThread(file_resource_id, md5, | 807 cache_->GetFileOnUIThread(file_resource_id, md5, |
| 810 google_apis::test_util::CreateCopyResultCallback( | 808 google_apis::test_util::CreateCopyResultCallback( |
| 811 &error, &cache_file_path)); | 809 &error, &cache_file_path)); |
| 812 google_apis::test_util::RunBlockingPoolTask(); | 810 google_apis::test_util::RunBlockingPoolTask(); |
| 813 EXPECT_EQ(FILE_ERROR_OK, error); | 811 EXPECT_EQ(FILE_ERROR_OK, error); |
| 814 EXPECT_EQ(cache_file_path, opened_file_path); | 812 EXPECT_EQ(cache_file_path, opened_file_path); |
| 815 | 813 |
| 816 // Write a new content. | 814 // Write a new content. |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 900 entry->resource_id(), | 898 entry->resource_id(), |
| 901 entry->file_specific_info().md5(), | 899 entry->file_specific_info().md5(), |
| 902 google_apis::test_util::CreateCopyResultCallback(&success, &cache_entry)); | 900 google_apis::test_util::CreateCopyResultCallback(&success, &cache_entry)); |
| 903 google_apis::test_util::RunBlockingPoolTask(); | 901 google_apis::test_util::RunBlockingPoolTask(); |
| 904 | 902 |
| 905 EXPECT_TRUE(success); | 903 EXPECT_TRUE(success); |
| 906 EXPECT_FALSE(cache_entry.is_mounted()); | 904 EXPECT_FALSE(cache_entry.is_mounted()); |
| 907 } | 905 } |
| 908 | 906 |
| 909 } // namespace drive | 907 } // namespace drive |
| OLD | NEW |