| 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_cache.h" | 5 #include "chrome/browser/chromeos/drive/file_cache.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
| (...skipping 504 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 515 current = enumerator.Next()) { | 515 current = enumerator.Next()) { |
| 516 ++num_files_found; | 516 ++num_files_found; |
| 517 EXPECT_EQ(util::EscapeCacheFileName(resource_id) + | 517 EXPECT_EQ(util::EscapeCacheFileName(resource_id) + |
| 518 base::FilePath::kExtensionSeparator + | 518 base::FilePath::kExtensionSeparator + |
| 519 util::EscapeCacheFileName(md5), | 519 util::EscapeCacheFileName(md5), |
| 520 current.BaseName().value()); | 520 current.BaseName().value()); |
| 521 } | 521 } |
| 522 return num_files_found; | 522 return num_files_found; |
| 523 } | 523 } |
| 524 | 524 |
| 525 MessageLoopForUI message_loop_; | 525 base::MessageLoopForUI message_loop_; |
| 526 content::TestBrowserThread ui_thread_; | 526 content::TestBrowserThread ui_thread_; |
| 527 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_; | 527 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_; |
| 528 base::ScopedTempDir temp_dir_; | 528 base::ScopedTempDir temp_dir_; |
| 529 | 529 |
| 530 scoped_ptr<FileCache, test_util::DestroyHelperForTests> cache_; | 530 scoped_ptr<FileCache, test_util::DestroyHelperForTests> cache_; |
| 531 scoped_ptr<FakeFreeDiskSpaceGetter> fake_free_disk_space_getter_; | 531 scoped_ptr<FakeFreeDiskSpaceGetter> fake_free_disk_space_getter_; |
| 532 scoped_ptr<StrictMock<MockCacheObserver> > mock_cache_observer_; | 532 scoped_ptr<StrictMock<MockCacheObserver> > mock_cache_observer_; |
| 533 | 533 |
| 534 FileError expected_error_; | 534 FileError expected_error_; |
| 535 int expected_cache_state_; | 535 int expected_cache_state_; |
| (...skipping 721 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1257 FILE_ERROR_NO_SPACE, | 1257 FILE_ERROR_NO_SPACE, |
| 1258 test_util::TEST_CACHE_STATE_NONE, | 1258 test_util::TEST_CACHE_STATE_NONE, |
| 1259 FileCache::CACHE_TYPE_TMP); | 1259 FileCache::CACHE_TYPE_TMP); |
| 1260 | 1260 |
| 1261 // Verify that there's no files added. | 1261 // Verify that there's no files added. |
| 1262 EXPECT_EQ(0U, CountCacheFiles(resource_id, md5)); | 1262 EXPECT_EQ(0U, CountCacheFiles(resource_id, md5)); |
| 1263 } | 1263 } |
| 1264 | 1264 |
| 1265 // Don't use TEST_F, as we don't want SetUp() and TearDown() for this test. | 1265 // Don't use TEST_F, as we don't want SetUp() and TearDown() for this test. |
| 1266 TEST(FileCacheExtraTest, InitializationFailure) { | 1266 TEST(FileCacheExtraTest, InitializationFailure) { |
| 1267 MessageLoopForUI message_loop; | 1267 base::MessageLoopForUI message_loop; |
| 1268 content::TestBrowserThread ui_thread(content::BrowserThread::UI, | 1268 content::TestBrowserThread ui_thread(content::BrowserThread::UI, |
| 1269 &message_loop); | 1269 &message_loop); |
| 1270 | 1270 |
| 1271 scoped_refptr<base::SequencedWorkerPool> pool = | 1271 scoped_refptr<base::SequencedWorkerPool> pool = |
| 1272 content::BrowserThread::GetBlockingPool(); | 1272 content::BrowserThread::GetBlockingPool(); |
| 1273 | 1273 |
| 1274 // Set the cache root to a non existent path, so the initialization fails. | 1274 // Set the cache root to a non existent path, so the initialization fails. |
| 1275 scoped_ptr<FileCache, test_util::DestroyHelperForTests> cache(new FileCache( | 1275 scoped_ptr<FileCache, test_util::DestroyHelperForTests> cache(new FileCache( |
| 1276 base::FilePath::FromUTF8Unsafe("/somewhere/nonexistent/blah/blah"), | 1276 base::FilePath::FromUTF8Unsafe("/somewhere/nonexistent/blah/blah"), |
| 1277 pool->GetSequencedTaskRunner(pool->GetSequenceToken()), | 1277 pool->GetSequencedTaskRunner(pool->GetSequenceToken()), |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1316 google_apis::test_util::GetTestFilePath("chromeos/gdata/empty_feed.json"), | 1316 google_apis::test_util::GetTestFilePath("chromeos/gdata/empty_feed.json"), |
| 1317 FILE_ERROR_OK, | 1317 FILE_ERROR_OK, |
| 1318 test_util::TEST_CACHE_STATE_PRESENT | | 1318 test_util::TEST_CACHE_STATE_PRESENT | |
| 1319 test_util::TEST_CACHE_STATE_PINNED | | 1319 test_util::TEST_CACHE_STATE_PINNED | |
| 1320 test_util::TEST_CACHE_STATE_PERSISTENT, | 1320 test_util::TEST_CACHE_STATE_PERSISTENT, |
| 1321 FileCache::CACHE_TYPE_PERSISTENT); | 1321 FileCache::CACHE_TYPE_PERSISTENT); |
| 1322 } | 1322 } |
| 1323 | 1323 |
| 1324 } // namespace internal | 1324 } // namespace internal |
| 1325 } // namespace drive | 1325 } // namespace drive |
| OLD | NEW |