storage: Move testing code from namespace content to storage.
Testing code that was moved from //content to //storage is still under
the content namespace. This is hindering Storage Service-related
refactoring. This CL updates the namespace to reflect the directory
structure.
This CL also makes mechanical code health improvements (such as new ->
base::MakeRefCounted) applied when obvious. clang-tidy improvements are
applied where requested by Tricium.
Bug: 653751
Change-Id: I3d0b5712b531d0d33205ee2a3de3de5dce73e84d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2048986
Commit-Queue: Victor Costan <pwnall@chromium.org>
Reviewed-by: Scott Violet <sky@chromium.org>
Reviewed-by: Jarryd Goodman <jarrydg@chromium.org>
Cr-Commit-Position: refs/heads/master@{#740558}
diff --git a/chrome/browser/browsing_data/browsing_data_quota_helper_unittest.cc b/chrome/browser/browsing_data/browsing_data_quota_helper_unittest.cc
index 08b08ad6..c6139dd 100644
--- a/chrome/browser/browsing_data/browsing_data_quota_helper_unittest.cc
+++ b/chrome/browser/browsing_data/browsing_data_quota_helper_unittest.cc
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "testing/gtest/include/gtest/gtest.h"
-
#include <stddef.h>
#include <stdint.h>
@@ -19,11 +17,12 @@
#include "storage/browser/quota/quota_manager.h"
#include "storage/browser/quota/quota_manager_proxy.h"
#include "storage/browser/test/mock_storage_client.h"
+#include "testing/gtest/include/gtest/gtest.h"
using blink::mojom::StorageType;
using content::BrowserThread;
-using content::MockOriginData;
-using content::MockStorageClient;
+using storage::MockOriginData;
+using storage::MockStorageClient;
class BrowsingDataQuotaHelperTest : public testing::Test {
public:
@@ -36,7 +35,7 @@
void SetUp() override {
EXPECT_TRUE(dir_.CreateUniqueTempDir());
- quota_manager_ = new storage::QuotaManager(
+ quota_manager_ = base::MakeRefCounted<storage::QuotaManager>(
false, dir_.GetPath(),
base::CreateSingleThreadTaskRunner({BrowserThread::IO}).get(), nullptr,
storage::GetQuotaSettingsFunc());
diff --git a/chrome/browser/chromeos/arc/fileapi/file_stream_forwarder_unittest.cc b/chrome/browser/chromeos/arc/fileapi/file_stream_forwarder_unittest.cc
index 4a146063..af945cb6 100644
--- a/chrome/browser/chromeos/arc/fileapi/file_stream_forwarder_unittest.cc
+++ b/chrome/browser/chromeos/arc/fileapi/file_stream_forwarder_unittest.cc
@@ -38,7 +38,7 @@
ASSERT_TRUE(dest_file.IsValid());
dest_fd_ = base::ScopedFD(dest_file.TakePlatformFile());
- context_ = content::CreateFileSystemContextForTesting(nullptr,
+ context_ = storage::CreateFileSystemContextForTesting(nullptr,
temp_dir_.GetPath());
// Prepare a file system.
@@ -63,7 +63,7 @@
test_data_ = base::RandBytesAsString(kTestDataSize);
ASSERT_EQ(base::File::FILE_OK,
- content::AsyncFileTestHelper::CreateFileWithData(
+ storage::AsyncFileTestHelper::CreateFileWithData(
context_.get(), url_, test_data_.data(), test_data_.size()));
}
diff --git a/chrome/browser/chromeos/file_system_provider/fileapi/provider_async_file_util_unittest.cc b/chrome/browser/chromeos/file_system_provider/fileapi/provider_async_file_util_unittest.cc
index f11f31b5..a325a52 100644
--- a/chrome/browser/chromeos/file_system_provider/fileapi/provider_async_file_util_unittest.cc
+++ b/chrome/browser/chromeos/file_system_provider/fileapi/provider_async_file_util_unittest.cc
@@ -8,6 +8,7 @@
#include <memory>
#include <string>
+#include <utility>
#include <vector>
#include "base/bind.h"
@@ -130,8 +131,8 @@
profile_ = profile_manager_->CreateTestingProfile("testing-profile");
async_file_util_.reset(new internal::ProviderAsyncFileUtil);
- file_system_context_ =
- content::CreateFileSystemContextForTesting(NULL, data_dir_.GetPath());
+ file_system_context_ = storage::CreateFileSystemContextForTesting(
+ nullptr, data_dir_.GetPath());
Service* service = Service::Get(profile_); // Owned by its factory.
service->RegisterProvider(FakeExtensionProvider::Create(kExtensionId));
diff --git a/chrome/browser/chromeos/fileapi/recent_disk_source_unittest.cc b/chrome/browser/chromeos/fileapi/recent_disk_source_unittest.cc
index cb6995f..8bf675f 100644
--- a/chrome/browser/chromeos/fileapi/recent_disk_source_unittest.cc
+++ b/chrome/browser/chromeos/fileapi/recent_disk_source_unittest.cc
@@ -41,7 +41,7 @@
ASSERT_TRUE(temp_dir_.CreateUniqueTempDir());
- file_system_context_ = content::CreateFileSystemContextForTesting(
+ file_system_context_ = storage::CreateFileSystemContextForTesting(
nullptr, temp_dir_.GetPath());
mount_point_name_ =
diff --git a/chrome/browser/engagement/important_sites_usage_counter_unittest.cc b/chrome/browser/engagement/important_sites_usage_counter_unittest.cc
index 1d27edb..cfcf779 100644
--- a/chrome/browser/engagement/important_sites_usage_counter_unittest.cc
+++ b/chrome/browser/engagement/important_sites_usage_counter_unittest.cc
@@ -4,6 +4,9 @@
#include "chrome/browser/engagement/important_sites_usage_counter.h"
+#include <memory>
+#include <utility>
+
#include "base/bind.h"
#include "base/files/file_path.h"
#include "base/files/file_util.h"
@@ -50,8 +53,8 @@
return quota_manager_.get();
}
- void RegisterClient(const std::vector<content::MockOriginData>& data) {
- auto* client = new content::MockStorageClient(
+ void RegisterClient(const std::vector<storage::MockOriginData>& data) {
+ auto* client = new storage::MockStorageClient(
quota_manager_->proxy(), data.data(), storage::QuotaClient::kFileSystem,
data.size());
quota_manager_->proxy()->RegisterClient(client);
@@ -105,7 +108,7 @@
important_sites.push_back(std::move(i1));
important_sites.push_back(std::move(i2));
- const std::vector<content::MockOriginData> origins = {
+ const std::vector<storage::MockOriginData> origins = {
{"http://example.com/", blink::mojom::StorageType::kTemporary, 1},
{"https://example.com/", blink::mojom::StorageType::kTemporary, 2},
{"https://maps.example.com/", blink::mojom::StorageType::kTemporary, 4},
diff --git a/chrome/browser/media_galleries/fileapi/media_file_validator_browsertest.cc b/chrome/browser/media_galleries/fileapi/media_file_validator_browsertest.cc
index b6eba71..170d0a1 100644
--- a/chrome/browser/media_galleries/fileapi/media_file_validator_browsertest.cc
+++ b/chrome/browser/media_galleries/fileapi/media_file_validator_browsertest.cc
@@ -76,7 +76,7 @@
public:
MediaFileValidatorTest() : test_file_size_(0) {}
- ~MediaFileValidatorTest() override {}
+ ~MediaFileValidatorTest() override = default;
// Write |content| into |filename| in a test file system and try to move
// it into a media file system. The result is compared to |expected_result|.
@@ -128,15 +128,15 @@
file_system_runner_ =
base::CreateSequencedTaskRunner({base::ThreadPool(), base::MayBlock()});
additional_providers.push_back(
- std::make_unique<content::TestFileSystemBackend>(
+ std::make_unique<storage::TestFileSystemBackend>(
file_system_runner_.get(), src_path));
additional_providers.push_back(
std::make_unique<MediaFileSystemBackend>(base));
file_system_context_ =
- content::CreateFileSystemContextWithAdditionalProvidersForTesting(
+ storage::CreateFileSystemContextWithAdditionalProvidersForTesting(
base::CreateSingleThreadTaskRunner({content::BrowserThread::IO})
.get(),
- file_system_runner_.get(), NULL, std::move(additional_providers),
+ file_system_runner_.get(), nullptr, std::move(additional_providers),
base);
move_src_ = file_system_context_->CreateCrackedFileSystemURL(
@@ -154,7 +154,7 @@
dest_fs_ =
storage::IsolatedContext::GetInstance()->RegisterFileSystemForPath(
storage::kFileSystemTypeNativeMedia, std::string(), dest_path,
- NULL);
+ nullptr);
size_t extension_index = filename.find_last_of(".");
ASSERT_NE(std::string::npos, extension_index);
diff --git a/chrome/browser/media_galleries/fileapi/native_media_file_util_unittest.cc b/chrome/browser/media_galleries/fileapi/native_media_file_util_unittest.cc
index 12e67181..76f438ba 100644
--- a/chrome/browser/media_galleries/fileapi/native_media_file_util_unittest.cc
+++ b/chrome/browser/media_galleries/fileapi/native_media_file_util_unittest.cc
@@ -14,6 +14,7 @@
#include "base/files/file_util.h"
#include "base/files/scoped_temp_dir.h"
#include "base/format_macros.h"
+#include "base/memory/scoped_refptr.h"
#include "base/stl_util.h"
#include "base/strings/stringprintf.h"
#include "base/task/post_task.h"
@@ -55,10 +56,10 @@
const FilteringTestCase kFilteringTestCases[] = {
// Directory should always be visible.
- {FPL("hoge"), true, true, false, NULL},
- {FPL("fuga.jpg"), true, true, false, NULL},
- {FPL("piyo.txt"), true, true, false, NULL},
- {FPL("moga.cod"), true, true, false, NULL},
+ {FPL("hoge"), true, true, false, nullptr},
+ {FPL("fuga.jpg"), true, true, false, nullptr},
+ {FPL("piyo.txt"), true, true, false, nullptr},
+ {FPL("moga.cod"), true, true, false, nullptr},
// File should be visible if it's a supported media file.
// File without extension.
@@ -108,7 +109,7 @@
if (test_cases[i].is_directory) {
ASSERT_TRUE(base::CreateDirectory(path));
} else {
- ASSERT_TRUE(test_cases[i].content != NULL);
+ ASSERT_TRUE(test_cases[i].content != nullptr);
int len = strlen(test_cases[i].content);
ASSERT_EQ(len, base::WriteFile(path, test_cases[i].content, len));
}
@@ -119,30 +120,31 @@
class NativeMediaFileUtilTest : public testing::Test {
public:
- NativeMediaFileUtilTest() {}
+ NativeMediaFileUtilTest() = default;
void SetUp() override {
ASSERT_TRUE(data_dir_.CreateUniqueTempDir());
ASSERT_TRUE(base::CreateDirectory(root_path()));
- scoped_refptr<storage::SpecialStoragePolicy> storage_policy =
- new content::MockSpecialStoragePolicy();
+ auto storage_policy =
+ base::MakeRefCounted<storage::MockSpecialStoragePolicy>();
std::vector<std::unique_ptr<storage::FileSystemBackend>>
additional_providers;
additional_providers.push_back(
std::make_unique<MediaFileSystemBackend>(data_dir_.GetPath()));
- file_system_context_ = new storage::FileSystemContext(
+ file_system_context_ = base::MakeRefCounted<storage::FileSystemContext>(
base::CreateSingleThreadTaskRunner({content::BrowserThread::IO}).get(),
base::SequencedTaskRunnerHandle::Get().get(),
storage::ExternalMountPoints::CreateRefCounted().get(),
- storage_policy.get(), NULL, std::move(additional_providers),
+ storage_policy.get(), nullptr, std::move(additional_providers),
std::vector<storage::URLRequestAutoMountHandler>(), data_dir_.GetPath(),
- content::CreateAllowFileAccessOptions());
+ storage::CreateAllowFileAccessOptions());
filesystem_ = isolated_context()->RegisterFileSystemForPath(
- storage::kFileSystemTypeNativeMedia, std::string(), root_path(), NULL);
+ storage::kFileSystemTypeNativeMedia, std::string(), root_path(),
+ nullptr);
filesystem_id_ = filesystem_.id();
}
diff --git a/chrome/browser/sync_file_system/local/canned_syncable_file_system.cc b/chrome/browser/sync_file_system/local/canned_syncable_file_system.cc
index 7d0541f..69519b9 100644
--- a/chrome/browser/sync_file_system/local/canned_syncable_file_system.cc
+++ b/chrome/browser/sync_file_system/local/canned_syncable_file_system.cc
@@ -15,6 +15,7 @@
#include "base/files/file_util.h"
#include "base/guid.h"
#include "base/macros.h"
+#include "base/memory/scoped_refptr.h"
#include "base/run_loop.h"
#include "base/single_thread_task_runner.h"
#include "base/task/thread_pool/thread_pool_instance.h"
@@ -162,7 +163,7 @@
base::GenerateGUID(),
blob_data)) {}
- ~WriteHelper() {}
+ ~WriteHelper() = default;
ScopedTextBlob* scoped_text_blob() const { return blob_data_.get(); }
@@ -224,14 +225,14 @@
is_filesystem_opened_(false),
sync_status_observers_(new ObserverList) {}
-CannedSyncableFileSystem::~CannedSyncableFileSystem() {}
+CannedSyncableFileSystem::~CannedSyncableFileSystem() = default;
void CannedSyncableFileSystem::SetUp(QuotaMode quota_mode) {
ASSERT_FALSE(is_filesystem_set_up_);
ASSERT_TRUE(data_dir_.CreateUniqueTempDir());
- scoped_refptr<storage::SpecialStoragePolicy> storage_policy =
- new content::MockSpecialStoragePolicy();
+ auto storage_policy =
+ base::MakeRefCounted<storage::MockSpecialStoragePolicy>();
if (quota_mode == QUOTA_ENABLED) {
quota_manager_ = new QuotaManager(
diff --git a/chrome/browser/sync_file_system/local/syncable_file_system_unittest.cc b/chrome/browser/sync_file_system/local/syncable_file_system_unittest.cc
index d837af84..da005d3 100644
--- a/chrome/browser/sync_file_system/local/syncable_file_system_unittest.cc
+++ b/chrome/browser/sync_file_system/local/syncable_file_system_unittest.cc
@@ -23,12 +23,12 @@
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/leveldatabase/leveldb_chrome.h"
-using content::SandboxFileSystemTestHelper;
using storage::FileSystemContext;
using storage::FileSystemOperationContext;
using storage::FileSystemURL;
using storage::FileSystemURLSet;
using storage::QuotaManager;
+using storage::SandboxFileSystemTestHelper;
namespace sync_file_system {
diff --git a/content/browser/appcache/appcache_storage_unittest.cc b/content/browser/appcache/appcache_storage_unittest.cc
index 775958c..6a2ea1e 100644
--- a/content/browser/appcache/appcache_storage_unittest.cc
+++ b/content/browser/appcache/appcache_storage_unittest.cc
@@ -142,8 +142,8 @@
const url::Origin kOrigin2(url::Origin::Create(GURL("http://origin2/")));
MockAppCacheService service;
- scoped_refptr<MockQuotaManagerProxy> mock_proxy =
- base::MakeRefCounted<MockQuotaManagerProxy>(nullptr, nullptr);
+ scoped_refptr<storage::MockQuotaManagerProxy> mock_proxy =
+ base::MakeRefCounted<storage::MockQuotaManagerProxy>(nullptr, nullptr);
service.set_quota_manager_proxy(mock_proxy.get());
service.storage()->UpdateUsageMapAndNotify(kOrigin, 0);
diff --git a/content/browser/appcache/chrome_appcache_service_unittest.cc b/content/browser/appcache/chrome_appcache_service_unittest.cc
index b7fedc19..dfd5644 100644
--- a/content/browser/appcache/chrome_appcache_service_unittest.cc
+++ b/content/browser/appcache/chrome_appcache_service_unittest.cc
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include <set>
#include <utility>
#include "base/bind.h"
@@ -25,8 +26,6 @@
#include "storage/browser/test/mock_special_storage_policy.h"
#include "testing/gtest/include/gtest/gtest.h"
-#include <set>
-
namespace content {
namespace {
const base::FilePath::CharType kTestingAppCacheDirname[] =
@@ -70,7 +69,7 @@
bool init_storage) {
auto appcache_service =
base::MakeRefCounted<ChromeAppCacheService>(nullptr, nullptr);
- auto mock_policy = base::MakeRefCounted<MockSpecialStoragePolicy>();
+ auto mock_policy = base::MakeRefCounted<storage::MockSpecialStoragePolicy>();
mock_policy->AddProtected(kProtectedManifestURL.GetOrigin());
mock_policy->AddSessionOnly(kSessionOnlyManifestURL.GetOrigin());
appcache_service->Initialize(appcache_path, &browser_context_,
diff --git a/content/browser/background_fetch/background_fetch_test_data_manager.cc b/content/browser/background_fetch/background_fetch_test_data_manager.cc
index 3e7126d..d86550b8 100644
--- a/content/browser/background_fetch/background_fetch_test_data_manager.cc
+++ b/content/browser/background_fetch/background_fetch_test_data_manager.cc
@@ -4,6 +4,8 @@
#include "content/browser/background_fetch/background_fetch_test_data_manager.h"
+#include <utility>
+
#include "base/run_loop.h"
#include "content/browser/blob_storage/chrome_blob_storage_context.h"
#include "content/browser/cache_storage/cache_storage_manager.h"
@@ -20,14 +22,15 @@
namespace {
-class MockBGFQuotaManagerProxy : public MockQuotaManagerProxy {
+class MockBGFQuotaManagerProxy : public storage::MockQuotaManagerProxy {
public:
- MockBGFQuotaManagerProxy(MockQuotaManager* quota_manager)
- : MockQuotaManagerProxy(quota_manager,
- base::ThreadTaskRunnerHandle::Get().get()) {}
+ explicit MockBGFQuotaManagerProxy(storage::MockQuotaManager* quota_manager)
+ : storage::MockQuotaManagerProxy(
+ quota_manager,
+ base::ThreadTaskRunnerHandle::Get().get()) {}
// Ignore quota client, it is irrelevant for these tests.
- void RegisterClient(scoped_refptr<QuotaClient> client) override {}
+ void RegisterClient(scoped_refptr<storage::QuotaClient> client) override {}
void GetUsageAndQuota(base::SequencedTaskRunner* original_task_runner,
const url::Origin& origin,
@@ -60,10 +63,10 @@
// Wait for ChromeBlobStorageContext to finish initializing.
base::RunLoop().RunUntilIdle();
- mock_quota_manager_ = base::MakeRefCounted<MockQuotaManager>(
+ mock_quota_manager_ = base::MakeRefCounted<storage::MockQuotaManager>(
storage_partition_->GetPath().empty(), storage_partition_->GetPath(),
base::ThreadTaskRunnerHandle::Get().get(),
- base::MakeRefCounted<MockSpecialStoragePolicy>());
+ base::MakeRefCounted<storage::MockSpecialStoragePolicy>());
quota_manager_proxy_ =
base::MakeRefCounted<MockBGFQuotaManagerProxy>(mock_quota_manager_.get());
diff --git a/content/browser/background_fetch/background_fetch_test_data_manager.h b/content/browser/background_fetch/background_fetch_test_data_manager.h
index 4663d8d..1e33624 100644
--- a/content/browser/background_fetch/background_fetch_test_data_manager.h
+++ b/content/browser/background_fetch/background_fetch_test_data_manager.h
@@ -12,12 +12,15 @@
#include "content/browser/background_fetch/background_fetch_request_info.h"
#include "url/origin.h"
+namespace storage {
+class MockQuotaManager;
+} // namespace storage
+
namespace content {
class BrowserContext;
class CacheStorageManager;
class ChromeBlobStorageContext;
-class MockQuotaManager;
class ServiceWorkerContextWrapper;
class StoragePartition;
@@ -41,7 +44,7 @@
private:
friend class BackgroundFetchDataManagerTest;
- scoped_refptr<MockQuotaManager> mock_quota_manager_;
+ scoped_refptr<storage::MockQuotaManager> mock_quota_manager_;
BrowserContext* browser_context_;
StoragePartition* storage_partition_;
scoped_refptr<ChromeBlobStorageContext> blob_storage_context_;
diff --git a/content/browser/blob_storage/blob_url_unittest.cc b/content/browser/blob_storage/blob_url_unittest.cc
index 6795097..0054056 100644
--- a/content/browser/blob_storage/blob_url_unittest.cc
+++ b/content/browser/blob_storage/blob_url_unittest.cc
@@ -111,8 +111,8 @@
void SetUpFileSystem() {
// Prepare file system.
- file_system_context_ =
- CreateFileSystemContextForTesting(nullptr, temp_dir_.GetPath());
+ file_system_context_ = storage::CreateFileSystemContextForTesting(
+ nullptr, temp_dir_.GetPath());
file_system_context_->OpenFileSystem(
url::Origin::Create(GURL(kFileSystemURLOrigin)), kFileSystemType,
@@ -149,12 +149,12 @@
base::FilePath().AppendASCII(filename));
ASSERT_EQ(base::File::FILE_OK,
- content::AsyncFileTestHelper::CreateFileWithData(
+ storage::AsyncFileTestHelper::CreateFileWithData(
file_system_context_.get(), url, buf, buf_size));
base::File::Info file_info;
ASSERT_EQ(base::File::FILE_OK,
- content::AsyncFileTestHelper::GetMetadata(
+ storage::AsyncFileTestHelper::GetMetadata(
file_system_context_.get(), url, &file_info));
if (modification_time)
*modification_time = file_info.last_modified;
diff --git a/content/browser/browsing_data/browsing_data_remover_impl_unittest.cc b/content/browser/browsing_data/browsing_data_remover_impl_unittest.cc
index b82e6d0..9a872ed 100644
--- a/content/browser/browsing_data/browsing_data_remover_impl_unittest.cc
+++ b/content/browser/browsing_data/browsing_data_remover_impl_unittest.cc
@@ -412,12 +412,14 @@
return storage_partition_removal_data_;
}
- MockSpecialStoragePolicy* CreateMockPolicy() {
- mock_policy_ = new MockSpecialStoragePolicy();
+ storage::MockSpecialStoragePolicy* CreateMockPolicy() {
+ mock_policy_ = base::MakeRefCounted<storage::MockSpecialStoragePolicy>();
return mock_policy_.get();
}
- MockSpecialStoragePolicy* mock_policy() { return mock_policy_.get(); }
+ storage::MockSpecialStoragePolicy* mock_policy() {
+ return mock_policy_.get();
+ }
bool Match(const GURL& origin,
int mask,
@@ -435,7 +437,7 @@
StoragePartitionRemovalData storage_partition_removal_data_;
- scoped_refptr<MockSpecialStoragePolicy> mock_policy_;
+ scoped_refptr<storage::MockSpecialStoragePolicy> mock_policy_;
DISALLOW_COPY_AND_ASSIGN(BrowsingDataRemoverImplTest);
};
@@ -519,7 +521,7 @@
}
TEST_F(BrowsingDataRemoverImplTest, RemoveUnprotectedLocalStorageForever) {
- MockSpecialStoragePolicy* policy = CreateMockPolicy();
+ storage::MockSpecialStoragePolicy* policy = CreateMockPolicy();
// Protect Origin1().
policy->AddProtected(Origin1().GetURL());
@@ -548,7 +550,7 @@
TEST_F(BrowsingDataRemoverImplTest, RemoveProtectedLocalStorageForever) {
// Protect Origin1().
- MockSpecialStoragePolicy* policy = CreateMockPolicy();
+ storage::MockSpecialStoragePolicy* policy = CreateMockPolicy();
policy->AddProtected(Origin1().GetURL());
BlockUntilBrowsingDataRemoved(base::Time(), base::Time::Max(),
@@ -921,7 +923,7 @@
}
TEST_F(BrowsingDataRemoverImplTest, RemoveQuotaManagedUnprotectedOrigins) {
- MockSpecialStoragePolicy* policy = CreateMockPolicy();
+ storage::MockSpecialStoragePolicy* policy = CreateMockPolicy();
// Protect Origin1().
policy->AddProtected(Origin1().GetURL());
@@ -965,7 +967,7 @@
}
TEST_F(BrowsingDataRemoverImplTest, RemoveQuotaManagedProtectedSpecificOrigin) {
- MockSpecialStoragePolicy* policy = CreateMockPolicy();
+ storage::MockSpecialStoragePolicy* policy = CreateMockPolicy();
// Protect Origin1().
policy->AddProtected(Origin1().GetURL());
@@ -1016,7 +1018,7 @@
}
TEST_F(BrowsingDataRemoverImplTest, RemoveQuotaManagedProtectedOrigins) {
- MockSpecialStoragePolicy* policy = CreateMockPolicy();
+ storage::MockSpecialStoragePolicy* policy = CreateMockPolicy();
// Protect Origin1().
policy->AddProtected(Origin1().GetURL());
@@ -1267,7 +1269,6 @@
Target* target_b() { return &target_b_; }
private:
-
Target target_a_;
Target target_b_;
std::vector<BrowsingDataRemover::Observer*> last_called_targets_;
diff --git a/content/browser/browsing_data/same_site_data_remover_impl_unittest.cc b/content/browser/browsing_data/same_site_data_remover_impl_unittest.cc
index 392e628..fb61c18 100644
--- a/content/browser/browsing_data/same_site_data_remover_impl_unittest.cc
+++ b/content/browser/browsing_data/same_site_data_remover_impl_unittest.cc
@@ -275,8 +275,8 @@
EXPECT_EQ(removal_data.quota_storage_removal_mask,
expected_quota_storage_mask);
- scoped_refptr<MockSpecialStoragePolicy> special_storage_policy =
- new MockSpecialStoragePolicy;
+ auto special_storage_policy =
+ base::MakeRefCounted<storage::MockSpecialStoragePolicy>();
EXPECT_TRUE(removal_data.origin_matcher.Run(
url::Origin::Create(GURL("http://www.google.com/test")),
special_storage_policy.get()));
diff --git a/content/browser/cache_storage/cache_storage_blob_to_disk_cache_unittest.cc b/content/browser/cache_storage/cache_storage_blob_to_disk_cache_unittest.cc
index 4055db4..52f1d7b 100644
--- a/content/browser/cache_storage/cache_storage_blob_to_disk_cache_unittest.cc
+++ b/content/browser/cache_storage/cache_storage_blob_to_disk_cache_unittest.cc
@@ -44,7 +44,7 @@
class TestCacheStorageBlobToDiskCache : public CacheStorageBlobToDiskCache {
public:
explicit TestCacheStorageBlobToDiskCache(
- scoped_refptr<QuotaManagerProxy> quota_manager_proxy)
+ scoped_refptr<storage::QuotaManagerProxy> quota_manager_proxy)
: CacheStorageBlobToDiskCache(quota_manager_proxy, url::Origin()) {}
~TestCacheStorageBlobToDiskCache() override = default;
@@ -132,11 +132,11 @@
void InitQuotaManager() {
EXPECT_TRUE(base_.CreateUniqueTempDir());
base::FilePath base_dir = base_.GetPath().AppendASCII("filesystem");
- quota_manager_ = base::MakeRefCounted<MockQuotaManager>(
+ quota_manager_ = base::MakeRefCounted<storage::MockQuotaManager>(
false /* is_incognito */, base_dir,
base::ThreadTaskRunnerHandle::Get().get(),
nullptr /* special storage policy */);
- quota_manager_proxy_ = base::MakeRefCounted<MockQuotaManagerProxy>(
+ quota_manager_proxy_ = base::MakeRefCounted<storage::MockQuotaManagerProxy>(
quota_manager(), base::ThreadTaskRunnerHandle::Get().get());
}
@@ -175,12 +175,13 @@
callback_called_ = true;
}
- MockQuotaManager* quota_manager() {
- return static_cast<MockQuotaManager*>(quota_manager_.get());
+ storage::MockQuotaManager* quota_manager() {
+ return static_cast<storage::MockQuotaManager*>(quota_manager_.get());
}
- MockQuotaManagerProxy* quota_manager_proxy() {
- return static_cast<MockQuotaManagerProxy*>(quota_manager_proxy_.get());
+ storage::MockQuotaManagerProxy* quota_manager_proxy() {
+ return static_cast<storage::MockQuotaManagerProxy*>(
+ quota_manager_proxy_.get());
}
BrowserTaskEnvironment task_environment_;
diff --git a/content/browser/cache_storage/cache_storage_cache_unittest.cc b/content/browser/cache_storage/cache_storage_cache_unittest.cc
index 3d8e2f0..e974365 100644
--- a/content/browser/cache_storage/cache_storage_cache_unittest.cc
+++ b/content/browser/cache_storage/cache_storage_cache_unittest.cc
@@ -582,14 +582,14 @@
temp_dir_path_ = temp_dir_.GetPath();
}
- quota_policy_ = new MockSpecialStoragePolicy;
- mock_quota_manager_ = new MockQuotaManager(
+ quota_policy_ = base::MakeRefCounted<storage::MockSpecialStoragePolicy>();
+ mock_quota_manager_ = base::MakeRefCounted<storage::MockQuotaManager>(
is_incognito, temp_dir_path_, base::ThreadTaskRunnerHandle::Get().get(),
quota_policy_.get());
mock_quota_manager_->SetQuota(
Origin(), blink::mojom::StorageType::kTemporary, 1024 * 1024 * 100);
- quota_manager_proxy_ = new MockQuotaManagerProxy(
+ quota_manager_proxy_ = base::MakeRefCounted<storage::MockQuotaManagerProxy>(
mock_quota_manager_.get(), base::ThreadTaskRunnerHandle::Get().get());
CreateRequests(blob_storage_context);
@@ -983,9 +983,9 @@
base::ScopedTempDir temp_dir_;
BrowserTaskEnvironment task_environment_;
TestBrowserContext browser_context_;
- scoped_refptr<MockSpecialStoragePolicy> quota_policy_;
- scoped_refptr<MockQuotaManager> mock_quota_manager_;
- scoped_refptr<MockQuotaManagerProxy> quota_manager_proxy_;
+ scoped_refptr<storage::MockSpecialStoragePolicy> quota_policy_;
+ scoped_refptr<storage::MockQuotaManager> mock_quota_manager_;
+ scoped_refptr<storage::MockQuotaManagerProxy> quota_manager_proxy_;
scoped_refptr<BlobStorageContextWrapper> blob_storage_context_;
std::unique_ptr<MockLegacyCacheStorage> mock_cache_storage_;
diff --git a/content/browser/cache_storage/cache_storage_manager_unittest.cc b/content/browser/cache_storage/cache_storage_manager_unittest.cc
index 966d6fda..485b989f 100644
--- a/content/browser/cache_storage/cache_storage_manager_unittest.cc
+++ b/content/browser/cache_storage/cache_storage_manager_unittest.cc
@@ -18,6 +18,7 @@
#include "base/guid.h"
#include "base/macros.h"
#include "base/memory/ptr_util.h"
+#include "base/memory/scoped_refptr.h"
#include "base/run_loop.h"
#include "base/stl_util.h"
#include "base/strings/string_number_conversions.h"
@@ -169,13 +170,14 @@
base::OnceClosure callback_;
};
-class MockCacheStorageQuotaManagerProxy : public MockQuotaManagerProxy {
+class MockCacheStorageQuotaManagerProxy
+ : public storage::MockQuotaManagerProxy {
public:
- MockCacheStorageQuotaManagerProxy(MockQuotaManager* quota_manager,
+ MockCacheStorageQuotaManagerProxy(storage::MockQuotaManager* quota_manager,
base::SingleThreadTaskRunner* task_runner)
: MockQuotaManagerProxy(quota_manager, task_runner) {}
- void RegisterClient(scoped_refptr<QuotaClient> client) override {
+ void RegisterClient(scoped_refptr<storage::QuotaClient> client) override {
registered_clients_.push_back(std::move(client));
}
@@ -191,7 +193,7 @@
DCHECK(registered_clients_.empty());
}
- std::vector<scoped_refptr<QuotaClient>> registered_clients_;
+ std::vector<scoped_refptr<storage::QuotaClient>> registered_clients_;
};
bool IsIndexFileCurrent(const base::FilePath& cache_dir) {
@@ -371,8 +373,8 @@
if (!MemoryOnly())
temp_dir_path = temp_dir_.GetPath();
- quota_policy_ = new MockSpecialStoragePolicy;
- mock_quota_manager_ = new MockQuotaManager(
+ quota_policy_ = base::MakeRefCounted<storage::MockSpecialStoragePolicy>();
+ mock_quota_manager_ = base::MakeRefCounted<storage::MockQuotaManager>(
MemoryOnly(), temp_dir_path, base::ThreadTaskRunnerHandle::Get().get(),
quota_policy_.get());
mock_quota_manager_->SetQuota(origin1_, StorageType::kTemporary,
@@ -380,8 +382,10 @@
mock_quota_manager_->SetQuota(origin2_, StorageType::kTemporary,
1024 * 1024 * 100);
- quota_manager_proxy_ = new MockCacheStorageQuotaManagerProxy(
- mock_quota_manager_.get(), base::ThreadTaskRunnerHandle::Get().get());
+ quota_manager_proxy_ =
+ base::MakeRefCounted<MockCacheStorageQuotaManagerProxy>(
+ mock_quota_manager_.get(),
+ base::ThreadTaskRunnerHandle::Get().get());
auto legacy_manager = LegacyCacheStorageManager::Create(
temp_dir_path, base::ThreadTaskRunnerHandle::Get(),
@@ -808,8 +812,8 @@
TestBrowserContext browser_context_;
scoped_refptr<BlobStorageContextWrapper> blob_storage_context_;
- scoped_refptr<MockSpecialStoragePolicy> quota_policy_;
- scoped_refptr<MockQuotaManager> mock_quota_manager_;
+ scoped_refptr<storage::MockSpecialStoragePolicy> quota_policy_;
+ scoped_refptr<storage::MockQuotaManager> mock_quota_manager_;
scoped_refptr<MockCacheStorageQuotaManagerProxy> quota_manager_proxy_;
scoped_refptr<CacheStorageContextImpl::ObserverList> observers_;
scoped_refptr<CacheStorageManager> cache_manager_;
diff --git a/content/browser/dom_storage/dom_storage_context_wrapper_unittest.cc b/content/browser/dom_storage/dom_storage_context_wrapper_unittest.cc
index ac8fae6..cbb34d56 100644
--- a/content/browser/dom_storage/dom_storage_context_wrapper_unittest.cc
+++ b/content/browser/dom_storage/dom_storage_context_wrapper_unittest.cc
@@ -4,6 +4,8 @@
#include "content/browser/dom_storage/dom_storage_context_wrapper.h"
+#include <utility>
+
#include "base/bind.h"
#include "base/macros.h"
#include "base/memory/ptr_util.h"
@@ -27,7 +29,7 @@
DOMStorageContextWrapperTest() = default;
void SetUp() override {
- storage_policy_ = new MockSpecialStoragePolicy();
+ storage_policy_ = base::MakeRefCounted<storage::MockSpecialStoragePolicy>();
fake_mojo_task_runner_ = base::MakeRefCounted<base::TestSimpleTaskRunner>();
auto* session_storage_context = new SessionStorageContextMojo(
/*partition_path=*/base::FilePath(),
@@ -53,7 +55,7 @@
protected:
base::test::TaskEnvironment task_environment_;
scoped_refptr<base::TestSimpleTaskRunner> fake_mojo_task_runner_;
- scoped_refptr<MockSpecialStoragePolicy> storage_policy_;
+ scoped_refptr<storage::MockSpecialStoragePolicy> storage_policy_;
scoped_refptr<DOMStorageContextWrapper> context_;
DISALLOW_COPY_AND_ASSIGN(DOMStorageContextWrapperTest);
diff --git a/content/browser/file_system/file_system_operation_runner_unittest.cc b/content/browser/file_system/file_system_operation_runner_unittest.cc
index 30a160f..37d69c21 100644
--- a/content/browser/file_system/file_system_operation_runner_unittest.cc
+++ b/content/browser/file_system/file_system_operation_runner_unittest.cc
@@ -8,6 +8,7 @@
#include "base/files/file_path.h"
#include "base/files/scoped_temp_dir.h"
#include "base/macros.h"
+#include "base/memory/scoped_refptr.h"
#include "base/run_loop.h"
#include "base/task/post_task.h"
#include "base/task/task_traits.h"
@@ -66,7 +67,8 @@
void SetUp() override {
ASSERT_TRUE(base_.CreateUniqueTempDir());
base::FilePath base_dir = base_.GetPath();
- file_system_context_ = CreateFileSystemContextForTesting(nullptr, base_dir);
+ file_system_context_ =
+ storage::CreateFileSystemContextForTesting(nullptr, base_dir);
}
void TearDown() override {
@@ -188,15 +190,15 @@
ASSERT_TRUE(base_.CreateUniqueTempDir());
base::FilePath base_dir = base_.GetPath();
- file_system_context_ = new FileSystemContext(
+ file_system_context_ = base::MakeRefCounted<FileSystemContext>(
base::ThreadTaskRunnerHandle::Get().get(),
base::CreateSequencedTaskRunner({base::ThreadPool(), base::MayBlock()})
.get(),
storage::ExternalMountPoints::CreateRefCounted().get(),
- base::MakeRefCounted<MockSpecialStoragePolicy>().get(), nullptr,
- std::vector<std::unique_ptr<storage::FileSystemBackend>>(),
+ base::MakeRefCounted<storage::MockSpecialStoragePolicy>().get(),
+ nullptr, std::vector<std::unique_ptr<storage::FileSystemBackend>>(),
std::vector<storage::URLRequestAutoMountHandler>(), base_dir,
- CreateAllowFileAccessOptions());
+ storage::CreateAllowFileAccessOptions());
// Disallow IO on the main loop.
base::ThreadRestrictions::SetIOAllowed(false);
diff --git a/content/browser/file_system/file_system_url_loader_factory_browsertest.cc b/content/browser/file_system/file_system_url_loader_factory_browsertest.cc
index 11ff277..2f3db525 100644
--- a/content/browser/file_system/file_system_url_loader_factory_browsertest.cc
+++ b/content/browser/file_system/file_system_url_loader_factory_browsertest.cc
@@ -49,8 +49,8 @@
#include "url/origin.h"
using base::BindLambdaForTesting;
-using content::AsyncFileTestHelper;
using network::mojom::URLLoaderFactory;
+using storage::AsyncFileTestHelper;
using storage::FileSystemContext;
using storage::FileSystemOperationContext;
using storage::FileSystemURL;
@@ -171,7 +171,8 @@
blocking_task_runner_ =
base::CreateSequencedTaskRunner({base::ThreadPool(), base::MayBlock()});
- special_storage_policy_ = new MockSpecialStoragePolicy;
+ special_storage_policy_ =
+ base::MakeRefCounted<storage::MockSpecialStoragePolicy>();
// Support multiple sites on the test server.
host_resolver()->AddRule("*", "127.0.0.1");
@@ -223,8 +224,9 @@
std::vector<std::unique_ptr<storage::FileSystemBackend>>
additional_providers;
- additional_providers.push_back(std::make_unique<TestFileSystemBackend>(
- base::ThreadTaskRunnerHandle::Get().get(), mnt_point));
+ additional_providers.push_back(
+ std::make_unique<storage::TestFileSystemBackend>(
+ base::ThreadTaskRunnerHandle::Get().get(), mnt_point));
std::vector<storage::URLRequestAutoMountHandler> handlers = {
base::BindRepeating(&TestAutoMountForURLRequest)};
@@ -424,8 +426,9 @@
const base::FilePath& base_path) {
std::vector<std::unique_ptr<storage::FileSystemBackend>>
additional_providers;
- additional_providers.push_back(std::make_unique<TestFileSystemBackend>(
- blocking_task_runner_.get(), base_path));
+ additional_providers.push_back(
+ std::make_unique<storage::TestFileSystemBackend>(
+ blocking_task_runner_.get(), base_path));
if (IsIncognito()) {
return CreateIncognitoFileSystemContextWithAdditionalProvidersForTesting(
io_task_runner_, blocking_task_runner_, quota_manager_proxy,
@@ -473,7 +476,7 @@
return client;
}
- scoped_refptr<MockSpecialStoragePolicy> special_storage_policy_;
+ scoped_refptr<storage::MockSpecialStoragePolicy> special_storage_policy_;
scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_;
scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_;
scoped_refptr<FileSystemContext> file_system_context_;
@@ -573,9 +576,9 @@
CreateDirectory("foo");
scoped_refptr<FileSystemContext> file_system_context =
- CreateIncognitoFileSystemContextForTesting(io_task_runner(),
- blocking_task_runner(),
- nullptr, temp_dir_.GetPath());
+ storage::CreateIncognitoFileSystemContextForTesting(
+ io_task_runner(), blocking_task_runner(), nullptr,
+ temp_dir_.GetPath());
auto client =
TestLoadWithContext(CreateFileSystemURL("/"), file_system_context.get());
@@ -852,9 +855,9 @@
// Creates a new filesystem context for incognito mode.
scoped_refptr<FileSystemContext> file_system_context =
- CreateIncognitoFileSystemContextForTesting(io_task_runner(),
- blocking_task_runner(),
- nullptr, temp_dir_.GetPath());
+ storage::CreateIncognitoFileSystemContextForTesting(
+ io_task_runner(), blocking_task_runner(), nullptr,
+ temp_dir_.GetPath());
// The request should return NOT_FOUND error if it's in incognito mode.
auto client = TestLoadWithContext(CreateFileSystemURL("file"),
diff --git a/content/browser/indexed_db/indexed_db_backing_store_unittest.cc b/content/browser/indexed_db/indexed_db_backing_store_unittest.cc
index dee49b2..6c10094e 100644
--- a/content/browser/indexed_db/indexed_db_backing_store_unittest.cc
+++ b/content/browser/indexed_db/indexed_db_backing_store_unittest.cc
@@ -6,6 +6,8 @@
#include <stddef.h>
#include <stdint.h>
+
+#include <string>
#include <utility>
#include "base/barrier_closure.h"
@@ -218,9 +220,10 @@
public:
IndexedDBBackingStoreTest()
: special_storage_policy_(
- base::MakeRefCounted<MockSpecialStoragePolicy>()),
+ base::MakeRefCounted<storage::MockSpecialStoragePolicy>()),
quota_manager_proxy_(
- base::MakeRefCounted<MockQuotaManagerProxy>(nullptr, nullptr)) {}
+ base::MakeRefCounted<storage::MockQuotaManagerProxy>(nullptr,
+ nullptr)) {}
void SetUp() override {
special_storage_policy_->SetAllUnlimited(true);
@@ -351,8 +354,8 @@
base::ScopedTempDir temp_dir_;
std::unique_ptr<MockBlobStorageContext> blob_context_;
- scoped_refptr<MockSpecialStoragePolicy> special_storage_policy_;
- scoped_refptr<MockQuotaManagerProxy> quota_manager_proxy_;
+ scoped_refptr<storage::MockSpecialStoragePolicy> special_storage_policy_;
+ scoped_refptr<storage::MockQuotaManagerProxy> quota_manager_proxy_;
scoped_refptr<IndexedDBContextImpl> idb_context_;
std::unique_ptr<TestIDBFactory> idb_factory_;
DisjointRangeLockManager* lock_manager_;
@@ -371,9 +374,6 @@
DISALLOW_COPY_AND_ASSIGN(IndexedDBBackingStoreTest);
};
-const static std::string kBlobFileData1 = "asdfgasdf";
-const static std::string kBlobFileData2 = "aaaaaa";
-
class IndexedDBBackingStoreTestWithBlobs : public IndexedDBBackingStoreTest {
public:
IndexedDBBackingStoreTestWithBlobs() = default;
@@ -544,6 +544,10 @@
IndexedDBKey key3_;
IndexedDBValue value3_;
+ protected:
+ const std::string kBlobFileData1 = "asdfgasdf";
+ const std::string kBlobFileData2 = "aaaaaa";
+
private:
// Blob details referenced by |value3_|. The various CheckBlob*() methods
// can be used to verify the state as a test progresses.
diff --git a/content/browser/indexed_db/indexed_db_dispatcher_host_unittest.cc b/content/browser/indexed_db/indexed_db_dispatcher_host_unittest.cc
index 5a67595..3da8b4f 100644
--- a/content/browser/indexed_db/indexed_db_dispatcher_host_unittest.cc
+++ b/content/browser/indexed_db/indexed_db_dispatcher_host_unittest.cc
@@ -169,8 +169,8 @@
IndexedDBDispatcherHostTest()
: task_environment_(BrowserTaskEnvironment::IO_MAINLOOP),
special_storage_policy_(
- base::MakeRefCounted<MockSpecialStoragePolicy>()),
- quota_manager_(base::MakeRefCounted<MockQuotaManager>(
+ base::MakeRefCounted<storage::MockSpecialStoragePolicy>()),
+ quota_manager_(base::MakeRefCounted<storage::MockQuotaManager>(
false /*is_incognito*/,
browser_context_.GetPath(),
base::CreateSingleThreadTaskRunner({BrowserThread::IO}),
@@ -227,8 +227,8 @@
TestBrowserContext browser_context_;
base::ScopedTempDir temp_dir_;
- scoped_refptr<MockSpecialStoragePolicy> special_storage_policy_;
- scoped_refptr<MockQuotaManager> quota_manager_;
+ scoped_refptr<storage::MockSpecialStoragePolicy> special_storage_policy_;
+ scoped_refptr<storage::MockQuotaManager> quota_manager_;
scoped_refptr<IndexedDBContextImpl> context_impl_;
std::unique_ptr<IndexedDBDispatcherHost, base::OnTaskRunnerDeleter> host_;
mojo::Remote<blink::mojom::IDBFactory> idb_mojo_factory_;
diff --git a/content/browser/indexed_db/indexed_db_factory_unittest.cc b/content/browser/indexed_db/indexed_db_factory_unittest.cc
index 57e8d4672..c264b269 100644
--- a/content/browser/indexed_db/indexed_db_factory_unittest.cc
+++ b/content/browser/indexed_db/indexed_db_factory_unittest.cc
@@ -68,13 +68,15 @@
IndexedDBFactoryTest()
: task_environment_(std::make_unique<BrowserTaskEnvironment>()),
quota_manager_proxy_(
- base::MakeRefCounted<MockQuotaManagerProxy>(nullptr, nullptr)) {}
+ base::MakeRefCounted<storage::MockQuotaManagerProxy>(nullptr,
+ nullptr)) {}
explicit IndexedDBFactoryTest(
std::unique_ptr<BrowserTaskEnvironment> task_environment)
: task_environment_(std::move(task_environment)),
quota_manager_proxy_(
- base::MakeRefCounted<MockQuotaManagerProxy>(nullptr, nullptr)) {}
+ base::MakeRefCounted<storage::MockQuotaManagerProxy>(nullptr,
+ nullptr)) {}
void TearDown() override {
quota_manager_proxy_->SimulateQuotaManagerDestroyed();
@@ -223,7 +225,7 @@
std::unique_ptr<BrowserTaskEnvironment> task_environment_;
base::ScopedTempDir temp_dir_;
- scoped_refptr<MockQuotaManagerProxy> quota_manager_proxy_;
+ scoped_refptr<storage::MockQuotaManagerProxy> quota_manager_proxy_;
scoped_refptr<IndexedDBContextImpl> context_;
DISALLOW_COPY_AND_ASSIGN(IndexedDBFactoryTest);
diff --git a/content/browser/indexed_db/indexed_db_quota_client_unittest.cc b/content/browser/indexed_db/indexed_db_quota_client_unittest.cc
index fe11ba0..905dfa99 100644
--- a/content/browser/indexed_db/indexed_db_quota_client_unittest.cc
+++ b/content/browser/indexed_db/indexed_db_quota_client_unittest.cc
@@ -13,6 +13,7 @@
#include "base/files/file_util.h"
#include "base/files/scoped_temp_dir.h"
#include "base/macros.h"
+#include "base/memory/scoped_refptr.h"
#include "base/run_loop.h"
#include "base/test/bind_test_util.h"
#include "base/threading/sequenced_task_runner_handle.h"
@@ -51,12 +52,12 @@
usage_(0) {
browser_context_.reset(new TestBrowserContext());
- scoped_refptr<storage::QuotaManager> quota_manager =
- new MockQuotaManager(false /*in_memory*/, browser_context_->GetPath(),
- base::ThreadTaskRunnerHandle::Get(),
- browser_context_->GetSpecialStoragePolicy());
+ auto quota_manager = base::MakeRefCounted<storage::MockQuotaManager>(
+ /*in_memory=*/false, browser_context_->GetPath(),
+ base::ThreadTaskRunnerHandle::Get(),
+ browser_context_->GetSpecialStoragePolicy());
- idb_context_ = new IndexedDBContextImpl(
+ idb_context_ = base::MakeRefCounted<IndexedDBContextImpl>(
browser_context_->GetPath(),
browser_context_->GetSpecialStoragePolicy(), quota_manager->proxy(),
base::DefaultClock::GetInstance(),
diff --git a/content/browser/indexed_db/indexed_db_unittest.cc b/content/browser/indexed_db/indexed_db_unittest.cc
index 0d8aa4d..9af4488 100644
--- a/content/browser/indexed_db/indexed_db_unittest.cc
+++ b/content/browser/indexed_db/indexed_db_unittest.cc
@@ -90,9 +90,10 @@
: kNormalOrigin(url::Origin::Create(GURL("http://normal/"))),
kSessionOnlyOrigin(url::Origin::Create(GURL("http://session-only/"))),
special_storage_policy_(
- base::MakeRefCounted<MockSpecialStoragePolicy>()),
+ base::MakeRefCounted<storage::MockSpecialStoragePolicy>()),
quota_manager_proxy_(
- base::MakeRefCounted<MockQuotaManagerProxy>(nullptr, nullptr)),
+ base::MakeRefCounted<storage::MockQuotaManagerProxy>(nullptr,
+ nullptr)),
context_(base::MakeRefCounted<IndexedDBContextImpl>(
CreateAndReturnTempDir(&temp_dir_),
/*special_storage_policy=*/special_storage_policy_.get(),
@@ -155,8 +156,8 @@
protected:
IndexedDBContextImpl* context() const { return context_.get(); }
- scoped_refptr<MockSpecialStoragePolicy> special_storage_policy_;
- scoped_refptr<MockQuotaManagerProxy> quota_manager_proxy_;
+ scoped_refptr<storage::MockSpecialStoragePolicy> special_storage_policy_;
+ scoped_refptr<storage::MockQuotaManagerProxy> quota_manager_proxy_;
private:
BrowserTaskEnvironment task_environment_;
diff --git a/content/browser/native_file_system/native_file_system_file_handle_impl_unittest.cc b/content/browser/native_file_system/native_file_system_file_handle_impl_unittest.cc
index cafe75a8..b1901a6 100644
--- a/content/browser/native_file_system/native_file_system_file_handle_impl_unittest.cc
+++ b/content/browser/native_file_system/native_file_system_file_handle_impl_unittest.cc
@@ -5,6 +5,11 @@
#include "content/browser/native_file_system/native_file_system_file_handle_impl.h"
#include <limits>
+#include <memory>
+#include <string>
+#include <utility>
+#include <vector>
+
#include "base/bind.h"
#include "base/files/scoped_temp_dir.h"
#include "base/run_loop.h"
@@ -43,7 +48,7 @@
void SetUp() override {
ASSERT_TRUE(dir_.CreateUniqueTempDir());
- file_system_context_ = CreateFileSystemContextForTesting(
+ file_system_context_ = storage::CreateFileSystemContextForTesting(
/*quota_manager_proxy=*/nullptr, dir_.GetPath());
test_file_url_ = file_system_context_->CreateCrackedFileSystemURL(
@@ -51,8 +56,8 @@
base::FilePath::FromUTF8Unsafe("test"));
ASSERT_EQ(base::File::FILE_OK,
- AsyncFileTestHelper::CreateFile(file_system_context_.get(),
- test_file_url_));
+ storage::AsyncFileTestHelper::CreateFile(
+ file_system_context_.get(), test_file_url_));
chrome_blob_context_ = base::MakeRefCounted<ChromeBlobStorageContext>();
chrome_blob_context_->InitializeOnIOThread(base::FilePath(),
diff --git a/content/browser/native_file_system/native_file_system_file_writer_impl_unittest.cc b/content/browser/native_file_system/native_file_system_file_writer_impl_unittest.cc
index 44cc5121..f48b214 100644
--- a/content/browser/native_file_system/native_file_system_file_writer_impl_unittest.cc
+++ b/content/browser/native_file_system/native_file_system_file_writer_impl_unittest.cc
@@ -5,6 +5,10 @@
#include "content/browser/native_file_system/native_file_system_file_writer_impl.h"
#include <limits>
+#include <memory>
+#include <string>
+#include <utility>
+
#include "base/bind.h"
#include "base/bind_helpers.h"
#include "base/files/scoped_temp_dir.h"
@@ -60,7 +64,7 @@
void SetUp() override {
ASSERT_TRUE(dir_.CreateUniqueTempDir());
- file_system_context_ = CreateFileSystemContextForTesting(
+ file_system_context_ = storage::CreateFileSystemContextForTesting(
/*quota_manager_proxy=*/nullptr, dir_.GetPath());
auto* isolated_context = IsolatedContext::GetInstance();
@@ -81,12 +85,12 @@
root_path.AppendASCII("test.crswap"));
ASSERT_EQ(base::File::FILE_OK,
- AsyncFileTestHelper::CreateFile(file_system_context_.get(),
- test_file_url_));
+ storage::AsyncFileTestHelper::CreateFile(
+ file_system_context_.get(), test_file_url_));
ASSERT_EQ(base::File::FILE_OK,
- AsyncFileTestHelper::CreateFile(file_system_context_.get(),
- test_swap_url_));
+ storage::AsyncFileTestHelper::CreateFile(
+ file_system_context_.get(), test_swap_url_));
chrome_blob_context_ = base::MakeRefCounted<ChromeBlobStorageContext>();
chrome_blob_context_->InitializeOnIOThread(base::FilePath(),
@@ -336,10 +340,9 @@
}
TEST_F(NativeFileSystemFileWriterImplTest, HashNonExistingFileFails) {
- ASSERT_EQ(base::File::FILE_OK,
- AsyncFileTestHelper::Remove(file_system_context_.get(),
- handle_->swap_url(),
- /*recursive=*/false));
+ ASSERT_EQ(base::File::FILE_OK, storage::AsyncFileTestHelper::Remove(
+ file_system_context_.get(),
+ handle_->swap_url(), /*recursive=*/false));
base::RunLoop loop;
handle_->ComputeHashForSwapFileForTesting(base::BindLambdaForTesting(
[&](base::File::Error result, const std::string& hash_value,
@@ -548,11 +551,11 @@
EXPECT_EQ(result, NativeFileSystemStatus::kOk);
task_environment_.RunUntilIdle();
- EXPECT_FALSE(AsyncFileTestHelper::FileExists(
+ EXPECT_FALSE(storage::AsyncFileTestHelper::FileExists(
file_system_context_.get(), test_swap_url_,
- AsyncFileTestHelper::kDontCheckSize));
- EXPECT_TRUE(AsyncFileTestHelper::FileExists(file_system_context_.get(),
- test_file_url_, 3));
+ storage::AsyncFileTestHelper::kDontCheckSize));
+ EXPECT_TRUE(storage::AsyncFileTestHelper::FileExists(
+ file_system_context_.get(), test_file_url_, 3));
}
TEST_F(NativeFileSystemFileWriterAfterWriteChecksTest, Block) {
@@ -570,11 +573,11 @@
EXPECT_EQ(result, NativeFileSystemStatus::kOperationAborted);
task_environment_.RunUntilIdle();
- EXPECT_FALSE(AsyncFileTestHelper::FileExists(
+ EXPECT_FALSE(storage::AsyncFileTestHelper::FileExists(
file_system_context_.get(), test_swap_url_,
- AsyncFileTestHelper::kDontCheckSize));
- EXPECT_TRUE(AsyncFileTestHelper::FileExists(file_system_context_.get(),
- test_file_url_, 0));
+ storage::AsyncFileTestHelper::kDontCheckSize));
+ EXPECT_TRUE(storage::AsyncFileTestHelper::FileExists(
+ file_system_context_.get(), test_file_url_, 0));
}
TEST_F(NativeFileSystemFileWriterAfterWriteChecksTest, HandleCloseDuringCheck) {
@@ -602,20 +605,20 @@
// Destructor should not have deleted swap file with an active safe browsing
// check pending.
task_environment_.RunUntilIdle();
- EXPECT_TRUE(AsyncFileTestHelper::FileExists(
+ EXPECT_TRUE(storage::AsyncFileTestHelper::FileExists(
file_system_context_.get(), test_swap_url_,
- AsyncFileTestHelper::kDontCheckSize));
+ storage::AsyncFileTestHelper::kDontCheckSize));
std::move(sb_callback)
.Run(NativeFileSystemPermissionContext::AfterWriteCheckResult::kAllow);
// Swap file should now be deleted, target file should be unmodified.
task_environment_.RunUntilIdle();
- EXPECT_FALSE(AsyncFileTestHelper::FileExists(
+ EXPECT_FALSE(storage::AsyncFileTestHelper::FileExists(
file_system_context_.get(), test_swap_url_,
- AsyncFileTestHelper::kDontCheckSize));
- EXPECT_TRUE(AsyncFileTestHelper::FileExists(file_system_context_.get(),
- test_file_url_, 0));
+ storage::AsyncFileTestHelper::kDontCheckSize));
+ EXPECT_TRUE(storage::AsyncFileTestHelper::FileExists(
+ file_system_context_.get(), test_file_url_, 0));
}
} // namespace content
diff --git a/content/browser/native_file_system/native_file_system_handle_base_unittest.cc b/content/browser/native_file_system/native_file_system_handle_base_unittest.cc
index 2012c2e..f5f15a72 100644
--- a/content/browser/native_file_system/native_file_system_handle_base_unittest.cc
+++ b/content/browser/native_file_system/native_file_system_handle_base_unittest.cc
@@ -51,7 +51,7 @@
void SetUp() override {
ASSERT_TRUE(dir_.CreateUniqueTempDir());
- file_system_context_ = CreateFileSystemContextForTesting(
+ file_system_context_ = storage::CreateFileSystemContextForTesting(
/*quota_manager_proxy=*/nullptr, dir_.GetPath());
chrome_blob_context_ = base::MakeRefCounted<ChromeBlobStorageContext>();
diff --git a/content/browser/native_file_system/native_file_system_manager_impl_unittest.cc b/content/browser/native_file_system/native_file_system_manager_impl_unittest.cc
index 8cec81d..a4a2062 100644
--- a/content/browser/native_file_system/native_file_system_manager_impl_unittest.cc
+++ b/content/browser/native_file_system/native_file_system_manager_impl_unittest.cc
@@ -4,6 +4,10 @@
#include "content/browser/native_file_system/native_file_system_manager_impl.h"
+#include <string>
+#include <utility>
+#include <vector>
+
#include "base/files/file_util.h"
#include "base/files/scoped_temp_dir.h"
#include "base/run_loop.h"
@@ -29,7 +33,6 @@
using base::test::RunOnceCallback;
using blink::mojom::PermissionStatus;
-using storage::FileSystemURL;
class NativeFileSystemManagerImplTest : public testing::Test {
public:
@@ -42,7 +45,7 @@
void SetUp() override {
ASSERT_TRUE(dir_.CreateUniqueTempDir());
ASSERT_TRUE(dir_.GetPath().IsAbsolute());
- file_system_context_ = CreateFileSystemContextForTesting(
+ file_system_context_ = storage::CreateFileSystemContextForTesting(
/*quota_manager_proxy=*/nullptr, dir_.GetPath());
chrome_blob_context_ = base::MakeRefCounted<ChromeBlobStorageContext>();
@@ -266,12 +269,12 @@
base::FilePath::FromUTF8Unsafe("test.crswap"));
ASSERT_EQ(base::File::FILE_OK,
- AsyncFileTestHelper::CreateFile(file_system_context_.get(),
- test_file_url));
+ storage::AsyncFileTestHelper::CreateFile(file_system_context_.get(),
+ test_file_url));
ASSERT_EQ(base::File::FILE_OK,
- AsyncFileTestHelper::CreateFile(file_system_context_.get(),
- test_swap_url));
+ storage::AsyncFileTestHelper::CreateFile(file_system_context_.get(),
+ test_swap_url));
mojo::Remote<blink::mojom::NativeFileSystemFileWriter> writer_remote(
manager_->CreateFileWriter(kBindingContext, test_file_url, test_swap_url,
@@ -279,17 +282,17 @@
allow_grant_, allow_grant_, {})));
ASSERT_TRUE(writer_remote.is_bound());
- ASSERT_TRUE(
- AsyncFileTestHelper::FileExists(file_system_context_.get(), test_swap_url,
- AsyncFileTestHelper::kDontCheckSize));
+ ASSERT_TRUE(storage::AsyncFileTestHelper::FileExists(
+ file_system_context_.get(), test_swap_url,
+ storage::AsyncFileTestHelper::kDontCheckSize));
// Severs the mojo pipe, causing the writer to be destroyed.
writer_remote.reset();
base::RunLoop().RunUntilIdle();
- ASSERT_FALSE(
- AsyncFileTestHelper::FileExists(file_system_context_.get(), test_swap_url,
- AsyncFileTestHelper::kDontCheckSize));
+ ASSERT_FALSE(storage::AsyncFileTestHelper::FileExists(
+ file_system_context_.get(), test_swap_url,
+ storage::AsyncFileTestHelper::kDontCheckSize));
}
TEST_F(NativeFileSystemManagerImplTest,
@@ -303,8 +306,8 @@
base::FilePath::FromUTF8Unsafe("test.crswap"));
ASSERT_EQ(base::File::FILE_OK,
- AsyncFileTestHelper::CreateFileWithData(file_system_context_.get(),
- test_swap_url, "foo", 3));
+ storage::AsyncFileTestHelper::CreateFileWithData(
+ file_system_context_.get(), test_swap_url, "foo", 3));
mojo::Remote<blink::mojom::NativeFileSystemFileWriter> writer_remote(
manager_->CreateFileWriter(kBindingContext, test_file_url, test_swap_url,
@@ -312,20 +315,20 @@
allow_grant_, allow_grant_, {})));
ASSERT_TRUE(writer_remote.is_bound());
- ASSERT_FALSE(
- AsyncFileTestHelper::FileExists(file_system_context_.get(), test_file_url,
- AsyncFileTestHelper::kDontCheckSize));
+ ASSERT_FALSE(storage::AsyncFileTestHelper::FileExists(
+ file_system_context_.get(), test_file_url,
+ storage::AsyncFileTestHelper::kDontCheckSize));
writer_remote->Close(base::DoNothing());
// Severs the mojo pipe, causing the writer to be destroyed.
writer_remote.reset();
base::RunLoop().RunUntilIdle();
- ASSERT_FALSE(
- AsyncFileTestHelper::FileExists(file_system_context_.get(), test_swap_url,
- AsyncFileTestHelper::kDontCheckSize));
- ASSERT_TRUE(AsyncFileTestHelper::FileExists(file_system_context_.get(),
- test_file_url, 3));
+ ASSERT_FALSE(storage::AsyncFileTestHelper::FileExists(
+ file_system_context_.get(), test_swap_url,
+ storage::AsyncFileTestHelper::kDontCheckSize));
+ ASSERT_TRUE(storage::AsyncFileTestHelper::FileExists(
+ file_system_context_.get(), test_file_url, 3));
}
TEST_F(NativeFileSystemManagerImplTest, SerializeHandle_SandboxedFile) {
diff --git a/content/browser/storage_partition_impl_unittest.cc b/content/browser/storage_partition_impl_unittest.cc
index a12a0e20..94df150 100644
--- a/content/browser/storage_partition_impl_unittest.cc
+++ b/content/browser/storage_partition_impl_unittest.cc
@@ -5,6 +5,12 @@
#include <stddef.h>
#include <stdint.h>
+#include <map>
+#include <set>
+#include <string>
+#include <utility>
+#include <vector>
+
#include "base/bind.h"
#include "base/files/file_util.h"
#include "base/location.h"
@@ -117,7 +123,7 @@
class AwaitCompletionHelper {
public:
AwaitCompletionHelper() : start_(false), already_quit_(false) {}
- virtual ~AwaitCompletionHelper() {}
+ virtual ~AwaitCompletionHelper() = default;
void BlockUntilNotified() {
if (!already_quit_) {
@@ -746,9 +752,9 @@
: task_environment_(content::BrowserTaskEnvironment::IO_MAINLOOP),
browser_context_(new TestBrowserContext()) {}
- MockQuotaManager* GetMockManager() {
+ storage::MockQuotaManager* GetMockManager() {
if (!quota_manager_.get()) {
- quota_manager_ = new MockQuotaManager(
+ quota_manager_ = base::MakeRefCounted<storage::MockQuotaManager>(
browser_context_->IsOffTheRecord(), browser_context_->GetPath(),
base::CreateSingleThreadTaskRunner({BrowserThread::IO}).get(),
browser_context_->GetSpecialStoragePolicy());
@@ -765,7 +771,7 @@
private:
content::BrowserTaskEnvironment task_environment_;
std::unique_ptr<TestBrowserContext> browser_context_;
- scoped_refptr<MockQuotaManager> quota_manager_;
+ scoped_refptr<storage::MockQuotaManager> quota_manager_;
DISALLOW_COPY_AND_ASSIGN(StoragePartitionImplTest);
};
@@ -849,7 +855,8 @@
StoragePartitionImpl::GenerateQuotaClientMask(kAllQuotaRemoveMask));
}
-void PopulateTestQuotaManagedPersistentData(MockQuotaManager* manager) {
+void PopulateTestQuotaManagedPersistentData(
+ storage::MockQuotaManager* manager) {
manager->AddOrigin(Origin2(), kPersistent, kClientFile, base::Time());
manager->AddOrigin(Origin3(), kPersistent, kClientFile,
base::Time::Now() - base::TimeDelta::FromDays(1));
@@ -859,7 +866,7 @@
EXPECT_TRUE(manager->OriginHasData(Origin3(), kPersistent, kClientFile));
}
-void PopulateTestQuotaManagedTemporaryData(MockQuotaManager* manager) {
+void PopulateTestQuotaManagedTemporaryData(storage::MockQuotaManager* manager) {
manager->AddOrigin(Origin1(), kTemporary, kClientFile, base::Time::Now());
manager->AddOrigin(Origin3(), kTemporary, kClientFile,
base::Time::Now() - base::TimeDelta::FromDays(1));
@@ -869,7 +876,7 @@
EXPECT_TRUE(manager->OriginHasData(Origin3(), kTemporary, kClientFile));
}
-void PopulateTestQuotaManagedData(MockQuotaManager* manager) {
+void PopulateTestQuotaManagedData(storage::MockQuotaManager* manager) {
// Set up Origin1() with a temporary quota, Origin2() with a persistent
// quota, and Origin3() with both. Origin1() is modified now, Origin2()
// is modified at the beginning of time, and Origin3() is modified one day
@@ -878,7 +885,8 @@
PopulateTestQuotaManagedTemporaryData(manager);
}
-void PopulateTestQuotaManagedNonBrowsingData(MockQuotaManager* manager) {
+void PopulateTestQuotaManagedNonBrowsingData(
+ storage::MockQuotaManager* manager) {
manager->AddOrigin(OriginDevTools(), kTemporary, kClientFile, base::Time());
manager->AddOrigin(OriginDevTools(), kPersistent, kClientFile, base::Time());
}
@@ -1071,8 +1079,7 @@
TEST_F(StoragePartitionImplTest, RemoveQuotaManagedUnprotectedOrigins) {
// Protect Origin1().
- scoped_refptr<MockSpecialStoragePolicy> mock_policy =
- new MockSpecialStoragePolicy;
+ auto mock_policy = base::MakeRefCounted<storage::MockSpecialStoragePolicy>();
mock_policy->AddProtected(Origin1().GetURL());
PopulateTestQuotaManagedData(GetMockManager());
@@ -1106,8 +1113,7 @@
TEST_F(StoragePartitionImplTest, RemoveQuotaManagedProtectedOrigins) {
// Protect Origin1().
- scoped_refptr<MockSpecialStoragePolicy> mock_policy =
- new MockSpecialStoragePolicy;
+ auto mock_policy = base::MakeRefCounted<storage::MockSpecialStoragePolicy>();
mock_policy->AddProtected(Origin1().GetURL());
PopulateTestQuotaManagedData(GetMockManager());
@@ -1215,8 +1221,7 @@
TEST_F(StoragePartitionImplTest, RemoveUnprotectedLocalStorageForever) {
// Protect Origin1().
- scoped_refptr<MockSpecialStoragePolicy> mock_policy =
- new MockSpecialStoragePolicy;
+ auto mock_policy = base::MakeRefCounted<storage::MockSpecialStoragePolicy>();
mock_policy->AddProtected(Origin1().GetURL());
RemoveLocalStorageTester tester(task_environment(), browser_context());
@@ -1250,8 +1255,7 @@
TEST_F(StoragePartitionImplTest, RemoveProtectedLocalStorageForever) {
// Protect Origin1().
- scoped_refptr<MockSpecialStoragePolicy> mock_policy =
- new MockSpecialStoragePolicy;
+ auto mock_policy = base::MakeRefCounted<storage::MockSpecialStoragePolicy>();
mock_policy->AddProtected(Origin1().GetURL());
RemoveLocalStorageTester tester(task_environment(), browser_context());
diff --git a/extensions/browser/api/file_handlers/mime_util_unittest.cc b/extensions/browser/api/file_handlers/mime_util_unittest.cc
index 0158178..ae2ecba6 100644
--- a/extensions/browser/api/file_handlers/mime_util_unittest.cc
+++ b/extensions/browser/api/file_handlers/mime_util_unittest.cc
@@ -52,13 +52,13 @@
class FileHandlersMimeUtilTest : public ExtensionsTest {
protected:
- FileHandlersMimeUtilTest() {}
- ~FileHandlersMimeUtilTest() override {}
+ FileHandlersMimeUtilTest() = default;
+ ~FileHandlersMimeUtilTest() override = default;
void SetUp() override {
ExtensionsTest::SetUp();
- file_system_context_ = content::CreateFileSystemContextForTesting(
- NULL, browser_context()->GetPath());
+ file_system_context_ = storage::CreateFileSystemContextForTesting(
+ nullptr, browser_context()->GetPath());
const std::string kSampleContent = "<html><body></body></html>";
base::FilePath temp_filename = CreateTemporaryFile(kSampleContent);
diff --git a/storage/browser/blob/blob_data_item.cc b/storage/browser/blob/blob_data_item.cc
index e568aa4..291ca75 100644
--- a/storage/browser/blob/blob_data_item.cc
+++ b/storage/browser/blob/blob_data_item.cc
@@ -7,6 +7,7 @@
#include <algorithm>
#include <memory>
#include <utility>
+#include <vector>
#include "base/strings/string_number_conversions.h"
#include "mojo/public/cpp/bindings/remote.h"
@@ -22,9 +23,10 @@
FILE_PATH_LITERAL("_future_name_");
}
-class MojoDataItem : public storage::BlobDataItem::DataHandle {
+class MojoDataItem : public BlobDataItem::DataHandle {
public:
- MojoDataItem(mojom::BlobDataItemPtr element) : item_(std::move(element)) {
+ explicit MojoDataItem(mojom::BlobDataItemPtr element)
+ : item_(std::move(element)) {
reader_.Bind(std::move(item_->reader));
}
diff --git a/storage/browser/blob/blob_reader.cc b/storage/browser/blob/blob_reader.cc
index 0bda3d7..ba1ec8f 100644
--- a/storage/browser/blob/blob_reader.cc
+++ b/storage/browser/blob/blob_reader.cc
@@ -352,7 +352,7 @@
continue;
}
++pending_get_file_info_count_;
- storage::FileStreamReader* const reader = GetOrCreateFileReaderAtIndex(i);
+ FileStreamReader* const reader = GetOrCreateFileReaderAtIndex(i);
if (!reader)
return ReportError(net::ERR_FILE_NOT_FOUND);
@@ -509,7 +509,7 @@
NOTREACHED();
return ReportError(net::ERR_UNEXPECTED);
}
- storage::FileStreamReader* const reader =
+ FileStreamReader* const reader =
GetOrCreateFileReaderAtIndex(current_item_index_);
if (!reader)
return ReportError(net::ERR_FILE_NOT_FOUND);
@@ -723,7 +723,7 @@
case BlobDataItem::Type::kFileFilesystem: {
int64_t max_bytes_to_read =
item.length() == std::numeric_limits<uint64_t>::max()
- ? storage::kMaximumLength
+ ? kMaximumLength
: item.length() - additional_offset;
if (file_stream_provider_for_testing_) {
return file_stream_provider_for_testing_->CreateFileStreamReader(
@@ -731,7 +731,7 @@
max_bytes_to_read, item.expected_modification_time());
}
return item.file_system_context()->CreateFileStreamReader(
- storage::FileSystemURL(
+ FileSystemURL(
item.file_system_context()->CrackURL(item.filesystem_url())),
item.offset() + additional_offset, max_bytes_to_read,
item.expected_modification_time());
@@ -827,8 +827,7 @@
BlobDataItem& item = *items.at(item_index);
DCHECK_EQ(item.type(), BlobDataItem::Type::kReadableDataHandle);
if (item.data_handle()->BytesReadHistogramLabel()) {
- storage::RecordBytesRead(item.data_handle()->BytesReadHistogramLabel(),
- result);
+ RecordBytesRead(item.data_handle()->BytesReadHistogramLabel(), result);
}
}
diff --git a/storage/browser/blob/blob_reader_unittest.cc b/storage/browser/blob/blob_reader_unittest.cc
index f4e5290..51b85c7 100644
--- a/storage/browser/blob/blob_reader_unittest.cc
+++ b/storage/browser/blob/blob_reader_unittest.cc
@@ -6,8 +6,11 @@
#include <stdint.h>
#include <string.h>
+#include <algorithm>
#include <memory>
+#include <string>
#include <utility>
+#include <vector>
#include "base/bind.h"
#include "base/bind_helpers.h"
@@ -42,14 +45,14 @@
#include "url/gurl.h"
using base::FilePath;
-using content::AsyncFileTestHelper;
using net::DrainableIOBuffer;
using net::IOBuffer;
-using FileCreationInfo = storage::BlobMemoryController::FileCreationInfo;
namespace storage {
namespace {
+using FileCreationInfo = BlobMemoryController::FileCreationInfo;
+
void SaveBlobStatusAndFiles(BlobStatus* status_ptr,
std::vector<FileCreationInfo>* files_ptr,
BlobStatus status,
@@ -378,8 +381,7 @@
TEST_F(BlobReaderTest, BasicReadableDataHandle) {
auto b = std::make_unique<BlobDataBuilder>("uuid");
const std::string kData = "Test Blob Data";
- auto data_handle =
- base::MakeRefCounted<storage::FakeBlobDataHandle>(kData, "");
+ auto data_handle = base::MakeRefCounted<FakeBlobDataHandle>(kData, "");
b->AppendReadableDataHandle(std::move(data_handle));
this->InitializeReader(std::move(b));
@@ -409,8 +411,7 @@
auto b = std::make_unique<BlobDataBuilder>("uuid");
const std::string kData = "Test Blob Data";
const std::string kSideData = "Test side data";
- auto data_handle =
- base::MakeRefCounted<storage::FakeBlobDataHandle>(kData, kSideData);
+ auto data_handle = base::MakeRefCounted<FakeBlobDataHandle>(kData, kSideData);
b->AppendReadableDataHandle(std::move(data_handle));
this->InitializeReader(std::move(b));
@@ -647,8 +648,7 @@
TEST_F(BlobReaderTest, ReadableDataHandleSingle) {
auto b = std::make_unique<BlobDataBuilder>("uuid");
const std::string kOrigData = "12345 Test Blob Data 12345";
- auto data_handle =
- base::MakeRefCounted<storage::FakeBlobDataHandle>(kOrigData, "");
+ auto data_handle = base::MakeRefCounted<FakeBlobDataHandle>(kOrigData, "");
b->AppendReadableDataHandle(data_handle, 6, 14);
this->InitializeReader(std::move(b));
const std::string kData = kOrigData.substr(6, 14);
@@ -691,8 +691,7 @@
TEST_F(BlobReaderTest, ReadableDataHandleSingleRange) {
auto b = std::make_unique<BlobDataBuilder>("uuid");
const std::string kOrigData = "12345 Test Blob Data 12345";
- auto data_handle =
- base::MakeRefCounted<storage::FakeBlobDataHandle>(kOrigData, "");
+ auto data_handle = base::MakeRefCounted<FakeBlobDataHandle>(kOrigData, "");
b->AppendReadableDataHandle(data_handle, 6, 14);
this->InitializeReader(std::move(b));
const std::string kData = kOrigData.substr(6, 14);
@@ -745,9 +744,9 @@
// non-first element that we read handle slices, as these touch different
// pieces of code.
b->AppendReadableDataHandle(
- base::MakeRefCounted<storage::FakeBlobDataHandle>(kData1, ""), 5, 4);
+ base::MakeRefCounted<FakeBlobDataHandle>(kData1, ""), 5, 4);
b->AppendReadableDataHandle(
- base::MakeRefCounted<storage::FakeBlobDataHandle>(kData2, ""), 6, 9);
+ base::MakeRefCounted<FakeBlobDataHandle>(kData2, ""), 6, 9);
this->InitializeReader(std::move(b));
std::string kData = kData1.substr(5, 4) + kData2.substr(6, 9);
@@ -825,8 +824,7 @@
const std::string kData = "Test Blob Data";
const uint64_t kOffset = 2;
const uint64_t kReadLength = 3;
- auto data_handle =
- base::MakeRefCounted<storage::FakeBlobDataHandle>(kData, "");
+ auto data_handle = base::MakeRefCounted<FakeBlobDataHandle>(kData, "");
b->AppendReadableDataHandle(std::move(data_handle));
this->InitializeReader(std::move(b));
@@ -937,8 +935,7 @@
const base::Time kTime = base::Time::Now();
const FilePath kData1Path = FilePath::FromUTF8Unsafe("/fake/file.txt");
- auto data_handle =
- base::MakeRefCounted<storage::FakeBlobDataHandle>(kData3, "");
+ auto data_handle = base::MakeRefCounted<FakeBlobDataHandle>(kData3, "");
b->AppendFile(kData1Path, 0, kData1.size(), kTime);
b->AppendData(kData2);
diff --git a/storage/browser/blob/blob_registry_impl_unittest.cc b/storage/browser/blob/blob_registry_impl_unittest.cc
index af309aa..50895705 100644
--- a/storage/browser/blob/blob_registry_impl_unittest.cc
+++ b/storage/browser/blob/blob_registry_impl_unittest.cc
@@ -6,6 +6,9 @@
#include <limits>
#include <memory>
+#include <string>
+#include <utility>
+#include <vector>
#include "base/bind.h"
#include "base/bind_helpers.h"
@@ -64,9 +67,8 @@
context_ = std::make_unique<BlobStorageContext>(
data_dir_.GetPath(), data_dir_.GetPath(),
base::CreateTaskRunner({base::ThreadPool(), base::MayBlock()}));
- auto storage_policy =
- base::MakeRefCounted<content::MockSpecialStoragePolicy>();
- file_system_context_ = base::MakeRefCounted<storage::FileSystemContext>(
+ auto storage_policy = base::MakeRefCounted<MockSpecialStoragePolicy>();
+ file_system_context_ = base::MakeRefCounted<FileSystemContext>(
base::ThreadTaskRunnerHandle::Get().get(),
base::ThreadTaskRunnerHandle::Get().get(),
nullptr /* external_mount_points */, storage_policy.get(),
@@ -86,7 +88,7 @@
mojo::core::SetDefaultProcessErrorCallback(base::BindRepeating(
&BlobRegistryImplTest::OnBadMessage, base::Unretained(this)));
- storage::BlobStorageLimits limits;
+ BlobStorageLimits limits;
limits.max_ipc_memory_size = kTestBlobStorageIPCThresholdBytes;
limits.max_shared_memory_size = kTestBlobStorageMaxSharedMemoryBytes;
limits.max_bytes_data_item_size = kTestBlobStorageMaxBytesDataItemSize;
@@ -187,7 +189,7 @@
base::ScopedTempDir data_dir_;
base::test::TaskEnvironment task_environment_;
std::unique_ptr<BlobStorageContext> context_;
- scoped_refptr<storage::FileSystemContext> file_system_context_;
+ scoped_refptr<FileSystemContext> file_system_context_;
std::unique_ptr<BlobRegistryImpl> registry_impl_;
mojo::Remote<blink::mojom::BlobRegistry> registry_;
MockBlobRegistryDelegate* delegate_ptr_;
diff --git a/storage/browser/blob/blob_storage_context.cc b/storage/browser/blob/blob_storage_context.cc
index d3f50f3..c19c249cd 100644
--- a/storage/browser/blob/blob_storage_context.cc
+++ b/storage/browser/blob/blob_storage_context.cc
@@ -771,9 +771,9 @@
mojom::WriteBlobToFileResult::kInvalidBlob);
return;
}
- ::storage::WriteBlobToFile(std::move(handle), file_path,
- flush_on_write, last_modified,
- std::move(callback));
+ storage::WriteBlobToFile(std::move(handle), file_path,
+ flush_on_write, last_modified,
+ std::move(callback));
},
AsWeakPtr(), file_path, flush_on_write, last_modified,
std::move(callback)));
diff --git a/storage/browser/blob/blob_storage_context.h b/storage/browser/blob/blob_storage_context.h
index 37a0401f..46297e5 100644
--- a/storage/browser/blob/blob_storage_context.h
+++ b/storage/browser/blob/blob_storage_context.h
@@ -35,17 +35,18 @@
class GURL;
namespace content {
-class BlobDispatcherHost;
-class BlobDispatcherHostTest;
+
class ChromeBlobStorageContext;
class ShareableBlobDataItem;
namespace indexed_db_backing_store_unittest {
class BlobStorageContextShim;
} // namespace indexed_db_backing_store_unittest
+
} // namespace content
namespace storage {
+
class BlobDataBuilder;
class BlobDataHandle;
class BlobDataSnapshot;
@@ -175,8 +176,6 @@
}
protected:
- friend class content::BlobDispatcherHost;
- friend class content::BlobDispatcherHostTest;
friend class content::ChromeBlobStorageContext;
friend class BlobBuilderFromStream;
friend class BlobDataHandle;
@@ -250,7 +249,7 @@
bool OnMemoryDump(const base::trace_event::MemoryDumpArgs& args,
base::trace_event::ProcessMemoryDump* pmd) override;
- // storage::mojom::BlobStorageContext implementation.
+ // mojom::BlobStorageContext implementation.
void RegisterFromDataItem(mojo::PendingReceiver<blink::mojom::Blob> blob,
const std::string& uuid,
mojom::BlobDataItemPtr item) override;
diff --git a/storage/browser/blob/blob_storage_context_unittest.cc b/storage/browser/blob/blob_storage_context_unittest.cc
index 770bf64..c472efbd 100644
--- a/storage/browser/blob/blob_storage_context_unittest.cc
+++ b/storage/browser/blob/blob_storage_context_unittest.cc
@@ -9,6 +9,7 @@
#include <limits>
#include <memory>
#include <string>
+#include <utility>
#include "base/bind.h"
#include "base/files/file.h"
@@ -33,13 +34,13 @@
#include "storage/browser/test/fake_blob_data_handle.h"
#include "testing/gtest/include/gtest/gtest.h"
-using FileCreationInfo = storage::BlobMemoryController::FileCreationInfo;
namespace storage {
namespace {
+
+using FileCreationInfo = BlobMemoryController::FileCreationInfo;
using base::TestSimpleTaskRunner;
-const std::string kBlobStorageDirectory = "blob_storage";
const size_t kTestBlobStorageIPCThresholdBytes = 20;
const size_t kTestBlobStorageMaxSharedMemoryBytes = 50;
@@ -479,7 +480,7 @@
TEST_F(BlobStorageContextTest, BuildReadableDataHandleBlob) {
const std::string kTestBlobData = "Test Blob Data";
auto data_handle =
- base::MakeRefCounted<storage::FakeBlobDataHandle>(kTestBlobData, "");
+ base::MakeRefCounted<FakeBlobDataHandle>(kTestBlobData, "");
{
BlobStorageContext context;
@@ -595,8 +596,7 @@
auto blob_data3_builder = std::make_unique<BlobDataBuilder>(kId3);
blob_data3_builder->AppendData("Data4");
- auto data_handle =
- base::MakeRefCounted<storage::FakeBlobDataHandle>("Data5", "");
+ auto data_handle = base::MakeRefCounted<FakeBlobDataHandle>("Data5", "");
blob_data3_builder->AppendReadableDataHandle(std::move(data_handle));
std::unique_ptr<BlobDataSnapshot> blob_data3 =
blob_data3_builder->CreateSnapshot();
@@ -719,7 +719,7 @@
std::vector<BlobDataBuilder::FutureData>* future_datas,
std::vector<BlobDataBuilder::FutureFile>* future_files,
size_t index,
- scoped_refptr<storage::BlobDataItem::DataHandle> data_handle) {
+ scoped_refptr<BlobDataItem::DataHandle> data_handle) {
size_t size = 0;
// We can't have both future data and future files, so split those up.
if (index % 2 != 0) {
@@ -782,8 +782,8 @@
temp_dir_.GetPath(), temp_dir_.GetPath(), file_runner_);
SetTestMemoryLimits();
- auto data_handle = base::MakeRefCounted<storage::FakeBlobDataHandle>(
- kTestDataHandleData, "");
+ auto data_handle =
+ base::MakeRefCounted<FakeBlobDataHandle>(kTestDataHandleData, "");
// This tests mixed blob content with both synchronous and asynchronous
// construction. Blobs should also be paged to disk during execution.
diff --git a/storage/browser/blob/blob_transport_strategy_unittest.cc b/storage/browser/blob/blob_transport_strategy_unittest.cc
index 4cdafb6..f50bc90 100644
--- a/storage/browser/blob/blob_transport_strategy_unittest.cc
+++ b/storage/browser/blob/blob_transport_strategy_unittest.cc
@@ -4,7 +4,11 @@
#include "storage/browser/blob/blob_transport_strategy.h"
+#include <algorithm>
#include <memory>
+#include <string>
+#include <utility>
+#include <vector>
#include "base/bind.h"
#include "base/files/file_util.h"
@@ -100,7 +104,7 @@
base::test::TaskEnvironment task_environment_;
scoped_refptr<base::SequencedTaskRunner> bytes_provider_runner_;
base::Time mock_time_;
- storage::BlobStorageLimits limits_;
+ BlobStorageLimits limits_;
std::vector<std::string> bad_messages_;
diff --git a/storage/browser/blob/blob_url_loader.h b/storage/browser/blob/blob_url_loader.h
index 82a3945..0b252d0 100644
--- a/storage/browser/blob/blob_url_loader.h
+++ b/storage/browser/blob/blob_url_loader.h
@@ -5,6 +5,10 @@
#ifndef STORAGE_BROWSER_BLOB_BLOB_URL_LOADER_H_
#define STORAGE_BROWSER_BLOB_BLOB_URL_LOADER_H_
+#include <memory>
+#include <string>
+#include <vector>
+
#include "base/component_export.h"
#include "base/macros.h"
#include "base/memory/ref_counted.h"
@@ -24,7 +28,7 @@
// method) when it has finished responding.
// Note: some of this code is duplicated from BlobURLRequestJob.
class COMPONENT_EXPORT(STORAGE_BROWSER) BlobURLLoader
- : public storage::MojoBlobReader::Delegate,
+ : public MojoBlobReader::Delegate,
public network::mojom::URLLoader {
public:
static void CreateAndStart(
@@ -52,7 +56,7 @@
void PauseReadingBodyFromNet() override {}
void ResumeReadingBodyFromNet() override {}
- // storage::MojoBlobReader::Delegate implementation:
+ // MojoBlobReader::Delegate implementation:
RequestSideData DidCalculateSize(uint64_t total_size,
uint64_t content_size) override;
void DidReadSideData(base::Optional<mojo_base::BigBuffer> data) override;
@@ -82,4 +86,4 @@
} // namespace storage
-#endif // CONTENT_BROWSER_BLOB_STORAGE_BLOB_URL_LOADER_FACTORY_H_
+#endif // STORAGE_BROWSER_BLOB_BLOB_URL_LOADER_H_
diff --git a/storage/browser/blob/view_blob_internals_job.cc b/storage/browser/blob/view_blob_internals_job.cc
index d6dca3e..5c4efbb 100644
--- a/storage/browser/blob/view_blob_internals_job.cc
+++ b/storage/browser/blob/view_blob_internals_job.cc
@@ -30,8 +30,9 @@
#include "storage/browser/blob/blob_storage_registry.h"
#include "storage/browser/blob/shareable_blob_data_item.h"
+namespace storage {
+
namespace {
-using storage::BlobStatus;
const char kEmptyBlobStorageMessage[] = "No available blob data.";
const char kContentType[] = "Content Type: ";
@@ -138,8 +139,6 @@
} // namespace
-namespace storage {
-
std::string ViewBlobInternalsJob::GenerateHTML(
BlobStorageContext* blob_storage_context) {
std::string out;
diff --git a/storage/browser/blob/write_blob_to_file.cc b/storage/browser/blob/write_blob_to_file.cc
index e937419..620e140 100644
--- a/storage/browser/blob/write_blob_to_file.cc
+++ b/storage/browser/blob/write_blob_to_file.cc
@@ -5,8 +5,12 @@
#include "storage/browser/blob/write_blob_to_file.h"
#include <stdint.h>
+
#include <algorithm>
#include <limits>
+#include <memory>
+#include <utility>
+#include <vector>
#include "base/bind.h"
#include "base/files/file_util.h"
@@ -140,8 +144,8 @@
if (offset == 0) {
base::File::Info info;
base::GetFileInfo(copy_from, &info);
- if (!storage::FileStreamReader::VerifySnapshotTime(
- expected_last_modified_copy_from, info)) {
+ if (!FileStreamReader::VerifySnapshotTime(expected_last_modified_copy_from,
+ info)) {
return mojom::WriteBlobToFileResult::kInvalidBlob;
}
if (!size || info.size == size.value()) {
@@ -167,8 +171,8 @@
base::File::Info info;
infile.GetInfo(&info);
- if (!storage::FileStreamReader::VerifySnapshotTime(
- expected_last_modified_copy_from, info)) {
+ if (!FileStreamReader::VerifySnapshotTime(expected_last_modified_copy_from,
+ info)) {
return mojom::WriteBlobToFileResult::kInvalidBlob;
}
@@ -223,8 +227,8 @@
mojom::BlobStorageContext::WriteBlobToFileCallback callback,
base::File::Error rv,
int64_t bytes_written,
- storage::FileWriterDelegate::WriteProgressStatus write_status) {
- bool success = write_status == storage::FileWriterDelegate::SUCCESS_COMPLETED;
+ FileWriterDelegate::WriteProgressStatus write_status) {
+ bool success = write_status == FileWriterDelegate::SUCCESS_COMPLETED;
if (!success) {
std::move(callback).Run(mojom::WriteBlobToFileResult::kIOError);
return;
@@ -317,20 +321,19 @@
}
// If not, copy the BlobReader and FileStreamWriter.
- std::unique_ptr<storage::FileStreamWriter> writer =
- storage::FileStreamWriter::CreateForLocalFile(
+ std::unique_ptr<FileStreamWriter> writer =
+ FileStreamWriter::CreateForLocalFile(
base::CreateTaskRunner({base::MayBlock(), base::ThreadPool(),
base::TaskPriority::USER_VISIBLE})
.get(),
file_path, /*initial_offset=*/0,
- storage::FileStreamWriter::CREATE_NEW_FILE_ALWAYS);
+ FileStreamWriter::CREATE_NEW_FILE_ALWAYS);
- storage::FlushPolicy policy =
- flush_on_write || last_modified
- ? storage::FlushPolicy::FLUSH_ON_COMPLETION
- : storage::FlushPolicy::NO_FLUSH_ON_COMPLETION;
- std::unique_ptr<storage::FileWriterDelegate> delegate(
- std::make_unique<storage::FileWriterDelegate>(std::move(writer), policy));
+ FlushPolicy policy = flush_on_write || last_modified
+ ? FlushPolicy::FLUSH_ON_COMPLETION
+ : FlushPolicy::NO_FLUSH_ON_COMPLETION;
+ auto delegate =
+ std::make_unique<FileWriterDelegate>(std::move(writer), policy);
auto* raw_delegate = delegate.get();
raw_delegate->Start(
diff --git a/storage/browser/database/database_quota_client.cc b/storage/browser/database/database_quota_client.cc
index 79f729c..74bd2ec 100644
--- a/storage/browser/database/database_quota_client.cc
+++ b/storage/browser/database/database_quota_client.cc
@@ -25,7 +25,6 @@
#include "third_party/blink/public/mojom/quota/quota_types.mojom.h"
using blink::mojom::StorageType;
-using storage::QuotaClient;
namespace storage {
@@ -34,8 +33,7 @@
int64_t GetOriginUsageOnDBThread(DatabaseTracker* db_tracker,
const url::Origin& origin) {
OriginInfo info;
- if (db_tracker->GetOriginInfo(storage::GetIdentifierFromOrigin(origin),
- &info))
+ if (db_tracker->GetOriginInfo(GetIdentifierFromOrigin(origin), &info))
return info.TotalSize();
return 0;
}
@@ -45,7 +43,7 @@
std::vector<std::string> origin_identifiers;
if (db_tracker->GetAllOriginIdentifiers(&origin_identifiers)) {
for (const auto& identifier : origin_identifiers) {
- origins_ptr->insert(storage::GetOriginFromIdentifier(identifier));
+ origins_ptr->insert(GetOriginFromIdentifier(identifier));
}
}
}
@@ -56,7 +54,7 @@
std::vector<std::string> origin_identifiers;
if (db_tracker->GetAllOriginIdentifiers(&origin_identifiers)) {
for (const auto& identifier : origin_identifiers) {
- url::Origin origin = storage::GetOriginFromIdentifier(identifier);
+ url::Origin origin = GetOriginFromIdentifier(identifier);
if (host == net::GetHostOrSpecFromURL(origin.GetURL()))
origins_ptr->insert(origin);
}
diff --git a/storage/browser/database/database_quota_client.h b/storage/browser/database/database_quota_client.h
index c65a48a..7982670 100644
--- a/storage/browser/database/database_quota_client.h
+++ b/storage/browser/database/database_quota_client.h
@@ -24,7 +24,7 @@
//
// This interface is used on the IO thread by the quota manager.
class COMPONENT_EXPORT(STORAGE_BROWSER) DatabaseQuotaClient
- : public storage::QuotaClient {
+ : public QuotaClient {
public:
explicit DatabaseQuotaClient(scoped_refptr<DatabaseTracker> tracker);
diff --git a/storage/browser/database/database_quota_client_unittest.cc b/storage/browser/database/database_quota_client_unittest.cc
index 34e4424..4e56e2f 100644
--- a/storage/browser/database/database_quota_client_unittest.cc
+++ b/storage/browser/database/database_quota_client_unittest.cc
@@ -25,11 +25,7 @@
#include "storage/common/database/database_identifier.h"
#include "testing/gtest/include/gtest/gtest.h"
-using storage::DatabaseQuotaClient;
-using storage::DatabaseTracker;
-using storage::OriginInfo;
-
-namespace content {
+namespace storage {
// Declared to shorten the line lengths.
static const blink::mojom::StorageType kTemp =
@@ -50,8 +46,8 @@
bool GetOriginInfo(const std::string& origin_identifier,
OriginInfo* info) override {
- auto found = mock_origin_infos_.find(
- storage::GetOriginFromIdentifier(origin_identifier));
+ auto found =
+ mock_origin_infos_.find(GetOriginFromIdentifier(origin_identifier));
if (found == mock_origin_infos_.end())
return false;
*info = OriginInfo(found->second);
@@ -90,7 +86,7 @@
void AddMockDatabase(const url::Origin& origin, const char* name, int size) {
MockOriginInfo& info = mock_origin_infos_[origin];
- info.set_origin(storage::GetIdentifierFromOrigin(origin));
+ info.set_origin(GetIdentifierFromOrigin(origin));
info.AddMockDatabase(base::ASCIIToUTF16(name), size);
}
@@ -134,7 +130,7 @@
usage_(0),
mock_tracker_(new MockDatabaseTracker) {}
- int64_t GetOriginUsage(scoped_refptr<storage::QuotaClient> client,
+ int64_t GetOriginUsage(scoped_refptr<QuotaClient> client,
const url::Origin& origin,
blink::mojom::StorageType type) {
usage_ = 0;
@@ -148,7 +144,7 @@
}
const std::set<url::Origin>& GetOriginsForType(
- scoped_refptr<storage::QuotaClient> client,
+ scoped_refptr<QuotaClient> client,
blink::mojom::StorageType type) {
origins_.clear();
client->GetOriginsForType(
@@ -160,7 +156,7 @@
}
const std::set<url::Origin>& GetOriginsForHost(
- scoped_refptr<storage::QuotaClient> client,
+ scoped_refptr<QuotaClient> client,
blink::mojom::StorageType type,
const std::string& host) {
origins_.clear();
@@ -173,7 +169,7 @@
return origins_;
}
- bool DeleteOriginData(scoped_refptr<storage::QuotaClient> client,
+ bool DeleteOriginData(scoped_refptr<QuotaClient> client,
blink::mojom::StorageType type,
const url::Origin& origin) {
delete_status_ = blink::mojom::QuotaStatusCode::kUnknown;
@@ -277,4 +273,4 @@
EXPECT_EQ(2, mock_tracker()->delete_called_count());
}
-} // namespace content
+} // namespace storage
diff --git a/storage/browser/database/database_tracker.cc b/storage/browser/database/database_tracker.cc
index d4cb25f..27f507e 100644
--- a/storage/browser/database/database_tracker.cc
+++ b/storage/browser/database/database_tracker.cc
@@ -83,11 +83,10 @@
OriginInfo::OriginInfo(const std::string& origin_identifier, int64_t total_size)
: origin_identifier_(origin_identifier), total_size_(total_size) {}
-DatabaseTracker::DatabaseTracker(
- const base::FilePath& profile_path,
- bool is_incognito,
- storage::SpecialStoragePolicy* special_storage_policy,
- storage::QuotaManagerProxy* quota_manager_proxy)
+DatabaseTracker::DatabaseTracker(const base::FilePath& profile_path,
+ bool is_incognito,
+ SpecialStoragePolicy* special_storage_policy,
+ QuotaManagerProxy* quota_manager_proxy)
: is_incognito_(is_incognito),
profile_path_(profile_path),
db_dir_(is_incognito_
@@ -124,7 +123,7 @@
if (quota_manager_proxy_.get())
quota_manager_proxy_->NotifyStorageAccessed(
- storage::GetOriginFromIdentifier(origin_identifier),
+ GetOriginFromIdentifier(origin_identifier),
blink::mojom::StorageType::kTemporary);
InsertOrUpdateDatabaseDetails(origin_identifier, database_name,
@@ -160,7 +159,7 @@
// closed because we don't call it for read while open.
if (quota_manager_proxy_.get())
quota_manager_proxy_->NotifyStorageAccessed(
- storage::GetOriginFromIdentifier(origin_identifier),
+ GetOriginFromIdentifier(origin_identifier),
blink::mojom::StorageType::kTemporary);
UpdateOpenDatabaseSizeAndNotify(origin_identifier, database_name);
@@ -371,8 +370,7 @@
if (quota_manager_proxy_.get() && db_file_size)
quota_manager_proxy_->NotifyStorageModified(
- storage::QuotaClient::kDatabase,
- storage::GetOriginFromIdentifier(origin_identifier),
+ QuotaClient::kDatabase, GetOriginFromIdentifier(origin_identifier),
blink::mojom::StorageType::kTemporary, -db_file_size);
// Clean up the main database and invalidate the cached record.
@@ -449,8 +447,7 @@
if (quota_manager_proxy_.get() && deleted_size) {
quota_manager_proxy_->NotifyStorageModified(
- storage::QuotaClient::kDatabase,
- storage::GetOriginFromIdentifier(origin_identifier),
+ QuotaClient::kDatabase, GetOriginFromIdentifier(origin_identifier),
blink::mojom::StorageType::kTemporary, -deleted_size);
}
@@ -657,8 +654,7 @@
info->SetDatabaseSize(name, new_size);
if (quota_manager_proxy_.get())
quota_manager_proxy_->NotifyStorageModified(
- storage::QuotaClient::kDatabase,
- storage::GetOriginFromIdentifier(origin_id),
+ QuotaClient::kDatabase, GetOriginFromIdentifier(origin_id),
blink::mojom::StorageType::kTemporary, new_size - old_size);
for (auto& observer : observers_)
observer.OnDatabaseSizeChanged(origin_id, name, new_size);
@@ -728,7 +724,7 @@
for (const auto& origin : origins_identifiers) {
if (special_storage_policy_.get() &&
special_storage_policy_->IsStorageProtected(
- storage::GetOriginURLFromIdentifier(origin))) {
+ GetOriginURLFromIdentifier(origin))) {
continue;
}
@@ -867,12 +863,12 @@
GetAllOriginIdentifiers(&origin_identifiers);
for (const auto& origin : origin_identifiers) {
- GURL origin_url = storage::GetOriginURLFromIdentifier(origin);
+ GURL origin_url = GetOriginURLFromIdentifier(origin);
if (!special_storage_policy_->IsStorageSessionOnly(origin_url))
continue;
if (special_storage_policy_->IsStorageProtected(origin_url))
continue;
- storage::OriginInfo origin_info;
+ OriginInfo origin_info;
std::vector<base::string16> databases;
GetOriginInfo(origin, &origin_info);
origin_info.GetAllDatabaseNames(&databases);
diff --git a/storage/browser/database/database_tracker.h b/storage/browser/database/database_tracker.h
index 942c9c1..1951738 100644
--- a/storage/browser/database/database_tracker.h
+++ b/storage/browser/database/database_tracker.h
@@ -28,22 +28,15 @@
#include "storage/common/database/database_connections.h"
#include "url/origin.h"
-namespace content {
-class DatabaseTracker_TestHelper_Test;
-class MockDatabaseTracker;
-}
-
namespace sql {
class Database;
class MetaTable;
}
namespace storage {
+
class QuotaManagerProxy;
class SpecialStoragePolicy;
-}
-
-namespace storage {
COMPONENT_EXPORT(STORAGE_BROWSER)
extern const base::FilePath::CharType kDatabaseDirectoryName[];
@@ -106,8 +99,8 @@
DatabaseTracker(const base::FilePath& profile_path,
bool is_incognito,
- storage::SpecialStoragePolicy* special_storage_policy,
- storage::QuotaManagerProxy* quota_manager_proxy);
+ SpecialStoragePolicy* special_storage_policy,
+ QuotaManagerProxy* quota_manager_proxy);
void DatabaseOpened(const std::string& origin_identifier,
const base::string16& database_name,
@@ -141,7 +134,7 @@
virtual bool GetAllOriginsInfo(std::vector<OriginInfo>* origins_info);
// Thread-safe getter.
- storage::QuotaManagerProxy* quota_manager_proxy() const {
+ QuotaManagerProxy* quota_manager_proxy() const {
return quota_manager_proxy_.get();
}
@@ -195,8 +188,8 @@
private:
friend class base::RefCountedThreadSafe<DatabaseTracker>;
- friend class content::DatabaseTracker_TestHelper_Test;
- friend class content::MockDatabaseTracker; // for testing
+ friend class DatabaseTracker_TestHelper_Test;
+ friend class MockDatabaseTracker; // for testing
using DatabaseSet = std::map<std::string, std::set<base::string16>>;
@@ -312,12 +305,12 @@
deletion_callbacks_;
// Apps and Extensions can have special rights.
- const scoped_refptr<storage::SpecialStoragePolicy> special_storage_policy_;
+ const scoped_refptr<SpecialStoragePolicy> special_storage_policy_;
// Can be accessed from any thread via quota_manager_proxy().
//
// Thread-safety argument: The reference is immutable.
- const scoped_refptr<storage::QuotaManagerProxy> quota_manager_proxy_;
+ const scoped_refptr<QuotaManagerProxy> quota_manager_proxy_;
// The database tracker thread we're supposed to run file IO on.
scoped_refptr<base::SequencedTaskRunner> task_runner_;
diff --git a/storage/browser/database/database_tracker_unittest.cc b/storage/browser/database/database_tracker_unittest.cc
index 0f7f7c3..4d73cd5 100644
--- a/storage/browser/database/database_tracker_unittest.cc
+++ b/storage/browser/database/database_tracker_unittest.cc
@@ -26,16 +26,13 @@
#include "third_party/sqlite/sqlite3.h"
using base::ASCIIToUTF16;
-using storage::DatabaseConnections;
-using storage::DatabaseTracker;
-using storage::OriginInfo;
-namespace {
+namespace storage {
const char kOrigin1Url[] = "http://origin1";
const char kOrigin2Url[] = "http://protected_origin2";
-class TestObserver : public storage::DatabaseTracker::Observer {
+class TestObserver : public DatabaseTracker::Observer {
public:
TestObserver()
: new_notification_received_(false),
@@ -95,12 +92,12 @@
EXPECT_EQ(expected_database_size, observer->GetNotificationDatabaseSize());
}
-class TestQuotaManagerProxy : public storage::QuotaManagerProxy {
+class TestQuotaManagerProxy : public QuotaManagerProxy {
public:
TestQuotaManagerProxy()
: QuotaManagerProxy(nullptr, nullptr), registered_client_(nullptr) {}
- void RegisterClient(scoped_refptr<storage::QuotaClient> client) override {
+ void RegisterClient(scoped_refptr<QuotaClient> client) override {
EXPECT_FALSE(registered_client_);
registered_client_ = client;
}
@@ -111,11 +108,11 @@
accesses_[origin] += 1;
}
- void NotifyStorageModified(storage::QuotaClient::ID client_id,
+ void NotifyStorageModified(QuotaClient::ID client_id,
const url::Origin& origin,
blink::mojom::StorageType type,
int64_t delta) override {
- EXPECT_EQ(storage::QuotaClient::kDatabase, client_id);
+ EXPECT_EQ(QuotaClient::kDatabase, client_id);
EXPECT_EQ(blink::mojom::StorageType::kTemporary, type);
modifications_[origin].first += 1;
modifications_[origin].second += delta;
@@ -124,7 +121,7 @@
// Not needed for our tests.
void NotifyOriginInUse(const url::Origin& origin) override {}
void NotifyOriginNoLongerInUse(const url::Origin& origin) override {}
- void SetUsageCacheEnabled(storage::QuotaClient::ID client_id,
+ void SetUsageCacheEnabled(QuotaClient::ID client_id,
const url::Origin& origin,
blink::mojom::StorageType type,
bool enabled) override {}
@@ -154,7 +151,7 @@
modifications_.clear();
}
- scoped_refptr<storage::QuotaClient> registered_client_;
+ scoped_refptr<QuotaClient> registered_client_;
// Map from origin to count of access notifications.
std::map<url::Origin, int> accesses_;
@@ -174,10 +171,6 @@
return file.SetLength(length);
}
-} // namespace
-
-namespace content {
-
// We declare a helper class, and make it a friend of DatabaseTracker using
// the FORWARD_DECLARE_TEST macro, and we implement all tests we want to run as
// static methods of this class. Then we make our TEST() targets call these
@@ -202,10 +195,8 @@
// Create and open three databases.
int64_t database_size = 0;
- const std::string kOrigin1 =
- storage::GetIdentifierFromOrigin(GURL(kOrigin1Url));
- const std::string kOrigin2 =
- storage::GetIdentifierFromOrigin(GURL(kOrigin2Url));
+ const std::string kOrigin1 = GetIdentifierFromOrigin(GURL(kOrigin1Url));
+ const std::string kOrigin2 = GetIdentifierFromOrigin(GURL(kOrigin2Url));
const base::string16 kDB1 = ASCIIToUTF16("db1");
const base::string16 kDB2 = ASCIIToUTF16("db2");
const base::string16 kDB3 = ASCIIToUTF16("db3");
@@ -304,10 +295,8 @@
// Open three new databases.
int64_t database_size = 0;
- const std::string kOrigin1 =
- storage::GetIdentifierFromOrigin(GURL(kOrigin1Url));
- const std::string kOrigin2 =
- storage::GetIdentifierFromOrigin(GURL(kOrigin2Url));
+ const std::string kOrigin1 = GetIdentifierFromOrigin(GURL(kOrigin1Url));
+ const std::string kOrigin2 = GetIdentifierFromOrigin(GURL(kOrigin2Url));
const base::string16 kDB1 = ASCIIToUTF16("db1");
const base::string16 kDB2 = ASCIIToUTF16("db2");
const base::string16 kDB3 = ASCIIToUTF16("db3");
@@ -420,7 +409,7 @@
static void DatabaseTrackerQuotaIntegration(bool incognito_mode) {
const url::Origin kOrigin(url::Origin::Create(GURL(kOrigin1Url)));
- const std::string kOriginId = storage::GetIdentifierFromOrigin(kOrigin);
+ const std::string kOriginId = GetIdentifierFromOrigin(kOrigin);
const base::string16 kName = ASCIIToUTF16("name");
const base::string16 kDescription = ASCIIToUTF16("description");
@@ -526,10 +515,8 @@
static void DatabaseTrackerClearSessionOnlyDatabasesOnExit() {
int64_t database_size = 0;
- const std::string kOrigin1 =
- storage::GetIdentifierFromOrigin(GURL(kOrigin1Url));
- const std::string kOrigin2 =
- storage::GetIdentifierFromOrigin(GURL(kOrigin2Url));
+ const std::string kOrigin1 = GetIdentifierFromOrigin(GURL(kOrigin1Url));
+ const std::string kOrigin2 = GetIdentifierFromOrigin(GURL(kOrigin2Url));
const base::string16 kDB1 = ASCIIToUTF16("db1");
const base::string16 kDB2 = ASCIIToUTF16("db2");
const base::string16 kDescription = ASCIIToUTF16("database_description");
@@ -606,10 +593,8 @@
static void DatabaseTrackerSetForceKeepSessionState() {
int64_t database_size = 0;
- const std::string kOrigin1 =
- storage::GetIdentifierFromOrigin(GURL(kOrigin1Url));
- const std::string kOrigin2 =
- storage::GetIdentifierFromOrigin(GURL(kOrigin2Url));
+ const std::string kOrigin1 = GetIdentifierFromOrigin(GURL(kOrigin1Url));
+ const std::string kOrigin2 = GetIdentifierFromOrigin(GURL(kOrigin2Url));
const base::string16 kDB1 = ASCIIToUTF16("db1");
const base::string16 kDB2 = ASCIIToUTF16("db2");
const base::string16 kDescription = ASCIIToUTF16("database_description");
@@ -683,7 +668,7 @@
static void EmptyDatabaseNameIsValid() {
const GURL kOrigin(kOrigin1Url);
- const std::string kOriginId = storage::GetIdentifierFromOrigin(kOrigin);
+ const std::string kOriginId = GetIdentifierFromOrigin(kOrigin);
const base::string16 kEmptyName;
const base::string16 kDescription(ASCIIToUTF16("description"));
const base::string16 kChangedDescription(
@@ -734,7 +719,7 @@
static void HandleSqliteError() {
const GURL kOrigin(kOrigin1Url);
- const std::string kOriginId = storage::GetIdentifierFromOrigin(kOrigin);
+ const std::string kOriginId = GetIdentifierFromOrigin(kOrigin);
const base::string16 kName(ASCIIToUTF16("name"));
const base::string16 kDescription(ASCIIToUTF16("description"));
@@ -852,4 +837,4 @@
DatabaseTracker_TestHelper_Test::HandleSqliteError();
}
-} // namespace content
+} // namespace storage
diff --git a/storage/browser/database/database_util_unittest.cc b/storage/browser/database/database_util_unittest.cc
index 6aa9f6ee..2da94bd 100644
--- a/storage/browser/database/database_util_unittest.cc
+++ b/storage/browser/database/database_util_unittest.cc
@@ -9,13 +9,16 @@
#include "testing/gtest/include/gtest/gtest.h"
using base::ASCIIToUTF16;
-using storage::DatabaseUtil;
-static void TestVfsFilePath(bool expected_result,
- const char* vfs_file_name,
- const char* expected_origin_identifier = "",
- const char* expected_database_name = "",
- const char* expected_sqlite_suffix = "") {
+namespace storage {
+
+namespace {
+
+void TestVfsFilePath(bool expected_result,
+ const char* vfs_file_name,
+ const char* expected_origin_identifier = "",
+ const char* expected_database_name = "",
+ const char* expected_sqlite_suffix = "") {
std::string origin_identifier;
base::string16 database_name;
base::string16 sqlite_suffix;
@@ -28,7 +31,7 @@
EXPECT_EQ(ASCIIToUTF16(expected_sqlite_suffix), sqlite_suffix);
}
-namespace content {
+} // namespace
// Test DatabaseUtil::CrackVfsFilePath on various inputs.
TEST(DatabaseUtilTest, CrackVfsFilePathTest) {
@@ -46,4 +49,4 @@
TestVfsFilePath(false, "/db_name#suffix");
}
-} // namespace content
+} // namespace storage
diff --git a/storage/browser/database/databases_table_unittest.cc b/storage/browser/database/databases_table_unittest.cc
index a2bd792..8a42041 100644
--- a/storage/browser/database/databases_table_unittest.cc
+++ b/storage/browser/database/databases_table_unittest.cc
@@ -4,6 +4,8 @@
#include <stddef.h>
+#include <string>
+
#include "base/bind.h"
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
@@ -15,10 +17,8 @@
#include "third_party/sqlite/sqlite3.h"
using base::ASCIIToUTF16;
-using storage::DatabaseDetails;
-using storage::DatabasesTable;
-namespace content {
+namespace storage {
static void CheckDetailsAreEqual(const DatabaseDetails& d1,
const DatabaseDetails& d2) {
@@ -145,4 +145,4 @@
ASSERT_TRUE(expecter.SawExpectedErrors());
}
-} // namespace content
+} // namespace storage
diff --git a/storage/browser/file_system/README.md b/storage/browser/file_system/README.md
index 3feda5ee..1e498f0 100644
--- a/storage/browser/file_system/README.md
+++ b/storage/browser/file_system/README.md
@@ -37,7 +37,7 @@
### External File Systems
External File Systems are only used by Chrome OS. A lot of the code for this
-(besides `storage::ExternalMountPoints` itself) lives in
+(besides `ExternalMountPoints` itself) lives in
[`//chrome/browser/chromeos/fileapi/`](../../../chrome/browser/chromeos/fileapi/).
TODO(mek): Document this more.
@@ -62,45 +62,45 @@
# Interesting Classes
-## `storage::FileSystemContext`
+## `FileSystemContext`
This is the main entry point for any interaction with the file system
subsystem. It is created (via `content::CreateFileSystemContext`) and owned
by each Storage Partition.
It owns:
- - Via `scoped_refptr` a optional `storage::ExternalMountPoints` instance to
+ - Via `scoped_refptr` a optional `ExternalMountPoints` instance to
deal with `BrowserContext` specific external file systems. Currently always
`nullptr`, except on Chrome OS.
- - A `storage::SandboxFileSystemBackendDelegate`. This is used by both the
+ - A `SandboxFileSystemBackendDelegate`. This is used by both the
backend for the regular sandboxed file system, and for the chrome extensions
specific "sync" file system.
- - Via `scoped_refptr` a bunch of `storage::FileSystemBackend` instances. These
+ - Via `scoped_refptr` a bunch of `FileSystemBackend` instances. These
are either created by the `FileSystemContext` itself (for sandbox, plugin
private, and isolated file systems) or passed in to constructor after
requesting the additional backends from the content embedder via
`ContentBrowserClient::GetAdditionalFileSystemBackends`.
And further more it references:
- - An ordered set of URL crackers (`storage::MountPoints` instances). This
+ - An ordered set of URL crackers (`MountPoints` instances). This
consists of the optional browser context specific `ExternalMountPoints`,
a global singleton `ExternalMountPoints` and finally a global singleton
`IsolatedContext`.
-## `storage::SandboxFileSystemBackend`
+## `SandboxFileSystemBackend`
The main entry point of support for sandboxed file systems. This class forwards
all operations to the `FileSystemContext` owned `SandboxFileSystemBackendDelegate`
instance, which does the actual work.
-### `storage::SandboxFileSystemBackendDelegate`
+### `SandboxFileSystemBackendDelegate`
The actual main entry point for sandboxed file systems, but as mentioned also
used for the Chrome Extensions specific sync file system.
-This class delegates operating on files to a `storage::ObfuscatedFileUtil`
+This class delegates operating on files to a `ObfuscatedFileUtil`
instance it owns (wrapped in a `AsyncFileUtilAdapter`).
It is however responsible for interacting with the quota system. In order to do that
@@ -109,7 +109,7 @@
in every directory for a origin/file system type containing the total disk usage of
that directory, and some extra meta data.
-### `storage::ObfuscatedFileUtil`
+### `ObfuscatedFileUtil`
This class uses several leveldb databases to translate virtual file paths given
by arbitrary untrusted apps to obfuscated file paths that are supported by the underlying
@@ -129,7 +129,7 @@
one that stores all the files in memory (for incognito mode) and one that stores
the files on disk inside the profile directory.
-## `storage::IsolatedContext`
+## `IsolatedContext`
This class keeps track of all currently registered Isolate File Systems. Isolated
file systems are identified by the hex encoding of 16 random bytes of data.
diff --git a/storage/browser/file_system/async_file_util.h b/storage/browser/file_system/async_file_util.h
index 6f4ef3c3..8528fad 100644
--- a/storage/browser/file_system/async_file_util.h
+++ b/storage/browser/file_system/async_file_util.h
@@ -68,11 +68,11 @@
using ReadDirectoryCallback = base::RepeatingCallback<
void(base::File::Error result, EntryList file_list, bool has_more)>;
- using CreateSnapshotFileCallback = base::OnceCallback<void(
- base::File::Error result,
- const base::File::Info& file_info,
- const base::FilePath& platform_path,
- scoped_refptr<storage::ShareableFileReference> file_ref)>;
+ using CreateSnapshotFileCallback =
+ base::OnceCallback<void(base::File::Error result,
+ const base::File::Info& file_info,
+ const base::FilePath& platform_path,
+ scoped_refptr<ShareableFileReference> file_ref)>;
using CopyFileProgressCallback = base::RepeatingCallback<void(int64_t size)>;
diff --git a/storage/browser/file_system/async_file_util_adapter.cc b/storage/browser/file_system/async_file_util_adapter.cc
index d9ce4c6..8dfc2cf5c 100644
--- a/storage/browser/file_system/async_file_util_adapter.cc
+++ b/storage/browser/file_system/async_file_util_adapter.cc
@@ -26,7 +26,6 @@
using base::Owned;
using base::Unretained;
-using storage::ShareableFileReference;
namespace storage {
@@ -96,7 +95,7 @@
base::File::Error error_;
base::File::Info file_info_;
base::FilePath platform_path_;
- storage::ScopedFile scoped_file_;
+ ScopedFile scoped_file_;
DISALLOW_COPY_AND_ASSIGN(GetFileInfoHelper);
};
diff --git a/storage/browser/file_system/copy_or_move_file_validator_unittest.cc b/storage/browser/file_system/copy_or_move_file_validator_unittest.cc
index 69150c8..43a0c91 100644
--- a/storage/browser/file_system/copy_or_move_file_validator_unittest.cc
+++ b/storage/browser/file_system/copy_or_move_file_validator_unittest.cc
@@ -4,6 +4,8 @@
#include <stddef.h>
#include <stdint.h>
+
+#include <memory>
#include <string>
#include <utility>
@@ -31,18 +33,12 @@
#include "testing/gtest/include/gtest/gtest.h"
#include "url/origin.h"
-using content::AsyncFileTestHelper;
-using storage::CopyOrMoveFileValidator;
-using storage::CopyOrMoveFileValidatorFactory;
-using storage::FileSystemURL;
-
-namespace content {
+namespace storage {
namespace {
-const storage::FileSystemType kNoValidatorType =
- storage::kFileSystemTypeTemporary;
-const storage::FileSystemType kWithValidatorType = storage::kFileSystemTypeTest;
+const FileSystemType kNoValidatorType = kFileSystemTypeTemporary;
+const FileSystemType kWithValidatorType = kFileSystemTypeTest;
void ExpectOk(const GURL& origin_url,
const std::string& name,
@@ -53,8 +49,8 @@
class CopyOrMoveFileValidatorTestHelper {
public:
CopyOrMoveFileValidatorTestHelper(const std::string& origin,
- storage::FileSystemType src_type,
- storage::FileSystemType dest_type)
+ FileSystemType src_type,
+ FileSystemType dest_type)
: origin_(url::Origin::Create(GURL(origin))),
src_type_(src_type),
dest_type_(dest_type) {}
@@ -71,18 +67,17 @@
file_system_context_ = CreateFileSystemContextForTesting(nullptr, base_dir);
// Set up TestFileSystemBackend to require CopyOrMoveFileValidator.
- storage::FileSystemBackend* test_file_system_backend =
+ FileSystemBackend* test_file_system_backend =
file_system_context_->GetFileSystemBackend(kWithValidatorType);
static_cast<TestFileSystemBackend*>(test_file_system_backend)
->set_require_copy_or_move_validator(true);
// Sets up source.
- storage::FileSystemBackend* src_file_system_backend =
+ FileSystemBackend* src_file_system_backend =
file_system_context_->GetFileSystemBackend(src_type_);
src_file_system_backend->ResolveURL(
FileSystemURL::CreateForTest(origin_, src_type_, base::FilePath()),
- storage::OPEN_FILE_SYSTEM_CREATE_IF_NONEXISTENT,
- base::BindOnce(&ExpectOk));
+ OPEN_FILE_SYSTEM_CREATE_IF_NONEXISTENT, base::BindOnce(&ExpectOk));
base::RunLoop().RunUntilIdle();
ASSERT_EQ(base::File::FILE_OK, CreateDirectory(SourceURL("")));
@@ -105,7 +100,7 @@
}
void SetMediaCopyOrMoveFileValidatorFactory(
- std::unique_ptr<storage::CopyOrMoveFileValidatorFactory> factory) {
+ std::unique_ptr<CopyOrMoveFileValidatorFactory> factory) {
TestFileSystemBackend* backend = static_cast<TestFileSystemBackend*>(
file_system_context_->GetFileSystemBackend(kWithValidatorType));
backend->InitializeCopyOrMoveFileValidatorFactory(std::move(factory));
@@ -177,13 +172,13 @@
const url::Origin origin_;
- const storage::FileSystemType src_type_;
- const storage::FileSystemType dest_type_;
+ const FileSystemType src_type_;
+ const FileSystemType dest_type_;
std::string src_fsid_;
std::string dest_fsid_;
base::test::TaskEnvironment task_environment_;
- scoped_refptr<storage::FileSystemContext> file_system_context_;
+ scoped_refptr<FileSystemContext> file_system_context_;
FileSystemURL copy_src_;
FileSystemURL copy_dest_;
@@ -197,7 +192,7 @@
enum Validity { VALID, PRE_WRITE_INVALID, POST_WRITE_INVALID };
class TestCopyOrMoveFileValidatorFactory
- : public storage::CopyOrMoveFileValidatorFactory {
+ : public CopyOrMoveFileValidatorFactory {
public:
// A factory that creates validators that accept everything or nothing.
// TODO(gbillock): switch args to enum or something
@@ -205,7 +200,7 @@
: validity_(validity) {}
~TestCopyOrMoveFileValidatorFactory() override = default;
- storage::CopyOrMoveFileValidator* CreateCopyOrMoveFileValidator(
+ CopyOrMoveFileValidator* CreateCopyOrMoveFileValidator(
const FileSystemURL& /*src_url*/,
const base::FilePath& /*platform_path*/) override {
return new TestCopyOrMoveFileValidator(validity_);
@@ -323,4 +318,4 @@
helper.MoveTest(base::File::FILE_ERROR_SECURITY);
}
-} // namespace content
+} // namespace storage
diff --git a/storage/browser/file_system/copy_or_move_operation_delegate.cc b/storage/browser/file_system/copy_or_move_operation_delegate.cc
index 6e017e2..94fbe068 100644
--- a/storage/browser/file_system/copy_or_move_operation_delegate.cc
+++ b/storage/browser/file_system/copy_or_move_operation_delegate.cc
@@ -131,7 +131,7 @@
base::File::Error error,
const base::File::Info& file_info,
const base::FilePath& platform_path,
- scoped_refptr<storage::ShareableFileReference> file_ref) {
+ scoped_refptr<ShareableFileReference> file_ref) {
if (cancel_requested_)
error = base::File::FILE_ERROR_ABORT;
@@ -162,7 +162,7 @@
void RunAfterPreWriteValidation(
const base::FilePath& platform_path,
const base::File::Info& file_info,
- scoped_refptr<storage::ShareableFileReference> file_ref,
+ scoped_refptr<ShareableFileReference> file_ref,
CopyOrMoveOperationDelegate::StatusCallback callback,
base::File::Error error) {
if (cancel_requested_)
@@ -184,7 +184,7 @@
void RunAfterCopyInForeignFile(
const base::File::Info& file_info,
- scoped_refptr<storage::ShareableFileReference> file_ref,
+ scoped_refptr<ShareableFileReference> file_ref,
CopyOrMoveOperationDelegate::StatusCallback callback,
base::File::Error error) {
if (cancel_requested_)
@@ -311,7 +311,7 @@
base::File::Error error,
const base::File::Info& file_info,
const base::FilePath& platform_path,
- scoped_refptr<storage::ShareableFileReference> file_ref) {
+ scoped_refptr<ShareableFileReference> file_ref) {
if (cancel_requested_)
error = base::File::FILE_ERROR_ABORT;
@@ -334,7 +334,7 @@
// |file_ref| is unused; it is passed here to make sure the reference is
// alive until after post-write validation is complete.
void DidPostWriteValidation(
- scoped_refptr<storage::ShareableFileReference> file_ref,
+ scoped_refptr<ShareableFileReference> file_ref,
CopyOrMoveOperationDelegate::StatusCallback callback,
base::File::Error error) {
std::move(callback).Run(error);
@@ -374,7 +374,7 @@
const FileSystemURL& src_url,
const FileSystemURL& dest_url,
CopyOrMoveOperationDelegate::CopyOrMoveOption option,
- std::unique_ptr<storage::FileStreamReader> reader,
+ std::unique_ptr<FileStreamReader> reader,
std::unique_ptr<FileStreamWriter> writer,
const FileSystemOperation::CopyFileProgressCallback&
file_progress_callback)
@@ -577,7 +577,7 @@
FileSystemURL src_url_;
FileSystemURL dest_url_;
CopyOrMoveOperationDelegate::CopyOrMoveOption option_;
- std::unique_ptr<storage::FileStreamReader> reader_;
+ std::unique_ptr<FileStreamReader> reader_;
std::unique_ptr<FileStreamWriter> writer_;
FileSystemOperation::CopyFileProgressCallback file_progress_callback_;
std::unique_ptr<CopyOrMoveOperationDelegate::StreamCopyHelper> copy_helper_;
@@ -589,9 +589,9 @@
} // namespace
CopyOrMoveOperationDelegate::StreamCopyHelper::StreamCopyHelper(
- std::unique_ptr<storage::FileStreamReader> reader,
+ std::unique_ptr<FileStreamReader> reader,
std::unique_ptr<FileStreamWriter> writer,
- storage::FlushPolicy flush_policy,
+ FlushPolicy flush_policy,
int buffer_size,
FileSystemOperation::CopyFileProgressCallback file_progress_callback,
const base::TimeDelta& min_progress_callback_invocation_span)
@@ -645,7 +645,7 @@
if (result == 0) {
// Here is the EOF.
- if (flush_policy_ == storage::FlushPolicy::FLUSH_ON_COMPLETION)
+ if (flush_policy_ == FlushPolicy::FLUSH_ON_COMPLETION)
Flush(true /* is_eof */);
else
std::move(completion_callback_).Run(base::File::FILE_OK);
@@ -696,7 +696,7 @@
return;
}
- if (flush_policy_ == storage::FlushPolicy::FLUSH_ON_COMPLETION &&
+ if (flush_policy_ == FlushPolicy::FLUSH_ON_COMPLETION &&
(num_copied_bytes_ - previous_flush_offset_) > kFlushIntervalInBytes) {
Flush(false /* not is_eof */);
} else {
@@ -814,9 +814,9 @@
}
if (!validator_factory) {
- std::unique_ptr<storage::FileStreamReader> reader =
+ std::unique_ptr<FileStreamReader> reader =
file_system_context()->CreateFileStreamReader(
- src_url, 0 /* offset */, storage::kMaximumLength, base::Time());
+ src_url, 0 /* offset */, kMaximumLength, base::Time());
std::unique_ptr<FileStreamWriter> writer =
file_system_context()->CreateFileStreamWriter(dest_url, 0);
if (reader && writer) {
diff --git a/storage/browser/file_system/copy_or_move_operation_delegate.h b/storage/browser/file_system/copy_or_move_operation_delegate.h
index e91bf10..3b709d2 100644
--- a/storage/browser/file_system/copy_or_move_operation_delegate.h
+++ b/storage/browser/file_system/copy_or_move_operation_delegate.h
@@ -22,13 +22,10 @@
} // namespace net
namespace storage {
+
class FileStreamReader;
-enum class FlushPolicy;
-} // namespace storage
-
-namespace storage {
-
class FileStreamWriter;
+enum class FlushPolicy;
// A delegate class for recursive copy or move operations.
class CopyOrMoveOperationDelegate : public RecursiveOperationDelegate {
@@ -45,7 +42,7 @@
class COMPONENT_EXPORT(STORAGE_BROWSER) StreamCopyHelper {
public:
StreamCopyHelper(
- std::unique_ptr<storage::FileStreamReader> reader,
+ std::unique_ptr<FileStreamReader> reader,
std::unique_ptr<FileStreamWriter> writer,
FlushPolicy flush_policy,
int buffer_size,
@@ -72,7 +69,7 @@
void Flush(bool is_eof);
void DidFlush(bool is_eof, int result);
- std::unique_ptr<storage::FileStreamReader> reader_;
+ std::unique_ptr<FileStreamReader> reader_;
std::unique_ptr<FileStreamWriter> writer_;
const FlushPolicy flush_policy_;
FileSystemOperation::CopyFileProgressCallback file_progress_callback_;
diff --git a/storage/browser/file_system/copy_or_move_operation_delegate_unittest.cc b/storage/browser/file_system/copy_or_move_operation_delegate_unittest.cc
index 704f17f8..59a0b48d 100644
--- a/storage/browser/file_system/copy_or_move_operation_delegate_unittest.cc
+++ b/storage/browser/file_system/copy_or_move_operation_delegate_unittest.cc
@@ -43,15 +43,9 @@
#include "testing/gtest/include/gtest/gtest.h"
#include "url/origin.h"
-using content::AsyncFileTestHelper;
-using storage::CopyOrMoveOperationDelegate;
-using storage::FileStreamWriter;
-using storage::FileSystemOperation;
-using storage::FileSystemURL;
+namespace storage {
-namespace content {
-
-using FileEntryList = storage::FileSystemOperation::FileEntryList;
+using FileEntryList = FileSystemOperation::FileEntryList;
namespace {
@@ -61,13 +55,13 @@
ASSERT_EQ(base::File::FILE_OK, error);
}
-class TestValidatorFactory : public storage::CopyOrMoveFileValidatorFactory {
+class TestValidatorFactory : public CopyOrMoveFileValidatorFactory {
public:
// A factory that creates validators that accept everything or nothing.
TestValidatorFactory() = default;
~TestValidatorFactory() override = default;
- storage::CopyOrMoveFileValidator* CreateCopyOrMoveFileValidator(
+ CopyOrMoveFileValidator* CreateCopyOrMoveFileValidator(
const FileSystemURL& /*src_url*/,
const base::FilePath& /*platform_path*/) override {
// Move arg management to TestValidator?
@@ -75,7 +69,7 @@
}
private:
- class TestValidator : public storage::CopyOrMoveFileValidator {
+ class TestValidator : public CopyOrMoveFileValidator {
public:
explicit TestValidator(bool pre_copy_valid,
bool post_copy_valid,
@@ -116,14 +110,14 @@
// Records CopyProgressCallback invocations.
struct ProgressRecord {
- storage::FileSystemOperation::CopyProgressType type;
+ FileSystemOperation::CopyProgressType type;
FileSystemURL source_url;
FileSystemURL dest_url;
int64_t size;
};
void RecordProgressCallback(std::vector<ProgressRecord>* records,
- storage::FileSystemOperation::CopyProgressType type,
+ FileSystemOperation::CopyProgressType type,
const FileSystemURL& source_url,
const FileSystemURL& dest_url,
int64_t size) {
@@ -149,7 +143,7 @@
class ScopedThreadStopper {
public:
- ScopedThreadStopper(base::Thread* thread) : thread_(thread) {}
+ explicit ScopedThreadStopper(base::Thread* thread) : thread_(thread) {}
~ScopedThreadStopper() {
if (thread_) {
@@ -174,8 +168,8 @@
class CopyOrMoveOperationTestHelper {
public:
CopyOrMoveOperationTestHelper(const std::string& origin,
- storage::FileSystemType src_type,
- storage::FileSystemType dest_type)
+ FileSystemType src_type,
+ FileSystemType dest_type)
: origin_(url::Origin::Create(GURL(origin))),
src_type_(src_type),
dest_type_(dest_type),
@@ -207,17 +201,16 @@
CreateFileSystemContextForTesting(quota_manager_proxy_.get(), base_dir);
// Prepare the origin's root directory.
- storage::FileSystemBackend* backend =
+ FileSystemBackend* backend =
file_system_context_->GetFileSystemBackend(src_type_);
backend->ResolveURL(
FileSystemURL::CreateForTest(origin_, src_type_, base::FilePath()),
- storage::OPEN_FILE_SYSTEM_CREATE_IF_NONEXISTENT,
- base::BindOnce(&ExpectOk));
+ OPEN_FILE_SYSTEM_CREATE_IF_NONEXISTENT, base::BindOnce(&ExpectOk));
backend = file_system_context_->GetFileSystemBackend(dest_type_);
- if (dest_type_ == storage::kFileSystemTypeTest) {
+ if (dest_type_ == kFileSystemTypeTest) {
TestFileSystemBackend* test_backend =
static_cast<TestFileSystemBackend*>(backend);
- std::unique_ptr<storage::CopyOrMoveFileValidatorFactory> factory(
+ std::unique_ptr<CopyOrMoveFileValidatorFactory> factory(
new TestValidatorFactory);
test_backend->set_require_copy_or_move_validator(
require_copy_or_move_validator);
@@ -227,17 +220,14 @@
}
backend->ResolveURL(
FileSystemURL::CreateForTest(origin_, dest_type_, base::FilePath()),
- storage::OPEN_FILE_SYSTEM_CREATE_IF_NONEXISTENT,
- base::BindOnce(&ExpectOk));
+ OPEN_FILE_SYSTEM_CREATE_IF_NONEXISTENT, base::BindOnce(&ExpectOk));
task_environment_.RunUntilIdle();
// Grant relatively big quota initially.
quota_manager_->SetQuota(
- origin_, storage::FileSystemTypeToQuotaStorageType(src_type_),
- 1024 * 1024);
+ origin_, FileSystemTypeToQuotaStorageType(src_type_), 1024 * 1024);
quota_manager_->SetQuota(
- origin_, storage::FileSystemTypeToQuotaStorageType(dest_type_),
- 1024 * 1024);
+ origin_, FileSystemTypeToQuotaStorageType(dest_type_), 1024 * 1024);
}
int64_t GetSourceUsage() {
@@ -371,9 +361,7 @@
}
private:
- void GetUsageAndQuota(storage::FileSystemType type,
- int64_t* usage,
- int64_t* quota) {
+ void GetUsageAndQuota(FileSystemType type, int64_t* usage, int64_t* quota) {
blink::mojom::QuotaStatusCode status =
AsyncFileTestHelper::GetUsageAndQuota(quota_manager_.get(), origin_,
type, usage, quota);
@@ -384,11 +372,11 @@
base::ScopedTempDir base_;
const url::Origin origin_;
- const storage::FileSystemType src_type_;
- const storage::FileSystemType dest_type_;
+ const FileSystemType src_type_;
+ const FileSystemType dest_type_;
base::test::TaskEnvironment task_environment_;
- scoped_refptr<storage::FileSystemContext> file_system_context_;
+ scoped_refptr<FileSystemContext> file_system_context_;
scoped_refptr<MockQuotaManagerProxy> quota_manager_proxy_;
scoped_refptr<MockQuotaManager> quota_manager_;
@@ -396,9 +384,8 @@
};
TEST(LocalFileSystemCopyOrMoveOperationTest, CopySingleFile) {
- CopyOrMoveOperationTestHelper helper("http://foo",
- storage::kFileSystemTypeTemporary,
- storage::kFileSystemTypePersistent);
+ CopyOrMoveOperationTestHelper helper("http://foo", kFileSystemTypeTemporary,
+ kFileSystemTypePersistent);
helper.SetUp();
FileSystemURL src = helper.SourceURL("a");
@@ -425,9 +412,8 @@
}
TEST(LocalFileSystemCopyOrMoveOperationTest, MoveSingleFile) {
- CopyOrMoveOperationTestHelper helper("http://foo",
- storage::kFileSystemTypeTemporary,
- storage::kFileSystemTypePersistent);
+ CopyOrMoveOperationTestHelper helper("http://foo", kFileSystemTypeTemporary,
+ kFileSystemTypePersistent);
helper.SetUp();
FileSystemURL src = helper.SourceURL("a");
@@ -454,9 +440,8 @@
}
TEST(LocalFileSystemCopyOrMoveOperationTest, CopySingleDirectory) {
- CopyOrMoveOperationTestHelper helper("http://foo",
- storage::kFileSystemTypeTemporary,
- storage::kFileSystemTypePersistent);
+ CopyOrMoveOperationTestHelper helper("http://foo", kFileSystemTypeTemporary,
+ kFileSystemTypePersistent);
helper.SetUp();
FileSystemURL src = helper.SourceURL("a");
@@ -483,9 +468,8 @@
}
TEST(LocalFileSystemCopyOrMoveOperationTest, MoveSingleDirectory) {
- CopyOrMoveOperationTestHelper helper("http://foo",
- storage::kFileSystemTypeTemporary,
- storage::kFileSystemTypePersistent);
+ CopyOrMoveOperationTestHelper helper("http://foo", kFileSystemTypeTemporary,
+ kFileSystemTypePersistent);
helper.SetUp();
FileSystemURL src = helper.SourceURL("a");
@@ -512,9 +496,8 @@
}
TEST(LocalFileSystemCopyOrMoveOperationTest, CopyDirectory) {
- CopyOrMoveOperationTestHelper helper("http://foo",
- storage::kFileSystemTypeTemporary,
- storage::kFileSystemTypePersistent);
+ CopyOrMoveOperationTestHelper helper("http://foo", kFileSystemTypeTemporary,
+ kFileSystemTypePersistent);
helper.SetUp();
FileSystemURL src = helper.SourceURL("a");
@@ -549,9 +532,8 @@
}
TEST(LocalFileSystemCopyOrMoveOperationTest, MoveDirectory) {
- CopyOrMoveOperationTestHelper helper("http://foo",
- storage::kFileSystemTypeTemporary,
- storage::kFileSystemTypePersistent);
+ CopyOrMoveOperationTestHelper helper("http://foo", kFileSystemTypeTemporary,
+ kFileSystemTypePersistent);
helper.SetUp();
FileSystemURL src = helper.SourceURL("a");
@@ -585,9 +567,8 @@
TEST(LocalFileSystemCopyOrMoveOperationTest,
MoveDirectoryFailPostWriteValidation) {
- CopyOrMoveOperationTestHelper helper("http://foo",
- storage::kFileSystemTypeTemporary,
- storage::kFileSystemTypeTest);
+ CopyOrMoveOperationTestHelper helper("http://foo", kFileSystemTypeTemporary,
+ kFileSystemTypeTest);
helper.SetUp();
FileSystemURL src = helper.SourceURL("a");
@@ -618,9 +599,8 @@
}
TEST(LocalFileSystemCopyOrMoveOperationTest, CopySingleFileNoValidator) {
- CopyOrMoveOperationTestHelper helper("http://foo",
- storage::kFileSystemTypeTemporary,
- storage::kFileSystemTypeTest);
+ CopyOrMoveOperationTestHelper helper("http://foo", kFileSystemTypeTemporary,
+ kFileSystemTypeTest);
helper.SetUpNoValidator();
FileSystemURL src = helper.SourceURL("a");
@@ -636,9 +616,8 @@
}
TEST(LocalFileSystemCopyOrMoveOperationTest, ProgressCallback) {
- CopyOrMoveOperationTestHelper helper("http://foo",
- storage::kFileSystemTypeTemporary,
- storage::kFileSystemTypePersistent);
+ CopyOrMoveOperationTestHelper helper("http://foo", kFileSystemTypeTemporary,
+ kFileSystemTypePersistent);
helper.SetUp();
FileSystemURL src = helper.SourceURL("a");
@@ -724,9 +703,9 @@
scoped_refptr<base::SingleThreadTaskRunner> task_runner =
file_thread.task_runner();
- std::unique_ptr<storage::FileStreamReader> reader =
- storage::FileStreamReader::CreateForLocalFile(
- task_runner.get(), source_path, 0, base::Time());
+ std::unique_ptr<FileStreamReader> reader =
+ FileStreamReader::CreateForLocalFile(task_runner.get(), source_path, 0,
+ base::Time());
std::unique_ptr<FileStreamWriter> writer =
FileStreamWriter::CreateForLocalFile(task_runner.get(), dest_path, 0,
@@ -734,8 +713,7 @@
std::vector<int64_t> progress;
CopyOrMoveOperationDelegate::StreamCopyHelper helper(
- std::move(reader), std::move(writer),
- storage::FlushPolicy::NO_FLUSH_ON_COMPLETION,
+ std::move(reader), std::move(writer), FlushPolicy::NO_FLUSH_ON_COMPLETION,
10, // buffer size
base::BindRepeating(&RecordFileProgressCallback,
base::Unretained(&progress)),
@@ -782,9 +760,9 @@
scoped_refptr<base::SingleThreadTaskRunner> task_runner =
file_thread.task_runner();
- std::unique_ptr<storage::FileStreamReader> reader =
- storage::FileStreamReader::CreateForLocalFile(
- task_runner.get(), source_path, 0, base::Time());
+ std::unique_ptr<FileStreamReader> reader =
+ FileStreamReader::CreateForLocalFile(task_runner.get(), source_path, 0,
+ base::Time());
std::unique_ptr<FileStreamWriter> writer =
FileStreamWriter::CreateForLocalFile(task_runner.get(), dest_path, 0,
@@ -792,8 +770,7 @@
std::vector<int64_t> progress;
CopyOrMoveOperationDelegate::StreamCopyHelper helper(
- std::move(reader), std::move(writer),
- storage::FlushPolicy::NO_FLUSH_ON_COMPLETION,
+ std::move(reader), std::move(writer), FlushPolicy::NO_FLUSH_ON_COMPLETION,
10, // buffer size
base::BindRepeating(&RecordFileProgressCallback,
base::Unretained(&progress)),
@@ -836,9 +813,9 @@
scoped_refptr<base::SingleThreadTaskRunner> task_runner =
file_thread.task_runner();
- std::unique_ptr<storage::FileStreamReader> reader =
- storage::FileStreamReader::CreateForLocalFile(
- task_runner.get(), source_path, 0, base::Time());
+ std::unique_ptr<FileStreamReader> reader =
+ FileStreamReader::CreateForLocalFile(task_runner.get(), source_path, 0,
+ base::Time());
std::unique_ptr<FileStreamWriter> writer =
FileStreamWriter::CreateForLocalFile(task_runner.get(), dest_path, 0,
@@ -846,8 +823,7 @@
std::vector<int64_t> progress;
CopyOrMoveOperationDelegate::StreamCopyHelper helper(
- std::move(reader), std::move(writer),
- storage::FlushPolicy::NO_FLUSH_ON_COMPLETION,
+ std::move(reader), std::move(writer), FlushPolicy::NO_FLUSH_ON_COMPLETION,
10, // buffer size
base::BindRepeating(&RecordFileProgressCallback,
base::Unretained(&progress)),
@@ -867,4 +843,4 @@
EXPECT_EQ(base::File::FILE_ERROR_ABORT, error);
}
-} // namespace content
+} // namespace storage
diff --git a/storage/browser/file_system/dragged_file_util_unittest.cc b/storage/browser/file_system/dragged_file_util_unittest.cc
index f9d1220..7dae7f3 100644
--- a/storage/browser/file_system/dragged_file_util_unittest.cc
+++ b/storage/browser/file_system/dragged_file_util_unittest.cc
@@ -33,13 +33,7 @@
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
-using content::AsyncFileTestHelper;
-using storage::FileSystemContext;
-using storage::FileSystemOperationContext;
-using storage::FileSystemType;
-using storage::FileSystemURL;
-
-namespace content {
+namespace storage {
namespace {
@@ -104,7 +98,7 @@
void SetUp() override {
ASSERT_TRUE(data_dir_.CreateUniqueTempDir());
ASSERT_TRUE(partition_dir_.CreateUniqueTempDir());
- file_util_.reset(new storage::DraggedFileUtil());
+ file_util_ = std::make_unique<DraggedFileUtil>();
// Register the files/directories of RegularTestCases (with random
// root paths) as dropped files.
@@ -121,14 +115,14 @@
}
protected:
- storage::IsolatedContext* isolated_context() const {
- return storage::IsolatedContext::GetInstance();
+ IsolatedContext* isolated_context() const {
+ return IsolatedContext::GetInstance();
}
const base::FilePath& root_path() const { return data_dir_.GetPath(); }
FileSystemContext* file_system_context() const {
return file_system_context_.get();
}
- storage::FileSystemFileUtil* file_util() const { return file_util_.get(); }
+ FileSystemFileUtil* file_util() const { return file_util_.get(); }
std::string filesystem_id() const { return filesystem_id_; }
base::FilePath GetTestCasePlatformPath(
@@ -149,13 +143,12 @@
base::FilePath virtual_path =
isolated_context()->CreateVirtualRootPath(filesystem_id()).Append(path);
return file_system_context_->CreateCrackedFileSystemURL(
- GURL("http://example.com"), storage::kFileSystemTypeIsolated,
- virtual_path);
+ GURL("http://example.com"), kFileSystemTypeIsolated, virtual_path);
}
FileSystemURL GetOtherFileSystemURL(const base::FilePath& path) const {
return file_system_context()->CreateCrackedFileSystemURL(
- GURL("http://example.com"), storage::kFileSystemTypeTemporary,
+ GURL("http://example.com"), kFileSystemTypeTemporary,
base::FilePath().AppendASCII("dest").Append(path));
}
@@ -243,16 +236,15 @@
}
}
- std::unique_ptr<storage::FileSystemOperationContext> GetOperationContext() {
- return std::make_unique<storage::FileSystemOperationContext>(
- file_system_context());
+ std::unique_ptr<FileSystemOperationContext> GetOperationContext() {
+ return std::make_unique<FileSystemOperationContext>(file_system_context());
}
private:
void SimulateDropFiles() {
size_t root_path_index = 0;
- storage::IsolatedContext::FileInfoSet toplevels;
+ IsolatedContext::FileInfoSet toplevels;
for (size_t i = 0; i < kRegularFileSystemTestCaseSize; ++i) {
const FileSystemTestCaseRecord& test_case =
kRegularFileSystemTestCases[i];
@@ -282,7 +274,7 @@
std::string filesystem_id_;
scoped_refptr<FileSystemContext> file_system_context_;
std::map<base::FilePath, base::FilePath> toplevel_root_map_;
- std::unique_ptr<storage::DraggedFileUtil> file_util_;
+ std::unique_ptr<DraggedFileUtil> file_util_;
DISALLOW_COPY_AND_ASSIGN(DraggedFileUtilTest);
};
@@ -600,4 +592,4 @@
.NormalizePathSeparators()));
}
-} // namespace content
+} // namespace storage
diff --git a/storage/browser/file_system/external_mount_points.cc b/storage/browser/file_system/external_mount_points.cc
index 92e5231..22ed0f7 100644
--- a/storage/browser/file_system/external_mount_points.cc
+++ b/storage/browser/file_system/external_mount_points.cc
@@ -5,12 +5,15 @@
#include "storage/browser/file_system/external_mount_points.h"
#include <memory>
+#include <utility>
#include "base/files/file_path.h"
#include "base/lazy_instance.h"
#include "base/macros.h"
#include "storage/browser/file_system/file_system_url.h"
+namespace storage {
+
namespace {
// Normalizes file path so it has normalized separators and ends with exactly
@@ -31,9 +34,9 @@
return base::FilePath(path_str).NormalizePathSeparators();
}
-bool IsOverlappingMountPathForbidden(storage::FileSystemType type) {
- return type != storage::kFileSystemTypeNativeMedia &&
- type != storage::kFileSystemTypeDeviceMedia;
+bool IsOverlappingMountPathForbidden(FileSystemType type) {
+ return type != kFileSystemTypeNativeMedia &&
+ type != kFileSystemTypeDeviceMedia;
}
// Wrapper around ref-counted ExternalMountPoints that will be used to lazily
@@ -41,15 +44,14 @@
class SystemMountPointsLazyWrapper {
public:
SystemMountPointsLazyWrapper()
- : system_mount_points_(storage::ExternalMountPoints::CreateRefCounted()) {
- }
+ : system_mount_points_(ExternalMountPoints::CreateRefCounted()) {}
~SystemMountPointsLazyWrapper() = default;
- storage::ExternalMountPoints* get() { return system_mount_points_.get(); }
+ ExternalMountPoints* get() { return system_mount_points_.get(); }
private:
- scoped_refptr<storage::ExternalMountPoints> system_mount_points_;
+ scoped_refptr<ExternalMountPoints> system_mount_points_;
};
base::LazyInstance<SystemMountPointsLazyWrapper>::Leaky
@@ -57,8 +59,6 @@
} // namespace
-namespace storage {
-
class ExternalMountPoints::Instance {
public:
Instance(FileSystemType type,
@@ -236,7 +236,7 @@
const std::string& mount_name,
const base::FilePath& path) const {
return CreateCrackedFileSystemURL(
- origin, storage::kFileSystemTypeExternal,
+ origin, kFileSystemTypeExternal,
// Avoid using FilePath::Append as path may be an absolute path.
base::FilePath(CreateVirtualRootPath(mount_name).value() +
base::FilePath::kSeparators[0] + path.value()));
diff --git a/storage/browser/file_system/external_mount_points_unittest.cc b/storage/browser/file_system/external_mount_points_unittest.cc
index 96792774..7911a42 100644
--- a/storage/browser/file_system/external_mount_points_unittest.cc
+++ b/storage/browser/file_system/external_mount_points_unittest.cc
@@ -23,13 +23,11 @@
#define DRIVE
#endif
-using storage::FileSystemURL;
-
-namespace content {
+namespace storage {
TEST(ExternalMountPointsTest, AddMountPoint) {
- scoped_refptr<storage::ExternalMountPoints> mount_points(
- storage::ExternalMountPoints::CreateRefCounted());
+ scoped_refptr<ExternalMountPoints> mount_points =
+ ExternalMountPoints::CreateRefCounted();
struct TestCase {
// The mount point's name.
@@ -114,8 +112,8 @@
for (const auto& test : kTestCases) {
EXPECT_EQ(test.success,
mount_points->RegisterFileSystem(
- test.name, storage::kFileSystemTypeNativeLocal,
- storage::FileSystemMountOption(), base::FilePath(test.path)))
+ test.name, kFileSystemTypeNativeLocal,
+ FileSystemMountOption(), base::FilePath(test.path)))
<< "Adding mount point: " << test.name << " with path " << test.path;
}
@@ -134,30 +132,29 @@
}
TEST(ExternalMountPointsTest, GetVirtualPath) {
- scoped_refptr<storage::ExternalMountPoints> mount_points(
- storage::ExternalMountPoints::CreateRefCounted());
+ scoped_refptr<ExternalMountPoints> mount_points =
+ ExternalMountPoints::CreateRefCounted();
- mount_points->RegisterFileSystem("c", storage::kFileSystemTypeNativeLocal,
- storage::FileSystemMountOption(),
+ mount_points->RegisterFileSystem("c", kFileSystemTypeNativeLocal,
+ FileSystemMountOption(),
base::FilePath(DRIVE FPL("/a/b/c")));
// Note that "/a/b/c" < "/a/b/c(1)" < "/a/b/c/".
- mount_points->RegisterFileSystem("c(1)", storage::kFileSystemTypeNativeLocal,
- storage::FileSystemMountOption(),
+ mount_points->RegisterFileSystem("c(1)", kFileSystemTypeNativeLocal,
+ FileSystemMountOption(),
base::FilePath(DRIVE FPL("/a/b/c(1)")));
- mount_points->RegisterFileSystem("x", storage::kFileSystemTypeNativeLocal,
- storage::FileSystemMountOption(),
+ mount_points->RegisterFileSystem("x", kFileSystemTypeNativeLocal,
+ FileSystemMountOption(),
base::FilePath(DRIVE FPL("/z/y/x")));
- mount_points->RegisterFileSystem("o", storage::kFileSystemTypeNativeLocal,
- storage::FileSystemMountOption(),
+ mount_points->RegisterFileSystem("o", kFileSystemTypeNativeLocal,
+ FileSystemMountOption(),
base::FilePath(DRIVE FPL("/m/n/o")));
// A mount point whose name does not match its path base name.
- mount_points->RegisterFileSystem("mount", storage::kFileSystemTypeNativeLocal,
- storage::FileSystemMountOption(),
+ mount_points->RegisterFileSystem("mount", kFileSystemTypeNativeLocal,
+ FileSystemMountOption(),
base::FilePath(DRIVE FPL("/root/foo")));
// A mount point with an empty path.
- mount_points->RegisterFileSystem(
- "empty_path", storage::kFileSystemTypeNativeLocal,
- storage::FileSystemMountOption(), base::FilePath());
+ mount_points->RegisterFileSystem("empty_path", kFileSystemTypeNativeLocal,
+ FileSystemMountOption(), base::FilePath());
struct TestCase {
const base::FilePath::CharType* const local_path;
@@ -230,54 +227,52 @@
}
TEST(ExternalMountPointsTest, HandlesFileSystemMountType) {
- scoped_refptr<storage::ExternalMountPoints> mount_points(
- storage::ExternalMountPoints::CreateRefCounted());
+ scoped_refptr<ExternalMountPoints> mount_points =
+ ExternalMountPoints::CreateRefCounted();
const GURL test_origin("http://chromium.org");
const base::FilePath test_path(FPL("/mount"));
// Should handle External File System.
- EXPECT_TRUE(mount_points->HandlesFileSystemMountType(
- storage::kFileSystemTypeExternal));
+ EXPECT_TRUE(
+ mount_points->HandlesFileSystemMountType(kFileSystemTypeExternal));
// Shouldn't handle the rest.
- EXPECT_FALSE(mount_points->HandlesFileSystemMountType(
- storage::kFileSystemTypeIsolated));
- EXPECT_FALSE(mount_points->HandlesFileSystemMountType(
- storage::kFileSystemTypeTemporary));
- EXPECT_FALSE(mount_points->HandlesFileSystemMountType(
- storage::kFileSystemTypePersistent));
EXPECT_FALSE(
- mount_points->HandlesFileSystemMountType(storage::kFileSystemTypeTest));
+ mount_points->HandlesFileSystemMountType(kFileSystemTypeIsolated));
+ EXPECT_FALSE(
+ mount_points->HandlesFileSystemMountType(kFileSystemTypeTemporary));
+ EXPECT_FALSE(
+ mount_points->HandlesFileSystemMountType(kFileSystemTypePersistent));
+ EXPECT_FALSE(mount_points->HandlesFileSystemMountType(kFileSystemTypeTest));
// Not even if it's external subtype.
+ EXPECT_FALSE(
+ mount_points->HandlesFileSystemMountType(kFileSystemTypeNativeLocal));
EXPECT_FALSE(mount_points->HandlesFileSystemMountType(
- storage::kFileSystemTypeNativeLocal));
- EXPECT_FALSE(mount_points->HandlesFileSystemMountType(
- storage::kFileSystemTypeRestrictedNativeLocal));
- EXPECT_FALSE(mount_points->HandlesFileSystemMountType(
- storage::kFileSystemTypeDriveFs));
- EXPECT_FALSE(mount_points->HandlesFileSystemMountType(
- storage::kFileSystemTypeSyncable));
+ kFileSystemTypeRestrictedNativeLocal));
+ EXPECT_FALSE(
+ mount_points->HandlesFileSystemMountType(kFileSystemTypeDriveFs));
+ EXPECT_FALSE(
+ mount_points->HandlesFileSystemMountType(kFileSystemTypeSyncable));
}
TEST(ExternalMountPointsTest, CreateCrackedFileSystemURL) {
- scoped_refptr<storage::ExternalMountPoints> mount_points(
- storage::ExternalMountPoints::CreateRefCounted());
+ scoped_refptr<ExternalMountPoints> mount_points =
+ ExternalMountPoints::CreateRefCounted();
const url::Origin kTestOrigin =
url::Origin::Create(GURL("http://chromium.org"));
- mount_points->RegisterFileSystem("c", storage::kFileSystemTypeNativeLocal,
- storage::FileSystemMountOption(),
+ mount_points->RegisterFileSystem("c", kFileSystemTypeNativeLocal,
+ FileSystemMountOption(),
base::FilePath(DRIVE FPL("/a/b/c")));
- mount_points->RegisterFileSystem("c(1)", storage::kFileSystemTypeDriveFs,
- storage::FileSystemMountOption(),
+ mount_points->RegisterFileSystem("c(1)", kFileSystemTypeDriveFs,
+ FileSystemMountOption(),
base::FilePath(DRIVE FPL("/a/b/c(1)")));
- mount_points->RegisterFileSystem(
- "empty_path", storage::kFileSystemTypeSyncable,
- storage::FileSystemMountOption(), base::FilePath());
- mount_points->RegisterFileSystem("mount", storage::kFileSystemTypeDriveFs,
- storage::FileSystemMountOption(),
+ mount_points->RegisterFileSystem("empty_path", kFileSystemTypeSyncable,
+ FileSystemMountOption(), base::FilePath());
+ mount_points->RegisterFileSystem("mount", kFileSystemTypeDriveFs,
+ FileSystemMountOption(),
base::FilePath(DRIVE FPL("/root")));
// Try cracking invalid GURL.
@@ -286,60 +281,55 @@
// Try cracking isolated path.
FileSystemURL isolated = mount_points->CreateCrackedFileSystemURL(
- kTestOrigin, storage::kFileSystemTypeIsolated, base::FilePath(FPL("c")));
+ kTestOrigin, kFileSystemTypeIsolated, base::FilePath(FPL("c")));
EXPECT_FALSE(isolated.is_valid());
// Try native local which is not cracked.
FileSystemURL native_local = mount_points->CreateCrackedFileSystemURL(
- kTestOrigin, storage::kFileSystemTypeNativeLocal,
- base::FilePath(FPL("c")));
+ kTestOrigin, kFileSystemTypeNativeLocal, base::FilePath(FPL("c")));
EXPECT_FALSE(native_local.is_valid());
struct TestCase {
const base::FilePath::CharType* const path;
bool expect_valid;
- storage::FileSystemType expect_type;
+ FileSystemType expect_type;
const base::FilePath::CharType* const expect_path;
const char* const expect_fs_id;
};
const TestCase kTestCases[] = {
- {FPL("c/d/e"), true, storage::kFileSystemTypeNativeLocal,
- DRIVE FPL("/a/b/c/d/e"), "c"},
- {FPL("c(1)/d/e"), true, storage::kFileSystemTypeDriveFs,
- DRIVE FPL("/a/b/c(1)/d/e"), "c(1)"},
- {FPL("c(1)"), true, storage::kFileSystemTypeDriveFs, DRIVE FPL("/a/b/c(1)"),
+ {FPL("c/d/e"), true, kFileSystemTypeNativeLocal, DRIVE FPL("/a/b/c/d/e"),
+ "c"},
+ {FPL("c(1)/d/e"), true, kFileSystemTypeDriveFs, DRIVE FPL("/a/b/c(1)/d/e"),
"c(1)"},
- {FPL("empty_path/a"), true, storage::kFileSystemTypeSyncable, FPL("a"),
+ {FPL("c(1)"), true, kFileSystemTypeDriveFs, DRIVE FPL("/a/b/c(1)"), "c(1)"},
+ {FPL("empty_path/a"), true, kFileSystemTypeSyncable, FPL("a"),
"empty_path"},
- {FPL("empty_path"), true, storage::kFileSystemTypeSyncable, FPL(""),
- "empty_path"},
- {FPL("mount/a/b"), true, storage::kFileSystemTypeDriveFs,
- DRIVE FPL("/root/a/b"), "mount"},
- {FPL("mount"), true, storage::kFileSystemTypeDriveFs, DRIVE FPL("/root"),
+ {FPL("empty_path"), true, kFileSystemTypeSyncable, FPL(""), "empty_path"},
+ {FPL("mount/a/b"), true, kFileSystemTypeDriveFs, DRIVE FPL("/root/a/b"),
"mount"},
- {FPL("cc"), false, storage::kFileSystemTypeUnknown, FPL(""), ""},
- {FPL(""), false, storage::kFileSystemTypeUnknown, FPL(""), ""},
- {FPL(".."), false, storage::kFileSystemTypeUnknown, FPL(""), ""},
- // Absolte paths.
- {FPL("/c/d/e"), false, storage::kFileSystemTypeUnknown, FPL(""), ""},
- {FPL("/c(1)/d/e"), false, storage::kFileSystemTypeUnknown, FPL(""), ""},
- {FPL("/empty_path"), false, storage::kFileSystemTypeUnknown, FPL(""), ""},
+ {FPL("mount"), true, kFileSystemTypeDriveFs, DRIVE FPL("/root"), "mount"},
+ {FPL("cc"), false, kFileSystemTypeUnknown, FPL(""), ""},
+ {FPL(""), false, kFileSystemTypeUnknown, FPL(""), ""},
+ {FPL(".."), false, kFileSystemTypeUnknown, FPL(""), ""},
+ // Absolute paths.
+ {FPL("/c/d/e"), false, kFileSystemTypeUnknown, FPL(""), ""},
+ {FPL("/c(1)/d/e"), false, kFileSystemTypeUnknown, FPL(""), ""},
+ {FPL("/empty_path"), false, kFileSystemTypeUnknown, FPL(""), ""},
// PAth references parent.
- {FPL("c/d/../e"), false, storage::kFileSystemTypeUnknown, FPL(""), ""},
- {FPL("/empty_path/a/../b"), false, storage::kFileSystemTypeUnknown, FPL(""),
- ""},
+ {FPL("c/d/../e"), false, kFileSystemTypeUnknown, FPL(""), ""},
+ {FPL("/empty_path/a/../b"), false, kFileSystemTypeUnknown, FPL(""), ""},
#if defined(FILE_PATH_USES_WIN_SEPARATORS)
- {FPL("c/d\\e"), true, storage::kFileSystemTypeNativeLocal,
- DRIVE FPL("/a/b/c/d/e"), "c"},
- {FPL("mount\\a\\b"), true, storage::kFileSystemTypeDriveFs,
- DRIVE FPL("/root/a/b"), "mount"},
+ {FPL("c/d\\e"), true, kFileSystemTypeNativeLocal, DRIVE FPL("/a/b/c/d/e"),
+ "c"},
+ {FPL("mount\\a\\b"), true, kFileSystemTypeDriveFs, DRIVE FPL("/root/a/b"),
+ "mount"},
#endif
};
for (size_t i = 0; i < base::size(kTestCases); ++i) {
FileSystemURL cracked = mount_points->CreateCrackedFileSystemURL(
- kTestOrigin, storage::kFileSystemTypeExternal,
+ kTestOrigin, kFileSystemTypeExternal,
base::FilePath(kTestCases[i].path));
EXPECT_EQ(kTestCases[i].expect_valid, cracked.is_valid())
@@ -360,78 +350,73 @@
<< "Test case index: " << i;
EXPECT_EQ(kTestCases[i].expect_fs_id, cracked.filesystem_id())
<< "Test case index: " << i;
- EXPECT_EQ(storage::kFileSystemTypeExternal, cracked.mount_type())
+ EXPECT_EQ(kFileSystemTypeExternal, cracked.mount_type())
<< "Test case index: " << i;
}
}
TEST(ExternalMountPointsTest, CrackVirtualPath) {
- scoped_refptr<storage::ExternalMountPoints> mount_points(
- storage::ExternalMountPoints::CreateRefCounted());
+ scoped_refptr<ExternalMountPoints> mount_points =
+ ExternalMountPoints::CreateRefCounted();
const GURL kTestOrigin("http://chromium.org");
- mount_points->RegisterFileSystem("c", storage::kFileSystemTypeNativeLocal,
- storage::FileSystemMountOption(),
+ mount_points->RegisterFileSystem("c", kFileSystemTypeNativeLocal,
+ FileSystemMountOption(),
base::FilePath(DRIVE FPL("/a/b/c")));
- mount_points->RegisterFileSystem("c(1)", storage::kFileSystemTypeDriveFs,
- storage::FileSystemMountOption(),
+ mount_points->RegisterFileSystem("c(1)", kFileSystemTypeDriveFs,
+ FileSystemMountOption(),
base::FilePath(DRIVE FPL("/a/b/c(1)")));
- mount_points->RegisterFileSystem(
- "empty_path", storage::kFileSystemTypeSyncable,
- storage::FileSystemMountOption(), base::FilePath());
- mount_points->RegisterFileSystem("mount", storage::kFileSystemTypeDriveFs,
- storage::FileSystemMountOption(),
+ mount_points->RegisterFileSystem("empty_path", kFileSystemTypeSyncable,
+ FileSystemMountOption(), base::FilePath());
+ mount_points->RegisterFileSystem("mount", kFileSystemTypeDriveFs,
+ FileSystemMountOption(),
base::FilePath(DRIVE FPL("/root")));
struct TestCase {
const base::FilePath::CharType* const path;
bool expect_valid;
- storage::FileSystemType expect_type;
+ FileSystemType expect_type;
const base::FilePath::CharType* const expect_path;
const char* const expect_name;
};
const TestCase kTestCases[] = {
- {FPL("c/d/e"), true, storage::kFileSystemTypeNativeLocal,
- DRIVE FPL("/a/b/c/d/e"), "c"},
- {FPL("c(1)/d/e"), true, storage::kFileSystemTypeDriveFs,
- DRIVE FPL("/a/b/c(1)/d/e"), "c(1)"},
- {FPL("c(1)"), true, storage::kFileSystemTypeDriveFs, DRIVE FPL("/a/b/c(1)"),
+ {FPL("c/d/e"), true, kFileSystemTypeNativeLocal, DRIVE FPL("/a/b/c/d/e"),
+ "c"},
+ {FPL("c(1)/d/e"), true, kFileSystemTypeDriveFs, DRIVE FPL("/a/b/c(1)/d/e"),
"c(1)"},
- {FPL("empty_path/a"), true, storage::kFileSystemTypeSyncable, FPL("a"),
+ {FPL("c(1)"), true, kFileSystemTypeDriveFs, DRIVE FPL("/a/b/c(1)"), "c(1)"},
+ {FPL("empty_path/a"), true, kFileSystemTypeSyncable, FPL("a"),
"empty_path"},
- {FPL("empty_path"), true, storage::kFileSystemTypeSyncable, FPL(""),
- "empty_path"},
- {FPL("mount/a/b"), true, storage::kFileSystemTypeDriveFs,
- DRIVE FPL("/root/a/b"), "mount"},
- {FPL("mount"), true, storage::kFileSystemTypeDriveFs, DRIVE FPL("/root"),
+ {FPL("empty_path"), true, kFileSystemTypeSyncable, FPL(""), "empty_path"},
+ {FPL("mount/a/b"), true, kFileSystemTypeDriveFs, DRIVE FPL("/root/a/b"),
"mount"},
- {FPL("cc"), false, storage::kFileSystemTypeUnknown, FPL(""), ""},
- {FPL(""), false, storage::kFileSystemTypeUnknown, FPL(""), ""},
- {FPL(".."), false, storage::kFileSystemTypeUnknown, FPL(""), ""},
- // Absolte paths.
- {FPL("/c/d/e"), false, storage::kFileSystemTypeUnknown, FPL(""), ""},
- {FPL("/c(1)/d/e"), false, storage::kFileSystemTypeUnknown, FPL(""), ""},
- {FPL("/empty_path"), false, storage::kFileSystemTypeUnknown, FPL(""), ""},
+ {FPL("mount"), true, kFileSystemTypeDriveFs, DRIVE FPL("/root"), "mount"},
+ {FPL("cc"), false, kFileSystemTypeUnknown, FPL(""), ""},
+ {FPL(""), false, kFileSystemTypeUnknown, FPL(""), ""},
+ {FPL(".."), false, kFileSystemTypeUnknown, FPL(""), ""},
+ // Absolute paths.
+ {FPL("/c/d/e"), false, kFileSystemTypeUnknown, FPL(""), ""},
+ {FPL("/c(1)/d/e"), false, kFileSystemTypeUnknown, FPL(""), ""},
+ {FPL("/empty_path"), false, kFileSystemTypeUnknown, FPL(""), ""},
// PAth references parent.
- {FPL("c/d/../e"), false, storage::kFileSystemTypeUnknown, FPL(""), ""},
- {FPL("/empty_path/a/../b"), false, storage::kFileSystemTypeUnknown, FPL(""),
- ""},
+ {FPL("c/d/../e"), false, kFileSystemTypeUnknown, FPL(""), ""},
+ {FPL("/empty_path/a/../b"), false, kFileSystemTypeUnknown, FPL(""), ""},
#if defined(FILE_PATH_USES_WIN_SEPARATORS)
- {FPL("c/d\\e"), true, storage::kFileSystemTypeNativeLocal,
- DRIVE FPL("/a/b/c/d/e"), "c"},
- {FPL("mount\\a\\b"), true, storage::kFileSystemTypeDriveFs,
- DRIVE FPL("/root/a/b"), "mount"},
+ {FPL("c/d\\e"), true, kFileSystemTypeNativeLocal, DRIVE FPL("/a/b/c/d/e"),
+ "c"},
+ {FPL("mount\\a\\b"), true, kFileSystemTypeDriveFs, DRIVE FPL("/root/a/b"),
+ "mount"},
#endif
};
for (size_t i = 0; i < base::size(kTestCases); ++i) {
std::string cracked_name;
- storage::FileSystemType cracked_type;
+ FileSystemType cracked_type;
std::string cracked_id;
base::FilePath cracked_path;
- storage::FileSystemMountOption cracked_option;
+ FileSystemMountOption cracked_option;
EXPECT_EQ(kTestCases[i].expect_valid,
mount_points->CrackVirtualPath(
base::FilePath(kTestCases[i].path), &cracked_name,
@@ -456,33 +441,31 @@
}
TEST(ExternalMountPointsTest, MountOption) {
- scoped_refptr<storage::ExternalMountPoints> mount_points(
- storage::ExternalMountPoints::CreateRefCounted());
+ scoped_refptr<ExternalMountPoints> mount_points =
+ ExternalMountPoints::CreateRefCounted();
mount_points->RegisterFileSystem(
- "nosync", storage::kFileSystemTypeNativeLocal,
- storage::FileSystemMountOption(
- storage::FlushPolicy::NO_FLUSH_ON_COMPLETION),
+ "nosync", kFileSystemTypeNativeLocal,
+ FileSystemMountOption(FlushPolicy::NO_FLUSH_ON_COMPLETION),
base::FilePath(DRIVE FPL("/nosync")));
mount_points->RegisterFileSystem(
- "sync", storage::kFileSystemTypeNativeLocal,
- storage::FileSystemMountOption(storage::FlushPolicy::FLUSH_ON_COMPLETION),
+ "sync", kFileSystemTypeNativeLocal,
+ FileSystemMountOption(FlushPolicy::FLUSH_ON_COMPLETION),
base::FilePath(DRIVE FPL("/sync")));
std::string name;
- storage::FileSystemType type;
+ FileSystemType type;
std::string cracked_id;
- storage::FileSystemMountOption option;
+ FileSystemMountOption option;
base::FilePath path;
EXPECT_TRUE(mount_points->CrackVirtualPath(base::FilePath(FPL("nosync/file")),
&name, &type, &cracked_id, &path,
&option));
- EXPECT_EQ(storage::FlushPolicy::NO_FLUSH_ON_COMPLETION,
- option.flush_policy());
+ EXPECT_EQ(FlushPolicy::NO_FLUSH_ON_COMPLETION, option.flush_policy());
EXPECT_TRUE(mount_points->CrackVirtualPath(base::FilePath(FPL("sync/file")),
&name, &type, &cracked_id, &path,
&option));
- EXPECT_EQ(storage::FlushPolicy::FLUSH_ON_COMPLETION, option.flush_policy());
+ EXPECT_EQ(FlushPolicy::FLUSH_ON_COMPLETION, option.flush_policy());
}
-} // namespace content
+} // namespace storage
diff --git a/storage/browser/file_system/file_stream_reader.h b/storage/browser/file_system/file_stream_reader.h
index c293e529..b3cfc7f 100644
--- a/storage/browser/file_system/file_stream_reader.h
+++ b/storage/browser/file_system/file_stream_reader.h
@@ -29,9 +29,6 @@
class FileSystemContext;
class FileSystemURL;
class ObfuscatedFileUtilMemoryDelegate;
-} // namespace storage
-
-namespace storage {
// A generic interface for reading a file-like object.
class FileStreamReader {
@@ -75,8 +72,8 @@
// succeeding read operations should fail with ERR_UPLOAD_FILE_CHANGED error.
COMPONENT_EXPORT(STORAGE_BROWSER)
static std::unique_ptr<FileStreamReader> CreateForFileSystemFile(
- storage::FileSystemContext* context,
- const storage::FileSystemURL& url,
+ FileSystemContext* context,
+ const FileSystemURL& url,
int64_t initial_offset,
const base::Time& expected_modification_time);
@@ -87,7 +84,7 @@
// It is valid to delete the reader at any time. If the stream is deleted
// while it has a pending read, its callback will not be called.
- virtual ~FileStreamReader() {}
+ virtual ~FileStreamReader() = default;
// Reads from the current cursor position asynchronously.
//
diff --git a/storage/browser/file_system/file_system_backend.h b/storage/browser/file_system/file_system_backend.h
index 1942fef..44bc068 100644
--- a/storage/browser/file_system/file_system_backend.h
+++ b/storage/browser/file_system/file_system_backend.h
@@ -119,7 +119,7 @@
// This method itself does *not* check if the given path exists and is a
// regular file. At most |max_bytes_to_read| can be fetched from the file
// stream reader.
- virtual std::unique_ptr<storage::FileStreamReader> CreateFileStreamReader(
+ virtual std::unique_ptr<FileStreamReader> CreateFileStreamReader(
const FileSystemURL& url,
int64_t offset,
int64_t max_bytes_to_read,
@@ -162,7 +162,7 @@
// Returns true if |url| is allowed to be accessed.
// This is supposed to perform ExternalFileSystem-specific security
// checks.
- virtual bool IsAccessAllowed(const storage::FileSystemURL& url) const = 0;
+ virtual bool IsAccessAllowed(const FileSystemURL& url) const = 0;
// Returns the list of top level directories that are exposed by this
// provider. This list is used to set appropriate child process file access
// permissions.
@@ -179,14 +179,13 @@
base::FilePath* virtual_path) const = 0;
// Gets a redirect URL for contents. e.g. Google Drive URL for hosted
// documents. Returns empty URL if the entry does not have the redirect URL.
- virtual void GetRedirectURLForContents(
- const storage::FileSystemURL& url,
- storage::URLCallback callback) const = 0;
+ virtual void GetRedirectURLForContents(const FileSystemURL& url,
+ URLCallback callback) const = 0;
// Creates an internal File System URL for performing internal operations such
// as confirming if a file or a directory exist before granting the final
// permission to the entry. The path must be an absolute path.
- virtual storage::FileSystemURL CreateInternalURL(
- storage::FileSystemContext* context,
+ virtual FileSystemURL CreateInternalURL(
+ FileSystemContext* context,
const base::FilePath& entry_path) const = 0;
};
diff --git a/storage/browser/file_system/file_system_context.cc b/storage/browser/file_system/file_system_context.cc
index 3b65f4a..e85b6c9 100644
--- a/storage/browser/file_system/file_system_context.cc
+++ b/storage/browser/file_system/file_system_context.cc
@@ -41,8 +41,6 @@
#include "storage/common/file_system/file_system_util.h"
#include "third_party/leveldatabase/leveldb_chrome.h"
-using storage::QuotaClient;
-
namespace storage {
namespace {
@@ -136,8 +134,8 @@
base::SingleThreadTaskRunner* io_task_runner,
base::SequencedTaskRunner* file_task_runner,
ExternalMountPoints* external_mount_points,
- storage::SpecialStoragePolicy* special_storage_policy,
- storage::QuotaManagerProxy* quota_manager_proxy,
+ SpecialStoragePolicy* special_storage_policy,
+ QuotaManagerProxy* quota_manager_proxy,
std::vector<std::unique_ptr<FileSystemBackend>> additional_backends,
const std::vector<URLRequestAutoMountHandler>& auto_mount_handlers,
const base::FilePath& partition_path,
@@ -428,8 +426,7 @@
std::move(callback));
}
-std::unique_ptr<storage::FileStreamReader>
-FileSystemContext::CreateFileStreamReader(
+std::unique_ptr<FileStreamReader> FileSystemContext::CreateFileStreamReader(
const FileSystemURL& url,
int64_t offset,
int64_t max_bytes_to_read,
@@ -604,8 +601,7 @@
return;
}
- storage::FileSystemInfo info(filesystem_name, filesystem_root,
- url.mount_type());
+ FileSystemInfo info(filesystem_name, filesystem_root, url.mount_type());
// Extract the virtual path not containing a filesystem type part from |url|.
base::FilePath parent = CrackURL(filesystem_root).virtual_path();
diff --git a/storage/browser/file_system/file_system_context.h b/storage/browser/file_system/file_system_context.h
index d735dfe..fd2ca2e 100644
--- a/storage/browser/file_system/file_system_context.h
+++ b/storage/browser/file_system/file_system_context.h
@@ -119,8 +119,8 @@
base::SingleThreadTaskRunner* io_task_runner,
base::SequencedTaskRunner* file_task_runner,
ExternalMountPoints* external_mount_points,
- storage::SpecialStoragePolicy* special_storage_policy,
- storage::QuotaManagerProxy* quota_manager_proxy,
+ SpecialStoragePolicy* special_storage_policy,
+ QuotaManagerProxy* quota_manager_proxy,
std::vector<std::unique_ptr<FileSystemBackend>> additional_backends,
const std::vector<URLRequestAutoMountHandler>& auto_mount_handlers,
const base::FilePath& partition_path,
@@ -136,7 +136,7 @@
const url::Origin& origin,
FileSystemType type);
- storage::QuotaManagerProxy* quota_manager_proxy() const {
+ QuotaManagerProxy* quota_manager_proxy() const {
return quota_manager_proxy_.get();
}
@@ -248,7 +248,7 @@
// The resolved FileSystemBackend could perform further specialization
// depending on the filesystem type pointed by the |url|.
// At most |max_bytes_to_read| can be fetched from the file stream reader.
- std::unique_ptr<storage::FileStreamReader> CreateFileStreamReader(
+ std::unique_ptr<FileStreamReader> CreateFileStreamReader(
const FileSystemURL& url,
int64_t offset,
int64_t max_bytes_to_read,
@@ -311,10 +311,10 @@
friend class FileSystemOperationRunner;
// For sandbox_backend().
- friend class content::SandboxFileSystemTestHelper;
+ friend class SandboxFileSystemTestHelper;
// For plugin_private_backend().
- friend class content::PluginPrivateFileSystemBackendTest;
+ friend class PluginPrivateFileSystemBackendTest;
// Deleters.
friend struct DefaultContextDeleter;
@@ -367,7 +367,7 @@
scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_;
scoped_refptr<base::SequencedTaskRunner> default_file_task_runner_;
- scoped_refptr<storage::QuotaManagerProxy> quota_manager_proxy_;
+ scoped_refptr<QuotaManagerProxy> quota_manager_proxy_;
std::unique_ptr<SandboxFileSystemBackendDelegate> sandbox_delegate_;
diff --git a/storage/browser/file_system/file_system_context_unittest.cc b/storage/browser/file_system/file_system_context_unittest.cc
index ec7128f2..76c1427 100644
--- a/storage/browser/file_system/file_system_context_unittest.cc
+++ b/storage/browser/file_system/file_system_context_unittest.cc
@@ -29,14 +29,7 @@
#define DRIVE
#endif
-using storage::ExternalMountPoints;
-using storage::FileSystemBackend;
-using storage::FileSystemContext;
-using storage::FileSystemMountOption;
-using storage::FileSystemURL;
-using storage::IsolatedContext;
-
-namespace content {
+namespace storage {
namespace {
@@ -66,21 +59,21 @@
protected:
FileSystemContext* CreateFileSystemContextForTest(
- storage::ExternalMountPoints* external_mount_points) {
+ ExternalMountPoints* external_mount_points) {
return new FileSystemContext(
base::ThreadTaskRunnerHandle::Get().get(),
base::ThreadTaskRunnerHandle::Get().get(), external_mount_points,
storage_policy_.get(), mock_quota_manager_->proxy(),
std::vector<std::unique_ptr<FileSystemBackend>>(),
- std::vector<storage::URLRequestAutoMountHandler>(), data_dir_.GetPath(),
+ std::vector<URLRequestAutoMountHandler>(), data_dir_.GetPath(),
CreateAllowFileAccessOptions());
}
// Verifies a *valid* filesystem url has expected values.
void ExpectFileSystemURLMatches(const FileSystemURL& url,
const GURL& expect_origin,
- storage::FileSystemType expect_mount_type,
- storage::FileSystemType expect_type,
+ FileSystemType expect_mount_type,
+ FileSystemType expect_type,
const base::FilePath& expect_path,
const base::FilePath& expect_virtual_path,
const std::string& expect_filesystem_id) {
@@ -97,7 +90,7 @@
private:
base::ScopedTempDir data_dir_;
base::test::TaskEnvironment task_environment_;
- scoped_refptr<storage::SpecialStoragePolicy> storage_policy_;
+ scoped_refptr<SpecialStoragePolicy> storage_policy_;
scoped_refptr<MockQuotaManager> mock_quota_manager_;
};
@@ -112,20 +105,20 @@
std::string isolated_name = "root";
IsolatedContext::ScopedFSHandle isolated_fs =
IsolatedContext::GetInstance()->RegisterFileSystemForPath(
- storage::kFileSystemTypeNativeLocal, std::string(),
+ kFileSystemTypeNativeLocal, std::string(),
base::FilePath(DRIVE FPL("/test/isolated/root")), &isolated_name);
std::string isolated_id = isolated_fs.id();
// Register system external mount point.
ASSERT_TRUE(ExternalMountPoints::GetSystemInstance()->RegisterFileSystem(
- "system", storage::kFileSystemTypeNativeLocal, FileSystemMountOption(),
+ "system", kFileSystemTypeNativeLocal, FileSystemMountOption(),
base::FilePath(DRIVE FPL("/test/sys/"))));
FileSystemURL cracked_isolated = file_system_context->CrackURL(
CreateRawFileSystemURL("isolated", isolated_id));
ExpectFileSystemURLMatches(
- cracked_isolated, GURL(kTestOrigin), storage::kFileSystemTypeIsolated,
- storage::kFileSystemTypeNativeLocal,
+ cracked_isolated, GURL(kTestOrigin), kFileSystemTypeIsolated,
+ kFileSystemTypeNativeLocal,
base::FilePath(DRIVE FPL("/test/isolated/root/file"))
.NormalizePathSeparators(),
base::FilePath::FromUTF8Unsafe(isolated_id)
@@ -137,8 +130,8 @@
CreateRawFileSystemURL("external", "system"));
ExpectFileSystemURLMatches(
- cracked_external, GURL(kTestOrigin), storage::kFileSystemTypeExternal,
- storage::kFileSystemTypeNativeLocal,
+ cracked_external, GURL(kTestOrigin), kFileSystemTypeExternal,
+ kFileSystemTypeNativeLocal,
base::FilePath(DRIVE FPL("/test/sys/root/file"))
.NormalizePathSeparators(),
base::FilePath(FPL("system/root/file")).NormalizePathSeparators(),
@@ -155,7 +148,7 @@
// Register system external mount point.
ASSERT_TRUE(mount_points->RegisterFileSystem(
- "system", storage::kFileSystemTypeNativeLocal, FileSystemMountOption(),
+ "system", kFileSystemTypeNativeLocal, FileSystemMountOption(),
base::FilePath(DRIVE FPL("/test/sys/"))));
scoped_refptr<FileSystemContext> file_system_context(
@@ -170,8 +163,8 @@
CreateRawFileSystemURL("external", "system"));
ExpectFileSystemURLMatches(
- cracked_external, GURL(kTestOrigin), storage::kFileSystemTypeExternal,
- storage::kFileSystemTypeNativeLocal,
+ cracked_external, GURL(kTestOrigin), kFileSystemTypeExternal,
+ kFileSystemTypeNativeLocal,
base::FilePath(DRIVE FPL("/test/sys/root/file"))
.NormalizePathSeparators(),
base::FilePath(FPL("system/root/file")).NormalizePathSeparators(),
@@ -191,27 +184,27 @@
std::string isolated_file_system_name = "root";
IsolatedContext::ScopedFSHandle isolated_fs =
IsolatedContext::GetInstance()->RegisterFileSystemForPath(
- storage::kFileSystemTypeNativeLocal, std::string(),
+ kFileSystemTypeNativeLocal, std::string(),
base::FilePath(DRIVE FPL("/test/isolated/root")),
&isolated_file_system_name);
const std::string kIsolatedFileSystemID = isolated_fs.id();
// Register system external mount point.
ASSERT_TRUE(ExternalMountPoints::GetSystemInstance()->RegisterFileSystem(
- "system", storage::kFileSystemTypeNativeLocal, FileSystemMountOption(),
+ "system", kFileSystemTypeNativeLocal, FileSystemMountOption(),
base::FilePath(DRIVE FPL("/test/sys/"))));
ASSERT_TRUE(ExternalMountPoints::GetSystemInstance()->RegisterFileSystem(
- "ext", storage::kFileSystemTypeNativeLocal, FileSystemMountOption(),
+ "ext", kFileSystemTypeNativeLocal, FileSystemMountOption(),
base::FilePath(DRIVE FPL("/test/ext"))));
// Register a system external mount point with the same name/id as the
// registered isolated mount point.
ASSERT_TRUE(ExternalMountPoints::GetSystemInstance()->RegisterFileSystem(
- kIsolatedFileSystemID, storage::kFileSystemTypeRestrictedNativeLocal,
+ kIsolatedFileSystemID, kFileSystemTypeRestrictedNativeLocal,
FileSystemMountOption(),
base::FilePath(DRIVE FPL("/test/system/isolated"))));
// Add a mount points with the same name as a system mount point to
// FileSystemContext's external mount points.
ASSERT_TRUE(external_mount_points->RegisterFileSystem(
- "ext", storage::kFileSystemTypeNativeLocal, FileSystemMountOption(),
+ "ext", kFileSystemTypeNativeLocal, FileSystemMountOption(),
base::FilePath(DRIVE FPL("/test/local/ext/"))));
const GURL kTestOrigin = GURL("http://chromium.org/");
@@ -224,8 +217,8 @@
// Expected test results.
bool expect_is_valid;
- storage::FileSystemType expect_mount_type;
- storage::FileSystemType expect_type;
+ FileSystemType expect_mount_type;
+ FileSystemType expect_type;
const base::FilePath::CharType* expect_path;
std::string expect_filesystem_id;
};
@@ -234,42 +227,37 @@
// Following should not be handled by the url crackers:
{
"pers_mount", "persistent", true /* is_valid */,
- storage::kFileSystemTypePersistent,
- storage::kFileSystemTypePersistent, FPL("pers_mount/root/file"),
- std::string() /* filesystem id */
+ kFileSystemTypePersistent, kFileSystemTypePersistent,
+ FPL("pers_mount/root/file"), std::string() /* filesystem id */
},
{
"temp_mount", "temporary", true /* is_valid */,
- storage::kFileSystemTypeTemporary, storage::kFileSystemTypeTemporary,
+ kFileSystemTypeTemporary, kFileSystemTypeTemporary,
FPL("temp_mount/root/file"), std::string() /* filesystem id */
},
// Should be cracked by isolated mount points:
{kIsolatedFileSystemID, "isolated", true /* is_valid */,
- storage::kFileSystemTypeIsolated, storage::kFileSystemTypeNativeLocal,
+ kFileSystemTypeIsolated, kFileSystemTypeNativeLocal,
DRIVE FPL("/test/isolated/root/file"), kIsolatedFileSystemID},
// Should be cracked by system mount points:
- {"system", "external", true /* is_valid */,
- storage::kFileSystemTypeExternal, storage::kFileSystemTypeNativeLocal,
- DRIVE FPL("/test/sys/root/file"), "system"},
+ {"system", "external", true /* is_valid */, kFileSystemTypeExternal,
+ kFileSystemTypeNativeLocal, DRIVE FPL("/test/sys/root/file"), "system"},
{kIsolatedFileSystemID, "external", true /* is_valid */,
- storage::kFileSystemTypeExternal,
- storage::kFileSystemTypeRestrictedNativeLocal,
+ kFileSystemTypeExternal, kFileSystemTypeRestrictedNativeLocal,
DRIVE FPL("/test/system/isolated/root/file"), kIsolatedFileSystemID},
// Should be cracked by FileSystemContext's ExternalMountPoints.
- {"ext", "external", true /* is_valid */, storage::kFileSystemTypeExternal,
- storage::kFileSystemTypeNativeLocal,
- DRIVE FPL("/test/local/ext/root/file"), "ext"},
+ {"ext", "external", true /* is_valid */, kFileSystemTypeExternal,
+ kFileSystemTypeNativeLocal, DRIVE FPL("/test/local/ext/root/file"),
+ "ext"},
// Test for invalid filesystem url (made invalid by adding invalid
// filesystem type).
{"sytem", "external", false /* is_valid */,
// The rest of values will be ignored.
- storage::kFileSystemTypeUnknown, storage::kFileSystemTypeUnknown,
- FPL(""), std::string()},
+ kFileSystemTypeUnknown, kFileSystemTypeUnknown, FPL(""), std::string()},
// Test for URL with non-existing filesystem id.
{"invalid", "external", false /* is_valid */,
// The rest of values will be ignored.
- storage::kFileSystemTypeUnknown, storage::kFileSystemTypeUnknown,
- FPL(""), std::string()},
+ kFileSystemTypeUnknown, kFileSystemTypeUnknown, FPL(""), std::string()},
};
for (size_t i = 0; i < base::size(kTestCases); ++i) {
@@ -313,29 +301,29 @@
// A request for a sandbox mount point should be served.
FileSystemURL cracked_url =
context->CrackURL(CreateRawFileSystemURL("persistent", "pers_mount"));
- EXPECT_EQ(storage::kFileSystemTypePersistent, cracked_url.mount_type());
+ EXPECT_EQ(kFileSystemTypePersistent, cracked_url.mount_type());
EXPECT_TRUE(context->CanServeURLRequest(cracked_url));
// A request for an isolated mount point should NOT be served.
std::string isolated_fs_name = "root";
IsolatedContext::ScopedFSHandle isolated_fs =
IsolatedContext::GetInstance()->RegisterFileSystemForPath(
- storage::kFileSystemTypeNativeLocal, std::string(),
+ kFileSystemTypeNativeLocal, std::string(),
base::FilePath(DRIVE FPL("/test/isolated/root")), &isolated_fs_name);
std::string isolated_fs_id = isolated_fs.id();
cracked_url =
context->CrackURL(CreateRawFileSystemURL("isolated", isolated_fs_id));
- EXPECT_EQ(storage::kFileSystemTypeIsolated, cracked_url.mount_type());
+ EXPECT_EQ(kFileSystemTypeIsolated, cracked_url.mount_type());
EXPECT_FALSE(context->CanServeURLRequest(cracked_url));
// A request for an external mount point should be served.
const std::string kExternalMountName = "ext_mount";
ASSERT_TRUE(ExternalMountPoints::GetSystemInstance()->RegisterFileSystem(
- kExternalMountName, storage::kFileSystemTypeNativeLocal,
- FileSystemMountOption(), base::FilePath()));
+ kExternalMountName, kFileSystemTypeNativeLocal, FileSystemMountOption(),
+ base::FilePath()));
cracked_url =
context->CrackURL(CreateRawFileSystemURL("external", kExternalMountName));
- EXPECT_EQ(storage::kFileSystemTypeExternal, cracked_url.mount_type());
+ EXPECT_EQ(kFileSystemTypeExternal, cracked_url.mount_type());
EXPECT_TRUE(context->CanServeURLRequest(cracked_url));
ExternalMountPoints::GetSystemInstance()->RevokeFileSystem(
@@ -352,18 +340,18 @@
CreateFileSystemContextForTest(nullptr));
// Isolated file system types are handled.
+ EXPECT_TRUE(
+ file_system_context->GetFileSystemBackend(kFileSystemTypeIsolated));
+ EXPECT_TRUE(
+ file_system_context->GetFileSystemBackend(kFileSystemTypeDragged));
EXPECT_TRUE(file_system_context->GetFileSystemBackend(
- storage::kFileSystemTypeIsolated));
+ kFileSystemTypeForTransientFile));
+ EXPECT_TRUE(
+ file_system_context->GetFileSystemBackend(kFileSystemTypeNativeLocal));
EXPECT_TRUE(file_system_context->GetFileSystemBackend(
- storage::kFileSystemTypeDragged));
- EXPECT_TRUE(file_system_context->GetFileSystemBackend(
- storage::kFileSystemTypeForTransientFile));
- EXPECT_TRUE(file_system_context->GetFileSystemBackend(
- storage::kFileSystemTypeNativeLocal));
- EXPECT_TRUE(file_system_context->GetFileSystemBackend(
- storage::kFileSystemTypeNativeForPlatformApp));
+ kFileSystemTypeNativeForPlatformApp));
}
} // namespace
-} // namespace content
+} // namespace storage
diff --git a/storage/browser/file_system/file_system_file_stream_reader.cc b/storage/browser/file_system/file_system_file_stream_reader.cc
index a30f90ad7..8a3b8516 100644
--- a/storage/browser/file_system/file_system_file_stream_reader.cc
+++ b/storage/browser/file_system/file_system_file_stream_reader.cc
@@ -19,8 +19,6 @@
#include "storage/browser/file_system/obfuscated_file_util_memory_delegate.h"
#include "storage/browser/file_system/plugin_private_file_system_backend.h"
-using storage::FileStreamReader;
-
// TODO(kinuko): Remove this temporary namespace hack after we move both
// blob and fileapi into content namespace.
namespace storage {
@@ -83,7 +81,7 @@
base::File::Error file_error,
const base::File::Info& file_info,
const base::FilePath& platform_path,
- scoped_refptr<storage::ShareableFileReference> file_ref) {
+ scoped_refptr<ShareableFileReference> file_ref) {
DCHECK(has_pending_create_snapshot_);
DCHECK(!file_reader_.get());
has_pending_create_snapshot_ = false;
diff --git a/storage/browser/file_system/file_system_file_stream_reader.h b/storage/browser/file_system/file_system_file_stream_reader.h
index 651562b..cc82aba 100644
--- a/storage/browser/file_system/file_system_file_stream_reader.h
+++ b/storage/browser/file_system/file_system_file_stream_reader.h
@@ -24,10 +24,6 @@
class FilePath;
}
-namespace content {
-class FileSystemFileStreamReaderTest;
-}
-
namespace storage {
class FileSystemContext;
@@ -38,7 +34,7 @@
// on FileSystemOperation::GetSnapshotFile() which may force downloading
// the entire contents for remote files.
class COMPONENT_EXPORT(STORAGE_BROWSER) FileSystemFileStreamReader
- : public storage::FileStreamReader {
+ : public FileStreamReader {
public:
~FileSystemFileStreamReader() override;
@@ -49,8 +45,8 @@
int64_t GetLength(net::Int64CompletionOnceCallback callback) override;
private:
- friend class storage::FileStreamReader;
- friend class content::FileSystemFileStreamReaderTest;
+ friend class FileStreamReader;
+ friend class FileSystemFileStreamReaderTest;
FileSystemFileStreamReader(FileSystemContext* file_system_context,
const FileSystemURL& url,
@@ -58,11 +54,10 @@
const base::Time& expected_modification_time);
int CreateSnapshot();
- void DidCreateSnapshot(
- base::File::Error file_error,
- const base::File::Info& file_info,
- const base::FilePath& platform_path,
- scoped_refptr<storage::ShareableFileReference> file_ref);
+ void DidCreateSnapshot(base::File::Error file_error,
+ const base::File::Info& file_info,
+ const base::FilePath& platform_path,
+ scoped_refptr<ShareableFileReference> file_ref);
void OnRead(int rv);
void OnGetLength(int64_t rv);
@@ -74,8 +69,8 @@
FileSystemURL url_;
const int64_t initial_offset_;
const base::Time expected_modification_time_;
- std::unique_ptr<storage::FileStreamReader> file_reader_;
- scoped_refptr<storage::ShareableFileReference> snapshot_ref_;
+ std::unique_ptr<FileStreamReader> file_reader_;
+ scoped_refptr<ShareableFileReference> snapshot_ref_;
bool has_pending_create_snapshot_;
base::WeakPtrFactory<FileSystemFileStreamReader> weak_factory_{this};
diff --git a/storage/browser/file_system/file_system_file_stream_reader_unittest.cc b/storage/browser/file_system/file_system_file_stream_reader_unittest.cc
index cc1656c..903ce86 100644
--- a/storage/browser/file_system/file_system_file_stream_reader_unittest.cc
+++ b/storage/browser/file_system/file_system_file_stream_reader_unittest.cc
@@ -29,13 +29,7 @@
#include "testing/gtest/include/gtest/gtest.h"
#include "url/origin.h"
-using content::AsyncFileTestHelper;
-using storage::FileSystemContext;
-using storage::FileSystemFileStreamReader;
-using storage::FileSystemType;
-using storage::FileSystemURL;
-
-namespace content {
+namespace storage {
namespace {
@@ -60,11 +54,10 @@
file_system_context_ =
CreateFileSystemContextForTesting(nullptr, temp_dir_.GetPath());
- file_system_context_->OpenFileSystem(
- url::Origin::Create(GURL(kURLOrigin)),
- storage::kFileSystemTypeTemporary,
- storage::OPEN_FILE_SYSTEM_CREATE_IF_NONEXISTENT,
- base::BindOnce(&OnOpenFileSystem));
+ file_system_context_->OpenFileSystem(url::Origin::Create(GURL(kURLOrigin)),
+ kFileSystemTypeTemporary,
+ OPEN_FILE_SYSTEM_CREATE_IF_NONEXISTENT,
+ base::BindOnce(&OnOpenFileSystem));
base::RunLoop().RunUntilIdle();
WriteFile(kTestFileName, kTestData, kTestDataSize,
@@ -74,7 +67,7 @@
void TearDown() override { base::RunLoop().RunUntilIdle(); }
protected:
- storage::FileSystemFileStreamReader* CreateFileReader(
+ FileSystemFileStreamReader* CreateFileReader(
const std::string& file_name,
int64_t initial_offset,
const base::Time& expected_modification_time) {
@@ -94,7 +87,7 @@
FileSystemURL url = GetFileSystemURL(file_name);
ASSERT_EQ(base::File::FILE_OK,
- content::AsyncFileTestHelper::CreateFileWithData(
+ AsyncFileTestHelper::CreateFileWithData(
file_system_context_.get(), url, buf, buf_size));
base::File::Info file_info;
@@ -114,7 +107,7 @@
FileSystemURL GetFileSystemURL(const std::string& file_name) {
return file_system_context_->CreateCrackedFileSystemURL(
- GURL(kURLOrigin), storage::kFileSystemTypeTemporary,
+ GURL(kURLOrigin), kFileSystemTypeTemporary,
base::FilePath().AppendASCII(file_name));
}
@@ -254,4 +247,4 @@
reader.reset();
}
-} // namespace content
+} // namespace storage
diff --git a/storage/browser/file_system/file_system_file_util.h b/storage/browser/file_system/file_system_file_util.h
index 18ab01e..1d855ba 100644
--- a/storage/browser/file_system/file_system_file_util.h
+++ b/storage/browser/file_system/file_system_file_util.h
@@ -169,12 +169,11 @@
//
// See header comments for AsyncFileUtil::CreateSnapshotFile() for
// more details.
- virtual storage::ScopedFile CreateSnapshotFile(
- FileSystemOperationContext* context,
- const FileSystemURL& url,
- base::File::Error* error,
- base::File::Info* file_info,
- base::FilePath* platform_path) = 0;
+ virtual ScopedFile CreateSnapshotFile(FileSystemOperationContext* context,
+ const FileSystemURL& url,
+ base::File::Error* error,
+ base::File::Info* file_info,
+ base::FilePath* platform_path) = 0;
protected:
FileSystemFileUtil() {}
diff --git a/storage/browser/file_system/file_system_operation.h b/storage/browser/file_system/file_system_operation.h
index 9259b64..b827d9a 100644
--- a/storage/browser/file_system/file_system_operation.h
+++ b/storage/browser/file_system/file_system_operation.h
@@ -110,11 +110,11 @@
// longer necessary in the javascript world.
// Please see the comment for ShareableFileReference for details.
//
- using SnapshotFileCallback = base::OnceCallback<void(
- base::File::Error result,
- const base::File::Info& file_info,
- const base::FilePath& platform_path,
- scoped_refptr<storage::ShareableFileReference> file_ref)>;
+ using SnapshotFileCallback =
+ base::OnceCallback<void(base::File::Error result,
+ const base::File::Info& file_info,
+ const base::FilePath& platform_path,
+ scoped_refptr<ShareableFileReference> file_ref)>;
// Used to specify how recursive operation delegate behaves for errors.
// With ERROR_BEHAVIOR_ABORT, it stops following operation when it fails an
diff --git a/storage/browser/file_system/file_system_operation_impl.cc b/storage/browser/file_system/file_system_operation_impl.cc
index 7201910..6496354 100644
--- a/storage/browser/file_system/file_system_operation_impl.cc
+++ b/storage/browser/file_system/file_system_operation_impl.cc
@@ -30,8 +30,6 @@
#include "storage/common/file_system/file_system_types.h"
#include "storage/common/file_system/file_system_util.h"
-using storage::ScopedFile;
-
namespace storage {
namespace {
@@ -392,7 +390,7 @@
const FileSystemURL& url,
base::OnceClosure task,
base::OnceClosure error_callback) {
- storage::QuotaManagerProxy* quota_manager_proxy =
+ QuotaManagerProxy* quota_manager_proxy =
file_system_context()->quota_manager_proxy();
if (!quota_manager_proxy ||
!file_system_context()->GetQuotaUtil(url.type())) {
diff --git a/storage/browser/file_system/file_system_operation_impl_unittest.cc b/storage/browser/file_system/file_system_operation_impl_unittest.cc
index d338055..cc9348fa 100644
--- a/storage/browser/file_system/file_system_operation_impl_unittest.cc
+++ b/storage/browser/file_system/file_system_operation_impl_unittest.cc
@@ -42,16 +42,7 @@
#include "testing/gtest/include/gtest/gtest.h"
#include "url/gurl.h"
-using content::AsyncFileTestHelper;
-using storage::FileSystemOperation;
-using storage::FileSystemOperationContext;
-using storage::FileSystemOperationRunner;
-using storage::FileSystemURL;
-using storage::QuotaManager;
-using storage::QuotaManagerProxy;
-using storage::ShareableFileReference;
-
-namespace content {
+namespace storage {
// Test class for FileSystemOperationImpl.
class FileSystemOperationImplTest : public testing::Test {
@@ -62,10 +53,8 @@
protected:
void SetUp() override {
EXPECT_TRUE(base_.CreateUniqueTempDir());
- change_observers_ =
- storage::MockFileChangeObserver::CreateList(&change_observer_);
- update_observers_ =
- storage::MockFileUpdateObserver::CreateList(&update_observer_);
+ change_observers_ = MockFileChangeObserver::CreateList(&change_observer_);
+ update_observers_ = MockFileUpdateObserver::CreateList(&update_observer_);
base::FilePath base_dir = base_.GetPath().AppendASCII("filesystem");
quota_manager_ =
@@ -110,13 +99,9 @@
return static_cast<MockQuotaManagerProxy*>(quota_manager_proxy_.get());
}
- storage::FileSystemFileUtil* file_util() {
- return sandbox_file_system_.file_util();
- }
+ FileSystemFileUtil* file_util() { return sandbox_file_system_.file_util(); }
- storage::MockFileChangeObserver* change_observer() {
- return &change_observer_;
- }
+ MockFileChangeObserver* change_observer() { return &change_observer_; }
std::unique_ptr<FileSystemOperationContext> NewContext() {
FileSystemOperationContext* context =
@@ -292,10 +277,9 @@
quota + quota_delta);
}
- base::File::Error Move(
- const FileSystemURL& src,
- const FileSystemURL& dest,
- storage::FileSystemOperation::CopyOrMoveOption option) {
+ base::File::Error Move(const FileSystemURL& src,
+ const FileSystemURL& dest,
+ FileSystemOperation::CopyOrMoveOption option) {
base::File::Error status;
base::RunLoop run_loop;
update_observer_.Enable();
@@ -307,15 +291,14 @@
return status;
}
- base::File::Error Copy(
- const FileSystemURL& src,
- const FileSystemURL& dest,
- storage::FileSystemOperation::CopyOrMoveOption option) {
+ base::File::Error Copy(const FileSystemURL& src,
+ const FileSystemURL& dest,
+ FileSystemOperation::CopyOrMoveOption option) {
base::File::Error status;
base::RunLoop run_loop;
update_observer_.Enable();
operation_runner()->Copy(
- src, dest, option, storage::FileSystemOperation::ERROR_BEHAVIOR_ABORT,
+ src, dest, option, FileSystemOperation::ERROR_BEHAVIOR_ABORT,
FileSystemOperationRunner::CopyProgressCallback(),
RecordStatusCallback(run_loop.QuitClosure(), &status));
run_loop.Run();
@@ -468,10 +451,10 @@
std::vector<filesystem::mojom::DirectoryEntry> entries_;
scoped_refptr<ShareableFileReference> shareable_file_ref_;
- storage::MockFileChangeObserver change_observer_;
- storage::ChangeObserverList change_observers_;
- storage::MockFileUpdateObserver update_observer_;
- storage::UpdateObserverList update_observers_;
+ MockFileChangeObserver change_observer_;
+ ChangeObserverList change_observers_;
+ MockFileUpdateObserver update_observer_;
+ UpdateObserverList update_observers_;
base::WeakPtrFactory<FileSystemOperationImplTest> weak_factory_{this};
@@ -928,7 +911,7 @@
TEST_F(FileSystemOperationImplTest, TestExistsAndMetadataFailure) {
EXPECT_EQ(base::File::FILE_ERROR_NOT_FOUND,
GetMetadata(URLForPath("nonexistent"),
- storage::FileSystemOperation::GET_METADATA_FIELD_NONE));
+ FileSystemOperation::GET_METADATA_FIELD_NONE));
EXPECT_EQ(base::File::FILE_ERROR_NOT_FOUND,
FileExists(URLForPath("nonexistent")));
@@ -948,8 +931,7 @@
EXPECT_EQ(
base::File::FILE_OK,
- GetMetadata(
- dir, storage::FileSystemOperation::GET_METADATA_FIELD_IS_DIRECTORY));
+ GetMetadata(dir, FileSystemOperation::GET_METADATA_FIELD_IS_DIRECTORY));
EXPECT_TRUE(info().is_directory);
++read_access;
@@ -958,8 +940,7 @@
EXPECT_EQ(
base::File::FILE_OK,
- GetMetadata(
- file, storage::FileSystemOperation::GET_METADATA_FIELD_IS_DIRECTORY));
+ GetMetadata(file, FileSystemOperation::GET_METADATA_FIELD_IS_DIRECTORY));
EXPECT_FALSE(info().is_directory);
++read_access;
@@ -1074,9 +1055,8 @@
// Check that its length is the size of the data written.
EXPECT_EQ(
base::File::FILE_OK,
- GetMetadata(
- file, storage::FileSystemOperation::GET_METADATA_FIELD_IS_DIRECTORY |
- storage::FileSystemOperation::GET_METADATA_FIELD_SIZE));
+ GetMetadata(file, FileSystemOperation::GET_METADATA_FIELD_IS_DIRECTORY |
+ FileSystemOperation::GET_METADATA_FIELD_SIZE));
EXPECT_FALSE(info().is_directory);
EXPECT_EQ(data_size, info().size);
@@ -1288,4 +1268,4 @@
EXPECT_EQ(0, GetFileSize("dest"));
}
-} // namespace content
+} // namespace storage
diff --git a/storage/browser/file_system/file_system_operation_impl_write_unittest.cc b/storage/browser/file_system/file_system_operation_impl_write_unittest.cc
index c90faff..6afd02f 100644
--- a/storage/browser/file_system/file_system_operation_impl_write_unittest.cc
+++ b/storage/browser/file_system/file_system_operation_impl_write_unittest.cc
@@ -31,17 +31,12 @@
#include "testing/gtest/include/gtest/gtest.h"
#include "url/gurl.h"
-using storage::FileSystemOperation;
-using storage::FileSystemOperationRunner;
-using storage::FileSystemURL;
-using storage::ScopedTextBlob;
-
-namespace content {
+namespace storage {
namespace {
const char kOrigin[] = "http://example.com";
-const storage::FileSystemType kFileSystemType = storage::kFileSystemTypeTest;
+const FileSystemType kFileSystemType = kFileSystemTypeTest;
void AssertStatusEq(base::File::Error expected, base::File::Error actual) {
ASSERT_EQ(expected, actual);
@@ -57,8 +52,7 @@
cancel_status_(base::File::FILE_ERROR_FAILED),
bytes_written_(0),
complete_(false) {
- change_observers_ =
- storage::MockFileChangeObserver::CreateList(&change_observer_);
+ change_observers_ = MockFileChangeObserver::CreateList(&change_observer_);
}
void SetUp() override {
@@ -72,7 +66,7 @@
file_system_context_ = CreateFileSystemContextForTesting(
quota_manager_->proxy(), dir_.GetPath());
- blob_storage_context_.reset(new storage::BlobStorageContext);
+ blob_storage_context_.reset(new BlobStorageContext);
file_system_context_->operation_runner()->CreateFile(
URLForPath(virtual_path_), true /* exclusive */,
@@ -100,13 +94,11 @@
bool complete() const { return complete_; }
protected:
- const storage::ChangeObserverList& change_observers() const {
+ const ChangeObserverList& change_observers() const {
return change_observers_;
}
- storage::MockFileChangeObserver* change_observer() {
- return &change_observer_;
- }
+ MockFileChangeObserver* change_observer() { return &change_observer_; }
FileSystemURL URLForPath(const base::FilePath& path) const {
return file_system_context_->CreateCrackedFileSystemURL(
@@ -141,13 +133,13 @@
void DidCancel(base::File::Error status) { cancel_status_ = status; }
- storage::BlobStorageContext* blob_storage_context() const {
+ BlobStorageContext* blob_storage_context() const {
return blob_storage_context_.get();
}
base::test::TaskEnvironment task_environment_;
- scoped_refptr<storage::FileSystemContext> file_system_context_;
+ scoped_refptr<FileSystemContext> file_system_context_;
scoped_refptr<MockQuotaManager> quota_manager_;
base::ScopedTempDir dir_;
@@ -159,10 +151,10 @@
int64_t bytes_written_;
bool complete_;
- std::unique_ptr<storage::BlobStorageContext> blob_storage_context_;
+ std::unique_ptr<BlobStorageContext> blob_storage_context_;
- storage::MockFileChangeObserver change_observer_;
- storage::ChangeObserverList change_observers_;
+ MockFileChangeObserver change_observer_;
+ ChangeObserverList change_observers_;
base::WeakPtrFactory<FileSystemOperationImplWriteTest> weak_factory_{this};
@@ -199,7 +191,7 @@
}
TEST_F(FileSystemOperationImplWriteTest, TestWriteInvalidBlob) {
- std::unique_ptr<storage::BlobDataHandle> null_handle;
+ std::unique_ptr<BlobDataHandle> null_handle;
file_system_context_->operation_runner()->Write(URLForPath(virtual_path_),
std::move(null_handle), 0,
RecordWriteCallback());
@@ -317,4 +309,4 @@
// TODO(ericu,dmikurube,kinuko): Add more tests for cancel cases.
-} // namespace content
+} // namespace storage
diff --git a/storage/browser/file_system/file_system_operation_runner.cc b/storage/browser/file_system/file_system_operation_runner.cc
index 991cfb7..3e99ddc 100644
--- a/storage/browser/file_system/file_system_operation_runner.cc
+++ b/storage/browser/file_system/file_system_operation_runner.cc
@@ -245,7 +245,7 @@
OperationID FileSystemOperationRunner::Write(
const FileSystemURL& url,
- std::unique_ptr<storage::BlobDataHandle> blob,
+ std::unique_ptr<BlobDataHandle> blob,
int64_t offset,
const WriteCallback& callback) {
base::File::Error error = base::File::FILE_OK;
@@ -670,7 +670,7 @@
base::File::Error rv,
const base::File::Info& file_info,
const base::FilePath& platform_path,
- scoped_refptr<storage::ShareableFileReference> file_ref) {
+ scoped_refptr<ShareableFileReference> file_ref) {
// Calling the callback or deleting the |operations_| entry in
// |FinishOperation| may release the FileSystemContext which owns this runner,
// so take a reference to keep both alive until the end of this call.
diff --git a/storage/browser/file_system/file_system_operation_runner.h b/storage/browser/file_system/file_system_operation_runner.h
index 8d1a47c..a5ec0e6 100644
--- a/storage/browser/file_system/file_system_operation_runner.h
+++ b/storage/browser/file_system/file_system_operation_runner.h
@@ -119,7 +119,7 @@
// Writes contents of |blob| to |url| at |offset|.
OperationID Write(const FileSystemURL& url,
- std::unique_ptr<storage::BlobDataHandle> blob,
+ std::unique_ptr<BlobDataHandle> blob,
int64_t offset,
const WriteCallback& callback);
@@ -275,13 +275,12 @@
OpenFileCallback callback,
base::File file,
base::OnceClosure on_close_callback);
- void DidCreateSnapshot(
- const OperationID id,
- SnapshotFileCallback callback,
- base::File::Error rv,
- const base::File::Info& file_info,
- const base::FilePath& platform_path,
- scoped_refptr<storage::ShareableFileReference> file_ref);
+ void DidCreateSnapshot(const OperationID id,
+ SnapshotFileCallback callback,
+ base::File::Error rv,
+ const base::File::Info& file_info,
+ const base::FilePath& platform_path,
+ scoped_refptr<ShareableFileReference> file_ref);
void OnCopyProgress(const OperationID id,
const CopyProgressCallback& callback,
diff --git a/storage/browser/file_system/file_system_quota_client.cc b/storage/browser/file_system/file_system_quota_client.cc
index f32d53e..b19b272 100644
--- a/storage/browser/file_system/file_system_quota_client.cc
+++ b/storage/browser/file_system/file_system_quota_client.cc
@@ -59,7 +59,7 @@
}
void DidGetFileSystemQuotaClientOrigins(
- storage::QuotaClient::GetOriginsCallback callback,
+ QuotaClient::GetOriginsCallback callback,
std::set<url::Origin>* origins_ptr) {
std::move(callback).Run(*origins_ptr);
}
@@ -96,8 +96,8 @@
FileSystemQuotaClient::~FileSystemQuotaClient() = default;
-storage::QuotaClient::ID FileSystemQuotaClient::id() const {
- return storage::QuotaClient::kFileSystem;
+QuotaClient::ID FileSystemQuotaClient::id() const {
+ return QuotaClient::kFileSystem;
}
void FileSystemQuotaClient::GetOriginUsage(const url::Origin& origin,
diff --git a/storage/browser/file_system/file_system_quota_client.h b/storage/browser/file_system/file_system_quota_client.h
index ccee9de..e4e4643 100644
--- a/storage/browser/file_system/file_system_quota_client.h
+++ b/storage/browser/file_system/file_system_quota_client.h
@@ -31,12 +31,12 @@
// All of the public methods of this class are called by the quota manager
// (except for the constructor/destructor).
class COMPONENT_EXPORT(STORAGE_BROWSER) FileSystemQuotaClient
- : public storage::QuotaClient {
+ : public QuotaClient {
public:
FileSystemQuotaClient(FileSystemContext* file_system_context);
// QuotaClient methods.
- storage::QuotaClient::ID id() const override;
+ QuotaClient::ID id() const override;
void OnQuotaManagerDestroyed() override {}
void GetOriginUsage(const url::Origin& origin,
blink::mojom::StorageType type,
diff --git a/storage/browser/file_system/file_system_quota_client_unittest.cc b/storage/browser/file_system/file_system_quota_client_unittest.cc
index 3e6c127..79799d8 100644
--- a/storage/browser/file_system/file_system_quota_client_unittest.cc
+++ b/storage/browser/file_system/file_system_quota_client_unittest.cc
@@ -26,11 +26,8 @@
#include "url/gurl.h"
using blink::mojom::StorageType;
-using content::AsyncFileTestHelper;
-using storage::FileSystemQuotaClient;
-using storage::FileSystemURL;
-namespace content {
+namespace storage {
namespace {
const char kDummyURL1[] = "http://www.dummy.org";
@@ -122,8 +119,7 @@
bool CreateFileSystemDirectory(const base::FilePath& file_path,
const std::string& origin_url,
StorageType storage_type) {
- storage::FileSystemType type =
- storage::QuotaStorageTypeToFileSystemType(storage_type);
+ FileSystemType type = QuotaStorageTypeToFileSystemType(storage_type);
FileSystemURL url = file_system_context_->CreateCrackedFileSystemURL(
GURL(origin_url), type, file_path);
@@ -139,8 +135,7 @@
if (file_path.empty())
return false;
- storage::FileSystemType type =
- storage::QuotaStorageTypeToFileSystemType(storage_type);
+ FileSystemType type = QuotaStorageTypeToFileSystemType(storage_type);
FileSystemURL url = file_system_context_->CreateCrackedFileSystemURL(
GURL(origin_url), type, file_path);
@@ -192,8 +187,7 @@
GURL(files[i].origin_url) == GURL(origin_url)) {
base::FilePath path = base::FilePath().AppendASCII(files[i].name);
if (!path.empty()) {
- file_paths_cost +=
- storage::ObfuscatedFileUtil::ComputeFilePathCost(path);
+ file_paths_cost += ObfuscatedFileUtil::ComputeFilePathCost(path);
}
}
}
@@ -234,7 +228,7 @@
base::ScopedTempDir data_dir_;
base::test::TaskEnvironment task_environment_;
- scoped_refptr<storage::FileSystemContext> file_system_context_;
+ scoped_refptr<FileSystemContext> file_system_context_;
int64_t usage_;
int additional_callback_count_;
std::set<url::Origin> origins_;
@@ -550,4 +544,4 @@
GetOriginUsage(quota_client.get(), "https://bar.com/", kTemporary));
}
-} // namespace content
+} // namespace storage
diff --git a/storage/browser/file_system/file_system_url_unittest.cc b/storage/browser/file_system/file_system_url_unittest.cc
index 516edc2..8a60e90 100644
--- a/storage/browser/file_system/file_system_url_unittest.cc
+++ b/storage/browser/file_system/file_system_url_unittest.cc
@@ -24,14 +24,7 @@
#define DRIVE FPL("/a/")
#endif
-using storage::FileSystemURL;
-using storage::kFileSystemTypeExternal;
-using storage::kFileSystemTypeIsolated;
-using storage::kFileSystemTypePersistent;
-using storage::kFileSystemTypeTemporary;
-using storage::VirtualPath;
-
-namespace content {
+namespace storage {
namespace {
@@ -248,4 +241,4 @@
}
}
-} // namespace content
+} // namespace storage
diff --git a/storage/browser/file_system/file_system_usage_cache_unittest.cc b/storage/browser/file_system/file_system_usage_cache_unittest.cc
index ba54754e..2b8ef41 100644
--- a/storage/browser/file_system/file_system_usage_cache_unittest.cc
+++ b/storage/browser/file_system/file_system_usage_cache_unittest.cc
@@ -14,9 +14,7 @@
#include "base/test/task_environment.h"
#include "testing/gtest/include/gtest/gtest.h"
-using storage::FileSystemUsageCache;
-
-namespace content {
+namespace storage {
class FileSystemUsageCacheTest : public testing::Test,
public ::testing::WithParamInterface<bool> {
@@ -161,4 +159,4 @@
EXPECT_FALSE(usage_cache()->IncrementDirty(usage_file_path));
}
-} // namespace content
+} // namespace storage
diff --git a/storage/browser/file_system/file_writer_delegate_unittest.cc b/storage/browser/file_system/file_writer_delegate_unittest.cc
index 36b01834..a249a1b4 100644
--- a/storage/browser/file_system/file_writer_delegate_unittest.cc
+++ b/storage/browser/file_system/file_writer_delegate_unittest.cc
@@ -40,16 +40,12 @@
#include "testing/platform_test.h"
#include "url/gurl.h"
-using content::AsyncFileTestHelper;
-using storage::FileSystemURL;
-using storage::FileWriterDelegate;
-
-namespace content {
+namespace storage {
namespace {
const char kOrigin[] = "http://example.com";
-const storage::FileSystemType kFileSystemType = storage::kFileSystemTypeTest;
+const FileSystemType kFileSystemType = kFileSystemTypeTest;
const char kData[] = "The quick brown fox jumps over the lazy dog.\n";
const int kDataSize = base::size(kData) - 1;
@@ -126,11 +122,11 @@
base::FilePath().FromUTF8Unsafe(file_name));
}
- std::unique_ptr<storage::SandboxFileStreamWriter> CreateWriter(
+ std::unique_ptr<SandboxFileStreamWriter> CreateWriter(
const char* test_file_path,
int64_t offset,
int64_t allowed_growth) {
- auto writer = std::make_unique<storage::SandboxFileStreamWriter>(
+ auto writer = std::make_unique<SandboxFileStreamWriter>(
file_system_context_.get(), GetFileSystemURL(test_file_path), offset,
*file_system_context_->GetUpdateObservers(kFileSystemType));
writer->set_default_quota(allowed_growth);
@@ -143,7 +139,7 @@
int64_t allowed_growth) {
auto writer = CreateWriter(test_file_path, offset, allowed_growth);
return std::make_unique<FileWriterDelegate>(
- std::move(writer), storage::FlushPolicy::FLUSH_ON_COMPLETION);
+ std::move(writer), FlushPolicy::FLUSH_ON_COMPLETION);
}
FileWriterDelegate::DelegateWriteCallback GetWriteCallback(Result* result) {
@@ -159,9 +155,8 @@
CreateWriterDelegate(test_file_path, offset, allowed_growth);
}
- std::unique_ptr<storage::BlobDataHandle> CreateBlob(
- const std::string& contents) {
- auto builder = std::make_unique<storage::BlobDataBuilder>("blob-uuid");
+ std::unique_ptr<BlobDataHandle> CreateBlob(const std::string& contents) {
+ auto builder = std::make_unique<BlobDataBuilder>("blob-uuid");
builder->AppendData(contents);
return blob_context_->AddFinishedBlob(std::move(builder));
}
@@ -169,8 +164,8 @@
// This should be alive until the very end of this instance.
base::test::TaskEnvironment task_environment_;
- scoped_refptr<storage::FileSystemContext> file_system_context_;
- std::unique_ptr<storage::BlobStorageContext> blob_context_;
+ scoped_refptr<FileSystemContext> file_system_context_;
+ std::unique_ptr<BlobStorageContext> blob_context_;
std::unique_ptr<FileWriterDelegate> file_writer_delegate_;
@@ -185,7 +180,7 @@
ASSERT_EQ(base::File::FILE_OK,
AsyncFileTestHelper::CreateFile(file_system_context_.get(),
GetFileSystemURL("test")));
- blob_context_ = std::make_unique<storage::BlobStorageContext>();
+ blob_context_ = std::make_unique<BlobStorageContext>();
}
void FileWriterDelegateTest::TearDown() {
@@ -413,4 +408,4 @@
}
}
-} // namespace content
+} // namespace storage
diff --git a/storage/browser/file_system/isolated_context_unittest.cc b/storage/browser/file_system/isolated_context_unittest.cc
index 8798710..c24d59e 100644
--- a/storage/browser/file_system/isolated_context_unittest.cc
+++ b/storage/browser/file_system/isolated_context_unittest.cc
@@ -21,14 +21,7 @@
#define DRIVE
#endif
-using storage::FileSystemMountOption;
-using storage::FileSystemURL;
-using storage::IsolatedContext;
-using storage::kFileSystemTypeDragged;
-using storage::kFileSystemTypeIsolated;
-using storage::kFileSystemTypeNativeLocal;
-
-namespace content {
+namespace storage {
using FileInfo = IsolatedContext::MountPointInfo;
@@ -105,7 +98,7 @@
std::string cracked_id;
base::FilePath cracked_path;
std::string cracked_inner_id;
- storage::FileSystemType cracked_type;
+ FileSystemType cracked_type;
FileSystemMountOption cracked_option;
ASSERT_TRUE(isolated_context()->CrackVirtualPath(
virtual_path, &cracked_id, &cracked_type, &cracked_inner_id,
@@ -209,7 +202,7 @@
.Append(relatives[j].path);
std::string cracked_id;
base::FilePath cracked_path;
- storage::FileSystemType cracked_type;
+ FileSystemType cracked_type;
std::string cracked_inner_id;
FileSystemMountOption cracked_option;
if (!relatives[j].valid) {
@@ -312,37 +305,36 @@
const base::FilePath test_path(FPL("/mount"));
// Should handle isolated file system.
- EXPECT_TRUE(isolated_context()->HandlesFileSystemMountType(
- storage::kFileSystemTypeIsolated));
+ EXPECT_TRUE(
+ isolated_context()->HandlesFileSystemMountType(kFileSystemTypeIsolated));
// Shouldn't handle the rest.
+ EXPECT_FALSE(
+ isolated_context()->HandlesFileSystemMountType(kFileSystemTypeExternal));
+ EXPECT_FALSE(
+ isolated_context()->HandlesFileSystemMountType(kFileSystemTypeTemporary));
EXPECT_FALSE(isolated_context()->HandlesFileSystemMountType(
- storage::kFileSystemTypeExternal));
- EXPECT_FALSE(isolated_context()->HandlesFileSystemMountType(
- storage::kFileSystemTypeTemporary));
- EXPECT_FALSE(isolated_context()->HandlesFileSystemMountType(
- storage::kFileSystemTypePersistent));
- EXPECT_FALSE(isolated_context()->HandlesFileSystemMountType(
- storage::kFileSystemTypeTest));
+ kFileSystemTypePersistent));
+ EXPECT_FALSE(
+ isolated_context()->HandlesFileSystemMountType(kFileSystemTypeTest));
// Not even if it's isolated subtype.
EXPECT_FALSE(isolated_context()->HandlesFileSystemMountType(
- storage::kFileSystemTypeNativeLocal));
+ kFileSystemTypeNativeLocal));
+ EXPECT_FALSE(
+ isolated_context()->HandlesFileSystemMountType(kFileSystemTypeDragged));
EXPECT_FALSE(isolated_context()->HandlesFileSystemMountType(
- storage::kFileSystemTypeDragged));
+ kFileSystemTypeNativeMedia));
EXPECT_FALSE(isolated_context()->HandlesFileSystemMountType(
- storage::kFileSystemTypeNativeMedia));
- EXPECT_FALSE(isolated_context()->HandlesFileSystemMountType(
- storage::kFileSystemTypeDeviceMedia));
+ kFileSystemTypeDeviceMedia));
}
TEST_F(IsolatedContextTest, VirtualFileSystemTests) {
// Should be able to register empty and non-absolute paths
std::string empty_fsid = isolated_context()->RegisterFileSystemForVirtualPath(
- storage::kFileSystemTypeIsolated, "_", base::FilePath());
+ kFileSystemTypeIsolated, "_", base::FilePath());
std::string relative_fsid =
isolated_context()->RegisterFileSystemForVirtualPath(
- storage::kFileSystemTypeIsolated, "_",
- base::FilePath(FPL("relpath")));
+ kFileSystemTypeIsolated, "_", base::FilePath(FPL("relpath")));
ASSERT_FALSE(empty_fsid.empty());
ASSERT_FALSE(relative_fsid.empty());
@@ -350,7 +342,7 @@
base::FilePath database_root = base::FilePath(DRIVE FPL("/database_path"));
std::string database_fsid =
isolated_context()->RegisterFileSystemForVirtualPath(
- storage::kFileSystemTypeIsolated, "_", database_root);
+ kFileSystemTypeIsolated, "_", database_root);
base::FilePath test_virtual_path =
base::FilePath().AppendASCII("virtualdir").AppendASCII("virtualfile.txt");
@@ -372,4 +364,4 @@
EXPECT_TRUE(cracked_inner_id.empty());
}
-} // namespace content
+} // namespace storage
diff --git a/storage/browser/file_system/isolated_file_system_backend.cc b/storage/browser/file_system/isolated_file_system_backend.cc
index 48897f2..f35a7f8 100644
--- a/storage/browser/file_system/isolated_file_system_backend.cc
+++ b/storage/browser/file_system/isolated_file_system_backend.cc
@@ -8,6 +8,7 @@
#include <memory>
#include <string>
+#include <utility>
#include "base/bind.h"
#include "base/files/file_path.h"
@@ -106,25 +107,25 @@
}
bool IsolatedFileSystemBackend::SupportsStreaming(
- const storage::FileSystemURL& url) const {
+ const FileSystemURL& url) const {
return false;
}
bool IsolatedFileSystemBackend::HasInplaceCopyImplementation(
- storage::FileSystemType type) const {
+ FileSystemType type) const {
DCHECK(type == kFileSystemTypeNativeLocal || type == kFileSystemTypeDragged ||
type == kFileSystemTypeForTransientFile);
return false;
}
-std::unique_ptr<storage::FileStreamReader>
+std::unique_ptr<FileStreamReader>
IsolatedFileSystemBackend::CreateFileStreamReader(
const FileSystemURL& url,
int64_t offset,
int64_t max_bytes_to_read,
const base::Time& expected_modification_time,
FileSystemContext* context) const {
- return storage::FileStreamReader::CreateForLocalFile(
+ return FileStreamReader::CreateForLocalFile(
context->default_file_task_runner(), url.path(), offset,
expected_modification_time);
}
diff --git a/storage/browser/file_system/isolated_file_system_backend.h b/storage/browser/file_system/isolated_file_system_backend.h
index 33a6fb3..9befd37 100644
--- a/storage/browser/file_system/isolated_file_system_backend.h
+++ b/storage/browser/file_system/isolated_file_system_backend.h
@@ -38,9 +38,8 @@
FileSystemContext* context,
base::File::Error* error_code) const override;
bool SupportsStreaming(const FileSystemURL& url) const override;
- bool HasInplaceCopyImplementation(
- storage::FileSystemType type) const override;
- std::unique_ptr<storage::FileStreamReader> CreateFileStreamReader(
+ bool HasInplaceCopyImplementation(FileSystemType type) const override;
+ std::unique_ptr<FileStreamReader> CreateFileStreamReader(
const FileSystemURL& url,
int64_t offset,
int64_t max_bytes_to_read,
diff --git a/storage/browser/file_system/local_file_stream_reader.h b/storage/browser/file_system/local_file_stream_reader.h
index a5e27654..f46c395 100644
--- a/storage/browser/file_system/local_file_stream_reader.h
+++ b/storage/browser/file_system/local_file_stream_reader.h
@@ -22,10 +22,6 @@
class TaskRunner;
}
-namespace content {
-class LocalFileStreamReaderTest;
-}
-
namespace net {
class FileStream;
}
@@ -47,7 +43,7 @@
private:
friend class FileStreamReader;
- friend class content::LocalFileStreamReaderTest;
+ friend class LocalFileStreamReaderTest;
LocalFileStreamReader(base::TaskRunner* task_runner,
const base::FilePath& file_path,
diff --git a/storage/browser/file_system/local_file_stream_reader_unittest.cc b/storage/browser/file_system/local_file_stream_reader_unittest.cc
index 52742e2..a31cf65 100644
--- a/storage/browser/file_system/local_file_stream_reader_unittest.cc
+++ b/storage/browser/file_system/local_file_stream_reader_unittest.cc
@@ -29,9 +29,7 @@
#include "storage/browser/file_system/file_stream_test_utils.h"
#include "testing/gtest/include/gtest/gtest.h"
-using storage::LocalFileStreamReader;
-
-namespace content {
+namespace storage {
namespace {
@@ -260,4 +258,4 @@
EnsureFileTaskFinished();
}
-} // namespace content
+} // namespace storage
diff --git a/storage/browser/file_system/local_file_stream_writer.h b/storage/browser/file_system/local_file_stream_writer.h
index f13d32c..ed51d9c 100644
--- a/storage/browser/file_system/local_file_stream_writer.h
+++ b/storage/browser/file_system/local_file_stream_writer.h
@@ -19,10 +19,6 @@
#include "base/task_runner.h"
#include "storage/browser/file_system/file_stream_writer.h"
-namespace content {
-class LocalFileStreamWriterTest;
-}
-
namespace net {
class FileStream;
}
@@ -43,8 +39,9 @@
int Flush(net::CompletionOnceCallback callback) override;
private:
- friend class content::LocalFileStreamWriterTest;
friend class FileStreamWriter;
+ friend class LocalFileStreamWriterTest;
+
LocalFileStreamWriter(base::TaskRunner* task_runner,
const base::FilePath& file_path,
int64_t initial_offset,
diff --git a/storage/browser/file_system/local_file_stream_writer_unittest.cc b/storage/browser/file_system/local_file_stream_writer_unittest.cc
index 2b63d2b0..62cce180 100644
--- a/storage/browser/file_system/local_file_stream_writer_unittest.cc
+++ b/storage/browser/file_system/local_file_stream_writer_unittest.cc
@@ -23,10 +23,7 @@
#include "storage/browser/file_system/file_stream_test_utils.h"
#include "testing/gtest/include/gtest/gtest.h"
-using storage::FileStreamWriter;
-using storage::LocalFileStreamWriter;
-
-namespace content {
+namespace storage {
class LocalFileStreamWriterTest : public testing::Test {
public:
@@ -164,4 +161,4 @@
EXPECT_EQ(net::OK, cancel_result);
}
-} // namespace content
+} // namespace storage
diff --git a/storage/browser/file_system/local_file_util.cc b/storage/browser/file_system/local_file_util.cc
index 04b4463..807079a 100644
--- a/storage/browser/file_system/local_file_util.cc
+++ b/storage/browser/file_system/local_file_util.cc
@@ -196,7 +196,7 @@
return NativeFileUtil::CopyOrMoveFile(
src_file_path, dest_file_path, option,
- storage::NativeFileUtil::CopyOrMoveModeForDestination(dest_url, copy));
+ NativeFileUtil::CopyOrMoveModeForDestination(dest_url, copy));
}
base::File::Error LocalFileUtil::CopyInForeignFile(
@@ -213,8 +213,7 @@
return error;
return NativeFileUtil::CopyOrMoveFile(
src_file_path, dest_file_path, FileSystemOperation::OPTION_NONE,
- storage::NativeFileUtil::CopyOrMoveModeForDestination(dest_url,
- true /* copy */));
+ NativeFileUtil::CopyOrMoveModeForDestination(dest_url, true /* copy */));
}
base::File::Error LocalFileUtil::DeleteFile(FileSystemOperationContext* context,
@@ -236,7 +235,7 @@
return NativeFileUtil::DeleteDirectory(file_path);
}
-storage::ScopedFile LocalFileUtil::CreateSnapshotFile(
+ScopedFile LocalFileUtil::CreateSnapshotFile(
FileSystemOperationContext* context,
const FileSystemURL& url,
base::File::Error* error,
@@ -247,7 +246,7 @@
*error = GetFileInfo(context, url, file_info, platform_path);
if (*error == base::File::FILE_OK && file_info->is_directory)
*error = base::File::FILE_ERROR_NOT_A_FILE;
- return storage::ScopedFile();
+ return ScopedFile();
}
bool LocalFileUtil::IsHiddenItem(const base::FilePath& local_file_path) const {
diff --git a/storage/browser/file_system/local_file_util.h b/storage/browser/file_system/local_file_util.h
index 8a654e9..4250d250 100644
--- a/storage/browser/file_system/local_file_util.h
+++ b/storage/browser/file_system/local_file_util.h
@@ -74,12 +74,11 @@
const FileSystemURL& url) override;
base::File::Error DeleteDirectory(FileSystemOperationContext* context,
const FileSystemURL& url) override;
- storage::ScopedFile CreateSnapshotFile(
- FileSystemOperationContext* context,
- const FileSystemURL& url,
- base::File::Error* error,
- base::File::Info* file_info,
- base::FilePath* platform_path) override;
+ ScopedFile CreateSnapshotFile(FileSystemOperationContext* context,
+ const FileSystemURL& url,
+ base::File::Error* error,
+ base::File::Info* file_info,
+ base::FilePath* platform_path) override;
protected:
// Whether this item should not be accessed. For security reasons by default
diff --git a/storage/browser/file_system/local_file_util_unittest.cc b/storage/browser/file_system/local_file_util_unittest.cc
index 35c1a03..1de5f08 100644
--- a/storage/browser/file_system/local_file_util_unittest.cc
+++ b/storage/browser/file_system/local_file_util_unittest.cc
@@ -28,18 +28,11 @@
#include "storage/common/file_system/file_system_types.h"
#include "testing/gtest/include/gtest/gtest.h"
-using content::AsyncFileTestHelper;
-using storage::AsyncFileUtilAdapter;
-using storage::FileSystemContext;
-using storage::FileSystemOperationContext;
-using storage::FileSystemURL;
-using storage::LocalFileUtil;
-
-namespace content {
+namespace storage {
namespace {
-const storage::FileSystemType kFileSystemType = storage::kFileSystemTypeTest;
+const FileSystemType kFileSystemType = kFileSystemTypeTest;
} // namespace
@@ -375,4 +368,4 @@
EXPECT_EQ(1020, GetSize(to_file));
}
-} // namespace content
+} // namespace storage
diff --git a/storage/browser/file_system/memory_file_stream_reader_unittest.cc b/storage/browser/file_system/memory_file_stream_reader_unittest.cc
index a7a50f8..7cbaf6e 100644
--- a/storage/browser/file_system/memory_file_stream_reader_unittest.cc
+++ b/storage/browser/file_system/memory_file_stream_reader_unittest.cc
@@ -39,7 +39,7 @@
void SetUp() override {
ASSERT_TRUE(file_system_directory_.CreateUniqueTempDir());
- file_util_ = std::make_unique<storage::ObfuscatedFileUtilMemoryDelegate>(
+ file_util_ = std::make_unique<ObfuscatedFileUtilMemoryDelegate>(
file_system_directory_.GetPath());
file_util_->CreateFileForTesting(
@@ -55,9 +55,7 @@
EXPECT_TRUE(base::IsDirectoryEmpty(file_system_directory_.GetPath()));
}
- storage::ObfuscatedFileUtilMemoryDelegate* file_util() {
- return file_util_.get();
- }
+ ObfuscatedFileUtilMemoryDelegate* file_util() { return file_util_.get(); }
protected:
std::unique_ptr<FileStreamReader> CreateFileReader(
@@ -86,7 +84,7 @@
private:
base::ScopedTempDir file_system_directory_;
- std::unique_ptr<storage::ObfuscatedFileUtilMemoryDelegate> file_util_;
+ std::unique_ptr<ObfuscatedFileUtilMemoryDelegate> file_util_;
base::Time test_file_modification_time_;
};
diff --git a/storage/browser/file_system/memory_file_stream_writer_unittest.cc b/storage/browser/file_system/memory_file_stream_writer_unittest.cc
index 41bf463..7fcda3df 100644
--- a/storage/browser/file_system/memory_file_stream_writer_unittest.cc
+++ b/storage/browser/file_system/memory_file_stream_writer_unittest.cc
@@ -28,7 +28,7 @@
void SetUp() override {
ASSERT_TRUE(file_system_directory_.CreateUniqueTempDir());
- file_util_ = std::make_unique<storage::ObfuscatedFileUtilMemoryDelegate>(
+ file_util_ = std::make_unique<ObfuscatedFileUtilMemoryDelegate>(
file_system_directory_.GetPath());
}
@@ -38,9 +38,7 @@
EXPECT_TRUE(base::IsDirectoryEmpty(file_system_directory_.GetPath()));
}
- storage::ObfuscatedFileUtilMemoryDelegate* file_util() {
- return file_util_.get();
- }
+ ObfuscatedFileUtilMemoryDelegate* file_util() { return file_util_.get(); }
protected:
base::FilePath Path(const std::string& name) {
@@ -67,7 +65,7 @@
private:
base::ScopedTempDir file_system_directory_;
- std::unique_ptr<storage::ObfuscatedFileUtilMemoryDelegate> file_util_;
+ std::unique_ptr<ObfuscatedFileUtilMemoryDelegate> file_util_;
};
TEST_F(MemoryFileStreamWriterTest, Write) {
diff --git a/storage/browser/file_system/mount_points.h b/storage/browser/file_system/mount_points.h
index 84487c83..4fb761f 100644
--- a/storage/browser/file_system/mount_points.h
+++ b/storage/browser/file_system/mount_points.h
@@ -21,9 +21,6 @@
namespace storage {
class FileSystemMountOption;
class FileSystemURL;
-} // namespace storage
-
-namespace storage {
// Represents a set of mount points for File API.
class COMPONENT_EXPORT(STORAGE_BROWSER) MountPoints {
@@ -68,7 +65,7 @@
// registered in this context, returns empty, invalid FileSystemURL.
virtual FileSystemURL CreateCrackedFileSystemURL(
const url::Origin& origin,
- storage::FileSystemType type,
+ FileSystemType type,
const base::FilePath& path) const = 0;
// Returns the mount point root path registered for a given |mount_name|.
diff --git a/storage/browser/file_system/native_file_util_unittest.cc b/storage/browser/file_system/native_file_util_unittest.cc
index 047abb1..fd00f8c 100644
--- a/storage/browser/file_system/native_file_util_unittest.cc
+++ b/storage/browser/file_system/native_file_util_unittest.cc
@@ -16,11 +16,7 @@
#include "storage/browser/file_system/native_file_util.h"
#include "testing/gtest/include/gtest/gtest.h"
-using storage::FileSystemFileUtil;
-using storage::FileSystemOperation;
-using storage::NativeFileUtil;
-
-namespace content {
+namespace storage {
class NativeFileUtilTest : public testing::Test {
public:
@@ -468,4 +464,4 @@
EXPECT_EQ(file_info1.last_modified, file_info2.last_modified);
}
-} // namespace content
+} // namespace storage
diff --git a/storage/browser/file_system/obfuscated_file_util.cc b/storage/browser/file_system/obfuscated_file_util.cc
index f59e7e09..816225f 100644
--- a/storage/browser/file_system/obfuscated_file_util.cc
+++ b/storage/browser/file_system/obfuscated_file_util.cc
@@ -9,6 +9,7 @@
#include <memory>
#include <tuple>
+#include <utility>
#include "base/bind.h"
#include "base/containers/queue.h"
@@ -79,7 +80,7 @@
}
bool AllocateQuota(FileSystemOperationContext* context, int64_t growth) {
- if (context->allowed_bytes_growth() == storage::QuotaManager::kNoLimit)
+ if (context->allowed_bytes_growth() == QuotaManager::kNoLimit)
return true;
int64_t new_quota = context->allowed_bytes_growth() - growth;
@@ -231,7 +232,7 @@
origins_.pop_back();
}
current_ = record;
- return storage::GetOriginURLFromIdentifier(record.origin);
+ return GetOriginURLFromIdentifier(record.origin);
}
// Returns the current origin's information.
@@ -258,7 +259,7 @@
};
ObfuscatedFileUtil::ObfuscatedFileUtil(
- storage::SpecialStoragePolicy* special_storage_policy,
+ SpecialStoragePolicy* special_storage_policy,
const base::FilePath& file_system_directory,
leveldb::Env* env_override,
GetTypeStringForURLCallback get_type_string_for_url,
@@ -793,7 +794,7 @@
return base::File::FILE_OK;
}
-storage::ScopedFile ObfuscatedFileUtil::CreateSnapshotFile(
+ScopedFile ObfuscatedFileUtil::CreateSnapshotFile(
FileSystemOperationContext* context,
const FileSystemURL& url,
base::File::Error* error,
@@ -808,7 +809,7 @@
}
// An empty ScopedFile does not have any on-disk operation, therefore it can
// be handled the same way by on-disk and in-memory implementations.
- return storage::ScopedFile();
+ return ScopedFile();
}
std::unique_ptr<FileSystemFileUtil::AbstractFileEnumerator>
@@ -914,8 +915,7 @@
// No other directories seem exist. Try deleting the entire origin directory.
InitOriginDatabase(origin, false);
if (origin_database_) {
- origin_database_->RemovePathForOrigin(
- storage::GetIdentifierFromOrigin(origin));
+ origin_database_->RemovePathForOrigin(GetIdentifierFromOrigin(origin));
}
return delegate_->DeleteFileOrDirectory(origin_path, true /* recursive */);
}
@@ -990,7 +990,7 @@
std::string origin_string = database.GetPrimaryOrigin();
if (origin_string.empty() || !database.HasOriginPath(origin_string))
return;
- const url::Origin origin = storage::GetOriginFromIdentifier(origin_string);
+ const url::Origin origin = GetOriginFromIdentifier(origin_string);
// Prepopulate the directory database(s) if and only if this instance
// has primary origin and the directory database is already there.
@@ -1203,8 +1203,8 @@
const url::Origin& origin,
const std::string& type_string) {
// For isolated origin we just use a type string as a key.
- return storage::GetIdentifierFromOrigin(origin) +
- kDirectoryDatabaseKeySeparator + type_string;
+ return GetIdentifierFromOrigin(origin) + kDirectoryDatabaseKeySeparator +
+ type_string;
}
// TODO(ericu): How to do the whole validation-without-creation thing?
@@ -1253,7 +1253,7 @@
return base::FilePath();
}
base::FilePath directory_name;
- std::string id = storage::GetIdentifierFromOrigin(origin);
+ std::string id = GetIdentifierFromOrigin(origin);
bool exists_in_db = origin_database_->HasOriginPath(id);
if (!exists_in_db && !create) {
@@ -1357,7 +1357,7 @@
return true;
const std::string isolated_origin_string =
- storage::GetIdentifierFromOrigin(origin_hint);
+ GetIdentifierFromOrigin(origin_hint);
prioritized_origin_database->InitializePrimaryOrigin(isolated_origin_string);
diff --git a/storage/browser/file_system/obfuscated_file_util.h b/storage/browser/file_system/obfuscated_file_util.h
index bafe640..d4bb0b27 100644
--- a/storage/browser/file_system/obfuscated_file_util.h
+++ b/storage/browser/file_system/obfuscated_file_util.h
@@ -28,21 +28,15 @@
#include "storage/browser/file_system/sandbox_file_system_backend_delegate.h"
#include "storage/common/file_system/file_system_types.h"
-namespace content {
-class ObfuscatedFileUtilTest;
-class QuotaBackendImplTest;
-} // namespace content
-
-namespace storage {
-class SpecialStoragePolicy;
-}
-
class GURL;
namespace storage {
class FileSystemOperationContext;
+class ObfuscatedFileUtilTest;
+class QuotaBackendImplTest;
class SandboxOriginDatabaseInterface;
+class SpecialStoragePolicy;
// This file util stores directory information in LevelDB to obfuscate
// and to neutralize virtual file paths given by arbitrary apps.
@@ -98,7 +92,7 @@
// for any known type exists the origin directory may get deleted when
// one origin/type pair is deleted.
//
- ObfuscatedFileUtil(storage::SpecialStoragePolicy* special_storage_policy,
+ ObfuscatedFileUtil(SpecialStoragePolicy* special_storage_policy,
const base::FilePath& file_system_directory,
leveldb::Env* env_override,
GetTypeStringForURLCallback get_type_string_for_url,
@@ -148,12 +142,11 @@
const FileSystemURL& url) override;
base::File::Error DeleteDirectory(FileSystemOperationContext* context,
const FileSystemURL& url) override;
- storage::ScopedFile CreateSnapshotFile(
- FileSystemOperationContext* context,
- const FileSystemURL& url,
- base::File::Error* error,
- base::File::Info* file_info,
- base::FilePath* platform_path) override;
+ ScopedFile CreateSnapshotFile(FileSystemOperationContext* context,
+ const FileSystemURL& url,
+ base::File::Error* error,
+ base::File::Info* file_info,
+ base::FilePath* platform_path) override;
// Returns true if the directory |url| is empty.
bool IsDirectoryEmpty(FileSystemOperationContext* context,
@@ -219,14 +212,14 @@
using FileInfo = SandboxDirectoryDatabase::FileInfo;
friend class ObfuscatedFileEnumerator;
- friend class content::ObfuscatedFileUtilTest;
- friend class content::QuotaBackendImplTest;
+ friend class ObfuscatedFileUtilTest;
+ friend class QuotaBackendImplTest;
// Helper method to create an obfuscated file util for regular
// (temporary, persistent) file systems. Used only for testing.
// Note: this is implemented in sandbox_file_system_backend_delegate.cc.
static ObfuscatedFileUtil* CreateForTesting(
- storage::SpecialStoragePolicy* special_storage_policy,
+ SpecialStoragePolicy* special_storage_policy,
const base::FilePath& file_system_directory,
leveldb::Env* env_override,
bool is_incognito);
@@ -321,7 +314,7 @@
std::map<std::string, std::unique_ptr<SandboxDirectoryDatabase>> directories_;
std::unique_ptr<SandboxOriginDatabaseInterface> origin_database_;
- scoped_refptr<storage::SpecialStoragePolicy> special_storage_policy_;
+ scoped_refptr<SpecialStoragePolicy> special_storage_policy_;
base::FilePath file_system_directory_;
leveldb::Env* env_override_;
bool is_incognito_;
diff --git a/storage/browser/file_system/obfuscated_file_util_memory_delegate_unittest.cc b/storage/browser/file_system/obfuscated_file_util_memory_delegate_unittest.cc
index dbde9cc..9652b79 100644
--- a/storage/browser/file_system/obfuscated_file_util_memory_delegate_unittest.cc
+++ b/storage/browser/file_system/obfuscated_file_util_memory_delegate_unittest.cc
@@ -5,6 +5,7 @@
#include "storage/browser/file_system/obfuscated_file_util_memory_delegate.h"
#include <memory>
+#include <string>
#include "base/files/file.h"
#include "base/files/file_path.h"
@@ -258,10 +259,8 @@
base::FilePath from_file = Path("fromfile");
base::FilePath to_file1 = Path("tofile1");
base::FilePath to_file2 = Path("tofile2");
- const storage::NativeFileUtil::CopyOrMoveMode nosync =
- storage::NativeFileUtil::COPY_NOSYNC;
- const storage::NativeFileUtil::CopyOrMoveMode sync =
- storage::NativeFileUtil::COPY_SYNC;
+ const NativeFileUtil::CopyOrMoveMode nosync = NativeFileUtil::COPY_NOSYNC;
+ const NativeFileUtil::CopyOrMoveMode sync = NativeFileUtil::COPY_SYNC;
bool created = false;
ASSERT_EQ(base::File::FILE_OK,
@@ -311,8 +310,7 @@
char test_data[] = "0123456789";
const int test_data_len = strlen(test_data);
- const storage::NativeFileUtil::CopyOrMoveMode sync =
- storage::NativeFileUtil::COPY_SYNC;
+ const NativeFileUtil::CopyOrMoveMode sync = NativeFileUtil::COPY_SYNC;
// Test copying nonexistent file.
EXPECT_EQ(
@@ -346,8 +344,7 @@
}
TEST_F(ObfuscatedFileUtilMemoryDelegateTest, CopyFileNonExistingFile) {
- const storage::NativeFileUtil::CopyOrMoveMode nosync =
- storage::NativeFileUtil::COPY_NOSYNC;
+ const NativeFileUtil::CopyOrMoveMode nosync = NativeFileUtil::COPY_NOSYNC;
EXPECT_EQ(
base::File::FILE_ERROR_NOT_FOUND,
@@ -356,8 +353,7 @@
}
TEST_F(ObfuscatedFileUtilMemoryDelegateTest, CopyDirectoryOverFile) {
- const storage::NativeFileUtil::CopyOrMoveMode nosync =
- storage::NativeFileUtil::COPY_NOSYNC;
+ const NativeFileUtil::CopyOrMoveMode nosync = NativeFileUtil::COPY_NOSYNC;
base::FilePath dir = Path("dir");
ASSERT_EQ(base::File::FILE_OK,
@@ -371,8 +367,7 @@
TEST_F(ObfuscatedFileUtilMemoryDelegateTest, CopyFileOverDirectory) {
base::FilePath file_name = Path("fromfile");
base::FilePath dir = Path("dir");
- const storage::NativeFileUtil::CopyOrMoveMode nosync =
- storage::NativeFileUtil::COPY_NOSYNC;
+ const NativeFileUtil::CopyOrMoveMode nosync = NativeFileUtil::COPY_NOSYNC;
bool created = false;
ASSERT_EQ(base::File::FILE_OK,
@@ -387,8 +382,7 @@
TEST_F(ObfuscatedFileUtilMemoryDelegateTest, CopyFileToNonExistingDirectory) {
base::FilePath file_name = Path("fromfile");
- const storage::NativeFileUtil::CopyOrMoveMode nosync =
- storage::NativeFileUtil::COPY_NOSYNC;
+ const NativeFileUtil::CopyOrMoveMode nosync = NativeFileUtil::COPY_NOSYNC;
bool created = false;
ASSERT_EQ(base::File::FILE_OK,
@@ -403,8 +397,7 @@
TEST_F(ObfuscatedFileUtilMemoryDelegateTest, CopyFileAsChildOfOtherFile) {
base::FilePath from_file = Path("fromfile");
base::FilePath to_file = Path("tofile");
- const storage::NativeFileUtil::CopyOrMoveMode nosync =
- storage::NativeFileUtil::COPY_NOSYNC;
+ const NativeFileUtil::CopyOrMoveMode nosync = NativeFileUtil::COPY_NOSYNC;
bool created = false;
ASSERT_EQ(base::File::FILE_OK,
@@ -422,8 +415,7 @@
base::FilePath from_file = Path("fromfile");
base::FilePath to_file = Path("tofile");
- const storage::NativeFileUtil::CopyOrMoveMode move =
- storage::NativeFileUtil::MOVE;
+ const NativeFileUtil::CopyOrMoveMode move = NativeFileUtil::MOVE;
bool created = false;
ASSERT_EQ(base::File::FILE_OK,
@@ -462,8 +454,7 @@
}
TEST_F(ObfuscatedFileUtilMemoryDelegateTest, MoveNonExistingFile) {
- const storage::NativeFileUtil::CopyOrMoveMode move =
- storage::NativeFileUtil::MOVE;
+ const NativeFileUtil::CopyOrMoveMode move = NativeFileUtil::MOVE;
EXPECT_EQ(
base::File::FILE_ERROR_NOT_FOUND,
@@ -475,8 +466,7 @@
base::FilePath dir = Path("dir");
base::FilePath dir2 = Path("dir2");
- const storage::NativeFileUtil::CopyOrMoveMode move =
- storage::NativeFileUtil::MOVE;
+ const NativeFileUtil::CopyOrMoveMode move = NativeFileUtil::MOVE;
ASSERT_EQ(base::File::FILE_OK,
file_util()->CreateDirectory(dir, false, false));
@@ -496,8 +486,7 @@
base::FilePath from_file = Path("fromfile");
base::FilePath dir = Path("dir");
- const storage::NativeFileUtil::CopyOrMoveMode move =
- storage::NativeFileUtil::MOVE;
+ const NativeFileUtil::CopyOrMoveMode move = NativeFileUtil::MOVE;
bool created = false;
ASSERT_EQ(base::File::FILE_OK,
@@ -513,8 +502,7 @@
TEST_F(ObfuscatedFileUtilMemoryDelegateTest, MoveFileToNonExistingDirectory) {
base::FilePath from_file = Path("fromfile");
- const storage::NativeFileUtil::CopyOrMoveMode move =
- storage::NativeFileUtil::MOVE;
+ const NativeFileUtil::CopyOrMoveMode move = NativeFileUtil::MOVE;
bool created = false;
ASSERT_EQ(base::File::FILE_OK,
@@ -530,8 +518,7 @@
base::FilePath from_file = Path("fromfile");
base::FilePath to_file = Path("tofile");
- const storage::NativeFileUtil::CopyOrMoveMode move =
- storage::NativeFileUtil::MOVE;
+ const NativeFileUtil::CopyOrMoveMode move = NativeFileUtil::MOVE;
bool created = false;
ASSERT_EQ(base::File::FILE_OK,
@@ -554,8 +541,7 @@
ASSERT_EQ(base::File::FILE_OK,
file_util()->CreateDirectory(from_directory, false /* exclusive */,
false /* recursive */));
- const storage::NativeFileUtil::CopyOrMoveMode move =
- storage::NativeFileUtil::MOVE;
+ const NativeFileUtil::CopyOrMoveMode move = NativeFileUtil::MOVE;
bool created = false;
ASSERT_EQ(base::File::FILE_OK,
file_util()->EnsureFileExists(from_file, &created));
@@ -589,8 +575,7 @@
ASSERT_EQ(base::File::FILE_OK,
file_util()->CreateDirectory(to_directory, false /* exclusive */,
false /* recursive */));
- const storage::NativeFileUtil::CopyOrMoveMode move =
- storage::NativeFileUtil::MOVE;
+ const NativeFileUtil::CopyOrMoveMode move = NativeFileUtil::MOVE;
bool created = false;
ASSERT_EQ(base::File::FILE_OK,
file_util()->EnsureFileExists(from_file, &created));
@@ -616,8 +601,7 @@
base::FilePath from_file = Path("fromfile");
base::FilePath to_file = Path("tofile");
- const storage::NativeFileUtil::CopyOrMoveMode nosync =
- storage::NativeFileUtil::COPY_NOSYNC;
+ const NativeFileUtil::CopyOrMoveMode nosync = NativeFileUtil::COPY_NOSYNC;
bool created = false;
ASSERT_EQ(base::File::FILE_OK,
@@ -645,8 +629,7 @@
base::FilePath from_file = Path("fromfile");
base::FilePath to_file = Path("tofile");
- const storage::NativeFileUtil::CopyOrMoveMode sync =
- storage::NativeFileUtil::COPY_SYNC;
+ const NativeFileUtil::CopyOrMoveMode sync = NativeFileUtil::COPY_SYNC;
bool created = false;
ASSERT_EQ(base::File::FILE_OK,
@@ -674,8 +657,7 @@
base::FilePath from_file = Path("fromfile");
base::FilePath to_file = Path("tofile");
- const storage::NativeFileUtil::CopyOrMoveMode move =
- storage::NativeFileUtil::MOVE;
+ const NativeFileUtil::CopyOrMoveMode move = NativeFileUtil::MOVE;
bool created = false;
ASSERT_EQ(base::File::FILE_OK,
@@ -726,4 +708,4 @@
ASSERT_EQ(45u, file_util()->ComputeDirectorySize(Path()));
}
-} // namespace storage
\ No newline at end of file
+} // namespace storage
diff --git a/storage/browser/file_system/obfuscated_file_util_unittest.cc b/storage/browser/file_system/obfuscated_file_util_unittest.cc
index add0d6b..4fdb2e5c 100644
--- a/storage/browser/file_system/obfuscated_file_util_unittest.cc
+++ b/storage/browser/file_system/obfuscated_file_util_unittest.cc
@@ -18,6 +18,7 @@
#include "base/files/file_util.h"
#include "base/files/scoped_temp_dir.h"
#include "base/macros.h"
+#include "base/memory/scoped_refptr.h"
#include "base/run_loop.h"
#include "base/stl_util.h"
#include "base/test/task_environment.h"
@@ -54,19 +55,9 @@
#define MAYBE_TestQuotaOnTruncation TestQuotaOnTruncation
#endif
-using content::AsyncFileTestHelper;
-using storage::FileSystemContext;
-using storage::FileSystemOperation;
-using storage::FileSystemOperationContext;
-using storage::FileSystemURL;
-using storage::kFileSystemTypePersistent;
-using storage::kFileSystemTypeTemporary;
-using storage::ObfuscatedFileUtil;
-using storage::SandboxDirectoryDatabase;
-using storage::SandboxIsolatedOriginDatabase;
using url::Origin;
-namespace content {
+namespace storage {
namespace {
@@ -142,17 +133,16 @@
}
FileSystemURL FileSystemURLDirName(const FileSystemURL& url) {
- return FileSystemURL::CreateForTest(
- url.origin(), url.mount_type(),
- storage::VirtualPath::DirName(url.virtual_path()));
+ return FileSystemURL::CreateForTest(url.origin(), url.mount_type(),
+ VirtualPath::DirName(url.virtual_path()));
}
-std::string GetTypeString(storage::FileSystemType type) {
- return storage::SandboxFileSystemBackendDelegate::GetTypeString(type);
+std::string GetTypeString(FileSystemType type) {
+ return SandboxFileSystemBackendDelegate::GetTypeString(type);
}
bool HasFileSystemType(ObfuscatedFileUtil::AbstractOriginEnumerator* enumerator,
- storage::FileSystemType type) {
+ FileSystemType type) {
return enumerator->HasTypeDirectory(GetTypeString(type));
}
@@ -168,7 +158,7 @@
ObfuscatedFileUtilTest()
: task_environment_(base::test::TaskEnvironment::MainThreadType::IO),
origin_(Origin::Create(GURL("http://www.example.com"))),
- type_(storage::kFileSystemTypeTemporary),
+ type_(kFileSystemTypeTemporary),
sandbox_file_system_(origin_, type_),
quota_status_(blink::mojom::QuotaStatusCode::kUnknown),
usage_(-1) {}
@@ -178,13 +168,13 @@
void SetUp() override {
ASSERT_TRUE(data_dir_.CreateUniqueTempDir());
- storage_policy_ = new MockSpecialStoragePolicy();
+ storage_policy_ = base::MakeRefCounted<MockSpecialStoragePolicy>();
- quota_manager_ = new storage::QuotaManager(
+ quota_manager_ = base::MakeRefCounted<QuotaManager>(
is_incognito(), data_dir_.GetPath(),
base::ThreadTaskRunnerHandle::Get().get(), storage_policy_.get(),
- storage::GetQuotaSettingsFunc());
- storage::QuotaSettings settings;
+ GetQuotaSettingsFunc());
+ QuotaSettings settings;
settings.per_host_quota = 25 * 1024 * 1024;
settings.pool_size = settings.per_host_quota * 5;
settings.must_remain_available = 10 * 1024 * 1024;
@@ -205,8 +195,7 @@
sandbox_file_system_.SetUp(file_system_context_.get());
- change_observers_ =
- storage::MockFileChangeObserver::CreateList(&change_observer_);
+ change_observers_ = MockFileChangeObserver::CreateList(&change_observer_);
if (is_incognito())
incognito_leveldb_environment_ = leveldb_chrome::NewMemEnv("FileSystem");
@@ -247,20 +236,18 @@
return context;
}
- const storage::ChangeObserverList& change_observers() const {
+ const ChangeObserverList& change_observers() const {
return change_observers_;
}
- storage::MockFileChangeObserver* change_observer() {
- return &change_observer_;
- }
+ MockFileChangeObserver* change_observer() { return &change_observer_; }
// This can only be used after SetUp has run and created file_system_context_
// and obfuscated_file_util_.
// Use this for tests which need to run in multiple origins; we need a test
// helper per origin.
SandboxFileSystemTestHelper* NewFileSystem(const Origin& origin,
- storage::FileSystemType type) {
+ FileSystemType type) {
SandboxFileSystemTestHelper* file_system =
new SandboxFileSystemTestHelper(origin, type);
@@ -269,7 +256,7 @@
}
std::unique_ptr<ObfuscatedFileUtil> CreateObfuscatedFileUtil(
- storage::SpecialStoragePolicy* storage_policy) {
+ SpecialStoragePolicy* storage_policy) {
return std::unique_ptr<ObfuscatedFileUtil>(
ObfuscatedFileUtil::CreateForTesting(
storage_policy, data_dir_path(),
@@ -285,7 +272,7 @@
const Origin& origin() const { return origin_; }
- storage::FileSystemType type() const { return type_; }
+ FileSystemType type() const { return type_; }
std::string type_string() const { return GetTypeString(type_); }
@@ -344,7 +331,7 @@
}
int64_t usage() const { return usage_; }
- storage::FileSystemUsageCache* usage_cache() {
+ FileSystemUsageCache* usage_cache() {
return sandbox_file_system_.usage_cache();
}
@@ -382,8 +369,7 @@
if (is_incognito()) {
ASSERT_FALSE(file.IsValid());
auto* memory_delegate =
- static_cast<storage::ObfuscatedFileUtilMemoryDelegate*>(
- ofu()->delegate());
+ static_cast<ObfuscatedFileUtilMemoryDelegate*>(ofu()->delegate());
ASSERT_EQ(
length,
memory_delegate->WriteFile(
@@ -805,15 +791,15 @@
base::test::TaskEnvironment task_environment_;
base::ScopedTempDir data_dir_;
scoped_refptr<MockSpecialStoragePolicy> storage_policy_;
- scoped_refptr<storage::QuotaManager> quota_manager_;
+ scoped_refptr<QuotaManager> quota_manager_;
scoped_refptr<FileSystemContext> file_system_context_;
Origin origin_;
- storage::FileSystemType type_;
+ FileSystemType type_;
SandboxFileSystemTestHelper sandbox_file_system_;
blink::mojom::QuotaStatusCode quota_status_;
int64_t usage_;
- storage::MockFileChangeObserver change_observer_;
- storage::ChangeObserverList change_observers_;
+ MockFileChangeObserver change_observer_;
+ ChangeObserverList change_observers_;
base::WeakPtrFactory<ObfuscatedFileUtilTest> weak_factory_{this};
private:
@@ -1903,8 +1889,8 @@
base::FilePath foreign_src_file_path =
foreign_source_dir.GetPath().AppendASCII("file_name");
- EXPECT_EQ(base::File::FILE_OK, storage::NativeFileUtil::EnsureFileExists(
- foreign_src_file_path, &created));
+ EXPECT_EQ(base::File::FILE_OK,
+ NativeFileUtil::EnsureFileExists(foreign_src_file_path, &created));
EXPECT_TRUE(created);
ClearTimestamp(dir_url);
@@ -2013,8 +1999,8 @@
base::Time()));
context.reset(NewContext(nullptr));
- std::unique_ptr<storage::FileSystemFileUtil::AbstractFileEnumerator>
- file_enum(ofu()->CreateFileEnumerator(context.get(), dir, false));
+ std::unique_ptr<FileSystemFileUtil::AbstractFileEnumerator> file_enum =
+ ofu()->CreateFileEnumerator(context.get(), dir, false);
int count = 0;
base::FilePath file_path_each;
@@ -2534,4 +2520,4 @@
ASSERT_EQ(base::File::FILE_OK, error);
}
-} // namespace content
+} // namespace storage
diff --git a/storage/browser/file_system/plugin_private_file_system_backend.cc b/storage/browser/file_system/plugin_private_file_system_backend.cc
index 3472e51..fc6e1ef 100644
--- a/storage/browser/file_system/plugin_private_file_system_backend.cc
+++ b/storage/browser/file_system/plugin_private_file_system_backend.cc
@@ -96,7 +96,7 @@
PluginPrivateFileSystemBackend::PluginPrivateFileSystemBackend(
base::SequencedTaskRunner* file_task_runner,
const base::FilePath& profile_path,
- storage::SpecialStoragePolicy* special_storage_policy,
+ SpecialStoragePolicy* special_storage_policy,
const FileSystemOptions& file_system_options,
leveldb::Env* env_override)
: file_task_runner_(file_task_runner),
@@ -230,7 +230,7 @@
base::File::Error
PluginPrivateFileSystemBackend::DeleteOriginDataOnFileTaskRunner(
FileSystemContext* context,
- storage::QuotaManagerProxy* proxy,
+ QuotaManagerProxy* proxy,
const GURL& origin_url,
FileSystemType type) {
if (!CanHandleType(type))
@@ -244,7 +244,7 @@
void PluginPrivateFileSystemBackend::PerformStorageCleanupOnFileTaskRunner(
FileSystemContext* context,
- storage::QuotaManagerProxy* proxy,
+ QuotaManagerProxy* proxy,
FileSystemType type) {
if (!CanHandleType(type))
return;
@@ -304,13 +304,12 @@
*total_size = 0;
*last_modified_time = base::Time::UnixEpoch();
std::string fsid =
- storage::IsolatedContext::GetInstance()->RegisterFileSystemForVirtualPath(
- storage::kFileSystemTypePluginPrivate, "pluginprivate",
- base::FilePath());
- DCHECK(storage::ValidateIsolatedFileSystemId(fsid));
+ IsolatedContext::GetInstance()->RegisterFileSystemForVirtualPath(
+ kFileSystemTypePluginPrivate, "pluginprivate", base::FilePath());
+ DCHECK(ValidateIsolatedFileSystemId(fsid));
- std::string root = storage::GetIsolatedFileSystemRootURIString(
- origin.GetURL(), fsid, "pluginprivate");
+ std::string root = GetIsolatedFileSystemRootURIString(origin.GetURL(), fsid,
+ "pluginprivate");
std::unique_ptr<FileSystemOperationContext> operation_context(
new FileSystemOperationContext(context));
@@ -336,8 +335,7 @@
std::string plugin_name = plugin_path.BaseName().MaybeAsASCII();
if (OpenFileSystemOnFileTaskRunner(
obfuscated_file_util(), plugin_map_, origin, fsid, plugin_name,
- storage::OPEN_FILE_SYSTEM_FAIL_IF_NONEXISTENT) !=
- base::File::FILE_OK) {
+ OPEN_FILE_SYSTEM_FAIL_IF_NONEXISTENT) != base::File::FILE_OK) {
continue;
}
diff --git a/storage/browser/file_system/plugin_private_file_system_backend.h b/storage/browser/file_system/plugin_private_file_system_backend.h
index d02bc81..246a6821 100644
--- a/storage/browser/file_system/plugin_private_file_system_backend.h
+++ b/storage/browser/file_system/plugin_private_file_system_backend.h
@@ -24,10 +24,6 @@
class SequencedTaskRunner;
}
-namespace content {
-class PluginPrivateFileSystemBackendTest;
-}
-
namespace leveldb {
class Env;
}
@@ -50,12 +46,11 @@
class FileSystemIDToPluginMap;
using StatusCallback = base::OnceCallback<void(base::File::Error result)>;
- PluginPrivateFileSystemBackend(
- base::SequencedTaskRunner* file_task_runner,
- const base::FilePath& profile_path,
- storage::SpecialStoragePolicy* special_storage_policy,
- const FileSystemOptions& file_system_options,
- leveldb::Env* env_override);
+ PluginPrivateFileSystemBackend(base::SequencedTaskRunner* file_task_runner,
+ const base::FilePath& profile_path,
+ SpecialStoragePolicy* special_storage_policy,
+ const FileSystemOptions& file_system_options,
+ leveldb::Env* env_override);
~PluginPrivateFileSystemBackend() override;
// This must be used to open 'private' filesystem instead of regular
@@ -87,9 +82,8 @@
FileSystemContext* context,
base::File::Error* error_code) const override;
bool SupportsStreaming(const FileSystemURL& url) const override;
- bool HasInplaceCopyImplementation(
- storage::FileSystemType type) const override;
- std::unique_ptr<storage::FileStreamReader> CreateFileStreamReader(
+ bool HasInplaceCopyImplementation(FileSystemType type) const override;
+ std::unique_ptr<FileStreamReader> CreateFileStreamReader(
const FileSystemURL& url,
int64_t offset,
int64_t max_bytes_to_read,
@@ -110,11 +104,11 @@
// FileSystemQuotaUtil overrides.
base::File::Error DeleteOriginDataOnFileTaskRunner(
FileSystemContext* context,
- storage::QuotaManagerProxy* proxy,
+ QuotaManagerProxy* proxy,
const GURL& origin_url,
FileSystemType type) override;
void PerformStorageCleanupOnFileTaskRunner(FileSystemContext* context,
- storage::QuotaManagerProxy* proxy,
+ QuotaManagerProxy* proxy,
FileSystemType type) override;
void GetOriginsForTypeOnFileTaskRunner(FileSystemType type,
std::set<GURL>* origins) override;
@@ -140,7 +134,7 @@
ObfuscatedFileUtilMemoryDelegate* obfuscated_file_util_memory_delegate();
private:
- friend class content::PluginPrivateFileSystemBackendTest;
+ friend class PluginPrivateFileSystemBackendTest;
ObfuscatedFileUtil* obfuscated_file_util();
const base::FilePath& base_path() const { return base_path_; }
diff --git a/storage/browser/file_system/plugin_private_file_system_backend_unittest.cc b/storage/browser/file_system/plugin_private_file_system_backend_unittest.cc
index 482fa40..eea37df 100644
--- a/storage/browser/file_system/plugin_private_file_system_backend_unittest.cc
+++ b/storage/browser/file_system/plugin_private_file_system_backend_unittest.cc
@@ -20,30 +20,18 @@
#include "testing/gtest/include/gtest/gtest.h"
#include "url/origin.h"
-using content::AsyncFileTestHelper;
-using storage::FileSystemContext;
-using storage::FileSystemURL;
-using storage::IsolatedContext;
using url::Origin;
-namespace content {
+namespace storage {
namespace {
-const std::string kPlugin1("plugin1");
-const std::string kPlugin2("plugin2");
-const storage::FileSystemType kType = storage::kFileSystemTypePluginPrivate;
-const std::string kRootName = "pluginprivate";
+const FileSystemType kType = kFileSystemTypePluginPrivate;
void DidOpenFileSystem(base::File::Error* error_out, base::File::Error error) {
*error_out = error;
}
-std::string RegisterFileSystem() {
- return IsolatedContext::GetInstance()->RegisterFileSystemForVirtualPath(
- kType, kRootName, base::FilePath());
-}
-
} // namespace
class PluginPrivateFileSystemBackendTest : public testing::Test {
@@ -61,12 +49,21 @@
root.virtual_path().AppendASCII(relative));
}
- storage::PluginPrivateFileSystemBackend* backend() const {
+ PluginPrivateFileSystemBackend* backend() const {
return context_->plugin_private_backend();
}
+ std::string RegisterFileSystem() {
+ return IsolatedContext::GetInstance()->RegisterFileSystemForVirtualPath(
+ kType, kRootName, base::FilePath());
+ }
+
const base::FilePath& base_path() const { return backend()->base_path(); }
+ const std::string kPlugin1 = "plugin1";
+ const std::string kPlugin2 = "plugin2";
+ const std::string kRootName = "pluginprivate";
+
base::ScopedTempDir data_dir_;
base::test::SingleThreadTaskEnvironment task_environment_;
scoped_refptr<FileSystemContext> context_;
@@ -80,24 +77,22 @@
const std::string filesystem_id1 = RegisterFileSystem();
base::File::Error error = base::File::FILE_ERROR_FAILED;
- backend()->OpenPrivateFileSystem(
- kOrigin, kType, filesystem_id1, kPlugin1,
- storage::OPEN_FILE_SYSTEM_CREATE_IF_NONEXISTENT,
- base::BindOnce(&DidOpenFileSystem, &error));
+ backend()->OpenPrivateFileSystem(kOrigin, kType, filesystem_id1, kPlugin1,
+ OPEN_FILE_SYSTEM_CREATE_IF_NONEXISTENT,
+ base::BindOnce(&DidOpenFileSystem, &error));
base::RunLoop().RunUntilIdle();
ASSERT_EQ(base::File::FILE_OK, error);
// Run this again with FAIL_IF_NONEXISTENT to see if it succeeds.
const std::string filesystem_id2 = RegisterFileSystem();
error = base::File::FILE_ERROR_FAILED;
- backend()->OpenPrivateFileSystem(
- kOrigin, kType, filesystem_id2, kPlugin1,
- storage::OPEN_FILE_SYSTEM_FAIL_IF_NONEXISTENT,
- base::BindOnce(&DidOpenFileSystem, &error));
+ backend()->OpenPrivateFileSystem(kOrigin, kType, filesystem_id2, kPlugin1,
+ OPEN_FILE_SYSTEM_FAIL_IF_NONEXISTENT,
+ base::BindOnce(&DidOpenFileSystem, &error));
base::RunLoop().RunUntilIdle();
ASSERT_EQ(base::File::FILE_OK, error);
- const GURL root_url(storage::GetIsolatedFileSystemRootURIString(
+ const GURL root_url(GetIsolatedFileSystemRootURIString(
kOrigin.GetURL(), filesystem_id1, kRootName));
FileSystemURL file = CreateURL(root_url, "foo");
base::FilePath platform_path;
@@ -115,24 +110,22 @@
// Open filesystem for kPlugin1 and kPlugin2.
const std::string filesystem_id1 = RegisterFileSystem();
base::File::Error error = base::File::FILE_ERROR_FAILED;
- backend()->OpenPrivateFileSystem(
- kOrigin, kType, filesystem_id1, kPlugin1,
- storage::OPEN_FILE_SYSTEM_CREATE_IF_NONEXISTENT,
- base::BindOnce(&DidOpenFileSystem, &error));
+ backend()->OpenPrivateFileSystem(kOrigin, kType, filesystem_id1, kPlugin1,
+ OPEN_FILE_SYSTEM_CREATE_IF_NONEXISTENT,
+ base::BindOnce(&DidOpenFileSystem, &error));
base::RunLoop().RunUntilIdle();
ASSERT_EQ(base::File::FILE_OK, error);
const std::string filesystem_id2 = RegisterFileSystem();
error = base::File::FILE_ERROR_FAILED;
- backend()->OpenPrivateFileSystem(
- kOrigin, kType, filesystem_id2, kPlugin2,
- storage::OPEN_FILE_SYSTEM_CREATE_IF_NONEXISTENT,
- base::BindOnce(&DidOpenFileSystem, &error));
+ backend()->OpenPrivateFileSystem(kOrigin, kType, filesystem_id2, kPlugin2,
+ OPEN_FILE_SYSTEM_CREATE_IF_NONEXISTENT,
+ base::BindOnce(&DidOpenFileSystem, &error));
base::RunLoop().RunUntilIdle();
ASSERT_EQ(base::File::FILE_OK, error);
// Create 'foo' in kPlugin1.
- const GURL root_url1(storage::GetIsolatedFileSystemRootURIString(
+ const GURL root_url1(GetIsolatedFileSystemRootURIString(
kOrigin.GetURL(), filesystem_id1, kRootName));
FileSystemURL file1 = CreateURL(root_url1, "foo");
EXPECT_EQ(base::File::FILE_OK,
@@ -141,7 +134,7 @@
context_.get(), file1, AsyncFileTestHelper::kDontCheckSize));
// See the same path is not available in kPlugin2.
- const GURL root_url2(storage::GetIsolatedFileSystemRootURIString(
+ const GURL root_url2(GetIsolatedFileSystemRootURIString(
kOrigin.GetURL(), filesystem_id2, kRootName));
FileSystemURL file2 = CreateURL(root_url2, "foo");
EXPECT_FALSE(AsyncFileTestHelper::FileExists(
@@ -155,24 +148,22 @@
// Open filesystem for kOrigin1 and kOrigin2.
const std::string filesystem_id1 = RegisterFileSystem();
base::File::Error error = base::File::FILE_ERROR_FAILED;
- backend()->OpenPrivateFileSystem(
- kOrigin1, kType, filesystem_id1, kPlugin1,
- storage::OPEN_FILE_SYSTEM_CREATE_IF_NONEXISTENT,
- base::BindOnce(&DidOpenFileSystem, &error));
+ backend()->OpenPrivateFileSystem(kOrigin1, kType, filesystem_id1, kPlugin1,
+ OPEN_FILE_SYSTEM_CREATE_IF_NONEXISTENT,
+ base::BindOnce(&DidOpenFileSystem, &error));
base::RunLoop().RunUntilIdle();
ASSERT_EQ(base::File::FILE_OK, error);
const std::string filesystem_id2 = RegisterFileSystem();
error = base::File::FILE_ERROR_FAILED;
- backend()->OpenPrivateFileSystem(
- kOrigin2, kType, filesystem_id2, kPlugin1,
- storage::OPEN_FILE_SYSTEM_CREATE_IF_NONEXISTENT,
- base::BindOnce(&DidOpenFileSystem, &error));
+ backend()->OpenPrivateFileSystem(kOrigin2, kType, filesystem_id2, kPlugin1,
+ OPEN_FILE_SYSTEM_CREATE_IF_NONEXISTENT,
+ base::BindOnce(&DidOpenFileSystem, &error));
base::RunLoop().RunUntilIdle();
ASSERT_EQ(base::File::FILE_OK, error);
// Create 'foo' in kOrigin1.
- const GURL root_url1(storage::GetIsolatedFileSystemRootURIString(
+ const GURL root_url1(GetIsolatedFileSystemRootURIString(
kOrigin1.GetURL(), filesystem_id1, kRootName));
FileSystemURL file1 = CreateURL(root_url1, "foo");
EXPECT_EQ(base::File::FILE_OK,
@@ -181,7 +172,7 @@
context_.get(), file1, AsyncFileTestHelper::kDontCheckSize));
// See the same path is not available in kOrigin2.
- const GURL root_url2(storage::GetIsolatedFileSystemRootURIString(
+ const GURL root_url2(GetIsolatedFileSystemRootURIString(
kOrigin2.GetURL(), filesystem_id2, kRootName));
FileSystemURL file2 = CreateURL(root_url2, "foo");
EXPECT_FALSE(AsyncFileTestHelper::FileExists(
@@ -195,24 +186,22 @@
// Open filesystem for kOrigin1 and kOrigin2.
const std::string filesystem_id1 = RegisterFileSystem();
base::File::Error error = base::File::FILE_ERROR_FAILED;
- backend()->OpenPrivateFileSystem(
- kOrigin1, kType, filesystem_id1, kPlugin1,
- storage::OPEN_FILE_SYSTEM_CREATE_IF_NONEXISTENT,
- base::BindOnce(&DidOpenFileSystem, &error));
+ backend()->OpenPrivateFileSystem(kOrigin1, kType, filesystem_id1, kPlugin1,
+ OPEN_FILE_SYSTEM_CREATE_IF_NONEXISTENT,
+ base::BindOnce(&DidOpenFileSystem, &error));
base::RunLoop().RunUntilIdle();
ASSERT_EQ(base::File::FILE_OK, error);
const std::string filesystem_id2 = RegisterFileSystem();
error = base::File::FILE_ERROR_FAILED;
- backend()->OpenPrivateFileSystem(
- kOrigin2, kType, filesystem_id2, kPlugin1,
- storage::OPEN_FILE_SYSTEM_CREATE_IF_NONEXISTENT,
- base::BindOnce(&DidOpenFileSystem, &error));
+ backend()->OpenPrivateFileSystem(kOrigin2, kType, filesystem_id2, kPlugin1,
+ OPEN_FILE_SYSTEM_CREATE_IF_NONEXISTENT,
+ base::BindOnce(&DidOpenFileSystem, &error));
base::RunLoop().RunUntilIdle();
ASSERT_EQ(base::File::FILE_OK, error);
// Create 'foo' in kOrigin1.
- const GURL root_url1(storage::GetIsolatedFileSystemRootURIString(
+ const GURL root_url1(GetIsolatedFileSystemRootURIString(
kOrigin1.GetURL(), filesystem_id1, kRootName));
FileSystemURL file1 = CreateURL(root_url1, "foo");
EXPECT_EQ(base::File::FILE_OK,
@@ -221,7 +210,7 @@
context_.get(), file1, AsyncFileTestHelper::kDontCheckSize));
// Create 'foo' in kOrigin2.
- const GURL root_url2(storage::GetIsolatedFileSystemRootURIString(
+ const GURL root_url2(GetIsolatedFileSystemRootURIString(
kOrigin2.GetURL(), filesystem_id2, kRootName));
FileSystemURL file2 = CreateURL(root_url2, "foo");
EXPECT_EQ(base::File::FILE_OK,
@@ -245,15 +234,14 @@
// Re-open filesystem for kOrigin1.
const std::string filesystem_id3 = RegisterFileSystem();
error = base::File::FILE_ERROR_FAILED;
- backend()->OpenPrivateFileSystem(
- kOrigin1, kType, filesystem_id3, kPlugin1,
- storage::OPEN_FILE_SYSTEM_CREATE_IF_NONEXISTENT,
- base::BindOnce(&DidOpenFileSystem, &error));
+ backend()->OpenPrivateFileSystem(kOrigin1, kType, filesystem_id3, kPlugin1,
+ OPEN_FILE_SYSTEM_CREATE_IF_NONEXISTENT,
+ base::BindOnce(&DidOpenFileSystem, &error));
base::RunLoop().RunUntilIdle();
ASSERT_EQ(base::File::FILE_OK, error);
// Re-create 'foo' in kOrigin1.
- const GURL root_url3(storage::GetIsolatedFileSystemRootURIString(
+ const GURL root_url3(GetIsolatedFileSystemRootURIString(
kOrigin1.GetURL(), filesystem_id3, kRootName));
FileSystemURL file3 = CreateURL(root_url3, "foo");
EXPECT_EQ(base::File::FILE_OK,
@@ -266,4 +254,4 @@
context_.get(), file3, AsyncFileTestHelper::kDontCheckSize));
}
-} // namespace content
+} // namespace storage
diff --git a/storage/browser/file_system/quota/quota_backend_impl.cc b/storage/browser/file_system/quota/quota_backend_impl.cc
index 0dcc81a..09ebe7a5 100644
--- a/storage/browser/file_system/quota/quota_backend_impl.cc
+++ b/storage/browser/file_system/quota/quota_backend_impl.cc
@@ -6,7 +6,9 @@
#include <stdint.h>
+#include <algorithm>
#include <string>
+#include <utility>
#include "base/bind.h"
#include "base/callback.h"
@@ -25,7 +27,7 @@
base::SequencedTaskRunner* file_task_runner,
ObfuscatedFileUtil* obfuscated_file_util,
FileSystemUsageCache* file_system_usage_cache,
- storage::QuotaManagerProxy* quota_manager_proxy)
+ QuotaManagerProxy* quota_manager_proxy)
: file_task_runner_(file_task_runner),
obfuscated_file_util_(obfuscated_file_util),
file_system_usage_cache_(file_system_usage_cache),
@@ -138,7 +140,7 @@
DCHECK(!info.origin.opaque());
DCHECK(quota_manager_proxy_.get());
quota_manager_proxy_->NotifyStorageModified(
- storage::QuotaClient::kFileSystem, info.origin,
+ QuotaClient::kFileSystem, info.origin,
FileSystemTypeToQuotaStorageType(info.type), info.delta);
}
diff --git a/storage/browser/file_system/quota/quota_backend_impl.h b/storage/browser/file_system/quota/quota_backend_impl.h
index a4c3fa0..9103bcf 100644
--- a/storage/browser/file_system/quota/quota_backend_impl.h
+++ b/storage/browser/file_system/quota/quota_backend_impl.h
@@ -20,10 +20,6 @@
class SequencedTaskRunner;
}
-namespace content {
-class QuotaBackendImplTest;
-}
-
namespace storage {
class FileSystemUsageCache;
@@ -39,7 +35,7 @@
QuotaBackendImpl(base::SequencedTaskRunner* file_task_runner,
ObfuscatedFileUtil* obfuscated_file_util,
FileSystemUsageCache* file_system_usage_cache,
- storage::QuotaManagerProxy* quota_manager_proxy);
+ QuotaManagerProxy* quota_manager_proxy);
~QuotaBackendImpl() override;
// QuotaReservationManager::QuotaBackend overrides.
@@ -59,7 +55,7 @@
FileSystemType type) override;
private:
- friend class content::QuotaBackendImplTest;
+ friend class QuotaBackendImplTest;
struct QuotaReservationInfo {
QuotaReservationInfo(const url::Origin& origin,
@@ -89,7 +85,7 @@
ObfuscatedFileUtil* obfuscated_file_util_;
FileSystemUsageCache* file_system_usage_cache_;
- scoped_refptr<storage::QuotaManagerProxy> quota_manager_proxy_;
+ scoped_refptr<QuotaManagerProxy> quota_manager_proxy_;
base::WeakPtrFactory<QuotaBackendImpl> weak_ptr_factory_{this};
diff --git a/storage/browser/file_system/quota/quota_backend_impl_unittest.cc b/storage/browser/file_system/quota/quota_backend_impl_unittest.cc
index 8b35837..5fb0ab50 100644
--- a/storage/browser/file_system/quota/quota_backend_impl_unittest.cc
+++ b/storage/browser/file_system/quota/quota_backend_impl_unittest.cc
@@ -8,6 +8,7 @@
#include <memory>
#include <string>
+#include <utility>
#include "base/bind.h"
#include "base/files/scoped_temp_dir.h"
@@ -21,12 +22,7 @@
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/leveldatabase/leveldb_chrome.h"
-using storage::FileSystemUsageCache;
-using storage::ObfuscatedFileUtil;
-using storage::QuotaBackendImpl;
-using storage::SandboxFileSystemBackendDelegate;
-
-namespace content {
+namespace storage {
namespace {
@@ -42,7 +38,7 @@
return accepted;
}
-class MockQuotaManagerProxy : public storage::QuotaManagerProxy {
+class MockQuotaManagerProxy : public QuotaManagerProxy {
public:
MockQuotaManagerProxy()
: QuotaManagerProxy(nullptr, nullptr),
@@ -53,12 +49,12 @@
// We don't mock them.
void NotifyOriginInUse(const url::Origin& origin) override {}
void NotifyOriginNoLongerInUse(const url::Origin& origin) override {}
- void SetUsageCacheEnabled(storage::QuotaClient::ID client_id,
+ void SetUsageCacheEnabled(QuotaClient::ID client_id,
const url::Origin& origin,
blink::mojom::StorageType type,
bool enabled) override {}
- void NotifyStorageModified(storage::QuotaClient::ID client_id,
+ void NotifyStorageModified(QuotaClient::ID client_id,
const url::Origin& origin,
blink::mojom::StorageType type,
int64_t delta) override {
@@ -120,7 +116,7 @@
protected:
void InitializeForOriginAndType(const url::Origin& origin,
- storage::FileSystemType type) {
+ FileSystemType type) {
ASSERT_TRUE(file_util_->InitOriginDatabase(origin, true /* create */));
ASSERT_TRUE(file_util_->origin_database_ != nullptr);
@@ -140,7 +136,7 @@
}
base::FilePath GetUsageCachePath(const url::Origin& origin,
- storage::FileSystemType type) {
+ FileSystemType type) {
base::FilePath path;
base::File::Error error = backend_->GetUsageCachePath(origin, type, &path);
EXPECT_EQ(base::File::FILE_OK, error);
@@ -165,7 +161,7 @@
TEST_P(QuotaBackendImplTest, ReserveQuota_Basic) {
const url::Origin kOrigin = url::Origin::Create(GURL("http://example.com"));
- storage::FileSystemType type = storage::kFileSystemTypeTemporary;
+ FileSystemType type = kFileSystemTypeTemporary;
InitializeForOriginAndType(kOrigin, type);
quota_manager_proxy_->set_quota(10000);
@@ -195,7 +191,7 @@
TEST_P(QuotaBackendImplTest, ReserveQuota_NoSpace) {
const url::Origin kOrigin = url::Origin::Create(GURL("http://example.com"));
- storage::FileSystemType type = storage::kFileSystemTypeTemporary;
+ FileSystemType type = kFileSystemTypeTemporary;
InitializeForOriginAndType(kOrigin, type);
quota_manager_proxy_->set_quota(100);
@@ -216,7 +212,7 @@
TEST_P(QuotaBackendImplTest, ReserveQuota_Revert) {
const url::Origin kOrigin = url::Origin::Create(GURL("http://example.com"));
- storage::FileSystemType type = storage::kFileSystemTypeTemporary;
+ FileSystemType type = kFileSystemTypeTemporary;
InitializeForOriginAndType(kOrigin, type);
quota_manager_proxy_->set_quota(10000);
@@ -237,7 +233,7 @@
TEST_P(QuotaBackendImplTest, ReleaseReservedQuota) {
const url::Origin kOrigin = url::Origin::Create(GURL("http://example.com"));
- storage::FileSystemType type = storage::kFileSystemTypeTemporary;
+ FileSystemType type = kFileSystemTypeTemporary;
InitializeForOriginAndType(kOrigin, type);
const int64_t kInitialUsage = 2000;
quota_manager_proxy_->set_usage(kInitialUsage);
@@ -253,7 +249,7 @@
TEST_P(QuotaBackendImplTest, CommitQuotaUsage) {
const url::Origin kOrigin = url::Origin::Create(GURL("http://example.com"));
- storage::FileSystemType type = storage::kFileSystemTypeTemporary;
+ FileSystemType type = kFileSystemTypeTemporary;
InitializeForOriginAndType(kOrigin, type);
quota_manager_proxy_->set_quota(10000);
base::FilePath path = GetUsageCachePath(kOrigin, type);
@@ -278,7 +274,7 @@
TEST_P(QuotaBackendImplTest, DirtyCount) {
const url::Origin kOrigin = url::Origin::Create(GURL("http://example.com"));
- storage::FileSystemType type = storage::kFileSystemTypeTemporary;
+ FileSystemType type = kFileSystemTypeTemporary;
InitializeForOriginAndType(kOrigin, type);
base::FilePath path = GetUsageCachePath(kOrigin, type);
@@ -292,4 +288,4 @@
EXPECT_EQ(0u, dirty);
}
-} // namespace content
+} // namespace storage
diff --git a/storage/browser/file_system/quota/quota_reservation_buffer.h b/storage/browser/file_system/quota/quota_reservation_buffer.h
index a18f4e8..ea3d6fb 100644
--- a/storage/browser/file_system/quota/quota_reservation_buffer.h
+++ b/storage/browser/file_system/quota/quota_reservation_buffer.h
@@ -72,7 +72,7 @@
base::WeakPtr<QuotaReservationManager> reservation_manager_;
url::Origin origin_;
- storage::FileSystemType type_;
+ FileSystemType type_;
int64_t reserved_quota_;
diff --git a/storage/browser/file_system/quota/quota_reservation_manager.h b/storage/browser/file_system/quota/quota_reservation_manager.h
index cb924534..74077e5 100644
--- a/storage/browser/file_system/quota/quota_reservation_manager.h
+++ b/storage/browser/file_system/quota/quota_reservation_manager.h
@@ -19,10 +19,6 @@
#include "base/memory/weak_ptr.h"
#include "storage/common/file_system/file_system_types.h"
-namespace content {
-class QuotaReservationManagerTest;
-}
-
namespace url {
class Origin;
}
@@ -90,7 +86,7 @@
friend class QuotaReservation;
friend class QuotaReservationBuffer;
- friend class content::QuotaReservationManagerTest;
+ friend class QuotaReservationManagerTest;
void ReserveQuota(const url::Origin& origin,
FileSystemType type,
diff --git a/storage/browser/file_system/quota/quota_reservation_manager_unittest.cc b/storage/browser/file_system/quota/quota_reservation_manager_unittest.cc
index 907ee644..8e7f8fc 100644
--- a/storage/browser/file_system/quota/quota_reservation_manager_unittest.cc
+++ b/storage/browser/file_system/quota/quota_reservation_manager_unittest.cc
@@ -25,16 +25,11 @@
#include "url/gurl.h"
#include "url/origin.h"
-using storage::kFileSystemTypeTemporary;
-using storage::OpenFileHandle;
-using storage::QuotaReservation;
-using storage::QuotaReservationManager;
-
-namespace content {
+namespace storage {
namespace {
-const storage::FileSystemType kType = kFileSystemTypeTemporary;
+const FileSystemType kType = kFileSystemTypeTemporary;
const int64_t kInitialFileSize = 1;
using ReserveQuotaCallback = QuotaReservationManager::ReserveQuotaCallback;
@@ -57,7 +52,7 @@
~FakeBackend() override = default;
void ReserveQuota(const url::Origin& origin,
- storage::FileSystemType type,
+ FileSystemType type,
int64_t delta,
ReserveQuotaCallback callback) override {
EXPECT_EQ(this->origin(), origin);
@@ -69,7 +64,7 @@
}
void ReleaseReservedQuota(const url::Origin& origin,
- storage::FileSystemType type,
+ FileSystemType type,
int64_t size) override {
EXPECT_LE(0, size);
EXPECT_EQ(this->origin(), origin);
@@ -78,7 +73,7 @@
}
void CommitQuotaUsage(const url::Origin& origin,
- storage::FileSystemType type,
+ FileSystemType type,
int64_t delta) override {
EXPECT_EQ(this->origin(), origin);
EXPECT_EQ(kType, type);
@@ -87,9 +82,9 @@
}
void IncrementDirtyCount(const url::Origin& origin,
- storage::FileSystemType type) override {}
+ FileSystemType type) override {}
void DecrementDirtyCount(const url::Origin& origin,
- storage::FileSystemType type) override {}
+ FileSystemType type) override {}
url::Origin origin() const { return origin_; }
int64_t on_memory_usage() { return on_memory_usage_; }
@@ -372,4 +367,4 @@
EXPECT_EQ(kInitialFileSize + 10, fake_backend()->on_memory_usage());
}
-} // namespace content
+} // namespace storage
diff --git a/storage/browser/file_system/recursive_operation_delegate_unittest.cc b/storage/browser/file_system/recursive_operation_delegate_unittest.cc
index a44e6bd..4195b5b 100644
--- a/storage/browser/file_system/recursive_operation_delegate_unittest.cc
+++ b/storage/browser/file_system/recursive_operation_delegate_unittest.cc
@@ -5,6 +5,8 @@
#include "storage/browser/file_system/recursive_operation_delegate.h"
#include <memory>
+#include <string>
+#include <utility>
#include <vector>
#include "base/bind.h"
@@ -23,14 +25,11 @@
#include "storage/browser/test/sandbox_file_system_test_helper.h"
#include "testing/gtest/include/gtest/gtest.h"
-using storage::FileSystemContext;
-using storage::FileSystemOperationContext;
-using storage::FileSystemURL;
+namespace storage {
-namespace content {
namespace {
-class LoggingRecursiveOperation : public storage::RecursiveOperationDelegate {
+class LoggingRecursiveOperation : public RecursiveOperationDelegate {
public:
struct LogEntry {
enum Type { PROCESS_FILE, PROCESS_DIRECTORY, POST_PROCESS_DIRECTORY };
@@ -41,7 +40,7 @@
LoggingRecursiveOperation(FileSystemContext* file_system_context,
const FileSystemURL& root,
StatusCallback callback)
- : storage::RecursiveOperationDelegate(file_system_context),
+ : RecursiveOperationDelegate(file_system_context),
root_(root),
callback_(std::move(callback)) {}
~LoggingRecursiveOperation() override = default;
@@ -52,14 +51,12 @@
void Run() override { NOTREACHED(); }
void RunRecursively() override {
- StartRecursiveOperation(root_,
- storage::FileSystemOperation::ERROR_BEHAVIOR_ABORT,
+ StartRecursiveOperation(root_, FileSystemOperation::ERROR_BEHAVIOR_ABORT,
std::move(callback_));
}
void RunRecursivelyWithIgnoringError() {
- StartRecursiveOperation(root_,
- storage::FileSystemOperation::ERROR_BEHAVIOR_SKIP,
+ StartRecursiveOperation(root_, FileSystemOperation::ERROR_BEHAVIOR_SKIP,
std::move(callback_));
}
@@ -72,7 +69,7 @@
}
operation_runner()->GetMetadata(
- url, storage::FileSystemOperation::GET_METADATA_FIELD_IS_DIRECTORY,
+ url, FileSystemOperation::GET_METADATA_FIELD_IS_DIRECTORY,
base::BindOnce(&LoggingRecursiveOperation::DidGetMetadata,
weak_factory_.GetWeakPtr(), std::move(callback)));
}
@@ -128,8 +125,7 @@
// To test the Cancel() during operation, calls Cancel() of |operation|
// after |counter| times message posting.
-void CallCancelLater(storage::RecursiveOperationDelegate* operation,
- int counter) {
+void CallCancelLater(RecursiveOperationDelegate* operation, int counter) {
if (counter > 0) {
base::ThreadTaskRunnerHandle::Get()->PostTask(
FROM_HERE, base::BindOnce(&CallCancelLater, base::Unretained(operation),
@@ -159,9 +155,7 @@
return base::WrapUnique(context);
}
- storage::FileSystemFileUtil* file_util() {
- return sandbox_file_system_.file_util();
- }
+ FileSystemFileUtil* file_util() { return sandbox_file_system_.file_util(); }
FileSystemURL URLForPath(const std::string& path) const {
return sandbox_file_system_.CreateURLFromUTF8(path);
@@ -379,4 +373,4 @@
EXPECT_EQ(src_root, log_entries[7].url);
}
-} // namespace content
+} // namespace storage
diff --git a/storage/browser/file_system/sandbox_directory_database.cc b/storage/browser/file_system/sandbox_directory_database.cc
index 6356ef7..509b20b 100644
--- a/storage/browser/file_system/sandbox_directory_database.cc
+++ b/storage/browser/file_system/sandbox_directory_database.cc
@@ -29,9 +29,9 @@
#include "third_party/leveldatabase/src/include/leveldb/db.h"
#include "third_party/leveldatabase/src/include/leveldb/write_batch.h"
-namespace {
+namespace storage {
-void PickleFromFileInfo(const storage::SandboxDirectoryDatabase::FileInfo& info,
+void PickleFromFileInfo(const SandboxDirectoryDatabase::FileInfo& info,
base::Pickle* pickle) {
DCHECK(pickle);
std::string data_path;
@@ -40,8 +40,8 @@
base::Time::FromDoubleT(floor(info.modification_time.ToDoubleT()));
std::string name;
- data_path = storage::FilePathToString(info.data_path);
- name = storage::FilePathToString(base::FilePath(info.name));
+ data_path = FilePathToString(info.data_path);
+ name = FilePathToString(base::FilePath(info.name));
pickle->WriteInt64(info.parent_id);
pickle->WriteString(data_path);
@@ -50,7 +50,7 @@
}
bool FileInfoFromPickle(const base::Pickle& pickle,
- storage::SandboxDirectoryDatabase::FileInfo* info) {
+ SandboxDirectoryDatabase::FileInfo* info) {
base::PickleIterator iter(pickle);
std::string data_path;
std::string name;
@@ -58,8 +58,8 @@
if (iter.ReadInt64(&info->parent_id) && iter.ReadString(&data_path) &&
iter.ReadString(&name) && iter.ReadInt64(&internal_time)) {
- info->data_path = storage::StringToFilePath(data_path);
- info->name = storage::StringToFilePath(name).value();
+ info->data_path = StringToFilePath(data_path);
+ info->name = StringToFilePath(name).value();
info->modification_time = base::Time::FromInternalValue(internal_time);
return true;
}
@@ -97,17 +97,16 @@
DB_REPAIR_MAX
};
-std::string GetChildLookupKey(
- storage::SandboxDirectoryDatabase::FileId parent_id,
- const base::FilePath::StringType& child_name) {
+std::string GetChildLookupKey(SandboxDirectoryDatabase::FileId parent_id,
+ const base::FilePath::StringType& child_name) {
std::string name;
- name = storage::FilePathToString(base::FilePath(child_name));
+ name = FilePathToString(base::FilePath(child_name));
return std::string(kChildLookupPrefix) + base::NumberToString(parent_id) +
std::string(kChildLookupSeparator) + name;
}
std::string GetChildListingKeyPrefix(
- storage::SandboxDirectoryDatabase::FileId parent_id) {
+ SandboxDirectoryDatabase::FileId parent_id) {
return std::string(kChildLookupPrefix) + base::NumberToString(parent_id) +
std::string(kChildLookupSeparator);
}
@@ -120,8 +119,7 @@
return kSandboxDirectoryLastIntegerKey;
}
-std::string GetFileLookupKey(
- storage::SandboxDirectoryDatabase::FileId file_id) {
+std::string GetFileLookupKey(SandboxDirectoryDatabase::FileId file_id) {
return base::NumberToString(file_id);
}
@@ -139,10 +137,10 @@
// - Directory structure is tree, i.e. connected and acyclic.
class DatabaseCheckHelper {
public:
- using FileId = storage::SandboxDirectoryDatabase::FileId;
- using FileInfo = storage::SandboxDirectoryDatabase::FileInfo;
+ using FileId = SandboxDirectoryDatabase::FileId;
+ using FileInfo = SandboxDirectoryDatabase::FileInfo;
- DatabaseCheckHelper(storage::SandboxDirectoryDatabase* dir_db,
+ DatabaseCheckHelper(SandboxDirectoryDatabase* dir_db,
leveldb::DB* db,
const base::FilePath& path);
@@ -160,7 +158,7 @@
bool ScanDirectory();
bool ScanHierarchy();
- storage::SandboxDirectoryDatabase* dir_db_;
+ SandboxDirectoryDatabase* dir_db_;
leveldb::DB* db_;
base::FilePath path_;
@@ -174,10 +172,9 @@
FileId last_integer_;
};
-DatabaseCheckHelper::DatabaseCheckHelper(
- storage::SandboxDirectoryDatabase* dir_db,
- leveldb::DB* db,
- const base::FilePath& path)
+DatabaseCheckHelper::DatabaseCheckHelper(SandboxDirectoryDatabase* dir_db,
+ leveldb::DB* db,
+ const base::FilePath& path)
: dir_db_(dir_db),
db_(db),
path_(path),
@@ -284,7 +281,7 @@
// has a database entry.
const base::FilePath kExcludes[] = {
base::FilePath(kDirectoryDatabaseName),
- base::FilePath(storage::FileSystemUsageCache::kUsageFileName),
+ base::FilePath(FileSystemUsageCache::kUsageFileName),
};
// Any path in |pending_directories| is relative to |path_|.
@@ -398,7 +395,7 @@
// See if it's not pointing to the special system paths.
const base::FilePath kExcludes[] = {
base::FilePath(kDirectoryDatabaseName),
- base::FilePath(storage::FileSystemUsageCache::kUsageFileName),
+ base::FilePath(FileSystemUsageCache::kUsageFileName),
};
for (const auto& exclude : kExcludes) {
if (data_path == exclude || exclude.IsParent(data_path))
@@ -407,10 +404,6 @@
return true;
}
-} // namespace
-
-namespace storage {
-
SandboxDirectoryDatabase::FileInfo::FileInfo() : parent_id(0) {}
SandboxDirectoryDatabase::FileInfo::~FileInfo() = default;
diff --git a/storage/browser/file_system/sandbox_directory_database.h b/storage/browser/file_system/sandbox_directory_database.h
index f87d0da..c8b9de7 100644
--- a/storage/browser/file_system/sandbox_directory_database.h
+++ b/storage/browser/file_system/sandbox_directory_database.h
@@ -17,10 +17,6 @@
#include "base/macros.h"
#include "base/time/time.h"
-namespace content {
-class SandboxDirectoryDatabaseTest;
-}
-
namespace base {
class Location;
}
@@ -108,8 +104,8 @@
FAIL_ON_CORRUPTION,
};
- friend class content::SandboxDirectoryDatabaseTest;
friend class ObfuscatedFileUtil;
+ friend class SandboxDirectoryDatabaseTest;
bool Init(RecoveryOption recovery_option);
bool RepairDatabase(const std::string& db_path);
diff --git a/storage/browser/file_system/sandbox_directory_database_unittest.cc b/storage/browser/file_system/sandbox_directory_database_unittest.cc
index 0b1fa39..60c7102 100644
--- a/storage/browser/file_system/sandbox_directory_database_unittest.cc
+++ b/storage/browser/file_system/sandbox_directory_database_unittest.cc
@@ -24,10 +24,7 @@
#define FPL(x) FILE_PATH_LITERAL(x)
-using storage::FilePathToString;
-using storage::SandboxDirectoryDatabase;
-
-namespace content {
+namespace storage {
namespace {
const base::FilePath::CharType kDirectoryDatabaseName[] = FPL("Paths");
@@ -668,4 +665,4 @@
EXPECT_TRUE(db()->IsFileSystemConsistent());
}
-} // namespace content
+} // namespace storage
diff --git a/storage/browser/file_system/sandbox_file_stream_writer.cc b/storage/browser/file_system/sandbox_file_stream_writer.cc
index 32ff1f11..21495ae 100644
--- a/storage/browser/file_system/sandbox_file_stream_writer.cc
+++ b/storage/browser/file_system/sandbox_file_stream_writer.cc
@@ -120,7 +120,7 @@
base::File::Error file_error,
const base::File::Info& file_info,
const base::FilePath& platform_path,
- scoped_refptr<storage::ShareableFileReference> file_ref) {
+ scoped_refptr<ShareableFileReference> file_ref) {
DCHECK(!file_ref.get());
if (CancelIfRequested())
@@ -162,7 +162,7 @@
file_system_context_->default_file_task_runner(), platform_path,
initial_offset_, FileStreamWriter::OPEN_EXISTING_FILE);
}
- storage::QuotaManagerProxy* quota_manager_proxy =
+ QuotaManagerProxy* quota_manager_proxy =
file_system_context_->quota_manager_proxy();
if (!quota_manager_proxy) {
// If we don't have the quota manager or the requested filesystem type
diff --git a/storage/browser/file_system/sandbox_file_stream_writer.h b/storage/browser/file_system/sandbox_file_stream_writer.h
index b454365..df36095 100644
--- a/storage/browser/file_system/sandbox_file_stream_writer.h
+++ b/storage/browser/file_system/sandbox_file_stream_writer.h
@@ -51,12 +51,11 @@
// Callbacks that are chained for the first write. This eventually calls
// WriteInternal.
- void DidCreateSnapshotFile(
- net::CompletionOnceCallback callback,
- base::File::Error file_error,
- const base::File::Info& file_info,
- const base::FilePath& platform_path,
- scoped_refptr<storage::ShareableFileReference> file_ref);
+ void DidCreateSnapshotFile(net::CompletionOnceCallback callback,
+ base::File::Error file_error,
+ const base::File::Info& file_info,
+ const base::FilePath& platform_path,
+ scoped_refptr<ShareableFileReference> file_ref);
void DidGetUsageAndQuota(net::CompletionOnceCallback callback,
blink::mojom::QuotaStatusCode status,
int64_t usage,
diff --git a/storage/browser/file_system/sandbox_file_system_backend.cc b/storage/browser/file_system/sandbox_file_system_backend.cc
index 0ae6c4dd..580047c 100644
--- a/storage/browser/file_system/sandbox_file_system_backend.cc
+++ b/storage/browser/file_system/sandbox_file_system_backend.cc
@@ -32,9 +32,6 @@
#include "storage/common/file_system/file_system_util.h"
#include "url/gurl.h"
-using storage::QuotaManagerProxy;
-using storage::SpecialStoragePolicy;
-
namespace storage {
SandboxFileSystemBackend::SandboxFileSystemBackend(
@@ -51,12 +48,12 @@
DCHECK(delegate_);
// Set quota observers.
- delegate_->RegisterQuotaUpdateObserver(storage::kFileSystemTypeTemporary);
- delegate_->AddFileAccessObserver(storage::kFileSystemTypeTemporary,
+ delegate_->RegisterQuotaUpdateObserver(kFileSystemTypeTemporary);
+ delegate_->AddFileAccessObserver(kFileSystemTypeTemporary,
delegate_->quota_observer(), nullptr);
- delegate_->RegisterQuotaUpdateObserver(storage::kFileSystemTypePersistent);
- delegate_->AddFileAccessObserver(storage::kFileSystemTypePersistent,
+ delegate_->RegisterQuotaUpdateObserver(kFileSystemTypePersistent);
+ delegate_->AddFileAccessObserver(kFileSystemTypePersistent,
delegate_->quota_observer(), nullptr);
}
@@ -123,18 +120,18 @@
}
bool SandboxFileSystemBackend::SupportsStreaming(
- const storage::FileSystemURL& url) const {
+ const FileSystemURL& url) const {
// Streaming is required for in-memory implementation to access memory-backed
// files.
return delegate_->file_system_options().is_incognito();
}
bool SandboxFileSystemBackend::HasInplaceCopyImplementation(
- storage::FileSystemType type) const {
+ FileSystemType type) const {
return false;
}
-std::unique_ptr<storage::FileStreamReader>
+std::unique_ptr<FileStreamReader>
SandboxFileSystemBackend::CreateFileStreamReader(
const FileSystemURL& url,
int64_t offset,
@@ -147,7 +144,7 @@
expected_modification_time, context);
}
-std::unique_ptr<storage::FileStreamWriter>
+std::unique_ptr<FileStreamWriter>
SandboxFileSystemBackend::CreateFileStreamWriter(
const FileSystemURL& url,
int64_t offset,
diff --git a/storage/browser/file_system/sandbox_file_system_backend.h b/storage/browser/file_system/sandbox_file_system_backend.h
index 58ace83c..b6cf3cdd 100644
--- a/storage/browser/file_system/sandbox_file_system_backend.h
+++ b/storage/browser/file_system/sandbox_file_system_backend.h
@@ -50,9 +50,8 @@
FileSystemContext* context,
base::File::Error* error_code) const override;
bool SupportsStreaming(const FileSystemURL& url) const override;
- bool HasInplaceCopyImplementation(
- storage::FileSystemType type) const override;
- std::unique_ptr<storage::FileStreamReader> CreateFileStreamReader(
+ bool HasInplaceCopyImplementation(FileSystemType type) const override;
+ std::unique_ptr<FileStreamReader> CreateFileStreamReader(
const FileSystemURL& url,
int64_t offset,
int64_t max_bytes_to_read,
diff --git a/storage/browser/file_system/sandbox_file_system_backend_delegate.cc b/storage/browser/file_system/sandbox_file_system_backend_delegate.cc
index 77985da..af5ca62 100644
--- a/storage/browser/file_system/sandbox_file_system_backend_delegate.cc
+++ b/storage/browser/file_system/sandbox_file_system_backend_delegate.cc
@@ -178,10 +178,10 @@
}
SandboxFileSystemBackendDelegate::SandboxFileSystemBackendDelegate(
- storage::QuotaManagerProxy* quota_manager_proxy,
+ QuotaManagerProxy* quota_manager_proxy,
base::SequencedTaskRunner* file_task_runner,
const base::FilePath& profile_path,
- storage::SpecialStoragePolicy* special_storage_policy,
+ SpecialStoragePolicy* special_storage_policy,
const FileSystemOptions& file_system_options,
leveldb::Env* env_override)
: file_task_runner_(file_task_runner),
@@ -341,7 +341,7 @@
base::File::Error
SandboxFileSystemBackendDelegate::DeleteOriginDataOnFileTaskRunner(
FileSystemContext* file_system_context,
- storage::QuotaManagerProxy* proxy,
+ QuotaManagerProxy* proxy,
const GURL& origin_url,
FileSystemType type) {
DCHECK(file_task_runner_->RunsTasksInCurrentSequence());
@@ -352,7 +352,7 @@
url::Origin::Create(origin_url), GetTypeString(type));
if (result && proxy && usage) {
proxy->NotifyStorageModified(
- storage::QuotaClient::kFileSystem, url::Origin::Create(origin_url),
+ QuotaClient::kFileSystem, url::Origin::Create(origin_url),
FileSystemTypeToQuotaStorageType(type), -usage);
}
@@ -363,7 +363,7 @@
void SandboxFileSystemBackendDelegate::PerformStorageCleanupOnFileTaskRunner(
FileSystemContext* context,
- storage::QuotaManagerProxy* proxy,
+ QuotaManagerProxy* proxy,
FileSystemType type) {
DCHECK(file_task_runner_->RunsTasksInCurrentSequence());
obfuscated_file_util()->RewriteDatabases();
@@ -721,7 +721,7 @@
// Declared in obfuscated_file_util.h.
// static
ObfuscatedFileUtil* ObfuscatedFileUtil::CreateForTesting(
- storage::SpecialStoragePolicy* special_storage_policy,
+ SpecialStoragePolicy* special_storage_policy,
const base::FilePath& file_system_directory,
leveldb::Env* env_override,
bool is_incognito) {
diff --git a/storage/browser/file_system/sandbox_file_system_backend_delegate.h b/storage/browser/file_system/sandbox_file_system_backend_delegate.h
index 831266f..14f074f7 100644
--- a/storage/browser/file_system/sandbox_file_system_backend_delegate.h
+++ b/storage/browser/file_system/sandbox_file_system_backend_delegate.h
@@ -29,10 +29,10 @@
class SequencedTaskRunner;
}
-namespace content {
+namespace storage {
class SandboxFileSystemBackendDelegateTest;
class SandboxFileSystemTestHelper;
-} // namespace content
+} // namespace storage
namespace leveldb {
class Env;
@@ -84,13 +84,12 @@
// Returns the type directory name in sandbox directory for given |type|.
static std::string GetTypeString(FileSystemType type);
- SandboxFileSystemBackendDelegate(
- storage::QuotaManagerProxy* quota_manager_proxy,
- base::SequencedTaskRunner* file_task_runner,
- const base::FilePath& profile_path,
- storage::SpecialStoragePolicy* special_storage_policy,
- const FileSystemOptions& file_system_options,
- leveldb::Env* env_override);
+ SandboxFileSystemBackendDelegate(QuotaManagerProxy* quota_manager_proxy,
+ base::SequencedTaskRunner* file_task_runner,
+ const base::FilePath& profile_path,
+ SpecialStoragePolicy* special_storage_policy,
+ const FileSystemOptions& file_system_options,
+ leveldb::Env* env_override);
~SandboxFileSystemBackendDelegate() override;
@@ -118,7 +117,7 @@
const FileSystemURL& url,
FileSystemContext* context,
base::File::Error* error_code) const;
- std::unique_ptr<storage::FileStreamReader> CreateFileStreamReader(
+ std::unique_ptr<FileStreamReader> CreateFileStreamReader(
const FileSystemURL& url,
int64_t offset,
const base::Time& expected_modification_time,
@@ -132,11 +131,11 @@
// FileSystemQuotaUtil overrides.
base::File::Error DeleteOriginDataOnFileTaskRunner(
FileSystemContext* context,
- storage::QuotaManagerProxy* proxy,
+ QuotaManagerProxy* proxy,
const GURL& origin_url,
FileSystemType type) override;
void PerformStorageCleanupOnFileTaskRunner(FileSystemContext* context,
- storage::QuotaManagerProxy* proxy,
+ QuotaManagerProxy* proxy,
FileSystemType type) override;
void GetOriginsForTypeOnFileTaskRunner(FileSystemType type,
std::set<GURL>* origins) override;
@@ -193,7 +192,7 @@
FileSystemUsageCache* usage_cache() { return file_system_usage_cache_.get(); }
SandboxQuotaObserver* quota_observer() { return quota_observer_.get(); }
- storage::SpecialStoragePolicy* special_storage_policy() {
+ SpecialStoragePolicy* special_storage_policy() {
return special_storage_policy_.get();
}
@@ -208,8 +207,8 @@
private:
friend class QuotaBackendImpl;
friend class SandboxQuotaObserver;
- friend class content::SandboxFileSystemBackendDelegateTest;
- friend class content::SandboxFileSystemTestHelper;
+ friend class SandboxFileSystemBackendDelegateTest;
+ friend class SandboxFileSystemTestHelper;
// Performs API-specific validity checks on the given path |url|.
// Returns true if access to |url| is valid in this filesystem.
@@ -237,14 +236,14 @@
ObfuscatedFileUtil* obfuscated_file_util();
scoped_refptr<base::SequencedTaskRunner> file_task_runner_;
- scoped_refptr<storage::QuotaManagerProxy> quota_manager_proxy_;
+ scoped_refptr<QuotaManagerProxy> quota_manager_proxy_;
std::unique_ptr<AsyncFileUtil> sandbox_file_util_;
std::unique_ptr<FileSystemUsageCache> file_system_usage_cache_;
std::unique_ptr<SandboxQuotaObserver> quota_observer_;
std::unique_ptr<QuotaReservationManager> quota_reservation_manager_;
- scoped_refptr<storage::SpecialStoragePolicy> special_storage_policy_;
+ scoped_refptr<SpecialStoragePolicy> special_storage_policy_;
FileSystemOptions file_system_options_;
diff --git a/storage/browser/file_system/sandbox_file_system_backend_delegate_unittest.cc b/storage/browser/file_system/sandbox_file_system_backend_delegate_unittest.cc
index 7301171..48a2098 100644
--- a/storage/browser/file_system/sandbox_file_system_backend_delegate_unittest.cc
+++ b/storage/browser/file_system/sandbox_file_system_backend_delegate_unittest.cc
@@ -19,17 +19,15 @@
#include "url/gurl.h"
#include "url/origin.h"
-using storage::FileSystemURL;
-
-namespace content {
+namespace storage {
namespace {
FileSystemURL CreateFileSystemURL(const char* path) {
const GURL kOrigin("http://foo/");
- return storage::FileSystemURL::CreateForTest(
- url::Origin::Create(kOrigin), storage::kFileSystemTypeTemporary,
- base::FilePath::FromUTF8Unsafe(path));
+ return FileSystemURL::CreateForTest(url::Origin::Create(kOrigin),
+ kFileSystemTypeTemporary,
+ base::FilePath::FromUTF8Unsafe(path));
}
} // namespace
@@ -38,12 +36,12 @@
protected:
void SetUp() override {
ASSERT_TRUE(data_dir_.CreateUniqueTempDir());
- quota_manager_proxy_ = new MockQuotaManagerProxy(
+ quota_manager_proxy_ = base::MakeRefCounted<MockQuotaManagerProxy>(
nullptr, base::ThreadTaskRunnerHandle::Get().get());
- delegate_.reset(new storage::SandboxFileSystemBackendDelegate(
+ delegate_ = std::make_unique<SandboxFileSystemBackendDelegate>(
quota_manager_proxy_.get(), base::ThreadTaskRunnerHandle::Get().get(),
- data_dir_.GetPath(), nullptr /* special_storage_policy */,
- CreateAllowFileAccessOptions(), nullptr /* env_override */));
+ data_dir_.GetPath(), /*special_storage_policy=*/nullptr,
+ CreateAllowFileAccessOptions(), /*env_override=*/nullptr);
}
bool IsAccessValid(const FileSystemURL& url) const {
@@ -51,8 +49,8 @@
}
void OpenFileSystem(const url::Origin& origin,
- storage::FileSystemType type,
- storage::OpenFileSystemMode mode) {
+ FileSystemType type,
+ OpenFileSystemMode mode) {
delegate_->OpenFileSystem(
origin, type, mode,
base::BindOnce(
@@ -81,7 +79,7 @@
base::ScopedTempDir data_dir_;
base::test::TaskEnvironment task_environment_;
scoped_refptr<MockQuotaManagerProxy> quota_manager_proxy_;
- std::unique_ptr<storage::SandboxFileSystemBackendDelegate> delegate_;
+ std::unique_ptr<SandboxFileSystemBackendDelegate> delegate_;
int callback_count_ = 0;
base::File::Error last_error_ = base::File::FILE_OK;
@@ -95,10 +93,9 @@
EXPECT_FALSE(IsAccessValid(CreateFileSystemURL("a/../b")));
// Access from non-allowed scheme should be disallowed.
- EXPECT_FALSE(IsAccessValid(
- FileSystemURL::CreateForTest(url::Origin::Create(GURL("unknown://bar")),
- storage::kFileSystemTypeTemporary,
- base::FilePath::FromUTF8Unsafe("foo"))));
+ EXPECT_FALSE(IsAccessValid(FileSystemURL::CreateForTest(
+ url::Origin::Create(GURL("unknown://bar")), kFileSystemTypeTemporary,
+ base::FilePath::FromUTF8Unsafe("foo"))));
// Access with restricted name should be disallowed.
EXPECT_FALSE(IsAccessValid(CreateFileSystemURL(".")));
@@ -128,8 +125,8 @@
EXPECT_EQ(quota_manager_proxy()->notify_storage_accessed_count(), 0);
EXPECT_EQ(callback_count(), 0);
- OpenFileSystem(url::Origin::Create(origin), storage::kFileSystemTypeTemporary,
- storage::OPEN_FILE_SYSTEM_CREATE_IF_NONEXISTENT);
+ OpenFileSystem(url::Origin::Create(origin), kFileSystemTypeTemporary,
+ OPEN_FILE_SYSTEM_CREATE_IF_NONEXISTENT);
EXPECT_EQ(callback_count(), 1);
EXPECT_EQ(last_error(), base::File::FILE_OK);
@@ -140,4 +137,4 @@
blink::mojom::StorageType::kTemporary);
}
-} // namespace content
+} // namespace storage
diff --git a/storage/browser/file_system/sandbox_file_system_backend_unittest.cc b/storage/browser/file_system/sandbox_file_system_backend_unittest.cc
index d4336d6..b8c716f 100644
--- a/storage/browser/file_system/sandbox_file_system_backend_unittest.cc
+++ b/storage/browser/file_system/sandbox_file_system_backend_unittest.cc
@@ -8,6 +8,7 @@
#include <memory>
#include <set>
+#include <vector>
#include "base/bind.h"
#include "base/files/file_util.h"
@@ -29,10 +30,6 @@
#include "url/gurl.h"
#include "url/origin.h"
-using storage::FileSystemURL;
-using storage::SandboxFileSystemBackend;
-using storage::SandboxFileSystemBackendDelegate;
-
// PS stands for path separator.
#if defined(FILE_PATH_USES_WIN_SEPARATORS)
#define PS "\\"
@@ -40,32 +37,32 @@
#define PS "/"
#endif
-namespace content {
+namespace storage {
namespace {
const struct RootPathTest {
- storage::FileSystemType type;
+ FileSystemType type;
const char* origin_url;
const char* expected_path;
} kRootPathTestCases[] = {
- {storage::kFileSystemTypeTemporary, "http://foo:1/", "000" PS "t"},
- {storage::kFileSystemTypePersistent, "http://foo:1/", "000" PS "p"},
- {storage::kFileSystemTypeTemporary, "http://bar.com/", "001" PS "t"},
- {storage::kFileSystemTypePersistent, "http://bar.com/", "001" PS "p"},
- {storage::kFileSystemTypeTemporary, "https://foo:2/", "002" PS "t"},
- {storage::kFileSystemTypePersistent, "https://foo:2/", "002" PS "p"},
- {storage::kFileSystemTypeTemporary, "https://bar.com/", "003" PS "t"},
- {storage::kFileSystemTypePersistent, "https://bar.com/", "003" PS "p"},
+ {kFileSystemTypeTemporary, "http://foo:1/", "000" PS "t"},
+ {kFileSystemTypePersistent, "http://foo:1/", "000" PS "p"},
+ {kFileSystemTypeTemporary, "http://bar.com/", "001" PS "t"},
+ {kFileSystemTypePersistent, "http://bar.com/", "001" PS "p"},
+ {kFileSystemTypeTemporary, "https://foo:2/", "002" PS "t"},
+ {kFileSystemTypePersistent, "https://foo:2/", "002" PS "p"},
+ {kFileSystemTypeTemporary, "https://bar.com/", "003" PS "t"},
+ {kFileSystemTypePersistent, "https://bar.com/", "003" PS "p"},
};
const struct RootPathFileURITest {
- storage::FileSystemType type;
+ FileSystemType type;
const char* origin_url;
const char* expected_path;
} kRootPathFileURITestCases[] = {
- {storage::kFileSystemTypeTemporary, "file:///", "000" PS "t"},
- {storage::kFileSystemTypePersistent, "file:///", "000" PS "p"}};
+ {kFileSystemTypeTemporary, "file:///", "000" PS "t"},
+ {kFileSystemTypePersistent, "file:///", "000" PS "p"}};
void DidOpenFileSystem(base::File::Error* error_out,
const GURL& origin_url,
@@ -85,14 +82,14 @@
SetUpNewDelegate(CreateAllowFileAccessOptions());
if (IsPersistentFileSystemEnabledIncognito()) {
feature_list_.InitAndEnableFeature(
- storage::features::kEnablePersistentFilesystemInIncognito);
+ features::kEnablePersistentFilesystemInIncognito);
} else {
feature_list_.InitAndDisableFeature(
- storage::features::kEnablePersistentFilesystemInIncognito);
+ features::kEnablePersistentFilesystemInIncognito);
}
}
- void SetUpNewDelegate(const storage::FileSystemOptions& options) {
+ void SetUpNewDelegate(const FileSystemOptions& options) {
incognito_env_override_ = leveldb_chrome::NewMemEnv("FileSystem");
delegate_.reset(new SandboxFileSystemBackendDelegate(
nullptr /* quota_manager_proxy */,
@@ -101,18 +98,17 @@
options.is_in_memory() ? incognito_env_override_.get() : nullptr));
}
- void SetUpNewBackend(const storage::FileSystemOptions& options) {
+ void SetUpNewBackend(const FileSystemOptions& options) {
SetUpNewDelegate(options);
backend_.reset(new SandboxFileSystemBackend(delegate_.get()));
}
- storage::SandboxFileSystemBackendDelegate::OriginEnumerator*
- CreateOriginEnumerator() const {
+ SandboxFileSystemBackendDelegate::OriginEnumerator* CreateOriginEnumerator()
+ const {
return backend_->CreateOriginEnumerator();
}
- void CreateOriginTypeDirectory(const char* origin_url,
- storage::FileSystemType type) {
+ void CreateOriginTypeDirectory(const char* origin_url, FileSystemType type) {
base::FilePath target = delegate_->GetBaseDirectoryForOriginAndType(
url::Origin::Create(GURL(origin_url)), type, true);
ASSERT_TRUE(!target.empty());
@@ -120,8 +116,8 @@
}
bool GetRootPath(const char* origin_url,
- storage::FileSystemType type,
- storage::OpenFileSystemMode mode,
+ FileSystemType type,
+ OpenFileSystemMode mode,
base::FilePath* root_path) {
base::File::Error error = base::File::FILE_OK;
backend_->ResolveURL(
@@ -150,8 +146,8 @@
std::unique_ptr<leveldb::Env> incognito_env_override_;
base::ScopedTempDir data_dir_;
base::test::TaskEnvironment task_environment_;
- std::unique_ptr<storage::SandboxFileSystemBackendDelegate> delegate_;
- std::unique_ptr<storage::SandboxFileSystemBackend> backend_;
+ std::unique_ptr<SandboxFileSystemBackendDelegate> delegate_;
+ std::unique_ptr<SandboxFileSystemBackend> backend_;
base::test::ScopedFeatureList feature_list_;
};
@@ -180,13 +176,11 @@
size_t persistent_size = base::size(persistent_origins);
std::set<GURL> temporary_set, persistent_set;
for (size_t i = 0; i < temporary_size; ++i) {
- CreateOriginTypeDirectory(temporary_origins[i],
- storage::kFileSystemTypeTemporary);
+ CreateOriginTypeDirectory(temporary_origins[i], kFileSystemTypeTemporary);
temporary_set.insert(GURL(temporary_origins[i]));
}
for (size_t i = 0; i < persistent_size; ++i) {
- CreateOriginTypeDirectory(persistent_origins[i],
- storage::kFileSystemTypePersistent);
+ CreateOriginTypeDirectory(persistent_origins[i], kFileSystemTypePersistent);
persistent_set.insert(GURL(persistent_origins[i]));
}
@@ -197,11 +191,11 @@
GURL current;
while (!(current = enumerator->Next()).is_empty()) {
SCOPED_TRACE(testing::Message() << "EnumerateOrigin " << current.spec());
- if (enumerator->HasFileSystemType(storage::kFileSystemTypeTemporary)) {
+ if (enumerator->HasFileSystemType(kFileSystemTypeTemporary)) {
ASSERT_TRUE(temporary_set.find(current) != temporary_set.end());
++temporary_actual_size;
}
- if (enumerator->HasFileSystemType(storage::kFileSystemTypePersistent)) {
+ if (enumerator->HasFileSystemType(kFileSystemTypePersistent)) {
ASSERT_TRUE(persistent_set.find(current) != persistent_set.end());
++persistent_actual_size;
}
@@ -224,7 +218,7 @@
base::FilePath root_path;
EXPECT_TRUE(GetRootPath(
kRootPathTestCases[i].origin_url, kRootPathTestCases[i].type,
- storage::OPEN_FILE_SYSTEM_CREATE_IF_NONEXISTENT, &root_path));
+ OPEN_FILE_SYSTEM_CREATE_IF_NONEXISTENT, &root_path));
base::FilePath expected =
file_system_path().AppendASCII(kRootPathTestCases[i].expected_path);
@@ -241,9 +235,9 @@
<< kRootPathTestCases[i].expected_path);
base::FilePath root_path;
- EXPECT_TRUE(GetRootPath(
- kRootPathTestCases[i].origin_url, kRootPathTestCases[i].type,
- storage::OPEN_FILE_SYSTEM_FAIL_IF_NONEXISTENT, &root_path));
+ EXPECT_TRUE(GetRootPath(kRootPathTestCases[i].origin_url,
+ kRootPathTestCases[i].type,
+ OPEN_FILE_SYSTEM_FAIL_IF_NONEXISTENT, &root_path));
ASSERT_TRUE(returned_root_path.size() > i);
EXPECT_EQ(returned_root_path[i].value(), root_path.value());
}
@@ -256,15 +250,13 @@
SetUpNewBackend(CreateAllowFileAccessOptions());
base::FilePath root_path1;
- EXPECT_TRUE(GetRootPath(
- "http://foo.com:1/", storage::kFileSystemTypeTemporary,
- storage::OPEN_FILE_SYSTEM_CREATE_IF_NONEXISTENT, &root_path1));
+ EXPECT_TRUE(GetRootPath("http://foo.com:1/", kFileSystemTypeTemporary,
+ OPEN_FILE_SYSTEM_CREATE_IF_NONEXISTENT, &root_path1));
SetUpNewBackend(CreateDisallowFileAccessOptions());
base::FilePath root_path2;
- EXPECT_TRUE(
- GetRootPath("http://foo.com:1/", storage::kFileSystemTypeTemporary,
- storage::OPEN_FILE_SYSTEM_FAIL_IF_NONEXISTENT, &root_path2));
+ EXPECT_TRUE(GetRootPath("http://foo.com:1/", kFileSystemTypeTemporary,
+ OPEN_FILE_SYSTEM_FAIL_IF_NONEXISTENT, &root_path2));
EXPECT_EQ(root_path1.value(), root_path2.value());
}
@@ -276,9 +268,9 @@
for (size_t i = 0; i < base::size(kRootPathTestCases); ++i) {
SCOPED_TRACE(testing::Message() << "RootPath (create=false) #" << i << " "
<< kRootPathTestCases[i].expected_path);
- EXPECT_FALSE(GetRootPath(
- kRootPathTestCases[i].origin_url, kRootPathTestCases[i].type,
- storage::OPEN_FILE_SYSTEM_FAIL_IF_NONEXISTENT, nullptr));
+ EXPECT_FALSE(GetRootPath(kRootPathTestCases[i].origin_url,
+ kRootPathTestCases[i].type,
+ OPEN_FILE_SYSTEM_FAIL_IF_NONEXISTENT, nullptr));
}
}
@@ -289,12 +281,11 @@
for (size_t i = 0; i < base::size(kRootPathTestCases); ++i) {
SCOPED_TRACE(testing::Message() << "RootPath (incognito) #" << i << " "
<< kRootPathTestCases[i].expected_path);
- EXPECT_EQ(
- IsPersistentFileSystemEnabledIncognito() ||
- kRootPathTestCases[i].type == storage::kFileSystemTypeTemporary,
- GetRootPath(kRootPathTestCases[i].origin_url,
- kRootPathTestCases[i].type,
- storage::OPEN_FILE_SYSTEM_CREATE_IF_NONEXISTENT, nullptr));
+ EXPECT_EQ(IsPersistentFileSystemEnabledIncognito() ||
+ kRootPathTestCases[i].type == kFileSystemTypeTemporary,
+ GetRootPath(kRootPathTestCases[i].origin_url,
+ kRootPathTestCases[i].type,
+ OPEN_FILE_SYSTEM_CREATE_IF_NONEXISTENT, nullptr));
}
}
@@ -306,8 +297,7 @@
<< kRootPathFileURITestCases[i].expected_path);
EXPECT_FALSE(GetRootPath(kRootPathFileURITestCases[i].origin_url,
kRootPathFileURITestCases[i].type,
- storage::OPEN_FILE_SYSTEM_CREATE_IF_NONEXISTENT,
- nullptr));
+ OPEN_FILE_SYSTEM_CREATE_IF_NONEXISTENT, nullptr));
}
}
@@ -320,7 +310,7 @@
base::FilePath root_path;
EXPECT_TRUE(GetRootPath(kRootPathFileURITestCases[i].origin_url,
kRootPathFileURITestCases[i].type,
- storage::OPEN_FILE_SYSTEM_CREATE_IF_NONEXISTENT,
+ OPEN_FILE_SYSTEM_CREATE_IF_NONEXISTENT,
&root_path));
base::FilePath expected = file_system_path().AppendASCII(
kRootPathFileURITestCases[i].expected_path);
@@ -329,4 +319,4 @@
}
}
-} // namespace content
+} // namespace storage
diff --git a/storage/browser/file_system/sandbox_isolated_origin_database_unittest.cc b/storage/browser/file_system/sandbox_isolated_origin_database_unittest.cc
index 68ac77b..9f27cea 100644
--- a/storage/browser/file_system/sandbox_isolated_origin_database_unittest.cc
+++ b/storage/browser/file_system/sandbox_isolated_origin_database_unittest.cc
@@ -8,9 +8,7 @@
#include "storage/browser/file_system/sandbox_origin_database.h"
#include "testing/gtest/include/gtest/gtest.h"
-using storage::SandboxIsolatedOriginDatabase;
-
-namespace content {
+namespace storage {
namespace {
const base::FilePath::CharType kOriginDirectory[] = FILE_PATH_LITERAL("iso");
@@ -39,4 +37,4 @@
EXPECT_EQ(path1, path2);
}
-} // namespace content
+} // namespace storage
diff --git a/storage/browser/file_system/sandbox_origin_database_unittest.cc b/storage/browser/file_system/sandbox_origin_database_unittest.cc
index 17b0273..a52ab31 100644
--- a/storage/browser/file_system/sandbox_origin_database_unittest.cc
+++ b/storage/browser/file_system/sandbox_origin_database_unittest.cc
@@ -24,9 +24,7 @@
#include "third_party/leveldatabase/src/db/filename.h"
#include "third_party/leveldatabase/src/include/leveldb/db.h"
-using storage::SandboxOriginDatabase;
-
-namespace content {
+namespace storage {
namespace {
const base::FilePath::CharType kFileSystemDirName[] =
@@ -299,4 +297,4 @@
}
}
-} // namespace content
+} // namespace storage
diff --git a/storage/browser/file_system/sandbox_prioritized_origin_database_unittest.cc b/storage/browser/file_system/sandbox_prioritized_origin_database_unittest.cc
index da1bf9ab..018176c 100644
--- a/storage/browser/file_system/sandbox_prioritized_origin_database_unittest.cc
+++ b/storage/browser/file_system/sandbox_prioritized_origin_database_unittest.cc
@@ -8,11 +8,7 @@
#include "storage/browser/file_system/sandbox_origin_database.h"
#include "testing/gtest/include/gtest/gtest.h"
-using storage::SandboxOriginDatabase;
-using storage::SandboxOriginDatabaseInterface;
-using storage::SandboxPrioritizedOriginDatabase;
-
-namespace content {
+namespace storage {
TEST(SandboxPrioritizedOriginDatabaseTest, BasicTest) {
base::ScopedTempDir dir;
@@ -211,4 +207,4 @@
EXPECT_TRUE(base::PathExists(old_dir_db_path2));
}
-} // namespace content
+} // namespace storage
diff --git a/storage/browser/file_system/sandbox_quota_observer.cc b/storage/browser/file_system/sandbox_quota_observer.cc
index 0862f5b..3cf90c3d 100644
--- a/storage/browser/file_system/sandbox_quota_observer.cc
+++ b/storage/browser/file_system/sandbox_quota_observer.cc
@@ -17,7 +17,7 @@
namespace storage {
SandboxQuotaObserver::SandboxQuotaObserver(
- storage::QuotaManagerProxy* quota_manager_proxy,
+ QuotaManagerProxy* quota_manager_proxy,
base::SequencedTaskRunner* update_notify_runner,
ObfuscatedFileUtil* sandbox_file_util,
FileSystemUsageCache* file_system_usage_cache)
@@ -41,7 +41,7 @@
if (quota_manager_proxy_.get()) {
quota_manager_proxy_->NotifyStorageModified(
- storage::QuotaClient::kFileSystem, url.origin(),
+ QuotaClient::kFileSystem, url.origin(),
FileSystemTypeToQuotaStorageType(url.type()), delta);
}
@@ -87,7 +87,7 @@
bool enabled) {
if (quota_manager_proxy_.get()) {
quota_manager_proxy_->SetUsageCacheEnabled(
- storage::QuotaClient::kFileSystem, origin,
+ QuotaClient::kFileSystem, origin,
FileSystemTypeToQuotaStorageType(type), enabled);
}
}
diff --git a/storage/browser/file_system/sandbox_quota_observer.h b/storage/browser/file_system/sandbox_quota_observer.h
index c2a200d..3711019 100644
--- a/storage/browser/file_system/sandbox_quota_observer.h
+++ b/storage/browser/file_system/sandbox_quota_observer.h
@@ -36,7 +36,7 @@
class SandboxQuotaObserver : public FileUpdateObserver,
public FileAccessObserver {
public:
- SandboxQuotaObserver(storage::QuotaManagerProxy* quota_manager_proxy,
+ SandboxQuotaObserver(QuotaManagerProxy* quota_manager_proxy,
base::SequencedTaskRunner* update_notify_runner,
ObfuscatedFileUtil* sandbox_file_util,
FileSystemUsageCache* file_system_usage_cache_);
@@ -61,7 +61,7 @@
base::FilePath GetUsageCachePath(const FileSystemURL& url);
- scoped_refptr<storage::QuotaManagerProxy> quota_manager_proxy_;
+ scoped_refptr<QuotaManagerProxy> quota_manager_proxy_;
scoped_refptr<base::SequencedTaskRunner> update_notify_runner_;
// Not owned; sandbox_file_util_ should have identical lifetime with this.
diff --git a/storage/browser/file_system/transient_file_util.cc b/storage/browser/file_system/transient_file_util.cc
index d67ee1c..c90ee36 100644
--- a/storage/browser/file_system/transient_file_util.cc
+++ b/storage/browser/file_system/transient_file_util.cc
@@ -12,8 +12,6 @@
#include "storage/browser/file_system/file_system_url.h"
#include "storage/browser/file_system/isolated_context.h"
-using storage::ScopedFile;
-
namespace storage {
namespace {
diff --git a/storage/browser/file_system/transient_file_util.h b/storage/browser/file_system/transient_file_util.h
index 836e73c..836bba2 100644
--- a/storage/browser/file_system/transient_file_util.h
+++ b/storage/browser/file_system/transient_file_util.h
@@ -18,16 +18,15 @@
class COMPONENT_EXPORT(STORAGE_BROWSER) TransientFileUtil
: public LocalFileUtil {
public:
- TransientFileUtil() {}
- ~TransientFileUtil() override {}
+ TransientFileUtil() = default;
+ ~TransientFileUtil() override = default;
// LocalFileUtil overrides.
- storage::ScopedFile CreateSnapshotFile(
- FileSystemOperationContext* context,
- const FileSystemURL& url,
- base::File::Error* error,
- base::File::Info* file_info,
- base::FilePath* platform_path) override;
+ ScopedFile CreateSnapshotFile(FileSystemOperationContext* context,
+ const FileSystemURL& url,
+ base::File::Error* error,
+ base::File::Info* file_info,
+ base::FilePath* platform_path) override;
private:
DISALLOW_COPY_AND_ASSIGN(TransientFileUtil);
diff --git a/storage/browser/file_system/transient_file_util_unittest.cc b/storage/browser/file_system/transient_file_util_unittest.cc
index cadd03b..4cec97b 100644
--- a/storage/browser/file_system/transient_file_util_unittest.cc
+++ b/storage/browser/file_system/transient_file_util_unittest.cc
@@ -3,6 +3,7 @@
// found in the LICENSE file.
#include <memory>
+#include <string>
#include "base/files/file_path.h"
#include "base/files/file_util.h"
@@ -18,9 +19,7 @@
#include "storage/browser/test/test_file_system_context.h"
#include "testing/gtest/include/gtest/gtest.h"
-using storage::FileSystemURL;
-
-namespace content {
+namespace storage {
class TransientFileUtilTest : public testing::Test {
public:
@@ -30,7 +29,7 @@
void SetUp() override {
file_system_context_ = CreateFileSystemContextForTesting(
nullptr, base::FilePath(FILE_PATH_LITERAL("dummy")));
- transient_file_util_.reset(new storage::TransientFileUtil);
+ transient_file_util_ = std::make_unique<TransientFileUtil>();
ASSERT_TRUE(data_dir_.CreateUniqueTempDir());
}
@@ -43,36 +42,32 @@
void CreateAndRegisterTemporaryFile(
FileSystemURL* file_url,
base::FilePath* file_path,
- storage::IsolatedContext::ScopedFSHandle* filesystem) {
+ IsolatedContext::ScopedFSHandle* filesystem) {
EXPECT_TRUE(base::CreateTemporaryFileInDir(data_dir_.GetPath(), file_path));
- storage::IsolatedContext* isolated_context =
- storage::IsolatedContext::GetInstance();
+ IsolatedContext* isolated_context = IsolatedContext::GetInstance();
std::string name = "tmp";
*filesystem = isolated_context->RegisterFileSystemForPath(
- storage::kFileSystemTypeForTransientFile, std::string(), *file_path,
- &name);
+ kFileSystemTypeForTransientFile, std::string(), *file_path, &name);
ASSERT_TRUE(filesystem->is_valid());
base::FilePath virtual_path =
isolated_context->CreateVirtualRootPath(filesystem->id())
.AppendASCII(name);
*file_url = file_system_context_->CreateCrackedFileSystemURL(
- GURL("http://foo"), storage::kFileSystemTypeIsolated, virtual_path);
+ GURL("http://foo"), kFileSystemTypeIsolated, virtual_path);
}
- std::unique_ptr<storage::FileSystemOperationContext> NewOperationContext() {
- return std::make_unique<storage::FileSystemOperationContext>(
+ std::unique_ptr<FileSystemOperationContext> NewOperationContext() {
+ return std::make_unique<FileSystemOperationContext>(
file_system_context_.get());
}
- storage::FileSystemFileUtil* file_util() {
- return transient_file_util_.get();
- }
+ FileSystemFileUtil* file_util() { return transient_file_util_.get(); }
private:
base::test::TaskEnvironment task_environment_;
base::ScopedTempDir data_dir_;
- scoped_refptr<storage::FileSystemContext> file_system_context_;
- std::unique_ptr<storage::TransientFileUtil> transient_file_util_;
+ scoped_refptr<FileSystemContext> file_system_context_;
+ std::unique_ptr<TransientFileUtil> transient_file_util_;
DISALLOW_COPY_AND_ASSIGN(TransientFileUtilTest);
};
@@ -80,7 +75,7 @@
TEST_F(TransientFileUtilTest, TransientFile) {
FileSystemURL temp_url;
base::FilePath temp_path;
- storage::IsolatedContext::ScopedFSHandle filesystem;
+ IsolatedContext::ScopedFSHandle filesystem;
CreateAndRegisterTemporaryFile(&temp_url, &temp_path, &filesystem);
@@ -95,7 +90,7 @@
// Create a snapshot file.
{
- storage::ScopedFile scoped_file = file_util()->CreateSnapshotFile(
+ ScopedFile scoped_file = file_util()->CreateSnapshotFile(
NewOperationContext().get(), temp_url, &error, &file_info, &path);
ASSERT_EQ(base::File::FILE_OK, error);
ASSERT_EQ(temp_path, path);
@@ -120,4 +115,4 @@
&file_info, &path));
}
-} // namespace content
+} // namespace storage
diff --git a/storage/browser/quota/quota_database.h b/storage/browser/quota/quota_database.h
index 887594e..286754e 100644
--- a/storage/browser/quota/quota_database.h
+++ b/storage/browser/quota/quota_database.h
@@ -22,10 +22,6 @@
#include "third_party/blink/public/mojom/quota/quota_types.mojom-forward.h"
#include "url/origin.h"
-namespace content {
-class QuotaDatabaseTest;
-}
-
namespace sql {
class Database;
class MetaTable;
@@ -218,7 +214,7 @@
base::OneShotTimer timer_;
- friend class content::QuotaDatabaseTest;
+ friend class QuotaDatabaseTest;
friend class QuotaManager;
static const TableSchema kTables[];
diff --git a/storage/browser/quota/quota_database_unittest.cc b/storage/browser/quota/quota_database_unittest.cc
index 31a54d0..81edd2a 100644
--- a/storage/browser/quota/quota_database_unittest.cc
+++ b/storage/browser/quota/quota_database_unittest.cc
@@ -26,13 +26,10 @@
#include "third_party/blink/public/mojom/quota/quota_types.mojom-shared.h"
#include "url/gurl.h"
-using storage::QuotaDatabase;
+namespace storage {
-namespace content {
namespace {
-
const char kDBFileName[] = "quota_manager.db";
-
} // namespace
// Declared to shorten the line lengths.
@@ -689,4 +686,4 @@
}
}
-} // namespace content
+} // namespace storage
diff --git a/storage/browser/quota/quota_manager.h b/storage/browser/quota/quota_manager.h
index 817b1cf..34de4614 100644
--- a/storage/browser/quota/quota_manager.h
+++ b/storage/browser/quota/quota_manager.h
@@ -45,15 +45,8 @@
class QuotaInternalsProxy;
} // namespace quota_internals
-namespace content {
-class MockQuotaManager;
-class MockStorageClient;
-class QuotaManagerTest;
-} // namespace content
-
namespace storage {
-class QuotaDatabase;
class QuotaManagerProxy;
class QuotaTemporaryStorageEvictor;
class UsageTracker;
@@ -281,11 +274,11 @@
private:
friend class base::DeleteHelper<QuotaManager>;
friend class base::RefCountedDeleteOnSequence<QuotaManager>;
- friend class content::QuotaManagerTest;
- friend class content::MockQuotaManager;
- friend class content::MockStorageClient;
friend class quota_internals::QuotaInternalsProxy;
+ friend class MockQuotaManager;
+ friend class MockStorageClient;
friend class QuotaManagerProxy;
+ friend class QuotaManagerTest;
friend class QuotaTemporaryStorageEvictor;
class EvictionRoundInfoHelper;
diff --git a/storage/browser/quota/quota_manager_unittest.cc b/storage/browser/quota/quota_manager_unittest.cc
index 83a0100..b7d035a 100644
--- a/storage/browser/quota/quota_manager_unittest.cc
+++ b/storage/browser/quota/quota_manager_unittest.cc
@@ -38,12 +38,8 @@
using blink::mojom::QuotaStatusCode;
using blink::mojom::StorageType;
-using storage::QuotaClient;
-using storage::QuotaManager;
-using storage::UsageInfo;
-using storage::UsageInfoEntries;
-namespace content {
+namespace storage {
namespace {
@@ -104,14 +100,14 @@
quota_manager_ = new QuotaManager(is_incognito, data_dir_.GetPath(),
base::ThreadTaskRunnerHandle::Get().get(),
mock_special_storage_policy_.get(),
- storage::GetQuotaSettingsFunc());
+ GetQuotaSettingsFunc());
SetQuotaSettings(kDefaultPoolSize, kDefaultPerHostQuota,
is_incognito ? INT64_C(0) : kMustRemainAvailableForSystem);
// Don't (automatically) start the eviction for testing.
quota_manager_->eviction_disabled_ = true;
// Don't query the hard disk for remaining capacity.
- quota_manager_->get_volume_info_fn_= &GetVolumeInfoForTests;
+ quota_manager_->get_volume_info_fn_ = &GetVolumeInfoForTests;
additional_callback_count_ = 0;
}
@@ -169,7 +165,7 @@
void SetQuotaSettings(int64_t pool_size,
int64_t per_host_quota,
int64_t must_remain_available) {
- storage::QuotaSettings settings;
+ QuotaSettings settings;
settings.pool_size = pool_size;
settings.per_host_quota = per_host_quota;
settings.session_only_per_host_quota =
@@ -275,7 +271,7 @@
void GetEvictionRoundInfo() {
quota_status_ = QuotaStatusCode::kUnknown;
- settings_ = storage::QuotaSettings();
+ settings_ = QuotaSettings();
available_space_ = -1;
total_space_ = -1;
usage_ = -1;
@@ -394,7 +390,7 @@
}
void DidGetEvictionRoundInfo(QuotaStatusCode status,
- const storage::QuotaSettings& settings,
+ const QuotaSettings& settings,
int64_t available_space,
int64_t total_space,
int64_t global_usage,
@@ -465,7 +461,7 @@
const OriginInfoTableEntries& origin_info_entries() const {
return origin_info_entries_;
}
- const storage::QuotaSettings& settings() const { return settings_; }
+ const QuotaSettings& settings() const { return settings_; }
base::FilePath profile_path() const { return data_dir_.GetPath(); }
int status_callback_count() const { return status_callback_count_; }
void reset_status_callback_count() { status_callback_count_ = 0; }
@@ -498,7 +494,7 @@
StorageType modified_origins_type_;
QuotaTableEntries quota_entries_;
OriginInfoTableEntries origin_info_entries_;
- storage::QuotaSettings settings_;
+ QuotaSettings settings_;
int status_callback_count_;
int additional_callback_count_;
@@ -1249,8 +1245,7 @@
// quota as what is set in QuotaSettings, despite being in a state of low
// available space. Notice the different expectation in the last line of
// each test.
- scoped_feature_list_.InitAndEnableFeature(
- storage::features::kStaticHostQuota);
+ scoped_feature_list_.InitAndEnableFeature(features::kStaticHostQuota);
static const MockOriginData kData[] = {
{"http://foo.com/", kTemp, 100000},
{"http://unlimited/", kTemp, 4000000},
@@ -2493,4 +2488,4 @@
EXPECT_EQ(0, quota());
}
-} // namespace content
+} // namespace storage
diff --git a/storage/browser/quota/quota_settings.cc b/storage/browser/quota/quota_settings.cc
index b2210b5..316b2d7 100644
--- a/storage/browser/quota/quota_settings.cc
+++ b/storage/browser/quota/quota_settings.cc
@@ -5,7 +5,9 @@
#include "storage/browser/quota/quota_settings.h"
#include <algorithm>
+#include <limits>
#include <memory>
+#include <utility>
#include "base/bind.h"
#include "base/rand_util.h"
@@ -30,7 +32,7 @@
return value + (value * (random_percent / 100.0));
}
-storage::QuotaSettings CalculateIncognitoDynamicSettings(
+QuotaSettings CalculateIncognitoDynamicSettings(
int64_t physical_memory_amount) {
// The incognito pool size is a fraction of the amount of system memory,
// and the amount is capped to a hard limit.
@@ -47,7 +49,7 @@
RandomizeByPercent(max_incognito_pool_size, kRandomizedPercentage);
}
- storage::QuotaSettings settings;
+ QuotaSettings settings;
settings.pool_size = std::min(
max_incognito_pool_size,
static_cast<int64_t>(physical_memory_amount * incognito_pool_size_ratio));
@@ -57,7 +59,7 @@
return settings;
}
-base::Optional<storage::QuotaSettings> CalculateNominalDynamicSettings(
+base::Optional<QuotaSettings> CalculateNominalDynamicSettings(
const base::FilePath& partition_path,
bool is_incognito,
QuotaDeviceInfoHelper* device_info_helper) {
@@ -118,7 +120,7 @@
const double kSessionOnlyHostQuotaRatio = 0.1; // 10%
const int64_t kMaxSessionOnlyHostQuota = 300 * kMBytes;
- storage::QuotaSettings settings;
+ QuotaSettings settings;
int64_t total = device_info_helper->AmountOfTotalDiskSpace(partition_path);
if (total == -1) {
diff --git a/storage/browser/quota/quota_temporary_storage_evictor.h b/storage/browser/quota/quota_temporary_storage_evictor.h
index 451d3dc..f2ccb09 100644
--- a/storage/browser/quota/quota_temporary_storage_evictor.h
+++ b/storage/browser/quota/quota_temporary_storage_evictor.h
@@ -19,10 +19,6 @@
#include "base/timer/timer.h"
#include "third_party/blink/public/mojom/quota/quota_types.mojom.h"
-namespace content {
-class QuotaTemporaryStorageEvictorTest;
-}
-
namespace url {
class Origin;
}
@@ -78,7 +74,7 @@
void Start();
private:
- friend class content::QuotaTemporaryStorageEvictorTest;
+ friend class QuotaTemporaryStorageEvictorTest;
void StartEvictionTimerWithDelay(int64_t delay_ms);
void ConsiderEviction();
diff --git a/storage/browser/quota/quota_temporary_storage_evictor_unittest.cc b/storage/browser/quota/quota_temporary_storage_evictor_unittest.cc
index d8a6dd9..cde57cb 100644
--- a/storage/browser/quota/quota_temporary_storage_evictor_unittest.cc
+++ b/storage/browser/quota/quota_temporary_storage_evictor_unittest.cc
@@ -21,10 +21,9 @@
#include "storage/browser/test/mock_storage_client.h"
#include "testing/gtest/include/gtest/gtest.h"
-using storage::QuotaTemporaryStorageEvictor;
using blink::mojom::StorageType;
-namespace content {
+namespace storage {
class QuotaTemporaryStorageEvictorTest;
@@ -35,7 +34,7 @@
return url::Origin::Create(GURL(url));
}
-class MockQuotaEvictionHandler : public storage::QuotaEvictionHandler {
+class MockQuotaEvictionHandler : public QuotaEvictionHandler {
public:
explicit MockQuotaEvictionHandler(QuotaTemporaryStorageEvictorTest* test)
: available_space_(0),
@@ -44,7 +43,7 @@
void EvictOriginData(const url::Origin& origin,
StorageType type,
- storage::StatusCallback callback) override {
+ StatusCallback callback) override {
if (error_on_evict_origin_data_) {
std::move(callback).Run(
blink::mojom::QuotaStatusCode::kErrorInvalidModification);
@@ -59,7 +58,7 @@
void GetEvictionRoundInfo(EvictionRoundInfoCallback callback) override {
if (error_on_get_usage_and_quota_) {
std::move(callback).Run(blink::mojom::QuotaStatusCode::kErrorAbort,
- storage::QuotaSettings(), 0, 0, 0, false);
+ QuotaSettings(), 0, 0, 0, false);
return;
}
if (!task_for_get_usage_and_quota_.is_null())
@@ -71,7 +70,7 @@
void GetEvictionOrigin(StorageType type,
int64_t global_quota,
- storage::GetOriginCallback callback) override {
+ GetOriginCallback callback) override {
if (origin_order_.empty())
std::move(callback).Run(base::nullopt);
else
@@ -85,7 +84,7 @@
return total_usage;
}
- const storage::QuotaSettings& settings() const { return settings_; }
+ const QuotaSettings& settings() const { return settings_; }
void SetPoolSize(int64_t pool_size) {
settings_.pool_size = pool_size;
settings_.per_host_quota = pool_size / 5;
@@ -136,7 +135,7 @@
return origin_usage;
}
- storage::QuotaSettings settings_;
+ QuotaSettings settings_;
int64_t available_space_;
std::list<url::Origin> origin_order_;
std::map<url::Origin, int64_t> origins_;
@@ -396,7 +395,7 @@
EXPECT_EQ(0, statistics().num_errors_on_getting_usage_and_quota);
EXPECT_EQ(2, statistics().num_evicted_origins);
EXPECT_EQ(1, statistics().num_eviction_rounds);
- EXPECT_EQ(0, statistics().num_skipped_eviction_rounds); // FIXME?
+ EXPECT_EQ(0, statistics().num_skipped_eviction_rounds); // FIXME?
}
-} // namespace content
+} // namespace storage
diff --git a/storage/browser/quota/usage_tracker_unittest.cc b/storage/browser/quota/usage_tracker_unittest.cc
index 8890530..43eff81 100644
--- a/storage/browser/quota/usage_tracker_unittest.cc
+++ b/storage/browser/quota/usage_tracker_unittest.cc
@@ -4,6 +4,7 @@
#include <stdint.h>
+#include <utility>
#include <vector>
#include "base/bind.h"
@@ -20,11 +21,8 @@
using blink::mojom::QuotaStatusCode;
using blink::mojom::StorageType;
-using storage::QuotaClient;
-using storage::SpecialStoragePolicy;
-using storage::UsageTracker;
-namespace content {
+namespace storage {
namespace {
@@ -391,5 +389,4 @@
EXPECT_EQ(2 + 32, unlimited_usage);
}
-
-} // namespace content
+} // namespace storage
diff --git a/storage/browser/test/async_file_test_helper.cc b/storage/browser/test/async_file_test_helper.cc
index be5601b0..4dfb4a4 100644
--- a/storage/browser/test/async_file_test_helper.cc
+++ b/storage/browser/test/async_file_test_helper.cc
@@ -3,6 +3,9 @@
// found in the LICENSE file.
#include "storage/browser/test/async_file_test_helper.h"
+
+#include <utility>
+
#include "base/bind.h"
#include "base/files/file_util.h"
#include "base/files/scoped_temp_dir.h"
@@ -16,9 +19,9 @@
#include "storage/common/file_system/file_system_util.h"
#include "testing/gtest/include/gtest/gtest.h"
-namespace content {
+namespace storage {
-using FileEntryList = storage::FileSystemOperation::FileEntryList;
+using FileEntryList = FileSystemOperation::FileEntryList;
namespace {
@@ -53,7 +56,7 @@
base::File::Error result,
const base::File::Info& file_info,
const base::FilePath& platform_path,
- scoped_refptr<storage::ShareableFileReference> file_ref) {
+ scoped_refptr<ShareableFileReference> file_ref) {
DCHECK(!file_ref.get());
*result_out = result;
if (platform_path_out)
@@ -94,45 +97,41 @@
const int64_t AsyncFileTestHelper::kDontCheckSize = -1;
-base::File::Error AsyncFileTestHelper::Copy(
- storage::FileSystemContext* context,
- const storage::FileSystemURL& src,
- const storage::FileSystemURL& dest) {
+base::File::Error AsyncFileTestHelper::Copy(FileSystemContext* context,
+ const FileSystemURL& src,
+ const FileSystemURL& dest) {
return CopyWithProgress(context, src, dest, CopyProgressCallback());
}
base::File::Error AsyncFileTestHelper::CopyWithProgress(
- storage::FileSystemContext* context,
- const storage::FileSystemURL& src,
- const storage::FileSystemURL& dest,
+ FileSystemContext* context,
+ const FileSystemURL& src,
+ const FileSystemURL& dest,
const CopyProgressCallback& progress_callback) {
base::File::Error result = base::File::FILE_ERROR_FAILED;
base::RunLoop run_loop;
- context->operation_runner()->Copy(
- src, dest, storage::FileSystemOperation::OPTION_NONE,
- storage::FileSystemOperation::ERROR_BEHAVIOR_ABORT, progress_callback,
- AssignAndQuitCallback(&run_loop, &result));
- run_loop.Run();
- return result;
-}
-
-base::File::Error AsyncFileTestHelper::Move(
- storage::FileSystemContext* context,
- const storage::FileSystemURL& src,
- const storage::FileSystemURL& dest) {
- base::File::Error result = base::File::FILE_ERROR_FAILED;
- base::RunLoop run_loop;
- context->operation_runner()->Move(src, dest,
- storage::FileSystemOperation::OPTION_NONE,
+ context->operation_runner()->Copy(src, dest, FileSystemOperation::OPTION_NONE,
+ FileSystemOperation::ERROR_BEHAVIOR_ABORT,
+ progress_callback,
AssignAndQuitCallback(&run_loop, &result));
run_loop.Run();
return result;
}
-base::File::Error AsyncFileTestHelper::Remove(
- storage::FileSystemContext* context,
- const storage::FileSystemURL& url,
- bool recursive) {
+base::File::Error AsyncFileTestHelper::Move(FileSystemContext* context,
+ const FileSystemURL& src,
+ const FileSystemURL& dest) {
+ base::File::Error result = base::File::FILE_ERROR_FAILED;
+ base::RunLoop run_loop;
+ context->operation_runner()->Move(src, dest, FileSystemOperation::OPTION_NONE,
+ AssignAndQuitCallback(&run_loop, &result));
+ run_loop.Run();
+ return result;
+}
+
+base::File::Error AsyncFileTestHelper::Remove(FileSystemContext* context,
+ const FileSystemURL& url,
+ bool recursive) {
base::File::Error result = base::File::FILE_ERROR_FAILED;
base::RunLoop run_loop;
context->operation_runner()->Remove(
@@ -141,10 +140,9 @@
return result;
}
-base::File::Error AsyncFileTestHelper::ReadDirectory(
- storage::FileSystemContext* context,
- const storage::FileSystemURL& url,
- FileEntryList* entries) {
+base::File::Error AsyncFileTestHelper::ReadDirectory(FileSystemContext* context,
+ const FileSystemURL& url,
+ FileEntryList* entries) {
base::File::Error result = base::File::FILE_ERROR_FAILED;
DCHECK(entries);
entries->clear();
@@ -157,8 +155,8 @@
}
base::File::Error AsyncFileTestHelper::CreateDirectory(
- storage::FileSystemContext* context,
- const storage::FileSystemURL& url) {
+ FileSystemContext* context,
+ const FileSystemURL& url) {
base::File::Error result = base::File::FILE_ERROR_FAILED;
base::RunLoop run_loop;
context->operation_runner()->CreateDirectory(
@@ -168,9 +166,8 @@
return result;
}
-base::File::Error AsyncFileTestHelper::CreateFile(
- storage::FileSystemContext* context,
- const storage::FileSystemURL& url) {
+base::File::Error AsyncFileTestHelper::CreateFile(FileSystemContext* context,
+ const FileSystemURL& url) {
base::File::Error result = base::File::FILE_ERROR_FAILED;
base::RunLoop run_loop;
context->operation_runner()->CreateFile(
@@ -180,8 +177,8 @@
}
base::File::Error AsyncFileTestHelper::CreateFileWithData(
- storage::FileSystemContext* context,
- const storage::FileSystemURL& url,
+ FileSystemContext* context,
+ const FileSystemURL& url,
const char* buf,
int buf_size) {
base::ScopedTempDir dir;
@@ -198,10 +195,9 @@
return result;
}
-base::File::Error AsyncFileTestHelper::TruncateFile(
- storage::FileSystemContext* context,
- const storage::FileSystemURL& url,
- size_t size) {
+base::File::Error AsyncFileTestHelper::TruncateFile(FileSystemContext* context,
+ const FileSystemURL& url,
+ size_t size) {
base::RunLoop run_loop;
base::File::Error result = base::File::FILE_ERROR_FAILED;
context->operation_runner()->Truncate(
@@ -211,24 +207,24 @@
}
base::File::Error AsyncFileTestHelper::GetMetadata(
- storage::FileSystemContext* context,
- const storage::FileSystemURL& url,
+ FileSystemContext* context,
+ const FileSystemURL& url,
base::File::Info* file_info) {
base::File::Error result = base::File::FILE_ERROR_FAILED;
base::RunLoop run_loop;
context->operation_runner()->GetMetadata(
url,
- storage::FileSystemOperation::GET_METADATA_FIELD_IS_DIRECTORY |
- storage::FileSystemOperation::GET_METADATA_FIELD_SIZE |
- storage::FileSystemOperation::GET_METADATA_FIELD_LAST_MODIFIED,
+ FileSystemOperation::GET_METADATA_FIELD_IS_DIRECTORY |
+ FileSystemOperation::GET_METADATA_FIELD_SIZE |
+ FileSystemOperation::GET_METADATA_FIELD_LAST_MODIFIED,
base::BindOnce(&GetMetadataCallback, &run_loop, &result, file_info));
run_loop.Run();
return result;
}
base::File::Error AsyncFileTestHelper::GetPlatformPath(
- storage::FileSystemContext* context,
- const storage::FileSystemURL& url,
+ FileSystemContext* context,
+ const FileSystemURL& url,
base::FilePath* platform_path) {
base::File::Error result = base::File::FILE_ERROR_FAILED;
base::RunLoop run_loop;
@@ -239,8 +235,8 @@
return result;
}
-bool AsyncFileTestHelper::FileExists(storage::FileSystemContext* context,
- const storage::FileSystemURL& url,
+bool AsyncFileTestHelper::FileExists(FileSystemContext* context,
+ const FileSystemURL& url,
int64_t expected_size) {
base::File::Info file_info;
base::File::Error result = GetMetadata(context, url, &file_info);
@@ -249,17 +245,17 @@
return expected_size == kDontCheckSize || file_info.size == expected_size;
}
-bool AsyncFileTestHelper::DirectoryExists(storage::FileSystemContext* context,
- const storage::FileSystemURL& url) {
+bool AsyncFileTestHelper::DirectoryExists(FileSystemContext* context,
+ const FileSystemURL& url) {
base::File::Info file_info;
base::File::Error result = GetMetadata(context, url, &file_info);
return (result == base::File::FILE_OK) && file_info.is_directory;
}
blink::mojom::QuotaStatusCode AsyncFileTestHelper::GetUsageAndQuota(
- storage::QuotaManager* quota_manager,
+ QuotaManager* quota_manager,
const url::Origin& origin,
- storage::FileSystemType type,
+ FileSystemType type,
int64_t* usage,
int64_t* quota) {
blink::mojom::QuotaStatusCode status =
@@ -273,4 +269,4 @@
return status;
}
-} // namespace content
+} // namespace storage
diff --git a/storage/browser/test/async_file_test_helper.h b/storage/browser/test/async_file_test_helper.h
index 2ba3221..a3a4030 100644
--- a/storage/browser/test/async_file_test_helper.h
+++ b/storage/browser/test/async_file_test_helper.h
@@ -22,95 +22,93 @@
class Origin;
}
-namespace content {
+namespace storage {
// A helper class to perform async file operations in a synchronous way.
class AsyncFileTestHelper {
public:
- using FileEntryList = storage::FileSystemOperation::FileEntryList;
- using CopyProgressCallback =
- storage::FileSystemOperation::CopyProgressCallback;
+ using FileEntryList = FileSystemOperation::FileEntryList;
+ using CopyProgressCallback = FileSystemOperation::CopyProgressCallback;
static const int64_t kDontCheckSize;
// Performs Copy from |src| to |dest| and returns the status code.
- static base::File::Error Copy(storage::FileSystemContext* context,
- const storage::FileSystemURL& src,
- const storage::FileSystemURL& dest);
+ static base::File::Error Copy(FileSystemContext* context,
+ const FileSystemURL& src,
+ const FileSystemURL& dest);
// Same as Copy, but this supports |progress_callback|.
static base::File::Error CopyWithProgress(
- storage::FileSystemContext* context,
- const storage::FileSystemURL& src,
- const storage::FileSystemURL& dest,
+ FileSystemContext* context,
+ const FileSystemURL& src,
+ const FileSystemURL& dest,
const CopyProgressCallback& progress_callback);
// Performs Move from |src| to |dest| and returns the status code.
- static base::File::Error Move(storage::FileSystemContext* context,
- const storage::FileSystemURL& src,
- const storage::FileSystemURL& dest);
+ static base::File::Error Move(FileSystemContext* context,
+ const FileSystemURL& src,
+ const FileSystemURL& dest);
// Removes the given |url|.
- static base::File::Error Remove(storage::FileSystemContext* context,
- const storage::FileSystemURL& url,
+ static base::File::Error Remove(FileSystemContext* context,
+ const FileSystemURL& url,
bool recursive);
// Performs ReadDirectory on |url|.
- static base::File::Error ReadDirectory(storage::FileSystemContext* context,
- const storage::FileSystemURL& url,
+ static base::File::Error ReadDirectory(FileSystemContext* context,
+ const FileSystemURL& url,
FileEntryList* entries);
// Creates a directory at |url|.
- static base::File::Error CreateDirectory(storage::FileSystemContext* context,
- const storage::FileSystemURL& url);
+ static base::File::Error CreateDirectory(FileSystemContext* context,
+ const FileSystemURL& url);
// Creates a file at |url|.
- static base::File::Error CreateFile(storage::FileSystemContext* context,
- const storage::FileSystemURL& url);
+ static base::File::Error CreateFile(FileSystemContext* context,
+ const FileSystemURL& url);
// Creates a file at |url| and fills with |buf|.
- static base::File::Error CreateFileWithData(
- storage::FileSystemContext* context,
- const storage::FileSystemURL& url,
- const char* buf,
- int buf_size);
+ static base::File::Error CreateFileWithData(FileSystemContext* context,
+ const FileSystemURL& url,
+ const char* buf,
+ int buf_size);
// Truncates the file |url| to |size|.
- static base::File::Error TruncateFile(storage::FileSystemContext* context,
- const storage::FileSystemURL& url,
+ static base::File::Error TruncateFile(FileSystemContext* context,
+ const FileSystemURL& url,
size_t size);
// Retrieves File::Info for |url| and populates |file_info|.
- static base::File::Error GetMetadata(storage::FileSystemContext* context,
- const storage::FileSystemURL& url,
+ static base::File::Error GetMetadata(FileSystemContext* context,
+ const FileSystemURL& url,
base::File::Info* file_info);
// Retrieves FilePath for |url| and populates |platform_path|.
- static base::File::Error GetPlatformPath(storage::FileSystemContext* context,
- const storage::FileSystemURL& url,
+ static base::File::Error GetPlatformPath(FileSystemContext* context,
+ const FileSystemURL& url,
base::FilePath* platform_path);
// Returns true if a file exists at |url| with |size|. If |size| is
// kDontCheckSize it doesn't check the file size (but just check its
// existence).
- static bool FileExists(storage::FileSystemContext* context,
- const storage::FileSystemURL& url,
+ static bool FileExists(FileSystemContext* context,
+ const FileSystemURL& url,
int64_t size);
// Returns true if a directory exists at |url|.
- static bool DirectoryExists(storage::FileSystemContext* context,
- const storage::FileSystemURL& url);
+ static bool DirectoryExists(FileSystemContext* context,
+ const FileSystemURL& url);
// Returns usage and quota. It's valid to pass nullptr to |usage| and/or
// |quota|.
static blink::mojom::QuotaStatusCode GetUsageAndQuota(
- storage::QuotaManager* quota_manager,
+ QuotaManager* quota_manager,
const url::Origin& origin,
- storage::FileSystemType type,
+ FileSystemType type,
int64_t* usage,
int64_t* quota);
};
-} // namespace content
+} // namespace storage
#endif // STORAGE_BROWSER_TEST_ASYNC_FILE_TEST_HELPER_H_
diff --git a/storage/browser/test/file_system_test_file_set.cc b/storage/browser/test/file_system_test_file_set.cc
index 8959580..6e647d6e 100644
--- a/storage/browser/test/file_system_test_file_set.cc
+++ b/storage/browser/test/file_system_test_file_set.cc
@@ -17,7 +17,7 @@
#include "base/stl_util.h"
#include "testing/gtest/include/gtest/gtest.h"
-namespace content {
+namespace storage {
const FileSystemTestCaseRecord kRegularFileSystemTestCases[] = {
{true, FILE_PATH_LITERAL("dir a"), 0},
@@ -68,4 +68,4 @@
}
}
-} // namespace content
+} // namespace storage
diff --git a/storage/browser/test/file_system_test_file_set.h b/storage/browser/test/file_system_test_file_set.h
index f98e0d73..680832d6 100644
--- a/storage/browser/test/file_system_test_file_set.h
+++ b/storage/browser/test/file_system_test_file_set.h
@@ -14,7 +14,7 @@
// Common test data structures and test cases.
-namespace content {
+namespace storage {
struct FileSystemTestCaseRecord {
bool is_directory;
@@ -34,6 +34,6 @@
// Creates the files and directories specified in kRegularTestCases.
void SetUpRegularFileSystemTestCases(const base::FilePath& root_path);
-} // namespace content
+} // namespace storage
#endif // STORAGE_BROWSER_TEST_FILE_SYSTEM_TEST_FILE_SET_H_
diff --git a/storage/browser/test/mock_file_change_observer.h b/storage/browser/test/mock_file_change_observer.h
index 1b95cfd..a875c22 100644
--- a/storage/browser/test/mock_file_change_observer.h
+++ b/storage/browser/test/mock_file_change_observer.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CONTENT_BROWSER_FILEAPI_MOCK_FILE_CHANGE_OBSERVER_H_
-#define CONTENT_BROWSER_FILEAPI_MOCK_FILE_CHANGE_OBSERVER_H_
+#ifndef STORAGE_BROWSER_TEST_MOCK_FILE_CHANGE_OBSERVER_H_
+#define STORAGE_BROWSER_TEST_MOCK_FILE_CHANGE_OBSERVER_H_
#include "base/compiler_specific.h"
#include "base/macros.h"
@@ -100,4 +100,4 @@
} // namespace storage
-#endif // CONTENT_BROWSER_FILEAPI_MOCK_FILE_CHANGE_OBSERVER_H_
+#endif // STORAGE_BROWSER_TEST_MOCK_FILE_CHANGE_OBSERVER_H_
diff --git a/storage/browser/test/mock_file_update_observer.h b/storage/browser/test/mock_file_update_observer.h
index eb9c624..a3081a79 100644
--- a/storage/browser/test/mock_file_update_observer.h
+++ b/storage/browser/test/mock_file_update_observer.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CONTENT_BROWSER_FILEAPI_MOCK_FILE_UPDATE_OBSERVER_H_
-#define CONTENT_BROWSER_FILEAPI_MOCK_FILE_UPDATE_OBSERVER_H_
+#ifndef STORAGE_BROWSER_TEST_MOCK_FILE_UPDATE_OBSERVER_H_
+#define STORAGE_BROWSER_TEST_MOCK_FILE_UPDATE_OBSERVER_H_
#include <stdint.h>
@@ -49,4 +49,4 @@
} // namespace storage
-#endif // CONTENT_BROWSER_FILEAPI_MOCK_FILE_UPDATE_OBSERVER_H_
+#endif // STORAGE_BROWSER_TEST_MOCK_FILE_UPDATE_OBSERVER_H_
diff --git a/storage/browser/test/mock_quota_manager.cc b/storage/browser/test/mock_quota_manager.cc
index 8caada0..045e3b7 100644
--- a/storage/browser/test/mock_quota_manager.cc
+++ b/storage/browser/test/mock_quota_manager.cc
@@ -15,10 +15,10 @@
#include "base/threading/thread_task_runner_handle.h"
#include "url/gurl.h"
-namespace content {
+namespace storage {
MockQuotaManager::OriginInfo::OriginInfo(const url::Origin& origin,
- StorageType type,
+ blink::mojom::StorageType type,
int quota_client_mask,
base::Time modified)
: origin(origin),
@@ -41,10 +41,10 @@
profile_path,
std::move(io_thread),
std::move(special_storage_policy),
- storage::GetQuotaSettingsFunc()) {}
+ GetQuotaSettingsFunc()) {}
void MockQuotaManager::GetUsageAndQuota(const url::Origin& origin,
- StorageType type,
+ blink::mojom::StorageType type,
UsageAndQuotaCallback callback) {
StorageInfo& info = usage_and_quota_map_[std::make_pair(origin, type)];
std::move(callback).Run(blink::mojom::QuotaStatusCode::kOk, info.usage,
@@ -58,7 +58,7 @@
}
bool MockQuotaManager::AddOrigin(const url::Origin& origin,
- StorageType type,
+ blink::mojom::StorageType type,
int quota_client_mask,
base::Time modified) {
origins_.push_back(OriginInfo(origin, type, quota_client_mask, modified));
@@ -66,7 +66,7 @@
}
bool MockQuotaManager::OriginHasData(const url::Origin& origin,
- StorageType type,
+ blink::mojom::StorageType type,
QuotaClient::ID quota_client) const {
for (const auto& info : origins_) {
if (info.origin == origin && info.type == type &&
@@ -76,7 +76,7 @@
return false;
}
-void MockQuotaManager::GetOriginsModifiedSince(StorageType type,
+void MockQuotaManager::GetOriginsModifiedSince(blink::mojom::StorageType type,
base::Time modified_since,
GetOriginsCallback callback) {
auto origins_to_return = std::make_unique<std::set<url::Origin>>();
@@ -92,7 +92,7 @@
}
void MockQuotaManager::DeleteOriginData(const url::Origin& origin,
- StorageType type,
+ blink::mojom::StorageType type,
int quota_client_mask,
StatusCallback callback) {
for (auto current = origins_.begin(); current != origins_.end(); ++current) {
@@ -120,7 +120,7 @@
MockQuotaManager::~MockQuotaManager() = default;
void MockQuotaManager::UpdateUsage(const url::Origin& origin,
- StorageType type,
+ blink::mojom::StorageType type,
int64_t delta) {
usage_and_quota_map_[std::make_pair(origin, type)].usage += delta;
}
@@ -128,7 +128,7 @@
void MockQuotaManager::DidGetModifiedSince(
GetOriginsCallback callback,
std::unique_ptr<std::set<url::Origin>> origins,
- StorageType storage_type) {
+ blink::mojom::StorageType storage_type) {
std::move(callback).Run(*origins, storage_type);
}
@@ -138,4 +138,4 @@
std::move(callback).Run(status);
}
-} // namespace content
+} // namespace storage
diff --git a/storage/browser/test/mock_quota_manager.h b/storage/browser/test/mock_quota_manager.h
index a33e6ea..f323094 100644
--- a/storage/browser/test/mock_quota_manager.h
+++ b/storage/browser/test/mock_quota_manager.h
@@ -21,13 +21,8 @@
#include "url/origin.h"
using blink::mojom::StorageType;
-using storage::GetOriginsCallback;
-using storage::QuotaClient;
-using storage::QuotaManager;
-using storage::SpecialStoragePolicy;
-using storage::StatusCallback;
-namespace content {
+namespace storage {
// Mocks the pieces of QuotaManager's interface.
//
@@ -52,13 +47,13 @@
// called. The internal quota value can be updated by calling
// a helper method MockQuotaManagerProxy::SetQuota().
void GetUsageAndQuota(const url::Origin& origin,
- StorageType type,
+ blink::mojom::StorageType type,
UsageAndQuotaCallback callback) override;
// Overrides QuotaManager's implementation with a canned implementation that
// allows clients to set up the origin database that should be queried. This
// method will only search through the origins added explicitly via AddOrigin.
- void GetOriginsModifiedSince(StorageType type,
+ void GetOriginsModifiedSince(blink::mojom::StorageType type,
base::Time modified_since,
GetOriginsCallback callback) override;
@@ -69,7 +64,7 @@
// QuotaClient::kAllClientsMask will remove all clients from the origin,
// regardless of type.
void DeleteOriginData(const url::Origin& origin,
- StorageType type,
+ blink::mojom::StorageType type,
int quota_client_mask,
StatusCallback callback) override;
@@ -157,6 +152,6 @@
DISALLOW_COPY_AND_ASSIGN(MockQuotaManager);
};
-} // namespace content
+} // namespace storage
#endif // STORAGE_BROWSER_TEST_MOCK_QUOTA_MANAGER_H_
diff --git a/storage/browser/test/mock_quota_manager_proxy.cc b/storage/browser/test/mock_quota_manager_proxy.cc
index c4cfa59..578a973 100644
--- a/storage/browser/test/mock_quota_manager_proxy.cc
+++ b/storage/browser/test/mock_quota_manager_proxy.cc
@@ -4,9 +4,11 @@
#include "storage/browser/test/mock_quota_manager_proxy.h"
+#include <utility>
+
#include "base/single_thread_task_runner.h"
-namespace content {
+namespace storage {
MockQuotaManagerProxy::MockQuotaManagerProxy(
MockQuotaManager* quota_manager,
@@ -67,4 +69,4 @@
DCHECK(!registered_client_);
}
-} // namespace content
+} // namespace storage
diff --git a/storage/browser/test/mock_quota_manager_proxy.h b/storage/browser/test/mock_quota_manager_proxy.h
index 95914f6..1d440093 100644
--- a/storage/browser/test/mock_quota_manager_proxy.h
+++ b/storage/browser/test/mock_quota_manager_proxy.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CONTENT_BROWSER_QUOTA_MOCK_QUOTA_MANAGER_PROXY_H_
-#define CONTENT_BROWSER_QUOTA_MOCK_QUOTA_MANAGER_PROXY_H_
+#ifndef STORAGE_BROWSER_TEST_MOCK_QUOTA_MANAGER_PROXY_H_
+#define STORAGE_BROWSER_TEST_MOCK_QUOTA_MANAGER_PROXY_H_
#include <stdint.h>
@@ -14,9 +14,7 @@
#include "third_party/blink/public/mojom/quota/quota_types.mojom.h"
#include "url/gurl.h"
-using storage::QuotaManagerProxy;
-
-namespace content {
+namespace storage {
class MockQuotaManager;
@@ -85,6 +83,6 @@
DISALLOW_COPY_AND_ASSIGN(MockQuotaManagerProxy);
};
-} // namespace content
+} // namespace storage
-#endif // CONTENT_BROWSER_QUOTA_MOCK_QUOTA_MANAGER_PROXY_H_
+#endif // STORAGE_BROWSER_TEST_MOCK_QUOTA_MANAGER_PROXY_H_
diff --git a/storage/browser/test/mock_quota_manager_unittest.cc b/storage/browser/test/mock_quota_manager_unittest.cc
index 4b03580..9ba2949 100644
--- a/storage/browser/test/mock_quota_manager_unittest.cc
+++ b/storage/browser/test/mock_quota_manager_unittest.cc
@@ -20,7 +20,7 @@
using blink::mojom::StorageType;
-namespace content {
+namespace storage {
const StorageType kTemporary = StorageType::kTemporary;
const StorageType kPersistent = StorageType::kPersistent;
@@ -221,4 +221,4 @@
EXPECT_EQ(0UL, origins().count(kOrigin1));
EXPECT_EQ(1UL, origins().count(kOrigin2));
}
-} // namespace content
+} // namespace storage
diff --git a/storage/browser/test/mock_special_storage_policy.cc b/storage/browser/test/mock_special_storage_policy.cc
index 37521ea..cdcede2 100644
--- a/storage/browser/test/mock_special_storage_policy.cc
+++ b/storage/browser/test/mock_special_storage_policy.cc
@@ -9,7 +9,7 @@
#include "base/stl_util.h"
#include "net/cookies/cookie_util.h"
-namespace content {
+namespace storage {
MockSpecialStoragePolicy::MockSpecialStoragePolicy() : all_unlimited_(false) {}
@@ -55,4 +55,4 @@
MockSpecialStoragePolicy::~MockSpecialStoragePolicy() = default;
-} // namespace content
+} // namespace storage
diff --git a/storage/browser/test/mock_special_storage_policy.h b/storage/browser/test/mock_special_storage_policy.h
index 0ae58d9..5e0d1da6 100644
--- a/storage/browser/test/mock_special_storage_policy.h
+++ b/storage/browser/test/mock_special_storage_policy.h
@@ -12,11 +12,9 @@
#include "storage/browser/quota/special_storage_policy.h"
#include "url/gurl.h"
-using storage::SpecialStoragePolicy;
+namespace storage {
-namespace content {
-
-class MockSpecialStoragePolicy : public storage::SpecialStoragePolicy {
+class MockSpecialStoragePolicy : public SpecialStoragePolicy {
public:
MockSpecialStoragePolicy();
@@ -79,6 +77,7 @@
bool all_unlimited_;
};
-} // namespace content
+
+} // namespace storage
#endif // STORAGE_BROWSER_TEST_MOCK_SPECIAL_STORAGE_POLICY_H_
diff --git a/storage/browser/test/mock_storage_client.cc b/storage/browser/test/mock_storage_client.cc
index f7311c7..d836247 100644
--- a/storage/browser/test/mock_storage_client.cc
+++ b/storage/browser/test/mock_storage_client.cc
@@ -16,7 +16,7 @@
#include "storage/browser/quota/quota_manager_proxy.h"
#include "url/gurl.h"
-namespace content {
+namespace storage {
using std::make_pair;
@@ -44,7 +44,7 @@
MockStorageClient::~MockStorageClient() = default;
void MockStorageClient::AddOriginAndNotify(const url::Origin& origin,
- StorageType type,
+ blink::mojom::StorageType type,
int64_t size) {
DCHECK(origin_data_.find(make_pair(origin, type)) == origin_data_.end());
DCHECK_GE(size, 0);
@@ -54,7 +54,7 @@
}
void MockStorageClient::ModifyOriginAndNotify(const url::Origin& origin,
- StorageType type,
+ blink::mojom::StorageType type,
int64_t delta) {
auto find = origin_data_.find(make_pair(origin, type));
DCHECK(find != origin_data_.end());
@@ -75,7 +75,7 @@
}
void MockStorageClient::AddOriginToErrorSet(const url::Origin& origin,
- StorageType type) {
+ blink::mojom::StorageType type) {
error_origins_.insert(make_pair(origin, type));
}
@@ -91,7 +91,7 @@
void MockStorageClient::OnQuotaManagerDestroyed() {}
void MockStorageClient::GetOriginUsage(const url::Origin& origin,
- StorageType type,
+ blink::mojom::StorageType type,
GetUsageCallback callback) {
base::ThreadTaskRunnerHandle::Get()->PostTask(
FROM_HERE, base::BindOnce(&MockStorageClient::RunGetOriginUsage,
@@ -99,7 +99,7 @@
std::move(callback)));
}
-void MockStorageClient::GetOriginsForType(StorageType type,
+void MockStorageClient::GetOriginsForType(blink::mojom::StorageType type,
GetOriginsCallback callback) {
base::ThreadTaskRunnerHandle::Get()->PostTask(
FROM_HERE,
@@ -107,7 +107,7 @@
weak_factory_.GetWeakPtr(), type, std::move(callback)));
}
-void MockStorageClient::GetOriginsForHost(StorageType type,
+void MockStorageClient::GetOriginsForHost(blink::mojom::StorageType type,
const std::string& host,
GetOriginsCallback callback) {
base::ThreadTaskRunnerHandle::Get()->PostTask(
@@ -117,7 +117,7 @@
}
void MockStorageClient::DeleteOriginData(const url::Origin& origin,
- StorageType type,
+ blink::mojom::StorageType type,
DeletionCallback callback) {
base::ThreadTaskRunnerHandle::Get()->PostTask(
FROM_HERE, base::BindOnce(&MockStorageClient::RunDeleteOriginData,
@@ -130,12 +130,12 @@
std::move(callback).Run();
}
-bool MockStorageClient::DoesSupport(StorageType type) const {
+bool MockStorageClient::DoesSupport(blink::mojom::StorageType type) const {
return true;
}
void MockStorageClient::RunGetOriginUsage(const url::Origin& origin,
- StorageType type,
+ blink::mojom::StorageType type,
GetUsageCallback callback) {
auto find = origin_data_.find(make_pair(origin, type));
if (find == origin_data_.end()) {
@@ -145,7 +145,7 @@
}
}
-void MockStorageClient::RunGetOriginsForType(StorageType type,
+void MockStorageClient::RunGetOriginsForType(blink::mojom::StorageType type,
GetOriginsCallback callback) {
std::set<url::Origin> origins;
for (const auto& origin_type_usage : origin_data_) {
@@ -155,7 +155,7 @@
std::move(callback).Run(origins);
}
-void MockStorageClient::RunGetOriginsForHost(StorageType type,
+void MockStorageClient::RunGetOriginsForHost(blink::mojom::StorageType type,
const std::string& host,
GetOriginsCallback callback) {
std::set<url::Origin> origins;
@@ -169,7 +169,7 @@
}
void MockStorageClient::RunDeleteOriginData(const url::Origin& origin,
- StorageType type,
+ blink::mojom::StorageType type,
DeletionCallback callback) {
auto itr_error = error_origins_.find(make_pair(origin, type));
if (itr_error != error_origins_.end()) {
@@ -188,4 +188,4 @@
std::move(callback).Run(blink::mojom::QuotaStatusCode::kOk);
}
-} // namespace content
+} // namespace storage
diff --git a/storage/browser/test/mock_storage_client.h b/storage/browser/test/mock_storage_client.h
index 58e69619..5d0df08 100644
--- a/storage/browser/test/mock_storage_client.h
+++ b/storage/browser/test/mock_storage_client.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CONTENT_PUBLIC_TEST_MOCK_STORAGE_CLIENT_H_
-#define CONTENT_PUBLIC_TEST_MOCK_STORAGE_CLIENT_H_
+#ifndef STORAGE_BROWSER_TEST_MOCK_STORAGE_CLIENT_H_
+#define STORAGE_BROWSER_TEST_MOCK_STORAGE_CLIENT_H_
#include <stddef.h>
#include <stdint.h>
@@ -22,18 +22,12 @@
#include "url/origin.h"
namespace storage {
+
class QuotaManagerProxy;
-}
-
-using storage::QuotaClient;
-using storage::QuotaManagerProxy;
-using blink::mojom::StorageType;
-
-namespace content {
struct MockOriginData {
const char* origin;
- StorageType type;
+ blink::mojom::StorageType type;
int64_t usage;
};
@@ -47,14 +41,15 @@
// To add or modify mock data in this client.
void AddOriginAndNotify(const url::Origin& origin,
- StorageType type,
+ blink::mojom::StorageType type,
int64_t size);
void ModifyOriginAndNotify(const url::Origin& origin,
- StorageType type,
+ blink::mojom::StorageType type,
int64_t delta);
void TouchAllOriginsAndNotify();
- void AddOriginToErrorSet(const url::Origin& origin, StorageType type);
+ void AddOriginToErrorSet(const url::Origin& origin,
+ blink::mojom::StorageType type);
base::Time IncrementMockTime();
@@ -62,32 +57,33 @@
QuotaClient::ID id() const override;
void OnQuotaManagerDestroyed() override;
void GetOriginUsage(const url::Origin& origin,
- StorageType type,
+ blink::mojom::StorageType type,
GetUsageCallback callback) override;
- void GetOriginsForType(StorageType type,
+ void GetOriginsForType(blink::mojom::StorageType type,
GetOriginsCallback callback) override;
- void GetOriginsForHost(StorageType type,
+ void GetOriginsForHost(blink::mojom::StorageType type,
const std::string& host,
GetOriginsCallback callback) override;
void DeleteOriginData(const url::Origin& origin,
- StorageType type,
+ blink::mojom::StorageType type,
DeletionCallback callback) override;
void PerformStorageCleanup(blink::mojom::StorageType type,
base::OnceClosure callback) override;
- bool DoesSupport(StorageType type) const override;
+ bool DoesSupport(blink::mojom::StorageType type) const override;
private:
~MockStorageClient() override;
void RunGetOriginUsage(const url::Origin& origin,
- StorageType type,
+ blink::mojom::StorageType type,
GetUsageCallback callback);
- void RunGetOriginsForType(StorageType type, GetOriginsCallback callback);
- void RunGetOriginsForHost(StorageType type,
+ void RunGetOriginsForType(blink::mojom::StorageType type,
+ GetOriginsCallback callback);
+ void RunGetOriginsForHost(blink::mojom::StorageType type,
const std::string& host,
GetOriginsCallback callback);
void RunDeleteOriginData(const url::Origin& origin,
- StorageType type,
+ blink::mojom::StorageType type,
DeletionCallback callback);
void Populate(const MockOriginData* mock_data, size_t mock_data_size);
@@ -95,8 +91,9 @@
const scoped_refptr<QuotaManagerProxy> quota_manager_proxy_;
const ID id_;
- std::map<std::pair<url::Origin, StorageType>, int64_t> origin_data_;
- std::set<std::pair<url::Origin, StorageType>> error_origins_;
+ std::map<std::pair<url::Origin, blink::mojom::StorageType>, int64_t>
+ origin_data_;
+ std::set<std::pair<url::Origin, blink::mojom::StorageType>> error_origins_;
int mock_time_counter_;
@@ -105,6 +102,6 @@
DISALLOW_COPY_AND_ASSIGN(MockStorageClient);
};
-} // namespace content
+} // namespace storage
-#endif // CONTENT_PUBLIC_TEST_MOCK_STORAGE_CLIENT_H_
+#endif // STORAGE_BROWSER_TEST_MOCK_STORAGE_CLIENT_H_
diff --git a/storage/browser/test/sandbox_database_test_helper.cc b/storage/browser/test/sandbox_database_test_helper.cc
index 4c2f80b0..6313879 100644
--- a/storage/browser/test/sandbox_database_test_helper.cc
+++ b/storage/browser/test/sandbox_database_test_helper.cc
@@ -18,9 +18,7 @@
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/leveldatabase/leveldb_chrome.h"
-using storage::FilePathToString;
-
-namespace content {
+namespace storage {
void CorruptDatabase(const base::FilePath& db_path,
leveldb::FileType type,
@@ -94,4 +92,4 @@
}
}
-} // namespace content
+} // namespace storage
diff --git a/storage/browser/test/sandbox_database_test_helper.h b/storage/browser/test/sandbox_database_test_helper.h
index 05ac226..573d000b 100644
--- a/storage/browser/test/sandbox_database_test_helper.h
+++ b/storage/browser/test/sandbox_database_test_helper.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CONTENT_BROWSER_FILEAPI_SANDBOX_DATABASE_TEST_HELPER_H_
-#define CONTENT_BROWSER_FILEAPI_SANDBOX_DATABASE_TEST_HELPER_H_
+#ifndef STORAGE_BROWSER_TEST_SANDBOX_DATABASE_TEST_HELPER_H_
+#define STORAGE_BROWSER_TEST_SANDBOX_DATABASE_TEST_HELPER_H_
#include <stddef.h>
@@ -13,7 +13,7 @@
class FilePath;
}
-namespace content {
+namespace storage {
void CorruptDatabase(const base::FilePath& db_path,
leveldb::FileType type,
@@ -23,6 +23,6 @@
void DeleteDatabaseFile(const base::FilePath& db_path,
leveldb::FileType type);
-} // namespace content
+} // namespace storage
-#endif // CONTENT_BROWSER_FILEAPI_SANDBOX_DATABASE_TEST_HELPER_H_
+#endif // STORAGE_BROWSER_TEST_SANDBOX_DATABASE_TEST_HELPER_H_
diff --git a/storage/browser/test/sandbox_file_system_test_helper.cc b/storage/browser/test/sandbox_file_system_test_helper.cc
index 204908b..f88848f 100644
--- a/storage/browser/test/sandbox_file_system_test_helper.cc
+++ b/storage/browser/test/sandbox_file_system_test_helper.cc
@@ -22,21 +22,16 @@
#include "storage/common/file_system/file_system_util.h"
#include "url/gurl.h"
-using storage::FileSystemContext;
-using storage::FileSystemOperationContext;
-using storage::FileSystemOperationRunner;
-using storage::FileSystemURL;
-
-namespace content {
+namespace storage {
SandboxFileSystemTestHelper::SandboxFileSystemTestHelper(
const url::Origin& origin,
- storage::FileSystemType type)
+ FileSystemType type)
: origin_(origin), type_(type), file_util_(nullptr) {}
SandboxFileSystemTestHelper::SandboxFileSystemTestHelper()
: origin_(url::Origin::Create(GURL("http://foo.com"))),
- type_(storage::kFileSystemTypeTemporary),
+ type_(kFileSystemTypeTemporary),
file_util_(nullptr) {}
SandboxFileSystemTestHelper::~SandboxFileSystemTestHelper() = default;
@@ -54,7 +49,7 @@
void SandboxFileSystemTestHelper::SetUp(
const base::FilePath& base_dir,
- storage::QuotaManagerProxy* quota_manager_proxy) {
+ QuotaManagerProxy* quota_manager_proxy) {
file_system_context_ =
CreateFileSystemContextForTesting(quota_manager_proxy, base_dir);
@@ -108,7 +103,7 @@
int64_t size =
file_util_delegate()->ComputeDirectorySize(GetOriginRootPath());
if (file_util_delegate()->PathExists(GetUsageCachePath()))
- size -= storage::FileSystemUsageCache::kUsageFileSize;
+ size -= FileSystemUsageCache::kUsageFileSize;
return size;
}
@@ -132,23 +127,22 @@
}
void SandboxFileSystemTestHelper::AddFileChangeObserver(
- storage::FileChangeObserver* observer) {
+ FileChangeObserver* observer) {
file_system_context_->sandbox_delegate()->AddFileChangeObserver(
type_, observer, nullptr);
}
void SandboxFileSystemTestHelper::AddFileUpdateObserver(
- storage::FileUpdateObserver* observer) {
+ FileUpdateObserver* observer) {
file_system_context_->sandbox_delegate()->AddFileUpdateObserver(
type_, observer, nullptr);
}
-storage::FileSystemUsageCache* SandboxFileSystemTestHelper::usage_cache() {
+FileSystemUsageCache* SandboxFileSystemTestHelper::usage_cache() {
return file_system_context()->sandbox_delegate()->usage_cache();
}
-storage::ObfuscatedFileUtilDelegate*
-SandboxFileSystemTestHelper::file_util_delegate() {
+ObfuscatedFileUtilDelegate* SandboxFileSystemTestHelper::file_util_delegate() {
return file_system_context_->sandbox_delegate()
->obfuscated_file_util()
->delegate();
@@ -170,4 +164,4 @@
usage_cache()->UpdateUsage(usage_cache_path, 0);
}
-} // namespace content
+} // namespace storage
diff --git a/storage/browser/test/sandbox_file_system_test_helper.h b/storage/browser/test/sandbox_file_system_test_helper.h
index d8e0b94..abf91be 100644
--- a/storage/browser/test/sandbox_file_system_test_helper.h
+++ b/storage/browser/test/sandbox_file_system_test_helper.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CONTENT_PUBLIC_TEST_SANDBOX_FILE_SYSTEM_TEST_HELPER_H_
-#define CONTENT_PUBLIC_TEST_SANDBOX_FILE_SYSTEM_TEST_HELPER_H_
+#ifndef STORAGE_BROWSER_TEST_SANDBOX_FILE_SYSTEM_TEST_HELPER_H_
+#define STORAGE_BROWSER_TEST_SANDBOX_FILE_SYSTEM_TEST_HELPER_H_
#include <stdint.h>
@@ -35,15 +35,14 @@
class Origin;
}
-namespace content {
+namespace storage {
// Filesystem test helper class that encapsulates test environment for
// a given {origin, type} pair. This helper only works for sandboxed
// file systems (Temporary or Persistent).
class SandboxFileSystemTestHelper {
public:
- SandboxFileSystemTestHelper(const url::Origin& origin,
- storage::FileSystemType type);
+ SandboxFileSystemTestHelper(const url::Origin& origin, FileSystemType type);
SandboxFileSystemTestHelper();
~SandboxFileSystemTestHelper();
@@ -52,9 +51,9 @@
// a single base directory, they have to share a context, so that they don't
// have multiple databases fighting over the lock to the origin directory
// [deep down inside ObfuscatedFileUtil].
- void SetUp(storage::FileSystemContext* file_system_context);
+ void SetUp(FileSystemContext* file_system_context);
void SetUp(const base::FilePath& base_dir,
- storage::QuotaManagerProxy* quota_manager_proxy);
+ QuotaManagerProxy* quota_manager_proxy);
void TearDown();
base::FilePath GetOriginRootPath();
@@ -64,8 +63,8 @@
// Returns empty path if filesystem type is neither temporary nor persistent.
base::FilePath GetUsageCachePath() const;
- storage::FileSystemURL CreateURL(const base::FilePath& path) const;
- storage::FileSystemURL CreateURLFromUTF8(const std::string& utf8) const {
+ FileSystemURL CreateURL(const base::FilePath& path) const;
+ FileSystemURL CreateURLFromUTF8(const std::string& utf8) const {
return CreateURL(base::FilePath::FromUTF8Unsafe(utf8));
}
@@ -77,36 +76,36 @@
int64_t ComputeCurrentDirectoryDatabaseUsage();
- storage::FileSystemOperationRunner* operation_runner();
- storage::FileSystemOperationContext* NewOperationContext();
+ FileSystemOperationRunner* operation_runner();
+ FileSystemOperationContext* NewOperationContext();
- void AddFileChangeObserver(storage::FileChangeObserver* observer);
- void AddFileUpdateObserver(storage::FileUpdateObserver* observer);
+ void AddFileChangeObserver(FileChangeObserver* observer);
+ void AddFileUpdateObserver(FileUpdateObserver* observer);
- storage::FileSystemContext* file_system_context() const {
+ FileSystemContext* file_system_context() const {
return file_system_context_.get();
}
const url::Origin& origin() const { return origin_; }
- storage::FileSystemType type() const { return type_; }
+ FileSystemType type() const { return type_; }
blink::mojom::StorageType storage_type() const {
- return storage::FileSystemTypeToQuotaStorageType(type_);
+ return FileSystemTypeToQuotaStorageType(type_);
}
- storage::FileSystemFileUtil* file_util() const { return file_util_; }
- storage::FileSystemUsageCache* usage_cache();
+ FileSystemFileUtil* file_util() const { return file_util_; }
+ FileSystemUsageCache* usage_cache();
- storage::ObfuscatedFileUtilDelegate* file_util_delegate();
+ ObfuscatedFileUtilDelegate* file_util_delegate();
private:
void SetUpFileSystem();
- scoped_refptr<storage::FileSystemContext> file_system_context_;
+ scoped_refptr<FileSystemContext> file_system_context_;
const url::Origin origin_;
- const storage::FileSystemType type_;
- storage::FileSystemFileUtil* file_util_;
+ const FileSystemType type_;
+ FileSystemFileUtil* file_util_;
};
-} // namespace content
+} // namespace storage
-#endif // CONTENT_PUBLIC_TEST_SANDBOX_FILE_SYSTEM_TEST_HELPER_H_
+#endif // STORAGE_BROWSER_TEST_SANDBOX_FILE_SYSTEM_TEST_HELPER_H_
diff --git a/storage/browser/test/test_file_system_backend.cc b/storage/browser/test/test_file_system_backend.cc
index e23e73f..29da05f 100644
--- a/storage/browser/test/test_file_system_backend.cc
+++ b/storage/browser/test/test_file_system_backend.cc
@@ -29,17 +29,12 @@
#include "storage/browser/quota/quota_manager.h"
#include "storage/common/file_system/file_system_util.h"
-using storage::FileSystemContext;
-using storage::FileSystemOperation;
-using storage::FileSystemOperationContext;
-using storage::FileSystemURL;
-
-namespace content {
+namespace storage {
namespace {
-// Stub implementation of storage::LocalFileUtil.
-class TestFileUtil : public storage::LocalFileUtil {
+// Stub implementation of LocalFileUtil.
+class TestFileUtil : public LocalFileUtil {
public:
explicit TestFileUtil(const base::FilePath& base_path)
: base_path_(base_path) {}
@@ -60,8 +55,8 @@
} // namespace
// This only supports single origin.
-class TestFileSystemBackend::QuotaUtil : public storage::FileSystemQuotaUtil,
- public storage::FileUpdateObserver {
+class TestFileSystemBackend::QuotaUtil : public FileSystemQuotaUtil,
+ public FileUpdateObserver {
public:
QuotaUtil() : usage_(0) {}
~QuotaUtil() override = default;
@@ -69,41 +64,38 @@
// FileSystemQuotaUtil overrides.
base::File::Error DeleteOriginDataOnFileTaskRunner(
FileSystemContext* context,
- storage::QuotaManagerProxy* proxy,
+ QuotaManagerProxy* proxy,
const GURL& origin_url,
- storage::FileSystemType type) override {
+ FileSystemType type) override {
NOTREACHED();
return base::File::FILE_OK;
}
- void PerformStorageCleanupOnFileTaskRunner(
- FileSystemContext* context,
- storage::QuotaManagerProxy* proxy,
- storage::FileSystemType type) override {}
+ void PerformStorageCleanupOnFileTaskRunner(FileSystemContext* context,
+ QuotaManagerProxy* proxy,
+ FileSystemType type) override {}
- scoped_refptr<storage::QuotaReservation>
- CreateQuotaReservationOnFileTaskRunner(
+ scoped_refptr<QuotaReservation> CreateQuotaReservationOnFileTaskRunner(
const url::Origin& origin,
- storage::FileSystemType type) override {
+ FileSystemType type) override {
NOTREACHED();
- return scoped_refptr<storage::QuotaReservation>();
+ return scoped_refptr<QuotaReservation>();
}
- void GetOriginsForTypeOnFileTaskRunner(storage::FileSystemType type,
+ void GetOriginsForTypeOnFileTaskRunner(FileSystemType type,
std::set<GURL>* origins) override {
NOTREACHED();
}
- void GetOriginsForHostOnFileTaskRunner(storage::FileSystemType type,
+ void GetOriginsForHostOnFileTaskRunner(FileSystemType type,
const std::string& host,
std::set<GURL>* origins) override {
NOTREACHED();
}
- int64_t GetOriginUsageOnFileTaskRunner(
- FileSystemContext* context,
- const url::Origin& origin,
- storage::FileSystemType type) override {
+ int64_t GetOriginUsageOnFileTaskRunner(FileSystemContext* context,
+ const url::Origin& origin,
+ FileSystemType type) override {
return usage_;
}
@@ -125,8 +117,8 @@
: base_path_(base_path),
task_runner_(task_runner),
file_util_(
- new storage::AsyncFileUtilAdapter(new TestFileUtil(base_path))),
- quota_util_(new QuotaUtil),
+ std::make_unique<AsyncFileUtilAdapter>(new TestFileUtil(base_path))),
+ quota_util_(std::make_unique<QuotaUtil>()),
require_copy_or_move_validator_(false) {
update_observers_ =
update_observers_.AddObserver(quota_util_.get(), task_runner_.get());
@@ -134,14 +126,14 @@
TestFileSystemBackend::~TestFileSystemBackend() = default;
-bool TestFileSystemBackend::CanHandleType(storage::FileSystemType type) const {
- return (type == storage::kFileSystemTypeTest);
+bool TestFileSystemBackend::CanHandleType(FileSystemType type) const {
+ return (type == kFileSystemTypeTest);
}
void TestFileSystemBackend::Initialize(FileSystemContext* context) {}
void TestFileSystemBackend::ResolveURL(const FileSystemURL& url,
- storage::OpenFileSystemMode mode,
+ OpenFileSystemMode mode,
OpenFileSystemCallback callback) {
std::move(callback).Run(
GetFileSystemRootURI(url.origin().GetURL(), url.type()),
@@ -149,19 +141,17 @@
base::File::FILE_OK);
}
-storage::AsyncFileUtil* TestFileSystemBackend::GetAsyncFileUtil(
- storage::FileSystemType type) {
+AsyncFileUtil* TestFileSystemBackend::GetAsyncFileUtil(FileSystemType type) {
return file_util_.get();
}
-storage::WatcherManager* TestFileSystemBackend::GetWatcherManager(
- storage::FileSystemType type) {
+WatcherManager* TestFileSystemBackend::GetWatcherManager(FileSystemType type) {
return nullptr;
}
-storage::CopyOrMoveFileValidatorFactory*
+CopyOrMoveFileValidatorFactory*
TestFileSystemBackend::GetCopyOrMoveFileValidatorFactory(
- storage::FileSystemType type,
+ FileSystemType type,
base::File::Error* error_code) {
DCHECK(error_code);
*error_code = base::File::FILE_OK;
@@ -174,7 +164,7 @@
}
void TestFileSystemBackend::InitializeCopyOrMoveFileValidatorFactory(
- std::unique_ptr<storage::CopyOrMoveFileValidatorFactory> factory) {
+ std::unique_ptr<CopyOrMoveFileValidatorFactory> factory) {
if (!copy_or_move_file_validator_factory_)
copy_or_move_file_validator_factory_ = std::move(factory);
}
@@ -191,60 +181,56 @@
std::move(operation_context));
}
-bool TestFileSystemBackend::SupportsStreaming(
- const storage::FileSystemURL& url) const {
+bool TestFileSystemBackend::SupportsStreaming(const FileSystemURL& url) const {
return false;
}
bool TestFileSystemBackend::HasInplaceCopyImplementation(
- storage::FileSystemType type) const {
+ FileSystemType type) const {
return true;
}
-std::unique_ptr<storage::FileStreamReader>
-TestFileSystemBackend::CreateFileStreamReader(
+std::unique_ptr<FileStreamReader> TestFileSystemBackend::CreateFileStreamReader(
const FileSystemURL& url,
int64_t offset,
int64_t max_bytes_to_read,
const base::Time& expected_modification_time,
FileSystemContext* context) const {
- return storage::FileStreamReader::CreateForFileSystemFile(
- context, url, offset, expected_modification_time);
+ return FileStreamReader::CreateForFileSystemFile(context, url, offset,
+ expected_modification_time);
}
-std::unique_ptr<storage::FileStreamWriter>
-TestFileSystemBackend::CreateFileStreamWriter(
+std::unique_ptr<FileStreamWriter> TestFileSystemBackend::CreateFileStreamWriter(
const FileSystemURL& url,
int64_t offset,
FileSystemContext* context) const {
- return std::unique_ptr<storage::FileStreamWriter>(
- new storage::SandboxFileStreamWriter(context, url, offset,
- *GetUpdateObservers(url.type())));
+ return std::make_unique<SandboxFileStreamWriter>(
+ context, url, offset, *GetUpdateObservers(url.type()));
}
-storage::FileSystemQuotaUtil* TestFileSystemBackend::GetQuotaUtil() {
+FileSystemQuotaUtil* TestFileSystemBackend::GetQuotaUtil() {
return quota_util_.get();
}
-const storage::UpdateObserverList* TestFileSystemBackend::GetUpdateObservers(
- storage::FileSystemType type) const {
+const UpdateObserverList* TestFileSystemBackend::GetUpdateObservers(
+ FileSystemType type) const {
return &update_observers_;
}
-const storage::ChangeObserverList* TestFileSystemBackend::GetChangeObservers(
- storage::FileSystemType type) const {
+const ChangeObserverList* TestFileSystemBackend::GetChangeObservers(
+ FileSystemType type) const {
return &change_observers_;
}
-const storage::AccessObserverList* TestFileSystemBackend::GetAccessObservers(
- storage::FileSystemType type) const {
+const AccessObserverList* TestFileSystemBackend::GetAccessObservers(
+ FileSystemType type) const {
return nullptr;
}
void TestFileSystemBackend::AddFileChangeObserver(
- storage::FileChangeObserver* observer) {
+ FileChangeObserver* observer) {
change_observers_ =
change_observers_.AddObserver(observer, task_runner_.get());
}
-} // namespace content
+} // namespace storage
diff --git a/storage/browser/test/test_file_system_backend.h b/storage/browser/test/test_file_system_backend.h
index e370218a..b102441 100644
--- a/storage/browser/test/test_file_system_backend.h
+++ b/storage/browser/test/test_file_system_backend.h
@@ -25,61 +25,58 @@
class FileSystemQuotaUtil;
}
-namespace content {
+namespace storage {
// This should be only used for testing.
// This file system backend uses LocalFileUtil and stores data file
// under the given directory.
-class TestFileSystemBackend : public storage::FileSystemBackend {
+class TestFileSystemBackend : public FileSystemBackend {
public:
TestFileSystemBackend(base::SequencedTaskRunner* task_runner,
const base::FilePath& base_path);
~TestFileSystemBackend() override;
// FileSystemBackend implementation.
- bool CanHandleType(storage::FileSystemType type) const override;
- void Initialize(storage::FileSystemContext* context) override;
- void ResolveURL(const storage::FileSystemURL& url,
- storage::OpenFileSystemMode mode,
+ bool CanHandleType(FileSystemType type) const override;
+ void Initialize(FileSystemContext* context) override;
+ void ResolveURL(const FileSystemURL& url,
+ OpenFileSystemMode mode,
OpenFileSystemCallback callback) override;
- storage::AsyncFileUtil* GetAsyncFileUtil(
- storage::FileSystemType type) override;
- storage::WatcherManager* GetWatcherManager(
- storage::FileSystemType type) override;
- storage::CopyOrMoveFileValidatorFactory* GetCopyOrMoveFileValidatorFactory(
- storage::FileSystemType type,
+ AsyncFileUtil* GetAsyncFileUtil(FileSystemType type) override;
+ WatcherManager* GetWatcherManager(FileSystemType type) override;
+ CopyOrMoveFileValidatorFactory* GetCopyOrMoveFileValidatorFactory(
+ FileSystemType type,
base::File::Error* error_code) override;
- storage::FileSystemOperation* CreateFileSystemOperation(
- const storage::FileSystemURL& url,
- storage::FileSystemContext* context,
+ FileSystemOperation* CreateFileSystemOperation(
+ const FileSystemURL& url,
+ FileSystemContext* context,
base::File::Error* error_code) const override;
- bool SupportsStreaming(const storage::FileSystemURL& url) const override;
- bool HasInplaceCopyImplementation(
- storage::FileSystemType type) const override;
- std::unique_ptr<storage::FileStreamReader> CreateFileStreamReader(
- const storage::FileSystemURL& url,
+ bool SupportsStreaming(const FileSystemURL& url) const override;
+ bool HasInplaceCopyImplementation(FileSystemType type) const override;
+ std::unique_ptr<FileStreamReader> CreateFileStreamReader(
+ const FileSystemURL& url,
int64_t offset,
int64_t max_bytes_to_read,
const base::Time& expected_modification_time,
- storage::FileSystemContext* context) const override;
- std::unique_ptr<storage::FileStreamWriter> CreateFileStreamWriter(
- const storage::FileSystemURL& url,
+ FileSystemContext* context) const override;
+ std::unique_ptr<FileStreamWriter> CreateFileStreamWriter(
+ const FileSystemURL& url,
int64_t offset,
- storage::FileSystemContext* context) const override;
- storage::FileSystemQuotaUtil* GetQuotaUtil() override;
- const storage::UpdateObserverList* GetUpdateObservers(
- storage::FileSystemType type) const override;
- const storage::ChangeObserverList* GetChangeObservers(
- storage::FileSystemType type) const override;
- const storage::AccessObserverList* GetAccessObservers(
- storage::FileSystemType type) const override;
+ FileSystemContext* context) const override;
+ FileSystemQuotaUtil* GetQuotaUtil() override;
+ const UpdateObserverList* GetUpdateObservers(
+ FileSystemType type) const override;
+ const ChangeObserverList* GetChangeObservers(
+ FileSystemType type) const override;
+ const AccessObserverList* GetAccessObservers(
+ FileSystemType type) const override;
// Initialize the CopyOrMoveFileValidatorFactory. Invalid to call more than
// once.
void InitializeCopyOrMoveFileValidatorFactory(
- std::unique_ptr<storage::CopyOrMoveFileValidatorFactory> factory);
+ std::unique_ptr<CopyOrMoveFileValidatorFactory> factory);
- void AddFileChangeObserver(storage::FileChangeObserver* observer);
+ void AddFileChangeObserver(FileChangeObserver* observer);
// For CopyOrMoveFileValidatorFactory testing. Once it's set to true
// GetCopyOrMoveFileValidatorFactory will start returning security
@@ -93,18 +90,18 @@
base::FilePath base_path_;
scoped_refptr<base::SequencedTaskRunner> task_runner_;
- std::unique_ptr<storage::AsyncFileUtilAdapter> file_util_;
+ std::unique_ptr<AsyncFileUtilAdapter> file_util_;
std::unique_ptr<QuotaUtil> quota_util_;
- storage::UpdateObserverList update_observers_;
- storage::ChangeObserverList change_observers_;
+ UpdateObserverList update_observers_;
+ ChangeObserverList change_observers_;
bool require_copy_or_move_validator_;
- std::unique_ptr<storage::CopyOrMoveFileValidatorFactory>
+ std::unique_ptr<CopyOrMoveFileValidatorFactory>
copy_or_move_file_validator_factory_;
DISALLOW_COPY_AND_ASSIGN(TestFileSystemBackend);
};
-} // namespace content
+} // namespace storage
#endif // STORAGE_BROWSER_TEST_TEST_FILE_SYSTEM_BACKEND_H_
diff --git a/storage/browser/test/test_file_system_context.cc b/storage/browser/test/test_file_system_context.cc
index 796b2fe..c861028e1 100644
--- a/storage/browser/test/test_file_system_context.cc
+++ b/storage/browser/test/test_file_system_context.cc
@@ -6,6 +6,7 @@
#include <memory>
#include <utility>
+#include <vector>
#include "base/threading/thread_task_runner_handle.h"
#include "storage/browser/file_system/external_mount_points.h"
@@ -15,12 +16,12 @@
#include "storage/browser/test/test_file_system_backend.h"
#include "storage/browser/test/test_file_system_options.h"
-namespace content {
+namespace storage {
-storage::FileSystemContext* CreateFileSystemContextForTesting(
- storage::QuotaManagerProxy* quota_manager_proxy,
+FileSystemContext* CreateFileSystemContextForTesting(
+ QuotaManagerProxy* quota_manager_proxy,
const base::FilePath& base_path) {
- std::vector<std::unique_ptr<storage::FileSystemBackend>> additional_providers;
+ std::vector<std::unique_ptr<FileSystemBackend>> additional_providers;
additional_providers.push_back(std::make_unique<TestFileSystemBackend>(
base::ThreadTaskRunnerHandle::Get().get(), base_path));
return CreateFileSystemContextWithAdditionalProvidersForTesting(
@@ -29,65 +30,61 @@
std::move(additional_providers), base_path);
}
-storage::FileSystemContext*
-CreateFileSystemContextWithAdditionalProvidersForTesting(
+FileSystemContext* CreateFileSystemContextWithAdditionalProvidersForTesting(
scoped_refptr<base::SingleThreadTaskRunner> io_task_runner,
scoped_refptr<base::SequencedTaskRunner> file_task_runner,
- storage::QuotaManagerProxy* quota_manager_proxy,
- std::vector<std::unique_ptr<storage::FileSystemBackend>>
- additional_providers,
+ QuotaManagerProxy* quota_manager_proxy,
+ std::vector<std::unique_ptr<FileSystemBackend>> additional_providers,
const base::FilePath& base_path) {
- return new storage::FileSystemContext(
+ return new FileSystemContext(
io_task_runner.get(), file_task_runner.get(),
- storage::ExternalMountPoints::CreateRefCounted().get(),
+ ExternalMountPoints::CreateRefCounted().get(),
base::MakeRefCounted<MockSpecialStoragePolicy>().get(),
quota_manager_proxy, std::move(additional_providers),
- std::vector<storage::URLRequestAutoMountHandler>(), base_path,
+ std::vector<URLRequestAutoMountHandler>(), base_path,
CreateAllowFileAccessOptions());
}
-storage::FileSystemContext* CreateFileSystemContextWithAutoMountersForTesting(
+FileSystemContext* CreateFileSystemContextWithAutoMountersForTesting(
scoped_refptr<base::SingleThreadTaskRunner> io_task_runner,
scoped_refptr<base::SequencedTaskRunner> file_task_runner,
- storage::QuotaManagerProxy* quota_manager_proxy,
- std::vector<std::unique_ptr<storage::FileSystemBackend>>
- additional_providers,
- const std::vector<storage::URLRequestAutoMountHandler>& auto_mounters,
+ QuotaManagerProxy* quota_manager_proxy,
+ std::vector<std::unique_ptr<FileSystemBackend>> additional_providers,
+ const std::vector<URLRequestAutoMountHandler>& auto_mounters,
const base::FilePath& base_path) {
- return new storage::FileSystemContext(
+ return new FileSystemContext(
io_task_runner.get(), file_task_runner.get(),
- storage::ExternalMountPoints::CreateRefCounted().get(),
+ ExternalMountPoints::CreateRefCounted().get(),
base::MakeRefCounted<MockSpecialStoragePolicy>().get(),
quota_manager_proxy, std::move(additional_providers), auto_mounters,
base_path, CreateAllowFileAccessOptions());
}
-storage::FileSystemContext* CreateIncognitoFileSystemContextForTesting(
+FileSystemContext* CreateIncognitoFileSystemContextForTesting(
scoped_refptr<base::SingleThreadTaskRunner> io_task_runner,
scoped_refptr<base::SequencedTaskRunner> file_task_runner,
- storage::QuotaManagerProxy* quota_manager_proxy,
+ QuotaManagerProxy* quota_manager_proxy,
const base::FilePath& base_path) {
- std::vector<std::unique_ptr<storage::FileSystemBackend>> additional_providers;
+ std::vector<std::unique_ptr<FileSystemBackend>> additional_providers;
return CreateIncognitoFileSystemContextWithAdditionalProvidersForTesting(
io_task_runner, file_task_runner, quota_manager_proxy,
std::move(additional_providers), base_path);
}
-storage::FileSystemContext*
+FileSystemContext*
CreateIncognitoFileSystemContextWithAdditionalProvidersForTesting(
scoped_refptr<base::SingleThreadTaskRunner> io_task_runner,
scoped_refptr<base::SequencedTaskRunner> file_task_runner,
- storage::QuotaManagerProxy* quota_manager_proxy,
- std::vector<std::unique_ptr<storage::FileSystemBackend>>
- additional_providers,
+ QuotaManagerProxy* quota_manager_proxy,
+ std::vector<std::unique_ptr<FileSystemBackend>> additional_providers,
const base::FilePath& base_path) {
- return new storage::FileSystemContext(
+ return new FileSystemContext(
io_task_runner.get(), file_task_runner.get(),
- storage::ExternalMountPoints::CreateRefCounted().get(),
+ ExternalMountPoints::CreateRefCounted().get(),
base::MakeRefCounted<MockSpecialStoragePolicy>().get(),
quota_manager_proxy, std::move(additional_providers),
- std::vector<storage::URLRequestAutoMountHandler>(), base_path,
+ std::vector<URLRequestAutoMountHandler>(), base_path,
CreateIncognitoFileSystemOptions());
}
-} // namespace content
+} // namespace storage
diff --git a/storage/browser/test/test_file_system_context.h b/storage/browser/test/test_file_system_context.h
index 0d9b58c..573cb26 100644
--- a/storage/browser/test/test_file_system_context.h
+++ b/storage/browser/test/test_file_system_context.h
@@ -5,6 +5,9 @@
#ifndef STORAGE_BROWSER_TEST_TEST_FILE_SYSTEM_CONTEXT_H_
#define STORAGE_BROWSER_TEST_TEST_FILE_SYSTEM_CONTEXT_H_
+#include <memory>
+#include <vector>
+
#include "base/files/file_path.h"
#include "base/single_thread_task_runner.h"
#include "storage/browser/file_system/file_system_context.h"
@@ -17,46 +20,42 @@
class FileSystemBackend;
}
-namespace content {
+namespace storage {
-storage::FileSystemContext* CreateFileSystemContextForTesting(
- storage::QuotaManagerProxy* quota_manager_proxy,
+FileSystemContext* CreateFileSystemContextForTesting(
+ QuotaManagerProxy* quota_manager_proxy,
const base::FilePath& base_path);
// The caller is responsible for including TestFileSystemBackend in
// |additional_providers| if needed.
-storage::FileSystemContext*
-CreateFileSystemContextWithAdditionalProvidersForTesting(
+FileSystemContext* CreateFileSystemContextWithAdditionalProvidersForTesting(
scoped_refptr<base::SingleThreadTaskRunner> io_task_runner,
scoped_refptr<base::SequencedTaskRunner> file_task_runner,
- storage::QuotaManagerProxy* quota_manager_proxy,
- std::vector<std::unique_ptr<storage::FileSystemBackend>>
- additional_providers,
+ QuotaManagerProxy* quota_manager_proxy,
+ std::vector<std::unique_ptr<FileSystemBackend>> additional_providers,
const base::FilePath& base_path);
-storage::FileSystemContext* CreateFileSystemContextWithAutoMountersForTesting(
+FileSystemContext* CreateFileSystemContextWithAutoMountersForTesting(
scoped_refptr<base::SingleThreadTaskRunner> io_task_runner,
scoped_refptr<base::SequencedTaskRunner> file_task_runner,
- storage::QuotaManagerProxy* quota_manager_proxy,
- std::vector<std::unique_ptr<storage::FileSystemBackend>>
- additional_providers,
- const std::vector<storage::URLRequestAutoMountHandler>& auto_mounters,
+ QuotaManagerProxy* quota_manager_proxy,
+ std::vector<std::unique_ptr<FileSystemBackend>> additional_providers,
+ const std::vector<URLRequestAutoMountHandler>& auto_mounters,
const base::FilePath& base_path);
-storage::FileSystemContext* CreateIncognitoFileSystemContextForTesting(
+FileSystemContext* CreateIncognitoFileSystemContextForTesting(
scoped_refptr<base::SingleThreadTaskRunner> io_task_runner,
scoped_refptr<base::SequencedTaskRunner> file_task_runner,
- storage::QuotaManagerProxy* quota_manager_proxy,
+ QuotaManagerProxy* quota_manager_proxy,
const base::FilePath& base_path);
-storage::FileSystemContext*
+FileSystemContext*
CreateIncognitoFileSystemContextWithAdditionalProvidersForTesting(
scoped_refptr<base::SingleThreadTaskRunner> io_task_runner,
scoped_refptr<base::SequencedTaskRunner> file_task_runner,
- storage::QuotaManagerProxy* quota_manager_proxy,
- std::vector<std::unique_ptr<storage::FileSystemBackend>>
- additional_providers,
+ QuotaManagerProxy* quota_manager_proxy,
+ std::vector<std::unique_ptr<FileSystemBackend>> additional_providers,
const base::FilePath& base_path);
-} // namespace content
+} // namespace storage
#endif // STORAGE_BROWSER_TEST_TEST_FILE_SYSTEM_CONTEXT_H_
diff --git a/storage/browser/test/test_file_system_options.cc b/storage/browser/test/test_file_system_options.cc
index 809c8cf9..23ca1782 100644
--- a/storage/browser/test/test_file_system_options.cc
+++ b/storage/browser/test/test_file_system_options.cc
@@ -3,14 +3,13 @@
// found in the LICENSE file.
#include "storage/browser/test/test_file_system_options.h"
-#include "build/build_config.h"
#include <string>
#include <vector>
-using storage::FileSystemOptions;
+#include "build/build_config.h"
-namespace content {
+namespace storage {
FileSystemOptions CreateIncognitoFileSystemOptions() {
std::vector<std::string> additional_allowed_schemes;
@@ -43,4 +42,4 @@
additional_allowed_schemes);
}
-} // namespace content
+} // namespace storage
diff --git a/storage/browser/test/test_file_system_options.h b/storage/browser/test/test_file_system_options.h
index b33b5c95..c14b1ecb 100644
--- a/storage/browser/test/test_file_system_options.h
+++ b/storage/browser/test/test_file_system_options.h
@@ -7,17 +7,17 @@
#include "storage/browser/file_system/file_system_options.h"
-namespace content {
+namespace storage {
// Returns Filesystem options for incognito mode.
-storage::FileSystemOptions CreateIncognitoFileSystemOptions();
+FileSystemOptions CreateIncognitoFileSystemOptions();
// Returns Filesystem options that allow file access.
-storage::FileSystemOptions CreateAllowFileAccessOptions();
+FileSystemOptions CreateAllowFileAccessOptions();
// Returns Filesystem options that disallow file access.
-storage::FileSystemOptions CreateDisallowFileAccessOptions();
+FileSystemOptions CreateDisallowFileAccessOptions();
-} // namespace content
+} // namespace storage
#endif // STORAGE_BROWSER_TEST_TEST_FILE_SYSTEM_OPTIONS_H_