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

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

Issue 1963293002: Replacing Indexed DB Chromium IPC with Mojo Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Refactoring after Passing URLRequestContextGetter. Created 4 years, 4 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_unittest.cc
diff --git a/content/browser/indexed_db/indexed_db_unittest.cc b/content/browser/indexed_db/indexed_db_unittest.cc
index a4b1f8ce6d78a01ae50eca000023ad7272f6c271..07d2f9b6838057f0a68cc2f70cbdd7cd4899e607 100644
--- a/content/browser/indexed_db/indexed_db_unittest.cc
+++ b/content/browser/indexed_db/indexed_db_unittest.cc
@@ -14,8 +14,7 @@
#include "content/browser/indexed_db/indexed_db_connection.h"
#include "content/browser/indexed_db/indexed_db_context_impl.h"
#include "content/browser/indexed_db/indexed_db_factory_impl.h"
-#include "content/browser/indexed_db/mock_indexed_db_callbacks.h"
-#include "content/browser/indexed_db/mock_indexed_db_database_callbacks.h"
+#include "content/browser/indexed_db/mock_indexed_db_change_handler.h"
#include "content/browser/quota/mock_quota_manager_proxy.h"
#include "content/public/browser/storage_partition.h"
#include "content/public/common/url_constants.h"
@@ -132,6 +131,7 @@ TEST_F(IndexedDBTest, SetForceKeepSessionState) {
EXPECT_TRUE(base::DirectoryExists(session_only_path));
}
+#ifdef CJM_NEED_CALLBACK
class ForceCloseDBCallbacks : public IndexedDBCallbacks {
public:
ForceCloseDBCallbacks(scoped_refptr<IndexedDBContextImpl> idb_context,
@@ -159,18 +159,20 @@ class ForceCloseDBCallbacks : public IndexedDBCallbacks {
std::unique_ptr<IndexedDBConnection> connection_;
DISALLOW_COPY_AND_ASSIGN(ForceCloseDBCallbacks);
};
+#endif
TEST_F(IndexedDBTest, ForceCloseOpenDatabasesOnDelete) {
base::ScopedTempDir temp_dir;
ASSERT_TRUE(temp_dir.CreateUniqueTempDir());
- scoped_refptr<MockIndexedDBDatabaseCallbacks> open_db_callbacks(
- new MockIndexedDBDatabaseCallbacks());
- scoped_refptr<MockIndexedDBDatabaseCallbacks> closed_db_callbacks(
- new MockIndexedDBDatabaseCallbacks());
+ scoped_refptr<MockIndexedDBChangeHandler> open_db_change_handler(
+ new MockIndexedDBChangeHandler());
+ scoped_refptr<MockIndexedDBChangeHandler> closed_db_change_handler(
+ new MockIndexedDBChangeHandler());
base::FilePath test_path;
+#ifdef CJM_NEED_CALLBACK
// Create the scope which will ensure we run the destructor of the context.
{
TestBrowserContext browser_context;
@@ -195,15 +197,16 @@ TEST_F(IndexedDBTest, ForceCloseOpenDatabasesOnDelete) {
std::unique_ptr<IndexedDBPendingConnection> open_connection(
base::MakeUnique<IndexedDBPendingConnection>(
- open_callbacks, open_db_callbacks, 0 /* child_process_id */,
+ open_callbacks, open_db_change_handler, 0 /* child_process_id */,
0 /* host_transaction_id */, 0 /* version */));
factory->Open(base::ASCIIToUTF16("opendb"), std::move(open_connection),
nullptr /* request_context */, Origin(kTestOrigin),
idb_context->data_path());
std::unique_ptr<IndexedDBPendingConnection> closed_connection(
base::MakeUnique<IndexedDBPendingConnection>(
- closed_callbacks, closed_db_callbacks, 0 /* child_process_id */,
- 0 /* host_transaction_id */, 0 /* version */));
+ closed_callbacks, closed_db_change_handler,
+ 0 /* child_process_id */, 0 /* host_transaction_id */,
+ 0 /* version */));
factory->Open(base::ASCIIToUTF16("closeddb"), std::move(closed_connection),
nullptr /* request_context */, Origin(kTestOrigin),
idb_context->data_path());
@@ -226,6 +229,7 @@ TEST_F(IndexedDBTest, ForceCloseOpenDatabasesOnDelete) {
EXPECT_TRUE(open_db_callbacks->forced_close_called());
EXPECT_FALSE(closed_db_callbacks->forced_close_called());
EXPECT_FALSE(base::DirectoryExists(test_path));
+#endif
}
TEST_F(IndexedDBTest, DeleteFailsIfDirectoryLocked) {
@@ -268,14 +272,15 @@ TEST_F(IndexedDBTest, ForceCloseOpenDatabasesOnCommitFailure) {
scoped_refptr<IndexedDBFactoryImpl> factory =
static_cast<IndexedDBFactoryImpl*>(context->GetIDBFactory());
+#ifdef CJM_NEED_CALLBACK
scoped_refptr<MockIndexedDBCallbacks> callbacks(new MockIndexedDBCallbacks());
- scoped_refptr<MockIndexedDBDatabaseCallbacks> db_callbacks(
- new MockIndexedDBDatabaseCallbacks());
+ scoped_refptr<MockIndexedDBChangeHandler> db_change_handler(
+ new MockIndexedDBChangeHandler());
const int64_t transaction_id = 1;
std::unique_ptr<IndexedDBPendingConnection> connection(
base::MakeUnique<IndexedDBPendingConnection>(
- callbacks, db_callbacks, 0 /* child_process_id */, transaction_id,
- IndexedDBDatabaseMetadata::DEFAULT_VERSION));
+ callbacks, db_change_handler, 0 /* child_process_id */,
+ transaction_id, IndexedDBDatabaseMetadata::DEFAULT_VERSION));
factory->Open(base::ASCIIToUTF16("db"), std::move(connection),
nullptr /* request_context */, Origin(kTestOrigin),
temp_dir.path());
@@ -291,8 +296,9 @@ TEST_F(IndexedDBTest, ForceCloseOpenDatabasesOnCommitFailure) {
leveldb::Status status = leveldb::Status::IOError("Simulated failure");
callbacks->connection()->database()->TransactionCommitFailed(status);
- EXPECT_TRUE(db_callbacks->forced_close_called());
+ EXPECT_TRUE(db_change_handler->forced_close_called());
EXPECT_FALSE(factory->IsBackingStoreOpen(kTestOrigin));
+#endif
}
} // namespace content
« no previous file with comments | « content/browser/indexed_db/indexed_db_transaction_unittest.cc ('k') | content/browser/indexed_db/manifest.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698