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

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

Issue 308103004: IndexedDB: Using a mock IndexedDBFactory for unit tests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Forgot to add mock_indexed_db_factory.* files in last patch set. Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/browser/indexed_db/indexed_db_database.cc
diff --git a/content/browser/indexed_db/indexed_db_database.cc b/content/browser/indexed_db/indexed_db_database.cc
index 5ba4e4839e70b7c91c417f7d538a2c43a9e62dcf..5ec8f1dfb6ac099ac75ddc2c6ec911fbde47cd9d 100644
--- a/content/browser/indexed_db/indexed_db_database.cc
+++ b/content/browser/indexed_db/indexed_db_database.cc
@@ -123,6 +123,7 @@ IndexedDBDatabase::IndexedDBDatabase(const base::string16& name,
kInvalidId),
identifier_(unique_identifier),
factory_(factory) {
+ DCHECK(factory != NULL);
}
void IndexedDBDatabase::AddObjectStore(
@@ -1360,9 +1361,6 @@ void IndexedDBDatabase::TransactionFinished(IndexedDBTransaction* transaction,
}
void IndexedDBDatabase::TransactionCommitFailed() {
- // Factory may be null in unit tests.
- if (!factory_)
- return;
factory_->HandleBackingStoreFailure(backing_store_->origin_url());
}
@@ -1656,8 +1654,7 @@ void IndexedDBDatabase::DeleteDatabaseFinal(
metadata_.int_version = IndexedDBDatabaseMetadata::NO_INT_VERSION;
metadata_.object_stores.clear();
callbacks->OnSuccess(old_version);
- if (factory_)
- factory_->DatabaseDeleted(identifier_);
+ factory_->DatabaseDeleted(identifier_);
}
void IndexedDBDatabase::ForceClose() {
@@ -1713,12 +1710,7 @@ void IndexedDBDatabase::Close(IndexedDBConnection* connection, bool forced) {
const GURL origin_url = backing_store_->origin_url();
backing_store_ = NULL;
- // factory_ should only be null in unit tests.
- // TODO(jsbell): DCHECK(factory_ || !in_unit_tests) - somehow.
- if (factory_) {
- factory_->ReleaseDatabase(identifier_, forced);
- factory_ = NULL;
- }
+ factory_->ReleaseDatabase(identifier_, forced);
}
}

Powered by Google App Engine
This is Rietveld 408576698