| Index: content/browser/indexed_db/indexed_db_cleanup_on_io_error_unittest.cc
|
| diff --git a/content/browser/indexed_db/indexed_db_cleanup_on_io_error_unittest.cc b/content/browser/indexed_db/indexed_db_cleanup_on_io_error_unittest.cc
|
| index d94454159596c9c908d4a2d4b6d6fe70836af5b9..bd7434b3bc227fa3a0dd8381e6ceecf58bb62494 100644
|
| --- a/content/browser/indexed_db/indexed_db_cleanup_on_io_error_unittest.cc
|
| +++ b/content/browser/indexed_db/indexed_db_cleanup_on_io_error_unittest.cc
|
| @@ -20,6 +20,18 @@ using content::LevelDBDatabase;
|
| using content::LevelDBFactory;
|
| using content::LevelDBSnapshot;
|
|
|
| +namespace base {
|
| +class TaskRunner;
|
| +}
|
| +
|
| +namespace content {
|
| +class IndexedDBFactory;
|
| +}
|
| +
|
| +namespace net {
|
| +class URLRequestContext;
|
| +}
|
| +
|
| namespace {
|
|
|
| class BustedLevelDBDatabase : public LevelDBDatabase {
|
| @@ -61,22 +73,30 @@ class MockLevelDBFactory : public LevelDBFactory {
|
| };
|
|
|
| TEST(IndexedDBIOErrorTest, CleanUpTest) {
|
| + content::IndexedDBFactory* factory = NULL;
|
| const GURL origin("http://localhost:81");
|
| base::ScopedTempDir temp_directory;
|
| ASSERT_TRUE(temp_directory.CreateUniqueTempDir());
|
| const base::FilePath path = temp_directory.path();
|
| + net::URLRequestContext* request_context = NULL;
|
| MockLevelDBFactory mock_leveldb_factory;
|
| blink::WebIDBDataLoss data_loss =
|
| blink::WebIDBDataLossNone;
|
| std::string data_loss_message;
|
| bool disk_full = false;
|
| + base::TaskRunner* task_runner = NULL;
|
| + bool clean_journal = false;
|
| scoped_refptr<IndexedDBBackingStore> backing_store =
|
| - IndexedDBBackingStore::Open(origin,
|
| + IndexedDBBackingStore::Open(factory,
|
| + origin,
|
| path,
|
| + request_context,
|
| &data_loss,
|
| &data_loss_message,
|
| &disk_full,
|
| - &mock_leveldb_factory);
|
| + &mock_leveldb_factory,
|
| + task_runner,
|
| + clean_journal);
|
| }
|
|
|
| // TODO(dgrogan): Remove expect_destroy if we end up not using it again. It is
|
| @@ -112,7 +132,9 @@ class MockErrorLevelDBFactory : public LevelDBFactory {
|
| };
|
|
|
| TEST(IndexedDBNonRecoverableIOErrorTest, NuancedCleanupTest) {
|
| + content::IndexedDBFactory* factory = NULL;
|
| const GURL origin("http://localhost:81");
|
| + net::URLRequestContext* request_context = NULL;
|
| base::ScopedTempDir temp_directory;
|
| ASSERT_TRUE(temp_directory.CreateUniqueTempDir());
|
| const base::FilePath path = temp_directory.path();
|
| @@ -120,44 +142,62 @@ TEST(IndexedDBNonRecoverableIOErrorTest, NuancedCleanupTest) {
|
| blink::WebIDBDataLossNone;
|
| std::string data_loss_reason;
|
| bool disk_full = false;
|
| + base::TaskRunner* task_runner = NULL;
|
| + bool clean_journal = false;
|
|
|
| MockErrorLevelDBFactory<int> mock_leveldb_factory(ENOSPC, false);
|
| scoped_refptr<IndexedDBBackingStore> backing_store =
|
| - IndexedDBBackingStore::Open(origin,
|
| + IndexedDBBackingStore::Open(factory,
|
| + origin,
|
| path,
|
| + request_context,
|
| &data_loss,
|
| &data_loss_reason,
|
| &disk_full,
|
| - &mock_leveldb_factory);
|
| + &mock_leveldb_factory,
|
| + task_runner,
|
| + clean_journal);
|
|
|
| MockErrorLevelDBFactory<base::PlatformFileError> mock_leveldb_factory2(
|
| base::PLATFORM_FILE_ERROR_NO_MEMORY, false);
|
| scoped_refptr<IndexedDBBackingStore> backing_store2 =
|
| - IndexedDBBackingStore::Open(origin,
|
| + IndexedDBBackingStore::Open(factory,
|
| + origin,
|
| path,
|
| + request_context,
|
| &data_loss,
|
| &data_loss_reason,
|
| &disk_full,
|
| - &mock_leveldb_factory2);
|
| + &mock_leveldb_factory2,
|
| + task_runner,
|
| + clean_journal);
|
|
|
| MockErrorLevelDBFactory<int> mock_leveldb_factory3(EIO, false);
|
| scoped_refptr<IndexedDBBackingStore> backing_store3 =
|
| - IndexedDBBackingStore::Open(origin,
|
| + IndexedDBBackingStore::Open(factory,
|
| + origin,
|
| path,
|
| + request_context,
|
| &data_loss,
|
| &data_loss_reason,
|
| &disk_full,
|
| - &mock_leveldb_factory3);
|
| + &mock_leveldb_factory3,
|
| + task_runner,
|
| + clean_journal);
|
|
|
| MockErrorLevelDBFactory<base::PlatformFileError> mock_leveldb_factory4(
|
| base::PLATFORM_FILE_ERROR_FAILED, false);
|
| scoped_refptr<IndexedDBBackingStore> backing_store4 =
|
| - IndexedDBBackingStore::Open(origin,
|
| + IndexedDBBackingStore::Open(factory,
|
| + origin,
|
| path,
|
| + request_context,
|
| &data_loss,
|
| &data_loss_reason,
|
| &disk_full,
|
| - &mock_leveldb_factory4);
|
| + &mock_leveldb_factory4,
|
| + task_runner,
|
| + clean_journal);
|
| }
|
|
|
| } // namespace
|
|
|