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

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

Issue 16998003: Update CrOS to use scoped_refptr<T>::get() rather than implicit "operator T*" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased Created 7 years, 6 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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); 57 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir());
58 ASSERT_TRUE(file_util::CreateTemporaryFileInDir(temp_dir_.path(), 58 ASSERT_TRUE(file_util::CreateTemporaryFileInDir(temp_dir_.path(),
59 &dummy_file_path_)); 59 &dummy_file_path_));
60 fake_free_disk_space_getter_.reset(new FakeFreeDiskSpaceGetter); 60 fake_free_disk_space_getter_.reset(new FakeFreeDiskSpaceGetter);
61 61
62 scoped_refptr<base::SequencedWorkerPool> pool = 62 scoped_refptr<base::SequencedWorkerPool> pool =
63 content::BrowserThread::GetBlockingPool(); 63 content::BrowserThread::GetBlockingPool();
64 blocking_task_runner_ = 64 blocking_task_runner_ =
65 pool->GetSequencedTaskRunner(pool->GetSequenceToken()); 65 pool->GetSequencedTaskRunner(pool->GetSequenceToken());
66 cache_.reset(new FileCache(temp_dir_.path(), 66 cache_.reset(new FileCache(temp_dir_.path(),
67 blocking_task_runner_, 67 blocking_task_runner_.get(),
68 fake_free_disk_space_getter_.get())); 68 fake_free_disk_space_getter_.get()));
69 69
70 bool success = false; 70 bool success = false;
71 cache_->RequestInitialize( 71 cache_->RequestInitialize(
72 google_apis::test_util::CreateCopyResultCallback(&success)); 72 google_apis::test_util::CreateCopyResultCallback(&success));
73 google_apis::test_util::RunBlockingPoolTask(); 73 google_apis::test_util::RunBlockingPoolTask();
74 ASSERT_TRUE(success); 74 ASSERT_TRUE(success);
75 } 75 }
76 76
77 virtual void TearDown() OVERRIDE { 77 virtual void TearDown() OVERRIDE {
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 const std::string& md5, 264 const std::string& md5,
265 FileError expected_error, 265 FileError expected_error,
266 int expected_cache_state, 266 int expected_cache_state,
267 FileCache::CacheSubDirectoryType expected_sub_dir_type) { 267 FileCache::CacheSubDirectoryType expected_sub_dir_type) {
268 expected_error_ = expected_error; 268 expected_error_ = expected_error;
269 expected_cache_state_ = expected_cache_state; 269 expected_cache_state_ = expected_cache_state;
270 expected_sub_dir_type_ = expected_sub_dir_type; 270 expected_sub_dir_type_ = expected_sub_dir_type;
271 271
272 FileError error = FILE_ERROR_OK; 272 FileError error = FILE_ERROR_OK;
273 PostTaskAndReplyWithResult( 273 PostTaskAndReplyWithResult(
274 blocking_task_runner_, 274 blocking_task_runner_.get(),
275 FROM_HERE, 275 FROM_HERE,
276 base::Bind(&FileCache::ClearDirty, 276 base::Bind(&FileCache::ClearDirty,
277 base::Unretained(cache_.get()), 277 base::Unretained(cache_.get()),
278 resource_id, md5), 278 resource_id,
279 md5),
279 google_apis::test_util::CreateCopyResultCallback(&error)); 280 google_apis::test_util::CreateCopyResultCallback(&error));
280 google_apis::test_util::RunBlockingPoolTask(); 281 google_apis::test_util::RunBlockingPoolTask();
281 VerifyCacheFileState(error, resource_id, md5); 282 VerifyCacheFileState(error, resource_id, md5);
282 } 283 }
283 284
284 void TestMarkAsMounted( 285 void TestMarkAsMounted(
285 const std::string& resource_id, 286 const std::string& resource_id,
286 FileError expected_error, 287 FileError expected_error,
287 int expected_cache_state, 288 int expected_cache_state,
288 FileCache::CacheSubDirectoryType expected_sub_dir_type) { 289 FileCache::CacheSubDirectoryType expected_sub_dir_type) {
(...skipping 875 matching lines...) Expand 10 before | Expand all | Expand 10 after
1164 EXPECT_TRUE(cache_->GetCacheEntry(resource_id_pinned, md5_pinned, &entry)); 1165 EXPECT_TRUE(cache_->GetCacheEntry(resource_id_pinned, md5_pinned, &entry));
1165 EXPECT_TRUE(file_util::PathExists(pinned_path)); 1166 EXPECT_TRUE(file_util::PathExists(pinned_path));
1166 1167
1167 // Returns false when disk space cannot be freed. 1168 // Returns false when disk space cannot be freed.
1168 fake_free_disk_space_getter_->set_default_value(0); 1169 fake_free_disk_space_getter_->set_default_value(0);
1169 EXPECT_FALSE(cache_->FreeDiskSpaceIfNeededFor(kNeededBytes)); 1170 EXPECT_FALSE(cache_->FreeDiskSpaceIfNeededFor(kNeededBytes));
1170 } 1171 }
1171 1172
1172 } // namespace internal 1173 } // namespace internal
1173 } // namespace drive 1174 } // namespace drive
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/drive/file_cache_metadata.cc ('k') | chrome/browser/chromeos/drive/file_system.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698