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

Unified Diff: third_party/WebKit/Source/modules/indexeddb/IDBTransactionTest.cpp

Issue 2320213004: Port IndexedDB open() and database callbacks to Mojo. (Closed)
Patch Set: Make DatabaseClient an associated interface. Created 4 years, 3 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: third_party/WebKit/Source/modules/indexeddb/IDBTransactionTest.cpp
diff --git a/third_party/WebKit/Source/modules/indexeddb/IDBTransactionTest.cpp b/third_party/WebKit/Source/modules/indexeddb/IDBTransactionTest.cpp
index 8bd2ab07ea2a2bbf8142daab88b0d764c5f7bf67..9aac7bfbc344fdb9e57f431fb8a02e035944ec3f 100644
--- a/third_party/WebKit/Source/modules/indexeddb/IDBTransactionTest.cpp
+++ b/third_party/WebKit/Source/modules/indexeddb/IDBTransactionTest.cpp
@@ -35,7 +35,6 @@
#include "core/dom/Document.h"
#include "core/dom/ExceptionCode.h"
#include "modules/indexeddb/IDBDatabase.h"
-#include "modules/indexeddb/IDBDatabaseCallbacks.h"
#include "modules/indexeddb/MockWebIDBDatabase.h"
#include "platform/SharedBuffer.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -50,24 +49,13 @@ void deactivateNewTransactions(v8::Isolate* isolate)
V8PerIsolateData::from(isolate)->runEndOfScopeTasks();
}
-class FakeIDBDatabaseCallbacks final : public IDBDatabaseCallbacks {
-public:
- static FakeIDBDatabaseCallbacks* create() { return new FakeIDBDatabaseCallbacks(); }
- void onVersionChange(int64_t oldVersion, int64_t newVersion) override { }
- void onForcedClose() override { }
- void onAbort(int64_t transactionId, DOMException* error) override { }
- void onComplete(int64_t transactionId) override { }
-private:
- FakeIDBDatabaseCallbacks() { }
-};
-
TEST(IDBTransactionTest, EnsureLifetime)
{
V8TestingScope scope;
std::unique_ptr<MockWebIDBDatabase> backend = MockWebIDBDatabase::create();
EXPECT_CALL(*backend, close())
.Times(1);
- Persistent<IDBDatabase> db = IDBDatabase::create(scope.getExecutionContext(), std::move(backend), FakeIDBDatabaseCallbacks::create());
+ Persistent<IDBDatabase> db = IDBDatabase::create(scope.getExecutionContext(), std::move(backend), nullptr);
const int64_t transactionId = 1234;
const HashSet<String> transactionScope = HashSet<String>();
@@ -104,7 +92,7 @@ TEST(IDBTransactionTest, TransactionFinish)
.Times(1);
EXPECT_CALL(*backend, close())
.Times(1);
- Persistent<IDBDatabase> db = IDBDatabase::create(scope.getExecutionContext(), std::move(backend), FakeIDBDatabaseCallbacks::create());
+ Persistent<IDBDatabase> db = IDBDatabase::create(scope.getExecutionContext(), std::move(backend), nullptr);
const HashSet<String> transactionScope = HashSet<String>();
Persistent<IDBTransaction> transaction = IDBTransaction::create(scope.getScriptState(), transactionId, transactionScope, WebIDBTransactionModeReadOnly, db.get());
@@ -129,7 +117,10 @@ TEST(IDBTransactionTest, TransactionFinish)
// Fire an abort to make sure this doesn't free the transaction during use. The test
// will not fail if it is, but ASAN would notice the error.
- db->onAbort(transactionId, DOMException::create(AbortError, "Aborted"));
+ auto errorInfo = indexed_db::mojom::blink::ErrorInfo::New();
+ errorInfo->code = AbortError;
+ errorInfo->message = "Aborted";
+ db->OnTransactionAborted(transactionId, std::move(errorInfo));
// onAbort() should have cleared the transaction's reference to the database.
ThreadState::current()-> collectAllGarbage();

Powered by Google App Engine
This is Rietveld 408576698