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

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

Issue 2140193002: IndexedDB: Saving data loss status in IndexedDBPendingConnection. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@idb-data-loss
Patch Set: Deleted commented out code. Created 4 years, 5 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_unittest.cc
diff --git a/content/browser/indexed_db/indexed_db_database_unittest.cc b/content/browser/indexed_db/indexed_db_database_unittest.cc
index 82089c4972fdadf4800aae0250455eec022a567d..1f246b20fd26b342c0a93752664211f8cf265ba9 100644
--- a/content/browser/indexed_db/indexed_db_database_unittest.cc
+++ b/content/browser/indexed_db/indexed_db_database_unittest.cc
@@ -76,10 +76,11 @@ TEST(IndexedDBDatabaseTest, ConnectionLifecycle) {
scoped_refptr<MockIndexedDBDatabaseCallbacks> callbacks1(
new MockIndexedDBDatabaseCallbacks());
const int64_t transaction_id1 = 1;
- IndexedDBPendingConnection connection1(
- request1, callbacks1, kFakeChildProcessId, transaction_id1,
- IndexedDBDatabaseMetadata::DEFAULT_VERSION);
- db->OpenConnection(connection1);
+ std::unique_ptr<IndexedDBPendingConnection> connection1(
+ new IndexedDBPendingConnection(
+ request1, callbacks1, kFakeChildProcessId, transaction_id1,
+ IndexedDBDatabaseMetadata::DEFAULT_VERSION));
+ db->OpenConnection(std::move(connection1));
EXPECT_FALSE(backing_store->HasOneRef()); // db, connection count > 0
@@ -87,10 +88,11 @@ TEST(IndexedDBDatabaseTest, ConnectionLifecycle) {
scoped_refptr<MockIndexedDBDatabaseCallbacks> callbacks2(
new MockIndexedDBDatabaseCallbacks());
const int64_t transaction_id2 = 2;
- IndexedDBPendingConnection connection2(
- request2, callbacks2, kFakeChildProcessId, transaction_id2,
- IndexedDBDatabaseMetadata::DEFAULT_VERSION);
- db->OpenConnection(connection2);
+ std::unique_ptr<IndexedDBPendingConnection> connection2(
+ new IndexedDBPendingConnection(
+ request2, callbacks2, kFakeChildProcessId, transaction_id2,
+ IndexedDBDatabaseMetadata::DEFAULT_VERSION));
+ db->OpenConnection(std::move(connection2));
EXPECT_FALSE(backing_store->HasOneRef()); // local and connection
@@ -128,10 +130,11 @@ TEST(IndexedDBDatabaseTest, ForcedClose) {
new MockIndexedDBDatabaseCallbacks());
scoped_refptr<MockIndexedDBCallbacks> request(new MockIndexedDBCallbacks());
const int64_t upgrade_transaction_id = 3;
- IndexedDBPendingConnection connection(
- request, callbacks, kFakeChildProcessId, upgrade_transaction_id,
- IndexedDBDatabaseMetadata::DEFAULT_VERSION);
- database->OpenConnection(connection);
+ std::unique_ptr<IndexedDBPendingConnection> connection(
+ new IndexedDBPendingConnection(
+ request, callbacks, kFakeChildProcessId, upgrade_transaction_id,
+ IndexedDBDatabaseMetadata::DEFAULT_VERSION));
+ database->OpenConnection(std::move(connection));
EXPECT_EQ(database.get(), request->connection()->database());
const int64_t transaction_id = 123;
@@ -189,10 +192,11 @@ TEST(IndexedDBDatabaseTest, PendingDelete) {
scoped_refptr<MockIndexedDBDatabaseCallbacks> callbacks1(
new MockIndexedDBDatabaseCallbacks());
const int64_t transaction_id1 = 1;
- IndexedDBPendingConnection connection(
- request1, callbacks1, kFakeChildProcessId, transaction_id1,
- IndexedDBDatabaseMetadata::DEFAULT_VERSION);
- db->OpenConnection(connection);
+ std::unique_ptr<IndexedDBPendingConnection> connection(
+ new IndexedDBPendingConnection(
+ request1, callbacks1, kFakeChildProcessId, transaction_id1,
+ IndexedDBDatabaseMetadata::DEFAULT_VERSION));
+ db->OpenConnection(std::move(connection));
EXPECT_EQ(db->ConnectionCount(), 1UL);
EXPECT_EQ(db->ActiveOpenDeleteCount(), 0UL);
@@ -246,9 +250,11 @@ class IndexedDBDatabaseOperationTest : public testing::Test {
request_ = new MockIndexedDBCallbacks();
callbacks_ = new MockIndexedDBDatabaseCallbacks();
const int64_t transaction_id = 1;
- db_->OpenConnection(IndexedDBPendingConnection(
- request_, callbacks_, kFakeChildProcessId, transaction_id,
- IndexedDBDatabaseMetadata::DEFAULT_VERSION));
+ std::unique_ptr<IndexedDBPendingConnection> connection(
+ new IndexedDBPendingConnection(
+ request_, callbacks_, kFakeChildProcessId, transaction_id,
+ IndexedDBDatabaseMetadata::DEFAULT_VERSION));
+ db_->OpenConnection(std::move(connection));
EXPECT_EQ(IndexedDBDatabaseMetadata::NO_VERSION, db_->metadata().version);
connection_ = base::WrapUnique(new IndexedDBConnection(db_, callbacks_));
« no previous file with comments | « content/browser/indexed_db/indexed_db_database.cc ('k') | content/browser/indexed_db/indexed_db_dispatcher_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698