| 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/drive_cache_metadata.h" | 5 #include "chrome/browser/chromeos/drive/drive_cache_metadata.h" |
| 6 | 6 |
| 7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
| 8 #include "base/scoped_temp_dir.h" | 8 #include "base/files/scoped_temp_dir.h" |
| 9 #include "chrome/browser/chromeos/drive/drive.pb.h" | 9 #include "chrome/browser/chromeos/drive/drive.pb.h" |
| 10 #include "chrome/browser/chromeos/drive/drive_file_system_util.h" | 10 #include "chrome/browser/chromeos/drive/drive_file_system_util.h" |
| 11 #include "chrome/browser/chromeos/drive/drive_test_util.h" | 11 #include "chrome/browser/chromeos/drive/drive_test_util.h" |
| 12 #include "testing/gtest/include/gtest/gtest.h" | 12 #include "testing/gtest/include/gtest/gtest.h" |
| 13 | 13 |
| 14 namespace drive { | 14 namespace drive { |
| 15 | 15 |
| 16 class DriveCacheMetadataTest : public testing::Test { | 16 class DriveCacheMetadataTest : public testing::Test { |
| 17 public: | 17 public: |
| 18 DriveCacheMetadataTest() {} | 18 DriveCacheMetadataTest() {} |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 } | 121 } |
| 122 | 122 |
| 123 // Adds all entries in |cache_map| to the metadata storage. | 123 // Adds all entries in |cache_map| to the metadata storage. |
| 124 void AddAllMapEntries(const DriveCacheMetadata::CacheMap& cache_map) { | 124 void AddAllMapEntries(const DriveCacheMetadata::CacheMap& cache_map) { |
| 125 for (DriveCacheMetadata::CacheMap::const_iterator iter = cache_map.begin(); | 125 for (DriveCacheMetadata::CacheMap::const_iterator iter = cache_map.begin(); |
| 126 iter != cache_map.end(); ++iter) { | 126 iter != cache_map.end(); ++iter) { |
| 127 metadata_->AddOrUpdateCacheEntry(iter->first, iter->second); | 127 metadata_->AddOrUpdateCacheEntry(iter->first, iter->second); |
| 128 } | 128 } |
| 129 } | 129 } |
| 130 | 130 |
| 131 ScopedTempDir temp_dir_; | 131 base::ScopedTempDir temp_dir_; |
| 132 scoped_ptr<DriveCacheMetadata> metadata_; | 132 scoped_ptr<DriveCacheMetadata> metadata_; |
| 133 std::vector<FilePath> cache_paths_; | 133 std::vector<FilePath> cache_paths_; |
| 134 FilePath persistent_directory_; | 134 FilePath persistent_directory_; |
| 135 FilePath tmp_directory_; | 135 FilePath tmp_directory_; |
| 136 FilePath pinned_directory_; | 136 FilePath pinned_directory_; |
| 137 FilePath outgoing_directory_; | 137 FilePath outgoing_directory_; |
| 138 }; | 138 }; |
| 139 | 139 |
| 140 // Test all the methods of DriveCacheMetadata except for | 140 // Test all the methods of DriveCacheMetadata except for |
| 141 // RemoveTemporaryFiles. | 141 // RemoveTemporaryFiles. |
| (...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 415 std::vector<FilePath> cache_paths = | 415 std::vector<FilePath> cache_paths = |
| 416 DriveCache::GetCachePaths( | 416 DriveCache::GetCachePaths( |
| 417 FilePath::FromUTF8Unsafe("/somewhere/nonexistent")); | 417 FilePath::FromUTF8Unsafe("/somewhere/nonexistent")); |
| 418 | 418 |
| 419 scoped_ptr<DriveCacheMetadata> metadata = | 419 scoped_ptr<DriveCacheMetadata> metadata = |
| 420 DriveCacheMetadata::CreateDriveCacheMetadata(NULL).Pass(); | 420 DriveCacheMetadata::CreateDriveCacheMetadata(NULL).Pass(); |
| 421 EXPECT_FALSE(metadata->Initialize(cache_paths)); | 421 EXPECT_FALSE(metadata->Initialize(cache_paths)); |
| 422 } | 422 } |
| 423 | 423 |
| 424 } // namespace drive | 424 } // namespace drive |
| OLD | NEW |