Commit 492f36e5 authored by Zhuoyu Qian's avatar Zhuoyu Qian Committed by Commit Bot

Replace IndexedDBContext::GetFilePathForTesting to use url::Origin instead of GURL.

As the comment left by jsbell@, replace IndexedDBContext::GetFilePathForTesting
to use url::Origin instead of GURL.

Change-Id: I50de11bbbc4b4bd582d3c7ad0031e43734c567c3
Reviewed-on: https://chromium-review.googlesource.com/c/1364992
Commit-Queue: Joshua Bell <jsbell@chromium.org>
Reviewed-by: default avatarJohn Abd-El-Malek <jam@chromium.org>
Reviewed-by: default avatarJoshua Bell <jsbell@chromium.org>
Cr-Commit-Position: refs/heads/master@{#614754}
parent 045dade4
...@@ -146,6 +146,7 @@ ...@@ -146,6 +146,7 @@
#include "testing/platform_test.h" #include "testing/platform_test.h"
#include "ui/base/l10n/l10n_util.h" #include "ui/base/l10n/l10n_util.h"
#include "url/gurl.h" #include "url/gurl.h"
#include "url/origin.h"
// The blacklist tests rely on the safe-browsing database. // The blacklist tests rely on the safe-browsing database.
#if defined(SAFE_BROWSING_DB_LOCAL) #if defined(SAFE_BROWSING_DB_LOCAL)
...@@ -4888,7 +4889,8 @@ TEST_F(ExtensionServiceTest, ClearExtensionData) { ...@@ -4888,7 +4889,8 @@ TEST_F(ExtensionServiceTest, ClearExtensionData) {
// "known" origins. // "known" origins.
IndexedDBContext* idb_context = BrowserContext::GetDefaultStoragePartition( IndexedDBContext* idb_context = BrowserContext::GetDefaultStoragePartition(
profile())->GetIndexedDBContext(); profile())->GetIndexedDBContext();
base::FilePath idb_path = idb_context->GetFilePathForTesting(ext_url); base::FilePath idb_path =
idb_context->GetFilePathForTesting(url::Origin::Create(ext_url));
EXPECT_TRUE(base::CreateDirectory(idb_path)); EXPECT_TRUE(base::CreateDirectory(idb_path));
EXPECT_TRUE(base::DirectoryExists(idb_path)); EXPECT_TRUE(base::DirectoryExists(idb_path));
idb_context->ResetCachesForTesting(); idb_context->ResetCachesForTesting();
...@@ -5031,7 +5033,8 @@ TEST_F(ExtensionServiceTest, ClearAppData) { ...@@ -5031,7 +5033,8 @@ TEST_F(ExtensionServiceTest, ClearAppData) {
// "known" origins. // "known" origins.
IndexedDBContext* idb_context = BrowserContext::GetDefaultStoragePartition( IndexedDBContext* idb_context = BrowserContext::GetDefaultStoragePartition(
profile())->GetIndexedDBContext(); profile())->GetIndexedDBContext();
base::FilePath idb_path = idb_context->GetFilePathForTesting(origin1); base::FilePath idb_path =
idb_context->GetFilePathForTesting(url::Origin::Create(origin1));
EXPECT_TRUE(base::CreateDirectory(idb_path)); EXPECT_TRUE(base::CreateDirectory(idb_path));
EXPECT_TRUE(base::DirectoryExists(idb_path)); EXPECT_TRUE(base::DirectoryExists(idb_path));
idb_context->ResetCachesForTesting(); idb_context->ResetCachesForTesting();
......
...@@ -429,12 +429,6 @@ std::vector<base::FilePath> IndexedDBContextImpl::GetStoragePaths( ...@@ -429,12 +429,6 @@ std::vector<base::FilePath> IndexedDBContextImpl::GetStoragePaths(
return paths; return paths;
} }
// TODO(jsbell): Update callers to use url::Origin overload and remove.
base::FilePath IndexedDBContextImpl::GetFilePathForTesting(
const GURL& origin_url) const {
return GetFilePathForTesting(Origin::Create(origin_url));
}
base::FilePath IndexedDBContextImpl::GetFilePathForTesting( base::FilePath IndexedDBContextImpl::GetFilePathForTesting(
const Origin& origin) const { const Origin& origin) const {
return GetLevelDBPath(origin); return GetLevelDBPath(origin);
......
...@@ -22,7 +22,6 @@ ...@@ -22,7 +22,6 @@
#include "content/public/browser/indexed_db_context.h" #include "content/public/browser/indexed_db_context.h"
#include "storage/browser/quota/quota_manager_proxy.h" #include "storage/browser/quota/quota_manager_proxy.h"
#include "storage/browser/quota/special_storage_policy.h" #include "storage/browser/quota/special_storage_policy.h"
#include "url/gurl.h"
#include "url/origin.h" #include "url/origin.h"
namespace base { namespace base {
...@@ -90,12 +89,10 @@ class CONTENT_EXPORT IndexedDBContextImpl : public IndexedDBContext { ...@@ -90,12 +89,10 @@ class CONTENT_EXPORT IndexedDBContextImpl : public IndexedDBContext {
void DeleteForOrigin(const url::Origin& origin) override; void DeleteForOrigin(const url::Origin& origin) override;
void CopyOriginData(const url::Origin& origin, void CopyOriginData(const url::Origin& origin,
IndexedDBContext* dest_context) override; IndexedDBContext* dest_context) override;
base::FilePath GetFilePathForTesting(const GURL& origin_url) const override; base::FilePath GetFilePathForTesting(
const url::Origin& origin) const override;
void ResetCachesForTesting() override; void ResetCachesForTesting() override;
// TODO(jsbell): Replace IndexedDBContext members with these.
base::FilePath GetFilePathForTesting(const url::Origin& origin) const;
// Methods called by IndexedDBDispatcherHost for quota support. // Methods called by IndexedDBDispatcherHost for quota support.
void ConnectionOpened(const url::Origin& origin, IndexedDBConnection* db); void ConnectionOpened(const url::Origin& origin, IndexedDBConnection* db);
void ConnectionClosed(const url::Origin& origin, IndexedDBConnection* db); void ConnectionClosed(const url::Origin& origin, IndexedDBConnection* db);
......
...@@ -14,8 +14,6 @@ ...@@ -14,8 +14,6 @@
#include "base/memory/ref_counted.h" #include "base/memory/ref_counted.h"
#include "content/common/content_export.h" #include "content/common/content_export.h"
class GURL;
namespace base { namespace base {
class SequencedTaskRunner; class SequencedTaskRunner;
} }
...@@ -48,7 +46,7 @@ class IndexedDBContext : public base::RefCountedThreadSafe<IndexedDBContext> { ...@@ -48,7 +46,7 @@ class IndexedDBContext : public base::RefCountedThreadSafe<IndexedDBContext> {
// Get the file name of the local storage file for the given origin. // Get the file name of the local storage file for the given origin.
virtual base::FilePath GetFilePathForTesting( virtual base::FilePath GetFilePathForTesting(
const GURL& origin_url) const = 0; const url::Origin& origin) const = 0;
// Forget the origins/sizes read from disk. // Forget the origins/sizes read from disk.
virtual void ResetCachesForTesting() = 0; virtual void ResetCachesForTesting() = 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment