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

Side by Side Diff: webkit/browser/fileapi/obfuscated_file_util_unittest.cc

Issue 16155009: Update webkit/ to use scoped_refptr<T>::get() rather than implicit "operator T*" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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 <set> 5 #include <set>
6 #include <string> 6 #include <string>
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/file_util.h" 10 #include "base/file_util.h"
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 quota_status_(quota::kQuotaStatusUnknown), 125 quota_status_(quota::kQuotaStatusUnknown),
126 usage_(-1) { 126 usage_(-1) {
127 } 127 }
128 128
129 virtual void SetUp() { 129 virtual void SetUp() {
130 ASSERT_TRUE(data_dir_.CreateUniqueTempDir()); 130 ASSERT_TRUE(data_dir_.CreateUniqueTempDir());
131 131
132 scoped_refptr<quota::SpecialStoragePolicy> storage_policy = 132 scoped_refptr<quota::SpecialStoragePolicy> storage_policy =
133 new quota::MockSpecialStoragePolicy(); 133 new quota::MockSpecialStoragePolicy();
134 134
135 quota_manager_ = new quota::QuotaManager( 135 quota_manager_ = new quota::QuotaManager(false /* is_incognito */,
136 false /* is_incognito */, 136 data_dir_.path(),
137 data_dir_.path(), 137 base::MessageLoopProxy::current(),
138 base::MessageLoopProxy::current(), 138 base::MessageLoopProxy::current(),
139 base::MessageLoopProxy::current(), 139 storage_policy.get());
140 storage_policy);
141 140
142 // Every time we create a new sandbox_file_system helper, 141 // Every time we create a new sandbox_file_system helper,
143 // it creates another context, which creates another path manager, 142 // it creates another context, which creates another path manager,
144 // another sandbox_mount_point_provider, and 143 // another sandbox_mount_point_provider, and
145 // another OFU. We need to pass in the context to skip all that. 144 // another OFU. We need to pass in the context to skip all that.
146 file_system_context_ = CreateFileSystemContextForTesting( 145 file_system_context_ = CreateFileSystemContextForTesting(
147 quota_manager_->proxy(), 146 quota_manager_->proxy(),
148 data_dir_.path()); 147 data_dir_.path());
149 148
150 sandbox_file_system_.SetUp(file_system_context_.get()); 149 sandbox_file_system_.SetUp(file_system_context_.get());
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 return type_; 219 return type_;
221 } 220 }
222 221
223 int64 ComputeTotalFileSize() { 222 int64 ComputeTotalFileSize() {
224 return sandbox_file_system_.ComputeCurrentOriginUsage() - 223 return sandbox_file_system_.ComputeCurrentOriginUsage() -
225 sandbox_file_system_.ComputeCurrentDirectoryDatabaseUsage(); 224 sandbox_file_system_.ComputeCurrentDirectoryDatabaseUsage();
226 } 225 }
227 226
228 void GetUsageFromQuotaManager() { 227 void GetUsageFromQuotaManager() {
229 int64 quota = -1; 228 int64 quota = -1;
230 quota_status_ = AsyncFileTestHelper::GetUsageAndQuota( 229 quota_status_ =
231 quota_manager_, origin(), sandbox_file_system_.type(), 230 AsyncFileTestHelper::GetUsageAndQuota(quota_manager_.get(),
232 &usage_, &quota); 231 origin(),
232 sandbox_file_system_.type(),
233 &usage_,
234 &quota);
233 EXPECT_EQ(quota::kQuotaStatusOk, quota_status_); 235 EXPECT_EQ(quota::kQuotaStatusOk, quota_status_);
234 } 236 }
235 237
236 void RevokeUsageCache() { 238 void RevokeUsageCache() {
237 quota_manager_->ResetUsageTracker(sandbox_file_system_.storage_type()); 239 quota_manager_->ResetUsageTracker(sandbox_file_system_.storage_type());
238 usage_cache()->Delete(sandbox_file_system_.GetUsageCachePath()); 240 usage_cache()->Delete(sandbox_file_system_.GetUsageCachePath());
239 } 241 }
240 242
241 int64 SizeByQuotaUtil() { 243 int64 SizeByQuotaUtil() {
242 return sandbox_file_system_.GetCachedOriginUsage(); 244 return sandbox_file_system_.GetCachedOriginUsage();
(...skipping 2000 matching lines...) Expand 10 before | Expand all | Expand 10 after
2243 ASSERT_EQ(base::PLATFORM_FILE_OK, 2245 ASSERT_EQ(base::PLATFORM_FILE_OK,
2244 ofu()->CreateOrOpen( 2246 ofu()->CreateOrOpen(
2245 AllowUsageIncrease(-length)->context(), file, 2247 AllowUsageIncrease(-length)->context(), file,
2246 base::PLATFORM_FILE_OPEN_TRUNCATED | base::PLATFORM_FILE_WRITE, 2248 base::PLATFORM_FILE_OPEN_TRUNCATED | base::PLATFORM_FILE_WRITE,
2247 &file_handle, &created)); 2249 &file_handle, &created));
2248 ASSERT_EQ(0, ComputeTotalFileSize()); 2250 ASSERT_EQ(0, ComputeTotalFileSize());
2249 EXPECT_TRUE(base::ClosePlatformFile(file_handle)); 2251 EXPECT_TRUE(base::ClosePlatformFile(file_handle));
2250 } 2252 }
2251 2253
2252 } // namespace fileapi 2254 } // namespace fileapi
OLDNEW
« no previous file with comments | « webkit/browser/fileapi/obfuscated_file_util.cc ('k') | webkit/browser/fileapi/sandbox_file_system_test_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698