Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(199)

Side by Side Diff: chrome/browser/chromeos/drive/file_cache_unittest.cc

Issue 14113053: chrome: Use base::MessageLoop. (Part 3) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase again Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 500 matching lines...) Expand 10 before | Expand all | Expand 10 after
511 current = enumerator.Next()) { 511 current = enumerator.Next()) {
512 ++num_files_found; 512 ++num_files_found;
513 EXPECT_EQ(util::EscapeCacheFileName(resource_id) + 513 EXPECT_EQ(util::EscapeCacheFileName(resource_id) +
514 base::FilePath::kExtensionSeparator + 514 base::FilePath::kExtensionSeparator +
515 util::EscapeCacheFileName(md5), 515 util::EscapeCacheFileName(md5),
516 current.BaseName().value()); 516 current.BaseName().value());
517 } 517 }
518 return num_files_found; 518 return num_files_found;
519 } 519 }
520 520
521 MessageLoopForUI message_loop_; 521 base::MessageLoopForUI message_loop_;
522 content::TestBrowserThread ui_thread_; 522 content::TestBrowserThread ui_thread_;
523 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_; 523 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_;
524 base::ScopedTempDir temp_dir_; 524 base::ScopedTempDir temp_dir_;
525 525
526 scoped_ptr<FileCache, test_util::DestroyHelperForTests> cache_; 526 scoped_ptr<FileCache, test_util::DestroyHelperForTests> cache_;
527 scoped_ptr<FakeFreeDiskSpaceGetter> fake_free_disk_space_getter_; 527 scoped_ptr<FakeFreeDiskSpaceGetter> fake_free_disk_space_getter_;
528 scoped_ptr<StrictMock<MockCacheObserver> > mock_cache_observer_; 528 scoped_ptr<StrictMock<MockCacheObserver> > mock_cache_observer_;
529 529
530 FileError expected_error_; 530 FileError expected_error_;
531 int expected_cache_state_; 531 int expected_cache_state_;
(...skipping 721 matching lines...) Expand 10 before | Expand all | Expand 10 after
1253 FILE_ERROR_NO_SPACE, 1253 FILE_ERROR_NO_SPACE,
1254 test_util::TEST_CACHE_STATE_NONE, 1254 test_util::TEST_CACHE_STATE_NONE,
1255 FileCache::CACHE_TYPE_TMP); 1255 FileCache::CACHE_TYPE_TMP);
1256 1256
1257 // Verify that there's no files added. 1257 // Verify that there's no files added.
1258 EXPECT_EQ(0U, CountCacheFiles(resource_id, md5)); 1258 EXPECT_EQ(0U, CountCacheFiles(resource_id, md5));
1259 } 1259 }
1260 1260
1261 // Don't use TEST_F, as we don't want SetUp() and TearDown() for this test. 1261 // Don't use TEST_F, as we don't want SetUp() and TearDown() for this test.
1262 TEST(FileCacheExtraTest, InitializationFailure) { 1262 TEST(FileCacheExtraTest, InitializationFailure) {
1263 MessageLoopForUI message_loop; 1263 base::MessageLoopForUI message_loop;
1264 content::TestBrowserThread ui_thread(content::BrowserThread::UI, 1264 content::TestBrowserThread ui_thread(content::BrowserThread::UI,
1265 &message_loop); 1265 &message_loop);
1266 1266
1267 scoped_refptr<base::SequencedWorkerPool> pool = 1267 scoped_refptr<base::SequencedWorkerPool> pool =
1268 content::BrowserThread::GetBlockingPool(); 1268 content::BrowserThread::GetBlockingPool();
1269 1269
1270 // Set the cache root to a non existent path, so the initialization fails. 1270 // Set the cache root to a non existent path, so the initialization fails.
1271 scoped_ptr<FileCache, test_util::DestroyHelperForTests> cache(new FileCache( 1271 scoped_ptr<FileCache, test_util::DestroyHelperForTests> cache(new FileCache(
1272 base::FilePath::FromUTF8Unsafe("/somewhere/nonexistent/blah/blah"), 1272 base::FilePath::FromUTF8Unsafe("/somewhere/nonexistent/blah/blah"),
1273 pool->GetSequencedTaskRunner(pool->GetSequenceToken()), 1273 pool->GetSequencedTaskRunner(pool->GetSequenceToken()),
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
1312 google_apis::test_util::GetTestFilePath("chromeos/gdata/empty_feed.json"), 1312 google_apis::test_util::GetTestFilePath("chromeos/gdata/empty_feed.json"),
1313 FILE_ERROR_OK, 1313 FILE_ERROR_OK,
1314 test_util::TEST_CACHE_STATE_PRESENT | 1314 test_util::TEST_CACHE_STATE_PRESENT |
1315 test_util::TEST_CACHE_STATE_PINNED | 1315 test_util::TEST_CACHE_STATE_PINNED |
1316 test_util::TEST_CACHE_STATE_PERSISTENT, 1316 test_util::TEST_CACHE_STATE_PERSISTENT,
1317 FileCache::CACHE_TYPE_PERSISTENT); 1317 FileCache::CACHE_TYPE_PERSISTENT);
1318 } 1318 }
1319 1319
1320 } // namespace internal 1320 } // namespace internal
1321 } // namespace drive 1321 } // namespace drive
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698