| 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" |
| 11 #include "base/prefs/testing_pref_service.h" | 11 #include "base/prefs/testing_pref_service.h" |
| 12 #include "base/run_loop.h" | 12 #include "base/run_loop.h" |
| 13 #include "base/test/test_timeouts.h" | 13 #include "base/test/test_timeouts.h" |
| 14 #include "chrome/browser/chromeos/drive/change_list_loader.h" | 14 #include "chrome/browser/chromeos/drive/change_list_loader.h" |
| 15 #include "chrome/browser/chromeos/drive/drive.pb.h" | 15 #include "chrome/browser/chromeos/drive/drive.pb.h" |
| 16 #include "chrome/browser/chromeos/drive/fake_free_disk_space_getter.h" | 16 #include "chrome/browser/chromeos/drive/fake_free_disk_space_getter.h" |
| 17 #include "chrome/browser/chromeos/drive/file_cache.h" | 17 #include "chrome/browser/chromeos/drive/file_cache.h" |
| 18 #include "chrome/browser/chromeos/drive/file_change.h" |
| 18 #include "chrome/browser/chromeos/drive/file_system/move_operation.h" | 19 #include "chrome/browser/chromeos/drive/file_system/move_operation.h" |
| 19 #include "chrome/browser/chromeos/drive/file_system/operation_observer.h" | 20 #include "chrome/browser/chromeos/drive/file_system/operation_observer.h" |
| 20 #include "chrome/browser/chromeos/drive/file_system/remove_operation.h" | 21 #include "chrome/browser/chromeos/drive/file_system/remove_operation.h" |
| 21 #include "chrome/browser/chromeos/drive/file_system_util.h" | 22 #include "chrome/browser/chromeos/drive/file_system_util.h" |
| 22 #include "chrome/browser/chromeos/drive/job_scheduler.h" | 23 #include "chrome/browser/chromeos/drive/job_scheduler.h" |
| 23 #include "chrome/browser/chromeos/drive/resource_entry_conversion.h" | 24 #include "chrome/browser/chromeos/drive/resource_entry_conversion.h" |
| 24 #include "chrome/browser/chromeos/drive/resource_metadata.h" | 25 #include "chrome/browser/chromeos/drive/resource_metadata.h" |
| 25 #include "chrome/browser/chromeos/drive/test_util.h" | 26 #include "chrome/browser/chromeos/drive/test_util.h" |
| 26 #include "chrome/browser/drive/event_logger.h" | 27 #include "chrome/browser/drive/event_logger.h" |
| 27 #include "chrome/browser/drive/fake_drive_service.h" | 28 #include "chrome/browser/drive/fake_drive_service.h" |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 private: | 92 private: |
| 92 int download_file_count_; | 93 int download_file_count_; |
| 93 std::string resource_id_to_be_cancelled_; | 94 std::string resource_id_to_be_cancelled_; |
| 94 std::string resource_id_to_be_paused_; | 95 std::string resource_id_to_be_paused_; |
| 95 base::Closure paused_action_; | 96 base::Closure paused_action_; |
| 96 }; | 97 }; |
| 97 | 98 |
| 98 class DummyOperationObserver : public file_system::OperationObserver { | 99 class DummyOperationObserver : public file_system::OperationObserver { |
| 99 // OperationObserver override: | 100 // OperationObserver override: |
| 100 virtual void OnDirectoryChangedByOperation( | 101 virtual void OnDirectoryChangedByOperation( |
| 101 const base::FilePath& path) OVERRIDE {} | 102 const FileChange& changed_files) OVERRIDE {} |
| 102 }; | 103 }; |
| 103 | 104 |
| 104 } // namespace | 105 } // namespace |
| 105 | 106 |
| 106 class SyncClientTest : public testing::Test { | 107 class SyncClientTest : public testing::Test { |
| 107 public: | 108 public: |
| 108 virtual void SetUp() OVERRIDE { | 109 virtual void SetUp() OVERRIDE { |
| 109 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); | 110 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); |
| 110 | 111 |
| 111 pref_service_.reset(new TestingPrefServiceSimple); | 112 pref_service_.reset(new TestingPrefServiceSimple); |
| (...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 484 | 485 |
| 485 // Both entries are synced. | 486 // Both entries are synced. |
| 486 EXPECT_EQ(FILE_ERROR_OK, metadata_->GetResourceEntryById(local_id1, &entry1)); | 487 EXPECT_EQ(FILE_ERROR_OK, metadata_->GetResourceEntryById(local_id1, &entry1)); |
| 487 EXPECT_EQ(ResourceEntry::CLEAN, entry1.metadata_edit_state()); | 488 EXPECT_EQ(ResourceEntry::CLEAN, entry1.metadata_edit_state()); |
| 488 EXPECT_EQ(FILE_ERROR_OK, metadata_->GetResourceEntryById(local_id2, &entry2)); | 489 EXPECT_EQ(FILE_ERROR_OK, metadata_->GetResourceEntryById(local_id2, &entry2)); |
| 489 EXPECT_EQ(ResourceEntry::CLEAN, entry2.metadata_edit_state()); | 490 EXPECT_EQ(ResourceEntry::CLEAN, entry2.metadata_edit_state()); |
| 490 } | 491 } |
| 491 | 492 |
| 492 } // namespace internal | 493 } // namespace internal |
| 493 } // namespace drive | 494 } // namespace drive |
| OLD | NEW |