| 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 <string> | 5 #include <string> |
| 6 | 6 |
| 7 #include "base/files/file_path.h" | 7 #include "base/files/file_path.h" |
| 8 #include "base/files/scoped_temp_dir.h" | 8 #include "base/files/scoped_temp_dir.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 fake_free_disk_space_getter_.reset(new FakeFreeDiskSpaceGetter); | 37 fake_free_disk_space_getter_.reset(new FakeFreeDiskSpaceGetter); |
| 38 | 38 |
| 39 cache_.reset(new FileCache(temp_dir_.path(), | 39 cache_.reset(new FileCache(temp_dir_.path(), |
| 40 message_loop_.message_loop_proxy(), | 40 message_loop_.message_loop_proxy(), |
| 41 fake_free_disk_space_getter_.get())); | 41 fake_free_disk_space_getter_.get())); |
| 42 | 42 |
| 43 resource_metadata_.reset(new ResourceMetadata( | 43 resource_metadata_.reset(new ResourceMetadata( |
| 44 cache_->GetCacheDirectoryPath(FileCache::CACHE_TYPE_META), | 44 cache_->GetCacheDirectoryPath(FileCache::CACHE_TYPE_META), |
| 45 message_loop_.message_loop_proxy())); | 45 message_loop_.message_loop_proxy())); |
| 46 | 46 |
| 47 cache_->RequestInitializeForTesting(); | 47 bool success = false; |
| 48 cache_->RequestInitialize( |
| 49 google_apis::test_util::CreateCopyResultCallback(&success)); |
| 48 message_loop_.RunUntilIdle(); | 50 message_loop_.RunUntilIdle(); |
| 51 ASSERT_TRUE(success); |
| 49 | 52 |
| 50 FileError error = FILE_ERROR_FAILED; | 53 FileError error = FILE_ERROR_FAILED; |
| 51 resource_metadata_->Initialize( | 54 resource_metadata_->Initialize( |
| 52 google_apis::test_util::CreateCopyResultCallback(&error)); | 55 google_apis::test_util::CreateCopyResultCallback(&error)); |
| 53 message_loop_.RunUntilIdle(); | 56 message_loop_.RunUntilIdle(); |
| 54 ASSERT_EQ(FILE_ERROR_OK, error); | 57 ASSERT_EQ(FILE_ERROR_OK, error); |
| 55 } | 58 } |
| 56 | 59 |
| 57 base::MessageLoopForUI message_loop_; | 60 base::MessageLoopForUI message_loop_; |
| 58 content::TestBrowserThread ui_thread_; | 61 content::TestBrowserThread ui_thread_; |
| (...skipping 28 matching lines...) Expand all Loading... |
| 87 | 90 |
| 88 // Remove stale cache files. | 91 // Remove stale cache files. |
| 89 RemoveStaleCacheFiles(cache_.get(), resource_metadata_.get()); | 92 RemoveStaleCacheFiles(cache_.get(), resource_metadata_.get()); |
| 90 | 93 |
| 91 // Verify that the cache entry is deleted. | 94 // Verify that the cache entry is deleted. |
| 92 EXPECT_FALSE(cache_->GetCacheEntry(resource_id, md5, &cache_entry)); | 95 EXPECT_FALSE(cache_->GetCacheEntry(resource_id, md5, &cache_entry)); |
| 93 } | 96 } |
| 94 | 97 |
| 95 } // namespace internal | 98 } // namespace internal |
| 96 } // namespace drive | 99 } // namespace drive |
| OLD | NEW |