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

Unified Diff: chrome/browser/chromeos/gdata/gdata_file_system_unittest.cc

Issue 10581038: chromeos: Stop returning scoped_ptr from GDataCache::GetCacheEntry (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 8 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/chromeos/gdata/gdata_cache_unittest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chromeos/gdata/gdata_file_system_unittest.cc
diff --git a/chrome/browser/chromeos/gdata/gdata_file_system_unittest.cc b/chrome/browser/chromeos/gdata/gdata_file_system_unittest.cc
index 742c792c954585f9aa18fa5accab74bb29c055ff..f0a099e1911e3a623716ec06a43e84d17bcfa1d3 100644
--- a/chrome/browser/chromeos/gdata/gdata_file_system_unittest.cc
+++ b/chrome/browser/chromeos/gdata/gdata_file_system_unittest.cc
@@ -420,10 +420,10 @@ class GDataFileSystemTest : public testing::Test {
}
// Helper function to call GetCacheEntry from origin thread.
- scoped_ptr<GDataCacheEntry> GetCacheEntryFromOriginThread(
- const std::string& resource_id,
- const std::string& md5) {
- scoped_ptr<GDataCacheEntry> cache_entry;
+ bool GetCacheEntryFromOriginThread(const std::string& resource_id,
+ const std::string& md5,
+ GDataCacheEntry* cache_entry) {
+ bool result = false;
content::BrowserThread::GetBlockingPool()
->GetSequencedTaskRunner(sequence_token_)->PostTask(
FROM_HERE,
@@ -432,23 +432,26 @@ class GDataFileSystemTest : public testing::Test {
base::Unretained(this),
resource_id,
md5,
- &cache_entry));
+ cache_entry,
+ &result));
test_util::RunBlockingPoolTask();
- return cache_entry.Pass();
+ return result;
}
// Used to implement GetCacheEntry.
void GetCacheEntryFromOriginThreadInternal(
const std::string& resource_id,
const std::string& md5,
- scoped_ptr<GDataCacheEntry>* cache_entry) {
- cache_entry->reset(cache_->GetCacheEntry(resource_id, md5).release());
+ GDataCacheEntry* cache_entry,
+ bool* result) {
+ *result = cache_->GetCacheEntry(resource_id, md5, cache_entry);
}
// Returns true if the cache entry exists for the given resource ID and MD5.
bool CacheEntryExists(const std::string& resource_id,
const std::string& md5) {
- return GetCacheEntryFromOriginThread(resource_id, md5).get();
+ GDataCacheEntry cache_entry;
+ return GetCacheEntryFromOriginThread(resource_id, md5, &cache_entry);
}
// Returns true if the cache file exists for the given resource ID and MD5.
@@ -595,16 +598,17 @@ class GDataFileSystemTest : public testing::Test {
EXPECT_EQ(expected_error_, error);
// Verify cache map.
- scoped_ptr<GDataCacheEntry> cache_entry =
- GetCacheEntryFromOriginThread(resource_id, md5);
+ GDataCacheEntry cache_entry;
+ const bool cache_entry_found =
+ GetCacheEntryFromOriginThread(resource_id, md5, &cache_entry);
if (ToCacheEntry(expected_cache_state_).IsPresent() ||
ToCacheEntry(expected_cache_state_).IsPinned()) {
- ASSERT_TRUE(cache_entry.get());
- EXPECT_EQ(expected_cache_state_, cache_entry->cache_state());
+ ASSERT_TRUE(cache_entry_found);
+ EXPECT_EQ(expected_cache_state_, cache_entry.cache_state());
EXPECT_EQ(expected_sub_dir_type_,
- GDataCache::GetSubDirectoryType(*cache_entry));
+ GDataCache::GetSubDirectoryType(cache_entry));
} else {
- EXPECT_FALSE(cache_entry.get());
+ EXPECT_FALSE(cache_entry_found);
}
// Verify actual cache file.
« no previous file with comments | « chrome/browser/chromeos/gdata/gdata_cache_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698