| 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 bc57a9dd3e4bd1b39afd533efaebea3c5276afe0..c4b70a1701f27bc1f26b3663b3f9e6c01c837a56 100644
|
| --- a/content/browser/indexed_db/indexed_db_factory_unittest.cc
|
| +++ b/content/browser/indexed_db/indexed_db_factory_unittest.cc
|
| @@ -43,7 +43,7 @@ class MockIDBFactory : public IndexedDBFactoryImpl {
|
| bool disk_full;
|
| leveldb::Status s;
|
| scoped_refptr<IndexedDBBackingStore> backing_store =
|
| - OpenBackingStore(origin, data_directory, NULL /* request_context */,
|
| + OpenBackingStore(origin, data_directory, nullptr /* request_context */,
|
| &data_loss_info, &disk_full, &s);
|
| EXPECT_EQ(blink::WebIDBDataLossNone, data_loss_info.status);
|
| return backing_store;
|
| @@ -72,7 +72,7 @@ class IndexedDBFactoryTest : public testing::Test {
|
| task_runner_ = new base::TestSimpleTaskRunner();
|
| quota_manager_proxy_ = new MockQuotaManagerProxy(nullptr, nullptr);
|
| context_ = new IndexedDBContextImpl(
|
| - base::FilePath(), NULL /* special_storage_policy */,
|
| + base::FilePath(), nullptr /* special_storage_policy */,
|
| quota_manager_proxy_.get(), task_runner_.get());
|
| idb_factory_ = new MockIDBFactory(context_.get());
|
| }
|
| @@ -85,7 +85,7 @@ class IndexedDBFactoryTest : public testing::Test {
|
| base::MessageLoop loop_;
|
|
|
| MockIDBFactory* factory() const { return idb_factory_.get(); }
|
| - void clear_factory() { idb_factory_ = NULL; }
|
| + void clear_factory() { idb_factory_ = nullptr; }
|
| IndexedDBContextImpl* context() const { return context_.get(); }
|
|
|
| private:
|
| @@ -119,7 +119,7 @@ TEST_F(IndexedDBFactoryTest, BackingStoreLifetime) {
|
| EXPECT_FALSE(disk_store2->HasOneRef());
|
| EXPECT_TRUE(disk_store3->HasOneRef());
|
|
|
| - disk_store2 = NULL;
|
| + disk_store2 = nullptr;
|
| EXPECT_TRUE(disk_store1->HasOneRef());
|
| }
|
|
|
| @@ -134,7 +134,7 @@ TEST_F(IndexedDBFactoryTest, BackingStoreLazyClose) {
|
| // Give up the local refptr so that the factory has the only
|
| // outstanding reference.
|
| IndexedDBBackingStore* store_ptr = store.get();
|
| - store = NULL;
|
| + store = nullptr;
|
| EXPECT_FALSE(store_ptr->close_timer()->IsRunning());
|
| factory()->TestReleaseBackingStore(store_ptr, false);
|
| EXPECT_TRUE(store_ptr->close_timer()->IsRunning());
|
| @@ -177,7 +177,7 @@ TEST_F(IndexedDBFactoryTest, MemoryBackingStoreLifetime) {
|
| EXPECT_FALSE(mem_store2->HasOneRef()); // mem_store1 and 2
|
| EXPECT_TRUE(mem_store3->HasOneRef());
|
|
|
| - mem_store2 = NULL;
|
| + mem_store2 = nullptr;
|
| EXPECT_TRUE(mem_store1->HasOneRef());
|
| }
|
|
|
| @@ -228,7 +228,7 @@ class DiskFullFactory : public IndexedDBFactoryImpl {
|
| class LookingForQuotaErrorMockCallbacks : public IndexedDBCallbacks {
|
| public:
|
| LookingForQuotaErrorMockCallbacks()
|
| - : IndexedDBCallbacks(NULL, 0, 0), error_called_(false) {}
|
| + : IndexedDBCallbacks(nullptr, 0, 0), error_called_(false) {}
|
| void OnError(const IndexedDBDatabaseError& error) override {
|
| error_called_ = true;
|
| EXPECT_EQ(blink::WebIDBDatabaseExceptionQuotaError, error.code());
|
| @@ -251,15 +251,14 @@ TEST_F(IndexedDBFactoryTest, QuotaErrorOnDiskFull) {
|
| scoped_refptr<LookingForQuotaErrorMockCallbacks> callbacks =
|
| new LookingForQuotaErrorMockCallbacks;
|
| scoped_refptr<IndexedDBDatabaseCallbacks> dummy_database_callbacks =
|
| - new IndexedDBDatabaseCallbacks(NULL, 0, 0);
|
| + new IndexedDBDatabaseCallbacks(nullptr, 0, 0);
|
| const base::string16 name(ASCIIToUTF16("name"));
|
| std::unique_ptr<IndexedDBPendingConnection> connection(
|
| - new IndexedDBPendingConnection(callbacks, dummy_database_callbacks,
|
| - 0, /* child_process_id */
|
| - 2, /* transaction_id */
|
| - 1 /* version */));
|
| - factory->Open(name, std::move(connection), NULL /* request_context */, origin,
|
| - temp_directory.path());
|
| + base::MakeUnique<IndexedDBPendingConnection>(
|
| + callbacks, dummy_database_callbacks, 0 /* child_process_id */,
|
| + 2 /* transaction_id */, 1 /* version */));
|
| + factory->Open(name, std::move(connection), nullptr /* request_context */,
|
| + origin, temp_directory.path());
|
| EXPECT_TRUE(callbacks->error_called());
|
| }
|
|
|
| @@ -274,11 +273,11 @@ TEST_F(IndexedDBFactoryTest, BackingStoreReleasedOnForcedClose) {
|
| new MockIndexedDBDatabaseCallbacks());
|
| const int64_t transaction_id = 1;
|
| std::unique_ptr<IndexedDBPendingConnection> connection(
|
| - new IndexedDBPendingConnection(
|
| - callbacks, db_callbacks, 0, /* child_process_id */
|
| - transaction_id, IndexedDBDatabaseMetadata::DEFAULT_VERSION));
|
| + base::MakeUnique<IndexedDBPendingConnection>(
|
| + callbacks, db_callbacks, 0 /* child_process_id */, transaction_id,
|
| + IndexedDBDatabaseMetadata::DEFAULT_VERSION));
|
| factory()->Open(ASCIIToUTF16("db"), std::move(connection),
|
| - NULL /* request_context */, origin, temp_directory.path());
|
| + nullptr /* request_context */, origin, temp_directory.path());
|
|
|
| EXPECT_TRUE(callbacks->connection());
|
|
|
| @@ -302,11 +301,11 @@ TEST_F(IndexedDBFactoryTest, BackingStoreReleaseDelayedOnClose) {
|
| new MockIndexedDBDatabaseCallbacks());
|
| const int64_t transaction_id = 1;
|
| std::unique_ptr<IndexedDBPendingConnection> connection(
|
| - new IndexedDBPendingConnection(
|
| - callbacks, db_callbacks, 0, /* child_process_id */
|
| - transaction_id, IndexedDBDatabaseMetadata::DEFAULT_VERSION));
|
| + base::MakeUnique<IndexedDBPendingConnection>(
|
| + callbacks, db_callbacks, 0 /* child_process_id */, transaction_id,
|
| + IndexedDBDatabaseMetadata::DEFAULT_VERSION));
|
| factory()->Open(ASCIIToUTF16("db"), std::move(connection),
|
| - NULL /* request_context */, origin, temp_directory.path());
|
| + nullptr /* request_context */, origin, temp_directory.path());
|
|
|
| EXPECT_TRUE(callbacks->connection());
|
| IndexedDBBackingStore* store =
|
| @@ -341,7 +340,7 @@ TEST_F(IndexedDBFactoryTest, DeleteDatabaseClosesBackingStore) {
|
| const bool expect_connection = false;
|
| scoped_refptr<MockIndexedDBCallbacks> callbacks(
|
| new MockIndexedDBCallbacks(expect_connection));
|
| - factory()->DeleteDatabase(ASCIIToUTF16("db"), NULL /* request_context */,
|
| + factory()->DeleteDatabase(ASCIIToUTF16("db"), nullptr /* request_context */,
|
| callbacks, origin, temp_directory.path());
|
|
|
| EXPECT_TRUE(factory()->IsBackingStoreOpen(origin));
|
| @@ -366,7 +365,7 @@ TEST_F(IndexedDBFactoryTest, GetDatabaseNamesClosesBackingStore) {
|
| scoped_refptr<MockIndexedDBCallbacks> callbacks(
|
| new MockIndexedDBCallbacks(expect_connection));
|
| factory()->GetDatabaseNames(callbacks, origin, temp_directory.path(),
|
| - NULL /* request_context */);
|
| + nullptr /* request_context */);
|
|
|
| EXPECT_TRUE(factory()->IsBackingStoreOpen(origin));
|
| EXPECT_TRUE(factory()->IsBackingStorePendingClose(origin));
|
| @@ -389,11 +388,11 @@ TEST_F(IndexedDBFactoryTest, ForceCloseReleasesBackingStore) {
|
| new MockIndexedDBDatabaseCallbacks());
|
| const int64_t transaction_id = 1;
|
| std::unique_ptr<IndexedDBPendingConnection> connection(
|
| - new IndexedDBPendingConnection(
|
| - callbacks, db_callbacks, 0, /* child_process_id */
|
| - transaction_id, IndexedDBDatabaseMetadata::DEFAULT_VERSION));
|
| + base::MakeUnique<IndexedDBPendingConnection>(
|
| + callbacks, db_callbacks, 0 /* child_process_id */, transaction_id,
|
| + IndexedDBDatabaseMetadata::DEFAULT_VERSION));
|
| factory()->Open(ASCIIToUTF16("db"), std::move(connection),
|
| - NULL /* request_context */, origin, temp_directory.path());
|
| + nullptr /* request_context */, origin, temp_directory.path());
|
|
|
| EXPECT_TRUE(callbacks->connection());
|
| EXPECT_TRUE(factory()->IsBackingStoreOpen(origin));
|
| @@ -470,11 +469,12 @@ TEST_F(IndexedDBFactoryTest, DatabaseFailedOpen) {
|
| scoped_refptr<MockIndexedDBCallbacks> callbacks(
|
| new UpgradeNeededCallbacks());
|
| std::unique_ptr<IndexedDBPendingConnection> connection(
|
| - new IndexedDBPendingConnection(callbacks, db_callbacks,
|
| - 0, /* child_process_id */
|
| - transaction_id, db_version));
|
| - factory()->Open(db_name, std::move(connection), NULL /* request_context */,
|
| - origin, temp_directory.path());
|
| + base::MakeUnique<IndexedDBPendingConnection>(
|
| + callbacks, db_callbacks, 0 /* child_process_id */, transaction_id,
|
| + db_version));
|
| + factory()->Open(db_name, std::move(connection),
|
| + nullptr /* request_context */, origin,
|
| + temp_directory.path());
|
| EXPECT_TRUE(factory()->IsDatabaseOpen(origin, db_name));
|
|
|
| // Pump the message loop so the upgrade transaction can run.
|
| @@ -491,11 +491,12 @@ TEST_F(IndexedDBFactoryTest, DatabaseFailedOpen) {
|
| {
|
| scoped_refptr<ErrorCallbacks> callbacks(new ErrorCallbacks());
|
| std::unique_ptr<IndexedDBPendingConnection> connection(
|
| - new IndexedDBPendingConnection(callbacks, db_callbacks,
|
| - 0, /* child_process_id */
|
| - transaction_id, db_version - 1));
|
| - factory()->Open(db_name, std::move(connection), NULL /* request_context */,
|
| - origin, temp_directory.path());
|
| + base::MakeUnique<IndexedDBPendingConnection>(
|
| + callbacks, db_callbacks, 0 /* child_process_id */, transaction_id,
|
| + db_version - 1));
|
| + factory()->Open(db_name, std::move(connection),
|
| + nullptr /* request_context */, origin,
|
| + temp_directory.path());
|
| EXPECT_TRUE(callbacks->saw_error());
|
| EXPECT_FALSE(factory()->IsDatabaseOpen(origin, db_name));
|
| }
|
|
|