| 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 683d45b994e40061b78a883ea7ccb4f730b53d4d..9eda221be3ff1313eb971df5d4095550ab590e6b 100644
|
| --- a/third_party/WebKit/Source/modules/indexeddb/IDBTransactionTest.cpp
|
| +++ b/third_party/WebKit/Source/modules/indexeddb/IDBTransactionTest.cpp
|
| @@ -43,6 +43,7 @@
|
| #include "modules/indexeddb/IDBKeyPath.h"
|
| #include "modules/indexeddb/IDBMetadata.h"
|
| #include "modules/indexeddb/IDBObjectStore.h"
|
| +#include "modules/indexeddb/IDBTestHelper.h"
|
| #include "modules/indexeddb/IDBValue.h"
|
| #include "modules/indexeddb/IDBValueWrapping.h"
|
| #include "modules/indexeddb/MockWebIDBDatabase.h"
|
| @@ -117,38 +118,6 @@ class IDBTransactionTest : public ::testing::Test {
|
| static constexpr int64_t kStoreId = 5678;
|
| };
|
|
|
| -// The created value is an array of true. If create_wrapped_value is true, the
|
| -// IDBValue's byte array will be wrapped in a Blob, otherwise it will not be.
|
| -RefPtr<IDBValue> CreateIDBValue(v8::Isolate* isolate,
|
| - bool create_wrapped_value) {
|
| - size_t element_count = create_wrapped_value ? 16 : 2;
|
| - v8::Local<v8::Array> v8_array = v8::Array::New(isolate, element_count);
|
| - for (size_t i = 0; i < element_count; ++i)
|
| - v8_array->Set(i, v8::True(isolate));
|
| -
|
| - NonThrowableExceptionState non_throwable_exception_state;
|
| - IDBValueWrapper wrapper(isolate, v8_array,
|
| - SerializedScriptValue::SerializeOptions::kSerialize,
|
| - non_throwable_exception_state);
|
| - wrapper.WrapIfBiggerThan(create_wrapped_value ? 0 : 1024 * element_count);
|
| -
|
| - std::unique_ptr<Vector<RefPtr<BlobDataHandle>>> blob_data_handles =
|
| - WTF::MakeUnique<Vector<RefPtr<BlobDataHandle>>>();
|
| - wrapper.ExtractBlobDataHandles(blob_data_handles.get());
|
| - Vector<WebBlobInfo>& blob_infos = wrapper.WrappedBlobInfo();
|
| - RefPtr<SharedBuffer> wrapped_marker_buffer = wrapper.ExtractWireBytes();
|
| - IDBKey* key = IDBKey::CreateNumber(42.0);
|
| - IDBKeyPath key_path(String("primaryKey"));
|
| -
|
| - RefPtr<IDBValue> idb_value = IDBValue::Create(
|
| - std::move(wrapped_marker_buffer), std::move(blob_data_handles),
|
| - WTF::MakeUnique<Vector<WebBlobInfo>>(blob_infos), key, key_path);
|
| -
|
| - DCHECK_EQ(create_wrapped_value,
|
| - IDBValueUnwrapper::IsWrapped(idb_value.Get()));
|
| - return idb_value;
|
| -}
|
| -
|
| TEST_F(IDBTransactionTest, ContextDestroyedEarlyDeath) {
|
| V8TestingScope scope;
|
| std::unique_ptr<MockWebIDBDatabase> backend = MockWebIDBDatabase::Create();
|
| @@ -200,7 +169,7 @@ TEST_F(IDBTransactionTest, ContextDestroyedAfterDone) {
|
| DeactivateNewTransactions(scope.GetIsolate());
|
|
|
| // This response should result in an event being enqueued immediately.
|
| - request->HandleResponse(CreateIDBValue(scope.GetIsolate(), false));
|
| + request->HandleResponse(CreateIDBValueForTesting(scope.GetIsolate(), false));
|
|
|
| request.Clear(); // The transaction is holding onto the request.
|
| ThreadState::Current()->CollectAllGarbage();
|
| @@ -239,7 +208,7 @@ TEST_F(IDBTransactionTest, ContextDestroyedWithQueuedResult) {
|
| transaction_.Get(), IDBRequest::AsyncTraceState());
|
| DeactivateNewTransactions(scope.GetIsolate());
|
|
|
| - request->HandleResponse(CreateIDBValue(scope.GetIsolate(), true));
|
| + request->HandleResponse(CreateIDBValueForTesting(scope.GetIsolate(), true));
|
|
|
| request.Clear(); // The transaction is holding onto the request.
|
| ThreadState::Current()->CollectAllGarbage();
|
| @@ -278,8 +247,8 @@ TEST_F(IDBTransactionTest, ContextDestroyedWithTwoQueuedResults) {
|
| transaction_.Get(), IDBRequest::AsyncTraceState());
|
| DeactivateNewTransactions(scope.GetIsolate());
|
|
|
| - request1->HandleResponse(CreateIDBValue(scope.GetIsolate(), true));
|
| - request2->HandleResponse(CreateIDBValue(scope.GetIsolate(), true));
|
| + request1->HandleResponse(CreateIDBValueForTesting(scope.GetIsolate(), true));
|
| + request2->HandleResponse(CreateIDBValueForTesting(scope.GetIsolate(), true));
|
|
|
| request1.Clear(); // The transaction is holding onto the requests.
|
| request2.Clear();
|
| @@ -321,8 +290,8 @@ TEST_F(IDBTransactionTest, DocumentShutdownWithQueuedAndBlockedResults) {
|
| transaction_.Get(), IDBRequest::AsyncTraceState());
|
| DeactivateNewTransactions(scope.GetIsolate());
|
|
|
| - request1->HandleResponse(CreateIDBValue(scope.GetIsolate(), true));
|
| - request2->HandleResponse(CreateIDBValue(scope.GetIsolate(), false));
|
| + request1->HandleResponse(CreateIDBValueForTesting(scope.GetIsolate(), true));
|
| + request2->HandleResponse(CreateIDBValueForTesting(scope.GetIsolate(), false));
|
|
|
| request1.Clear(); // The transaction is holding onto the requests.
|
| request2.Clear();
|
|
|