| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #ifndef CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_OPERATION_TEST_BASE_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_OPERATION_TEST_BASE_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_OPERATION_TEST_BASE_H_ | 6 #define CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_OPERATION_TEST_BASE_H_ |
| 7 | 7 |
| 8 #include <set> | 8 #include <set> |
| 9 | 9 |
| 10 #include "base/files/scoped_temp_dir.h" | 10 #include "base/files/scoped_temp_dir.h" |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 class LoggingObserver : public OperationObserver { | 44 class LoggingObserver : public OperationObserver { |
| 45 public: | 45 public: |
| 46 LoggingObserver(); | 46 LoggingObserver(); |
| 47 ~LoggingObserver(); | 47 ~LoggingObserver(); |
| 48 | 48 |
| 49 // OperationObserver overrides. | 49 // OperationObserver overrides. |
| 50 virtual void OnDirectoryChangedByOperation( | 50 virtual void OnDirectoryChangedByOperation( |
| 51 const base::FilePath& path) OVERRIDE; | 51 const base::FilePath& path) OVERRIDE; |
| 52 virtual void OnCacheFileUploadNeededByOperation( | 52 virtual void OnCacheFileUploadNeededByOperation( |
| 53 const std::string& local_id) OVERRIDE; | 53 const std::string& local_id) OVERRIDE; |
| 54 virtual void OnEntryRemovedByOperation( |
| 55 const std::string& local_id) OVERRIDE; |
| 54 | 56 |
| 55 // Gets the set of changed paths. | 57 // Gets the set of changed paths. |
| 56 const std::set<base::FilePath>& get_changed_paths() { | 58 const std::set<base::FilePath>& get_changed_paths() { |
| 57 return changed_paths_; | 59 return changed_paths_; |
| 58 } | 60 } |
| 59 | 61 |
| 60 // Gets the set of upload needed local IDs. | 62 // Gets the set of upload needed local IDs. |
| 61 const std::set<std::string>& upload_needed_local_ids() const { | 63 const std::set<std::string>& upload_needed_local_ids() const { |
| 62 return upload_needed_local_ids_; | 64 return upload_needed_local_ids_; |
| 63 } | 65 } |
| 64 | 66 |
| 67 // Gets the set of removed local IDs. |
| 68 const std::set<std::string>& removed_local_ids() const { |
| 69 return removed_local_ids_; |
| 70 } |
| 71 |
| 65 private: | 72 private: |
| 66 std::set<base::FilePath> changed_paths_; | 73 std::set<base::FilePath> changed_paths_; |
| 67 std::set<std::string> upload_needed_local_ids_; | 74 std::set<std::string> upload_needed_local_ids_; |
| 75 std::set<std::string> removed_local_ids_; |
| 68 }; | 76 }; |
| 69 | 77 |
| 70 OperationTestBase(); | 78 OperationTestBase(); |
| 71 explicit OperationTestBase(int test_thread_bundle_options); | 79 explicit OperationTestBase(int test_thread_bundle_options); |
| 72 virtual ~OperationTestBase(); | 80 virtual ~OperationTestBase(); |
| 73 | 81 |
| 74 // testing::Test overrides. | 82 // testing::Test overrides. |
| 75 virtual void SetUp() OVERRIDE; | 83 virtual void SetUp() OVERRIDE; |
| 76 | 84 |
| 77 // Returns the path of the temporary directory for putting test files. | 85 // Returns the path of the temporary directory for putting test files. |
| 78 base::FilePath temp_dir() const { return temp_dir_.path(); } | 86 base::FilePath temp_dir() const { return temp_dir_.path(); } |
| 79 | 87 |
| 80 // Synchronously gets the resource entry corresponding to the path from local | 88 // Synchronously gets the resource entry corresponding to the path from local |
| 81 // ResourceMetadta. | 89 // ResourceMetadta. |
| 82 FileError GetLocalResourceEntry(const base::FilePath& path, | 90 FileError GetLocalResourceEntry(const base::FilePath& path, |
| 83 ResourceEntry* entry); | 91 ResourceEntry* entry); |
| 84 | 92 |
| 93 // Synchronously gets the resource entry corresponding to the ID from local |
| 94 // ResourceMetadta. |
| 95 FileError GetLocalResourceEntryById(const std::string& local_id, |
| 96 ResourceEntry* entry); |
| 97 |
| 85 // Gets the local ID of the entry specified by the path. | 98 // Gets the local ID of the entry specified by the path. |
| 86 std::string GetLocalId(const base::FilePath& path); | 99 std::string GetLocalId(const base::FilePath& path); |
| 87 | 100 |
| 88 // Synchronously updates |metadata_| by fetching the change feed from the | 101 // Synchronously updates |metadata_| by fetching the change feed from the |
| 89 // |fake_service_|. | 102 // |fake_service_|. |
| 90 FileError CheckForUpdates(); | 103 FileError CheckForUpdates(); |
| 91 | 104 |
| 92 // Accessors for the components. | 105 // Accessors for the components. |
| 93 FakeDriveService* fake_service() { | 106 FakeDriveService* fake_service() { |
| 94 return fake_drive_service_.get(); | 107 return fake_drive_service_.get(); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 119 metadata_; | 132 metadata_; |
| 120 scoped_ptr<FakeFreeDiskSpaceGetter> fake_free_disk_space_getter_; | 133 scoped_ptr<FakeFreeDiskSpaceGetter> fake_free_disk_space_getter_; |
| 121 scoped_ptr<internal::FileCache, test_util::DestroyHelperForTests> cache_; | 134 scoped_ptr<internal::FileCache, test_util::DestroyHelperForTests> cache_; |
| 122 scoped_ptr<internal::ChangeListLoader> change_list_loader_; | 135 scoped_ptr<internal::ChangeListLoader> change_list_loader_; |
| 123 }; | 136 }; |
| 124 | 137 |
| 125 } // namespace file_system | 138 } // namespace file_system |
| 126 } // namespace drive | 139 } // namespace drive |
| 127 | 140 |
| 128 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_OPERATION_TEST_BASE_H_ | 141 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_OPERATION_TEST_BASE_H_ |
| OLD | NEW |