| 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" |
| 11 #include "base/message_loop.h" | 11 #include "base/message_loop.h" |
| 12 #include "chrome/browser/chromeos/drive/drive.pb.h" | 12 #include "chrome/browser/chromeos/drive/drive.pb.h" |
| 13 #include "chrome/browser/chromeos/drive/file_system/operation_observer.h" | 13 #include "chrome/browser/chromeos/drive/file_system/operation_observer.h" |
| 14 #include "chrome/browser/chromeos/drive/test_util.h" | 14 #include "chrome/browser/chromeos/drive/test_util.h" |
| 15 #include "content/public/test/test_browser_thread.h" | 15 #include "content/public/test/test_browser_thread.h" |
| 16 #include "testing/gtest/include/gtest/gtest.h" | 16 #include "testing/gtest/include/gtest/gtest.h" |
| 17 | 17 |
| 18 class TestingProfile; | 18 class TestingProfile; |
| 19 | 19 |
| 20 namespace base { | 20 namespace base { |
| 21 class SequencedTaskRunner; | 21 class SequencedTaskRunner; |
| 22 } // namespace base | 22 } // namespace base |
| 23 | 23 |
| 24 namespace google_apis { | 24 namespace google_apis { |
| 25 class FakeDriveService; | 25 class FakeDriveService; |
| 26 } // namespace googl_apis | 26 } // namespace google_apis |
| 27 | 27 |
| 28 namespace drive { | 28 namespace drive { |
| 29 | 29 |
| 30 class FakeFreeDiskSpaceGetter; | 30 class FakeFreeDiskSpaceGetter; |
| 31 class JobScheduler; | 31 class JobScheduler; |
| 32 | 32 |
| 33 namespace internal { | 33 namespace internal { |
| 34 class FileCache; | 34 class FileCache; |
| 35 class ResourceMetadata; | 35 class ResourceMetadata; |
| 36 } // namespace internal | 36 } // namespace internal |
| 37 | 37 |
| 38 namespace file_system { | 38 namespace file_system { |
| 39 | 39 |
| 40 // Base fixture class for testing Drive file system operations. It sets up the | 40 // Base fixture class for testing Drive file system operations. It sets up the |
| 41 // basic set of Drive internal classes (ResourceMetadata, Cache, etc) on top of | 41 // basic set of Drive internal classes (ResourceMetadata, Cache, etc) on top of |
| 42 // FakeDriveService for testing. | 42 // FakeDriveService for testing. |
| 43 class OperationTestBase : public testing::Test { | 43 class OperationTestBase : public testing::Test { |
| 44 protected: | 44 protected: |
| 45 // OperationObserver that records all the events. | 45 // OperationObserver that records all the events. |
| 46 class LoggingObserver : public OperationObserver { | 46 class LoggingObserver : public OperationObserver { |
| 47 public: | 47 public: |
| 48 LoggingObserver(); | 48 LoggingObserver(); |
| 49 ~LoggingObserver(); | 49 ~LoggingObserver(); |
| 50 | 50 |
| 51 // OperationObserver overrides. | 51 // OperationObserver overrides. |
| 52 virtual void OnDirectoryChangedByOperation( | 52 virtual void OnDirectoryChangedByOperation( |
| 53 const base::FilePath& path) OVERRIDE; | 53 const base::FilePath& path) OVERRIDE; |
| 54 virtual void OnCacheFileUploadNeededByOperation( |
| 55 const std::string& resource_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 |
| 62 // Gets the set of upload needed resource IDs. |
| 63 const std::set<std::string>& upload_needed_resource_ids() const { |
| 64 return upload_needed_resource_ids_; |
| 65 } |
| 66 |
| 60 private: | 67 private: |
| 61 std::set<base::FilePath> changed_paths_; | 68 std::set<base::FilePath> changed_paths_; |
| 69 std::set<std::string> upload_needed_resource_ids_; |
| 62 }; | 70 }; |
| 63 | 71 |
| 64 OperationTestBase(); | 72 OperationTestBase(); |
| 65 virtual ~OperationTestBase(); | 73 virtual ~OperationTestBase(); |
| 66 | 74 |
| 67 // testing::Test overrides. | 75 // testing::Test overrides. |
| 68 virtual void SetUp() OVERRIDE; | 76 virtual void SetUp() OVERRIDE; |
| 69 virtual void TearDown() OVERRIDE; | 77 virtual void TearDown() OVERRIDE; |
| 70 | 78 |
| 71 // Returns the path of the temporary directory for putting test files. | 79 // Returns the path of the temporary directory for putting test files. |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 scoped_ptr<internal::ResourceMetadata, test_util::DestroyHelperForTests> | 112 scoped_ptr<internal::ResourceMetadata, test_util::DestroyHelperForTests> |
| 105 metadata_; | 113 metadata_; |
| 106 scoped_ptr<FakeFreeDiskSpaceGetter> fake_free_disk_space_getter_; | 114 scoped_ptr<FakeFreeDiskSpaceGetter> fake_free_disk_space_getter_; |
| 107 scoped_ptr<internal::FileCache, test_util::DestroyHelperForTests> cache_; | 115 scoped_ptr<internal::FileCache, test_util::DestroyHelperForTests> cache_; |
| 108 }; | 116 }; |
| 109 | 117 |
| 110 } // namespace file_system | 118 } // namespace file_system |
| 111 } // namespace drive | 119 } // namespace drive |
| 112 | 120 |
| 113 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_OPERATION_TEST_BASE_H_ | 121 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_OPERATION_TEST_BASE_H_ |
| OLD | NEW |