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

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

Issue 345673002: Fully qualify all references to fileapi::FileSystemType (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix FileSystemType instances I missed Created 6 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 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"
11 #include "content/public/test/async_file_test_helper.h" 11 #include "content/public/test/async_file_test_helper.h"
12 #include "content/public/test/test_file_system_context.h" 12 #include "content/public/test/test_file_system_context.h"
13 #include "testing/gtest/include/gtest/gtest.h" 13 #include "testing/gtest/include/gtest/gtest.h"
14 #include "url/gurl.h" 14 #include "url/gurl.h"
15 #include "webkit/browser/fileapi/file_system_context.h" 15 #include "webkit/browser/fileapi/file_system_context.h"
16 #include "webkit/browser/fileapi/file_system_quota_client.h" 16 #include "webkit/browser/fileapi/file_system_quota_client.h"
17 #include "webkit/browser/fileapi/file_system_usage_cache.h" 17 #include "webkit/browser/fileapi/file_system_usage_cache.h"
18 #include "webkit/browser/fileapi/obfuscated_file_util.h" 18 #include "webkit/browser/fileapi/obfuscated_file_util.h"
19 #include "webkit/common/fileapi/file_system_types.h" 19 #include "webkit/common/fileapi/file_system_types.h"
20 #include "webkit/common/fileapi/file_system_util.h" 20 #include "webkit/common/fileapi/file_system_util.h"
21 #include "webkit/common/quota/quota_types.h" 21 #include "webkit/common/quota/quota_types.h"
22 22
23 using content::AsyncFileTestHelper; 23 using content::AsyncFileTestHelper;
24 using fileapi::FileSystemQuotaClient; 24 using fileapi::FileSystemQuotaClient;
25 using fileapi::FileSystemType;
26 using fileapi::FileSystemURL; 25 using fileapi::FileSystemURL;
27 26
28 namespace content { 27 namespace content {
29 namespace { 28 namespace {
30 29
31 const char kDummyURL1[] = "http://www.dummy.org"; 30 const char kDummyURL1[] = "http://www.dummy.org";
32 const char kDummyURL2[] = "http://www.example.com"; 31 const char kDummyURL2[] = "http://www.example.com";
33 const char kDummyURL3[] = "http://www.bleh"; 32 const char kDummyURL3[] = "http://www.bleh";
34 33
35 // Declared to shorten the variable names. 34 // Declared to shorten the variable names.
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 quota::StorageType type) { 112 quota::StorageType type) {
114 quota_client->GetOriginUsage( 113 quota_client->GetOriginUsage(
115 GURL(origin_url), type, 114 GURL(origin_url), type,
116 base::Bind(&FileSystemQuotaClientTest::OnGetAdditionalUsage, 115 base::Bind(&FileSystemQuotaClientTest::OnGetAdditionalUsage,
117 weak_factory_.GetWeakPtr())); 116 weak_factory_.GetWeakPtr()));
118 } 117 }
119 118
120 bool CreateFileSystemDirectory(const base::FilePath& file_path, 119 bool CreateFileSystemDirectory(const base::FilePath& file_path,
121 const std::string& origin_url, 120 const std::string& origin_url,
122 quota::StorageType storage_type) { 121 quota::StorageType storage_type) {
123 FileSystemType type = fileapi::QuotaStorageTypeToFileSystemType( 122 fileapi::FileSystemType type =
124 storage_type); 123 fileapi::QuotaStorageTypeToFileSystemType(storage_type);
125 FileSystemURL url = file_system_context_->CreateCrackedFileSystemURL( 124 FileSystemURL url = file_system_context_->CreateCrackedFileSystemURL(
126 GURL(origin_url), type, file_path); 125 GURL(origin_url), type, file_path);
127 126
128 base::File::Error result = 127 base::File::Error result =
129 AsyncFileTestHelper::CreateDirectory(file_system_context_, url); 128 AsyncFileTestHelper::CreateDirectory(file_system_context_, url);
130 return result == base::File::FILE_OK; 129 return result == base::File::FILE_OK;
131 } 130 }
132 131
133 bool CreateFileSystemFile(const base::FilePath& file_path, 132 bool CreateFileSystemFile(const base::FilePath& file_path,
134 int64 file_size, 133 int64 file_size,
135 const std::string& origin_url, 134 const std::string& origin_url,
136 quota::StorageType storage_type) { 135 quota::StorageType storage_type) {
137 if (file_path.empty()) 136 if (file_path.empty())
138 return false; 137 return false;
139 138
140 FileSystemType type = fileapi::QuotaStorageTypeToFileSystemType( 139 fileapi::FileSystemType type =
141 storage_type); 140 fileapi::QuotaStorageTypeToFileSystemType(storage_type);
142 FileSystemURL url = file_system_context_->CreateCrackedFileSystemURL( 141 FileSystemURL url = file_system_context_->CreateCrackedFileSystemURL(
143 GURL(origin_url), type, file_path); 142 GURL(origin_url), type, file_path);
144 143
145 base::File::Error result = 144 base::File::Error result =
146 AsyncFileTestHelper::CreateFile(file_system_context_, url); 145 AsyncFileTestHelper::CreateFile(file_system_context_, url);
147 if (result != base::File::FILE_OK) 146 if (result != base::File::FILE_OK)
148 return false; 147 return false;
149 148
150 result = AsyncFileTestHelper::TruncateFile( 149 result = AsyncFileTestHelper::TruncateFile(
151 file_system_context_, url, file_size); 150 file_system_context_, url, file_size);
(...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after
562 GetOriginUsage(quota_client.get(), 561 GetOriginUsage(quota_client.get(),
563 "https://bar.com/", 562 "https://bar.com/",
564 kPersistent)); 563 kPersistent));
565 EXPECT_EQ(64 + file_paths_cost_temporary_bar_https, 564 EXPECT_EQ(64 + file_paths_cost_temporary_bar_https,
566 GetOriginUsage(quota_client.get(), 565 GetOriginUsage(quota_client.get(),
567 "https://bar.com/", 566 "https://bar.com/",
568 kTemporary)); 567 kTemporary));
569 } 568 }
570 569
571 } // namespace content 570 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/fileapi/file_system_context_unittest.cc ('k') | content/browser/fileapi/isolated_context_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698