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/sync_client.h" | 5 #include "chrome/browser/chromeos/drive/sync_client.h" |
6 | 6 |
7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
9 #include "base/files/scoped_temp_dir.h" | 9 #include "base/files/scoped_temp_dir.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 temp_file, FileCache::FILE_OPERATION_COPY)); | 171 temp_file, FileCache::FILE_OPERATION_COPY)); |
172 EXPECT_EQ(FILE_ERROR_OK, cache_->Pin(resource_ids_["fetched"])); | 172 EXPECT_EQ(FILE_ERROR_OK, cache_->Pin(resource_ids_["fetched"])); |
173 | 173 |
174 // Prepare a pinned-and-fetched-and-dirty file. | 174 // Prepare a pinned-and-fetched-and-dirty file. |
175 const std::string md5_dirty = ""; // Don't care. | 175 const std::string md5_dirty = ""; // Don't care. |
176 ASSERT_NO_FATAL_FAILURE(AddFileEntry("dirty")); | 176 ASSERT_NO_FATAL_FAILURE(AddFileEntry("dirty")); |
177 EXPECT_EQ(FILE_ERROR_OK, | 177 EXPECT_EQ(FILE_ERROR_OK, |
178 cache_->Store(resource_ids_["dirty"], md5_dirty, | 178 cache_->Store(resource_ids_["dirty"], md5_dirty, |
179 temp_file, FileCache::FILE_OPERATION_COPY)); | 179 temp_file, FileCache::FILE_OPERATION_COPY)); |
180 EXPECT_EQ(FILE_ERROR_OK, cache_->Pin(resource_ids_["dirty"])); | 180 EXPECT_EQ(FILE_ERROR_OK, cache_->Pin(resource_ids_["dirty"])); |
181 EXPECT_EQ(FILE_ERROR_OK, | 181 EXPECT_EQ(FILE_ERROR_OK, cache_->MarkDirty(resource_ids_["dirty"])); |
182 cache_->MarkDirty(resource_ids_["dirty"], md5_dirty)); | |
183 | 182 |
184 // Load data from the service to the metadata. | 183 // Load data from the service to the metadata. |
185 FileError error = FILE_ERROR_FAILED; | 184 FileError error = FILE_ERROR_FAILED; |
186 internal::ChangeListLoader change_list_loader( | 185 internal::ChangeListLoader change_list_loader( |
187 base::MessageLoopProxy::current().get(), | 186 base::MessageLoopProxy::current().get(), |
188 metadata_.get(), | 187 metadata_.get(), |
189 scheduler_.get()); | 188 scheduler_.get()); |
190 change_list_loader.LoadIfNeeded( | 189 change_list_loader.LoadIfNeeded( |
191 DirectoryFetchInfo(), | 190 DirectoryFetchInfo(), |
192 google_apis::test_util::CreateCopyResultCallback(&error)); | 191 google_apis::test_util::CreateCopyResultCallback(&error)); |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
343 EXPECT_TRUE(cache_->GetCacheEntry(resource_ids_["foo"], std::string(), | 342 EXPECT_TRUE(cache_->GetCacheEntry(resource_ids_["foo"], std::string(), |
344 &cache_entry)); | 343 &cache_entry)); |
345 EXPECT_TRUE(cache_entry.is_present()); | 344 EXPECT_TRUE(cache_entry.is_present()); |
346 EXPECT_TRUE(cache_->GetCacheEntry(resource_ids_["dirty"], std::string(), | 345 EXPECT_TRUE(cache_->GetCacheEntry(resource_ids_["dirty"], std::string(), |
347 &cache_entry)); | 346 &cache_entry)); |
348 EXPECT_FALSE(cache_entry.is_dirty()); | 347 EXPECT_FALSE(cache_entry.is_dirty()); |
349 } | 348 } |
350 | 349 |
351 } // namespace internal | 350 } // namespace internal |
352 } // namespace drive | 351 } // namespace drive |
OLD | NEW |