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

Side by Side Diff: content/browser/fileapi/file_system_quota_client_unittest.cc

Issue 508683002: Remove implicit conversions from scoped_refptr to T* in content/browser/fileapi/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "base/basictypes.h" 5 #include "base/basictypes.h"
6 #include "base/bind.h" 6 #include "base/bind.h"
7 #include "base/file_util.h" 7 #include "base/file_util.h"
8 #include "base/files/scoped_temp_dir.h" 8 #include "base/files/scoped_temp_dir.h"
9 #include "base/message_loop/message_loop_proxy.h" 9 #include "base/message_loop/message_loop_proxy.h"
10 #include "base/run_loop.h" 10 #include "base/run_loop.h"
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 114
115 bool CreateFileSystemDirectory(const base::FilePath& file_path, 115 bool CreateFileSystemDirectory(const base::FilePath& file_path,
116 const std::string& origin_url, 116 const std::string& origin_url,
117 storage::StorageType storage_type) { 117 storage::StorageType storage_type) {
118 storage::FileSystemType type = 118 storage::FileSystemType type =
119 storage::QuotaStorageTypeToFileSystemType(storage_type); 119 storage::QuotaStorageTypeToFileSystemType(storage_type);
120 FileSystemURL url = file_system_context_->CreateCrackedFileSystemURL( 120 FileSystemURL url = file_system_context_->CreateCrackedFileSystemURL(
121 GURL(origin_url), type, file_path); 121 GURL(origin_url), type, file_path);
122 122
123 base::File::Error result = 123 base::File::Error result =
124 AsyncFileTestHelper::CreateDirectory(file_system_context_, url); 124 AsyncFileTestHelper::CreateDirectory(file_system_context_.get(), url);
125 return result == base::File::FILE_OK; 125 return result == base::File::FILE_OK;
126 } 126 }
127 127
128 bool CreateFileSystemFile(const base::FilePath& file_path, 128 bool CreateFileSystemFile(const base::FilePath& file_path,
129 int64 file_size, 129 int64 file_size,
130 const std::string& origin_url, 130 const std::string& origin_url,
131 storage::StorageType storage_type) { 131 storage::StorageType storage_type) {
132 if (file_path.empty()) 132 if (file_path.empty())
133 return false; 133 return false;
134 134
135 storage::FileSystemType type = 135 storage::FileSystemType type =
136 storage::QuotaStorageTypeToFileSystemType(storage_type); 136 storage::QuotaStorageTypeToFileSystemType(storage_type);
137 FileSystemURL url = file_system_context_->CreateCrackedFileSystemURL( 137 FileSystemURL url = file_system_context_->CreateCrackedFileSystemURL(
138 GURL(origin_url), type, file_path); 138 GURL(origin_url), type, file_path);
139 139
140 base::File::Error result = 140 base::File::Error result =
141 AsyncFileTestHelper::CreateFile(file_system_context_, url); 141 AsyncFileTestHelper::CreateFile(file_system_context_.get(), url);
142 if (result != base::File::FILE_OK) 142 if (result != base::File::FILE_OK)
143 return false; 143 return false;
144 144
145 result = AsyncFileTestHelper::TruncateFile( 145 result = AsyncFileTestHelper::TruncateFile(
146 file_system_context_, url, file_size); 146 file_system_context_.get(), url, file_size);
147 return result == base::File::FILE_OK; 147 return result == base::File::FILE_OK;
148 } 148 }
149 149
150 void InitializeOriginFiles(FileSystemQuotaClient* quota_client, 150 void InitializeOriginFiles(FileSystemQuotaClient* quota_client,
151 const TestFile* files, 151 const TestFile* files,
152 int num_files) { 152 int num_files) {
153 for (int i = 0; i < num_files; i++) { 153 for (int i = 0; i < num_files; i++) {
154 base::FilePath path = base::FilePath().AppendASCII(files[i].name); 154 base::FilePath path = base::FilePath().AppendASCII(files[i].name);
155 if (files[i].isDirectory) { 155 if (files[i].isDirectory) {
156 ASSERT_TRUE(CreateFileSystemDirectory( 156 ASSERT_TRUE(CreateFileSystemDirectory(
(...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after
557 GetOriginUsage(quota_client.get(), 557 GetOriginUsage(quota_client.get(),
558 "https://bar.com/", 558 "https://bar.com/",
559 kPersistent)); 559 kPersistent));
560 EXPECT_EQ(64 + file_paths_cost_temporary_bar_https, 560 EXPECT_EQ(64 + file_paths_cost_temporary_bar_https,
561 GetOriginUsage(quota_client.get(), 561 GetOriginUsage(quota_client.get(),
562 "https://bar.com/", 562 "https://bar.com/",
563 kTemporary)); 563 kTemporary));
564 } 564 }
565 565
566 } // namespace content 566 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698