| Index: content/browser/indexed_db/indexed_db_transaction_unittest.cc
|
| diff --git a/content/browser/indexed_db/indexed_db_transaction_unittest.cc b/content/browser/indexed_db/indexed_db_transaction_unittest.cc
|
| index bcd30a2e29f481c99a855ffbcd9d1379e4046c69..e103f5a6c0011d8a0c007fa40b410618ce2f8584 100644
|
| --- a/content/browser/indexed_db/indexed_db_transaction_unittest.cc
|
| +++ b/content/browser/indexed_db/indexed_db_transaction_unittest.cc
|
| @@ -20,6 +20,7 @@
|
| #include "testing/gtest/include/gtest/gtest.h"
|
|
|
| namespace content {
|
| +const int kFakeProcessId = 10;
|
|
|
| class AbortObserver {
|
| public:
|
| @@ -90,11 +91,11 @@ TEST_F(IndexedDBTransactionTest, Timeout) {
|
| const leveldb::Status commit_success = leveldb::Status::OK();
|
| std::unique_ptr<IndexedDBConnection> connection(
|
| base::MakeUnique<IndexedDBConnection>(
|
| - db_, new MockIndexedDBDatabaseCallbacks()));
|
| - scoped_refptr<IndexedDBTransaction> transaction = new IndexedDBTransaction(
|
| - id, connection->GetWeakPtr(), scope,
|
| - blink::WebIDBTransactionModeReadWrite,
|
| - new IndexedDBFakeBackingStore::FakeTransaction(commit_success));
|
| + kFakeProcessId, db_, new MockIndexedDBDatabaseCallbacks()));
|
| + std::unique_ptr<IndexedDBTransaction> transaction =
|
| + base::MakeUnique<IndexedDBTransaction>(
|
| + id, connection.get(), scope, blink::WebIDBTransactionModeReadWrite,
|
| + new IndexedDBFakeBackingStore::FakeTransaction(commit_success));
|
| db_->TransactionCreated(transaction.get());
|
|
|
| // No conflicting transactions, so coordinator will start it immediately:
|
| @@ -134,10 +135,11 @@ TEST_F(IndexedDBTransactionTest, NoTimeoutReadOnly) {
|
| const leveldb::Status commit_success = leveldb::Status::OK();
|
| std::unique_ptr<IndexedDBConnection> connection(
|
| base::MakeUnique<IndexedDBConnection>(
|
| - db_, new MockIndexedDBDatabaseCallbacks()));
|
| - scoped_refptr<IndexedDBTransaction> transaction = new IndexedDBTransaction(
|
| - id, connection->GetWeakPtr(), scope, blink::WebIDBTransactionModeReadOnly,
|
| - new IndexedDBFakeBackingStore::FakeTransaction(commit_success));
|
| + kFakeProcessId, db_, new MockIndexedDBDatabaseCallbacks()));
|
| + std::unique_ptr<IndexedDBTransaction> transaction =
|
| + base::MakeUnique<IndexedDBTransaction>(
|
| + id, connection.get(), scope, blink::WebIDBTransactionModeReadOnly,
|
| + new IndexedDBFakeBackingStore::FakeTransaction(commit_success));
|
| db_->TransactionCreated(transaction.get());
|
|
|
| // No conflicting transactions, so coordinator will start it immediately:
|
| @@ -165,10 +167,11 @@ TEST_P(IndexedDBTransactionTestMode, ScheduleNormalTask) {
|
| const leveldb::Status commit_success = leveldb::Status::OK();
|
| std::unique_ptr<IndexedDBConnection> connection(
|
| base::MakeUnique<IndexedDBConnection>(
|
| - db_, new MockIndexedDBDatabaseCallbacks()));
|
| - scoped_refptr<IndexedDBTransaction> transaction = new IndexedDBTransaction(
|
| - id, connection->GetWeakPtr(), scope, GetParam(),
|
| - new IndexedDBFakeBackingStore::FakeTransaction(commit_success));
|
| + kFakeProcessId, db_, new MockIndexedDBDatabaseCallbacks()));
|
| + std::unique_ptr<IndexedDBTransaction> transaction =
|
| + base::MakeUnique<IndexedDBTransaction>(
|
| + id, connection.get(), scope, GetParam(),
|
| + new IndexedDBFakeBackingStore::FakeTransaction(commit_success));
|
|
|
| EXPECT_FALSE(transaction->HasPendingTasks());
|
| EXPECT_TRUE(transaction->IsTaskQueueEmpty());
|
| @@ -226,11 +229,12 @@ TEST_F(IndexedDBTransactionTest, SchedulePreemptiveTask) {
|
| const leveldb::Status commit_failure = leveldb::Status::Corruption("Ouch.");
|
| std::unique_ptr<IndexedDBConnection> connection(
|
| base::MakeUnique<IndexedDBConnection>(
|
| - db_, new MockIndexedDBDatabaseCallbacks()));
|
| - scoped_refptr<IndexedDBTransaction> transaction = new IndexedDBTransaction(
|
| - id, connection->GetWeakPtr(), scope,
|
| - blink::WebIDBTransactionModeVersionChange,
|
| - new IndexedDBFakeBackingStore::FakeTransaction(commit_failure));
|
| + kFakeProcessId, db_, new MockIndexedDBDatabaseCallbacks()));
|
| + std::unique_ptr<IndexedDBTransaction> transaction =
|
| + base::MakeUnique<IndexedDBTransaction>(
|
| + id, connection.get(), scope,
|
| + blink::WebIDBTransactionModeVersionChange,
|
| + new IndexedDBFakeBackingStore::FakeTransaction(commit_failure));
|
|
|
| EXPECT_FALSE(transaction->HasPendingTasks());
|
| EXPECT_TRUE(transaction->IsTaskQueueEmpty());
|
| @@ -287,10 +291,11 @@ TEST_P(IndexedDBTransactionTestMode, AbortTasks) {
|
| const leveldb::Status commit_failure = leveldb::Status::Corruption("Ouch.");
|
| std::unique_ptr<IndexedDBConnection> connection(
|
| base::MakeUnique<IndexedDBConnection>(
|
| - db_, new MockIndexedDBDatabaseCallbacks()));
|
| - scoped_refptr<IndexedDBTransaction> transaction = new IndexedDBTransaction(
|
| - id, connection->GetWeakPtr(), scope, GetParam(),
|
| - new IndexedDBFakeBackingStore::FakeTransaction(commit_failure));
|
| + kFakeProcessId, db_, new MockIndexedDBDatabaseCallbacks()));
|
| + std::unique_ptr<IndexedDBTransaction> transaction =
|
| + base::MakeUnique<IndexedDBTransaction>(
|
| + id, connection.get(), scope, GetParam(),
|
| + new IndexedDBFakeBackingStore::FakeTransaction(commit_failure));
|
| db_->TransactionCreated(transaction.get());
|
|
|
| AbortObserver observer;
|
| @@ -316,10 +321,11 @@ TEST_P(IndexedDBTransactionTestMode, AbortPreemptive) {
|
| const leveldb::Status commit_success = leveldb::Status::OK();
|
| std::unique_ptr<IndexedDBConnection> connection(
|
| base::MakeUnique<IndexedDBConnection>(
|
| - db_, new MockIndexedDBDatabaseCallbacks()));
|
| - scoped_refptr<IndexedDBTransaction> transaction = new IndexedDBTransaction(
|
| - id, connection->GetWeakPtr(), scope, GetParam(),
|
| - new IndexedDBFakeBackingStore::FakeTransaction(commit_success));
|
| + kFakeProcessId, db_, new MockIndexedDBDatabaseCallbacks()));
|
| + std::unique_ptr<IndexedDBTransaction> transaction =
|
| + base::MakeUnique<IndexedDBTransaction>(
|
| + id, connection.get(), scope, GetParam(),
|
| + new IndexedDBFakeBackingStore::FakeTransaction(commit_success));
|
| db_->TransactionCreated(transaction.get());
|
|
|
| // No conflicting transactions, so coordinator will start it immediately:
|
| @@ -366,12 +372,13 @@ TEST_F(IndexedDBTransactionTest, IndexedDBObserver) {
|
| const leveldb::Status commit_success = leveldb::Status::OK();
|
| std::unique_ptr<IndexedDBConnection> connection(
|
| base::MakeUnique<IndexedDBConnection>(
|
| - db_, new MockIndexedDBDatabaseCallbacks()));
|
| - scoped_refptr<IndexedDBTransaction> transaction = new IndexedDBTransaction(
|
| - id, connection->GetWeakPtr(), scope,
|
| - blink::WebIDBTransactionModeReadWrite,
|
| - new IndexedDBFakeBackingStore::FakeTransaction(commit_success));
|
| - db_->TransactionCreated(transaction.get());
|
| + kFakeProcessId, db_, new MockIndexedDBDatabaseCallbacks()));
|
| +
|
| + IndexedDBTransaction* transaction = connection->StoreTransactionForTesting(
|
| + base::MakeUnique<IndexedDBTransaction>(
|
| + id, connection.get(), scope, blink::WebIDBTransactionModeReadWrite,
|
| + new IndexedDBFakeBackingStore::FakeTransaction(commit_success)));
|
| + db_->TransactionCreated(transaction);
|
|
|
| EXPECT_EQ(0UL, transaction->pending_observers_.size());
|
| EXPECT_EQ(0UL, connection->active_observers().size());
|
|
|