| 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/file_system.h" | 5 #include "chrome/browser/chromeos/drive/file_system.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 } | 55 } |
| 56 | 56 |
| 57 // This class is used to record directory changes and examine them later. | 57 // This class is used to record directory changes and examine them later. |
| 58 class MockDirectoryChangeObserver : public FileSystemObserver { | 58 class MockDirectoryChangeObserver : public FileSystemObserver { |
| 59 public: | 59 public: |
| 60 MockDirectoryChangeObserver() {} | 60 MockDirectoryChangeObserver() {} |
| 61 virtual ~MockDirectoryChangeObserver() {} | 61 virtual ~MockDirectoryChangeObserver() {} |
| 62 | 62 |
| 63 // FileSystemObserver overrides. | 63 // FileSystemObserver overrides. |
| 64 virtual void OnDirectoryChanged( | 64 virtual void OnDirectoryChanged( |
| 65 const base::FilePath& directory_path) OVERRIDE { | 65 const base::FilePath& directory_path) override { |
| 66 changed_directories_.push_back(directory_path); | 66 changed_directories_.push_back(directory_path); |
| 67 } | 67 } |
| 68 | 68 |
| 69 virtual void OnFileChanged(const FileChange& new_file_change) OVERRIDE { | 69 virtual void OnFileChanged(const FileChange& new_file_change) override { |
| 70 changed_files_.Apply(new_file_change); | 70 changed_files_.Apply(new_file_change); |
| 71 } | 71 } |
| 72 | 72 |
| 73 const std::vector<base::FilePath>& changed_directories() const { | 73 const std::vector<base::FilePath>& changed_directories() const { |
| 74 return changed_directories_; | 74 return changed_directories_; |
| 75 } | 75 } |
| 76 | 76 |
| 77 const FileChange& changed_files() const { return changed_files_; } | 77 const FileChange& changed_files() const { return changed_files_; } |
| 78 | 78 |
| 79 private: | 79 private: |
| 80 std::vector<base::FilePath> changed_directories_; | 80 std::vector<base::FilePath> changed_directories_; |
| 81 FileChange changed_files_; | 81 FileChange changed_files_; |
| 82 DISALLOW_COPY_AND_ASSIGN(MockDirectoryChangeObserver); | 82 DISALLOW_COPY_AND_ASSIGN(MockDirectoryChangeObserver); |
| 83 }; | 83 }; |
| 84 | 84 |
| 85 } // namespace | 85 } // namespace |
| 86 | 86 |
| 87 class FileSystemTest : public testing::Test { | 87 class FileSystemTest : public testing::Test { |
| 88 protected: | 88 protected: |
| 89 virtual void SetUp() OVERRIDE { | 89 virtual void SetUp() override { |
| 90 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); | 90 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); |
| 91 pref_service_.reset(new TestingPrefServiceSimple); | 91 pref_service_.reset(new TestingPrefServiceSimple); |
| 92 test_util::RegisterDrivePrefs(pref_service_->registry()); | 92 test_util::RegisterDrivePrefs(pref_service_->registry()); |
| 93 | 93 |
| 94 logger_.reset(new EventLogger); | 94 logger_.reset(new EventLogger); |
| 95 fake_drive_service_.reset(new FakeDriveService); | 95 fake_drive_service_.reset(new FakeDriveService); |
| 96 test_util::SetUpTestEntries(fake_drive_service_.get()); | 96 test_util::SetUpTestEntries(fake_drive_service_.get()); |
| 97 | 97 |
| 98 fake_free_disk_space_getter_.reset(new FakeFreeDiskSpaceGetter); | 98 fake_free_disk_space_getter_.reset(new FakeFreeDiskSpaceGetter); |
| 99 | 99 |
| (...skipping 867 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 967 kEmbedOrigin, | 967 kEmbedOrigin, |
| 968 google_apis::test_util::CreateCopyResultCallback(&error, &share_url)); | 968 google_apis::test_util::CreateCopyResultCallback(&error, &share_url)); |
| 969 content::RunAllBlockingPoolTasksUntilIdle(); | 969 content::RunAllBlockingPoolTasksUntilIdle(); |
| 970 | 970 |
| 971 // Verify the share url to the sharing dialog. | 971 // Verify the share url to the sharing dialog. |
| 972 EXPECT_EQ(FILE_ERROR_OK, error); | 972 EXPECT_EQ(FILE_ERROR_OK, error); |
| 973 EXPECT_TRUE(share_url.is_valid()); | 973 EXPECT_TRUE(share_url.is_valid()); |
| 974 } | 974 } |
| 975 | 975 |
| 976 } // namespace drive | 976 } // namespace drive |
| OLD | NEW |