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

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

Issue 2472213003: [IndexedDB] Refactoring to remove ref ptrs and host transaction ids. (Closed)
Patch Set: rebased & working Created 4 years, 1 month 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_factory_unittest.cc
diff --git a/content/browser/indexed_db/indexed_db_factory_unittest.cc b/content/browser/indexed_db/indexed_db_factory_unittest.cc
index 24c25bf83a5b9d68b07280049d577a7f892a42c9..6e69a186b27d1bd383fda1f39d3650523a4e8e10 100644
--- a/content/browser/indexed_db/indexed_db_factory_unittest.cc
+++ b/content/browser/indexed_db/indexed_db_factory_unittest.cc
@@ -427,15 +427,21 @@ class UpgradeNeededCallbacks : public MockIndexedDBCallbacks {
void OnUpgradeNeeded(int64_t old_version,
std::unique_ptr<IndexedDBConnection> connection,
+ IndexedDBTransaction* transaction,
const content::IndexedDBDatabaseMetadata& metadata,
const IndexedDBDataLossInfo& data_loss_info) override {
+ transaction_ = transaction;
connection_ = std::move(connection);
}
+ IndexedDBTransaction* transaction() const { return transaction_; }
+
protected:
~UpgradeNeededCallbacks() override {}
private:
+ IndexedDBTransaction* transaction_ = nullptr;
+
DISALLOW_COPY_AND_ASSIGN(UpgradeNeededCallbacks);
};
@@ -469,7 +475,7 @@ TEST_F(IndexedDBFactoryTest, DatabaseFailedOpen) {
// Open at version 2, then close.
{
- scoped_refptr<MockIndexedDBCallbacks> callbacks(
+ scoped_refptr<UpgradeNeededCallbacks> callbacks(
new UpgradeNeededCallbacks());
std::unique_ptr<IndexedDBPendingConnection> connection(
base::MakeUnique<IndexedDBPendingConnection>(
@@ -483,7 +489,8 @@ TEST_F(IndexedDBFactoryTest, DatabaseFailedOpen) {
// Pump the message loop so the upgrade transaction can run.
base::RunLoop().RunUntilIdle();
EXPECT_TRUE(callbacks->connection());
- callbacks->connection()->database()->Commit(transaction_id);
+ EXPECT_NE(callbacks->transaction(), nullptr);
+ callbacks->connection()->database()->Commit(callbacks->transaction());
callbacks->connection()->Close();
EXPECT_FALSE(factory()->IsDatabaseOpen(origin, db_name));

Powered by Google App Engine
This is Rietveld 408576698