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 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 EXPECT_EQ(FILE_ERROR_OK, | 216 EXPECT_EQ(FILE_ERROR_OK, |
217 cache_->Store(GetLocalId("dirty"), std::string(), | 217 cache_->Store(GetLocalId("dirty"), std::string(), |
218 temp_file, FileCache::FILE_OPERATION_COPY)); | 218 temp_file, FileCache::FILE_OPERATION_COPY)); |
219 EXPECT_EQ(FILE_ERROR_OK, cache_->Pin(GetLocalId("dirty"))); | 219 EXPECT_EQ(FILE_ERROR_OK, cache_->Pin(GetLocalId("dirty"))); |
220 | 220 |
221 // Prepare a removed file. | 221 // Prepare a removed file. |
222 file_system::RemoveOperation remove_operation( | 222 file_system::RemoveOperation remove_operation( |
223 base::MessageLoopProxy::current().get(), &observer_, metadata_.get(), | 223 base::MessageLoopProxy::current().get(), &observer_, metadata_.get(), |
224 cache_.get()); | 224 cache_.get()); |
225 remove_operation.Remove( | 225 remove_operation.Remove( |
226 metadata_->GetFilePath(GetLocalId("removed")), | 226 util::GetDriveMyDriveRootPath().AppendASCII("removed"), |
227 false, // is_recursive | 227 false, // is_recursive |
228 google_apis::test_util::CreateCopyResultCallback(&error)); | 228 google_apis::test_util::CreateCopyResultCallback(&error)); |
229 base::RunLoop().RunUntilIdle(); | 229 base::RunLoop().RunUntilIdle(); |
230 EXPECT_EQ(FILE_ERROR_OK, error); | 230 EXPECT_EQ(FILE_ERROR_OK, error); |
231 | 231 |
232 // Prepare a moved file. | 232 // Prepare a moved file. |
233 file_system::MoveOperation move_operation( | 233 file_system::MoveOperation move_operation( |
234 base::MessageLoopProxy::current().get(), &observer_, metadata_.get()); | 234 base::MessageLoopProxy::current().get(), &observer_, metadata_.get()); |
235 move_operation.Move( | 235 move_operation.Move( |
236 metadata_->GetFilePath(GetLocalId("moved")), | 236 util::GetDriveMyDriveRootPath().AppendASCII("moved"), |
237 util::GetDriveMyDriveRootPath().AppendASCII("moved_new_title"), | 237 util::GetDriveMyDriveRootPath().AppendASCII("moved_new_title"), |
238 google_apis::test_util::CreateCopyResultCallback(&error)); | 238 google_apis::test_util::CreateCopyResultCallback(&error)); |
239 base::RunLoop().RunUntilIdle(); | 239 base::RunLoop().RunUntilIdle(); |
240 EXPECT_EQ(FILE_ERROR_OK, error); | 240 EXPECT_EQ(FILE_ERROR_OK, error); |
241 } | 241 } |
242 | 242 |
243 protected: | 243 protected: |
244 std::string GetLocalId(const std::string& title) { | 244 std::string GetLocalId(const std::string& title) { |
245 EXPECT_EQ(1U, resource_ids_.count(title)); | 245 EXPECT_EQ(1U, resource_ids_.count(title)); |
246 std::string local_id; | 246 std::string local_id; |
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
470 | 470 |
471 // Both entries are synced. | 471 // Both entries are synced. |
472 EXPECT_EQ(FILE_ERROR_OK, metadata_->GetResourceEntryById(local_id1, &entry1)); | 472 EXPECT_EQ(FILE_ERROR_OK, metadata_->GetResourceEntryById(local_id1, &entry1)); |
473 EXPECT_EQ(ResourceEntry::CLEAN, entry1.metadata_edit_state()); | 473 EXPECT_EQ(ResourceEntry::CLEAN, entry1.metadata_edit_state()); |
474 EXPECT_EQ(FILE_ERROR_OK, metadata_->GetResourceEntryById(local_id2, &entry2)); | 474 EXPECT_EQ(FILE_ERROR_OK, metadata_->GetResourceEntryById(local_id2, &entry2)); |
475 EXPECT_EQ(ResourceEntry::CLEAN, entry2.metadata_edit_state()); | 475 EXPECT_EQ(ResourceEntry::CLEAN, entry2.metadata_edit_state()); |
476 } | 476 } |
477 | 477 |
478 } // namespace internal | 478 } // namespace internal |
479 } // namespace drive | 479 } // namespace drive |
OLD | NEW |