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 460 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
471 ResourceEntry entry2; | 471 ResourceEntry entry2; |
472 entry2.set_parent_local_id(local_id1); | 472 entry2.set_parent_local_id(local_id1); |
473 entry2.set_title(kPath2.BaseName().AsUTF8Unsafe()); | 473 entry2.set_title(kPath2.BaseName().AsUTF8Unsafe()); |
474 entry2.mutable_file_info()->set_is_directory(true); | 474 entry2.mutable_file_info()->set_is_directory(true); |
475 entry2.set_metadata_edit_state(ResourceEntry::DIRTY); | 475 entry2.set_metadata_edit_state(ResourceEntry::DIRTY); |
476 std::string local_id2; | 476 std::string local_id2; |
477 EXPECT_EQ(FILE_ERROR_OK, metadata_->AddEntry(entry2, &local_id2)); | 477 EXPECT_EQ(FILE_ERROR_OK, metadata_->AddEntry(entry2, &local_id2)); |
478 | 478 |
479 // Start syncing the child first. | 479 // Start syncing the child first. |
480 sync_client_->AddUpdateTask(ClientContext(USER_INITIATED), local_id2); | 480 sync_client_->AddUpdateTask(ClientContext(USER_INITIATED), local_id2); |
481 base::RunLoop().RunUntilIdle(); | |
482 // Start syncing the parent later. | 481 // Start syncing the parent later. |
483 sync_client_->AddUpdateTask(ClientContext(USER_INITIATED), local_id1); | 482 sync_client_->AddUpdateTask(ClientContext(USER_INITIATED), local_id1); |
484 base::RunLoop().RunUntilIdle(); | 483 base::RunLoop().RunUntilIdle(); |
485 | 484 |
486 // Both entries are synced. | 485 // Both entries are synced. |
487 EXPECT_EQ(FILE_ERROR_OK, metadata_->GetResourceEntryById(local_id1, &entry1)); | 486 EXPECT_EQ(FILE_ERROR_OK, metadata_->GetResourceEntryById(local_id1, &entry1)); |
488 EXPECT_EQ(ResourceEntry::CLEAN, entry1.metadata_edit_state()); | 487 EXPECT_EQ(ResourceEntry::CLEAN, entry1.metadata_edit_state()); |
489 EXPECT_EQ(FILE_ERROR_OK, metadata_->GetResourceEntryById(local_id2, &entry2)); | 488 EXPECT_EQ(FILE_ERROR_OK, metadata_->GetResourceEntryById(local_id2, &entry2)); |
490 EXPECT_EQ(ResourceEntry::CLEAN, entry2.metadata_edit_state()); | 489 EXPECT_EQ(ResourceEntry::CLEAN, entry2.metadata_edit_state()); |
491 } | 490 } |
492 | 491 |
493 } // namespace internal | 492 } // namespace internal |
494 } // namespace drive | 493 } // namespace drive |
OLD | NEW |