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

Unified Diff: content/browser/indexed_db/indexed_db_backing_store_unittest.cc

Issue 2773823002: Use a two-part data format version in IndexedDB metadata. (Closed)
Patch Set: jsbell, cmumford Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/browser/indexed_db/indexed_db_backing_store_unittest.cc
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 184e88256c14c4f8282ee34102b00dc668a10fe3..b465130cb76bcb91ebd3d1f10a2e77c644129d9e 100644
--- a/content/browser/indexed_db/indexed_db_backing_store_unittest.cc
+++ b/content/browser/indexed_db/indexed_db_backing_store_unittest.cc
@@ -30,6 +30,7 @@
#include "storage/browser/blob/blob_data_handle.h"
#include "storage/browser/quota/special_storage_policy.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/WebKit/public/platform/modules/indexeddb/WebIDBDatabaseException.h"
#include "third_party/WebKit/public/platform/modules/indexeddb/WebIDBTypes.h"
using base::ASCIIToUTF16;
@@ -81,6 +82,7 @@ class TestableIndexedDBBackingStore : public IndexedDBBackingStore {
IndexedDBFactory* indexed_db_factory,
const Origin& origin,
const base::FilePath& path_base,
+ const IndexedDBDataFormatVersion& data_format_version,
scoped_refptr<net::URLRequestContextGetter> request_context_getter,
LevelDBFactory* leveldb_factory,
base::SequencedTaskRunner* task_runner,
@@ -95,8 +97,10 @@ class TestableIndexedDBBackingStore : public IndexedDBBackingStore {
return scoped_refptr<TestableIndexedDBBackingStore>();
}
- const base::FilePath file_path = path_base.AppendASCII("test_db_path");
- const base::FilePath blob_path = path_base.AppendASCII("test_blob_path");
+ const base::FilePath file_path =
+ path_base.Append(IndexedDBContextImpl::GetLevelDBFileName(origin));
+ const base::FilePath blob_path =
+ path_base.Append(IndexedDBContextImpl::GetBlobStoreFileName(origin));
std::unique_ptr<LevelDBDatabase> db;
bool is_disk_full = false;
@@ -108,6 +112,7 @@ class TestableIndexedDBBackingStore : public IndexedDBBackingStore {
scoped_refptr<TestableIndexedDBBackingStore> backing_store(
new TestableIndexedDBBackingStore(indexed_db_factory, origin, blob_path,
+ data_format_version,
request_context_getter, std::move(db),
std::move(comparator), task_runner));
@@ -169,6 +174,7 @@ class TestableIndexedDBBackingStore : public IndexedDBBackingStore {
IndexedDBFactory* indexed_db_factory,
const Origin& origin,
const base::FilePath& blob_path,
+ const IndexedDBDataFormatVersion& data_format_version,
scoped_refptr<net::URLRequestContextGetter> request_context_getter,
std::unique_ptr<LevelDBDatabase> db,
std::unique_ptr<LevelDBComparator> comparator,
@@ -176,6 +182,7 @@ class TestableIndexedDBBackingStore : public IndexedDBBackingStore {
: IndexedDBBackingStore(indexed_db_factory,
origin,
blob_path,
+ data_format_version,
request_context_getter,
std::move(db),
std::move(comparator),
@@ -204,8 +211,8 @@ class TestIDBFactory : public IndexedDBFactoryImpl {
bool disk_full;
leveldb::Status status;
scoped_refptr<IndexedDBBackingStore> backing_store = OpenBackingStore(
- origin, context()->data_path(), url_request_context_getter,
- &data_loss_info, &disk_full, &status);
+ origin, context()->data_path(), IndexedDBDataFormatVersion(),
+ url_request_context_getter, &data_loss_info, &disk_full, &status);
scoped_refptr<TestableIndexedDBBackingStore> testable_store =
static_cast<TestableIndexedDBBackingStore*>(backing_store.get());
return testable_store;
@@ -217,6 +224,7 @@ class TestIDBFactory : public IndexedDBFactoryImpl {
scoped_refptr<IndexedDBBackingStore> OpenBackingStoreHelper(
const Origin& origin,
const base::FilePath& data_directory,
+ const IndexedDBDataFormatVersion& data_format_version,
scoped_refptr<net::URLRequestContextGetter> request_context_getter,
IndexedDBDataLossInfo* data_loss_info,
bool* disk_full,
@@ -224,8 +232,9 @@ class TestIDBFactory : public IndexedDBFactoryImpl {
leveldb::Status* status) override {
DefaultLevelDBFactory leveldb_factory;
return TestableIndexedDBBackingStore::Open(
- this, origin, data_directory, request_context_getter, &leveldb_factory,
- context()->TaskRunner(), status);
+ this, origin, data_directory, data_format_version,
+ request_context_getter, &leveldb_factory, context()->TaskRunner(),
+ status);
}
private:

Powered by Google App Engine
This is Rietveld 408576698