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

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

Issue 2867693004: Snapshot of all changes to get jumbo in blink and content.
Patch Set: Rebased again Created 3 years, 5 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/IDBRequestTest.cpp
diff --git a/third_party/WebKit/Source/modules/indexeddb/IDBRequestTest.cpp b/third_party/WebKit/Source/modules/indexeddb/IDBRequestTest.cpp
index f6f063b377fbf9086d5ec7e19fa1a41002b2fe14..8d801dd9806dd2f6de50704839cc275c7dd4ed46 100644
--- a/third_party/WebKit/Source/modules/indexeddb/IDBRequestTest.cpp
+++ b/third_party/WebKit/Source/modules/indexeddb/IDBRequestTest.cpp
@@ -40,6 +40,7 @@
#include "modules/indexeddb/IDBMetadata.h"
#include "modules/indexeddb/IDBObjectStore.h"
#include "modules/indexeddb/IDBOpenDBRequest.h"
+#include "modules/indexeddb/IDBTestHelper.h"
#include "modules/indexeddb/IDBTransaction.h"
#include "modules/indexeddb/IDBValue.h"
#include "modules/indexeddb/IDBValueWrapping.h"
@@ -99,38 +100,6 @@ class IDBRequestTest : 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;
-}
-
void EnsureIDBCallbacksDontThrow(IDBRequest* request,
ExceptionState& exception_state) {
ASSERT_TRUE(request->transaction());
@@ -185,7 +154,7 @@ TEST_F(IDBRequestTest, EventsAfterDoneStop) {
transaction_.Get(), IDBRequest::AsyncTraceState());
ASSERT_TRUE(!scope.GetExceptionState().HadException());
ASSERT_TRUE(request->transaction());
- request->HandleResponse(CreateIDBValue(scope.GetIsolate(), false));
+ request->HandleResponse(CreateIDBValueForTesting(scope.GetIsolate(), false));
scope.GetExecutionContext()->NotifyContextDestroyed();
EnsureIDBCallbacksDontThrow(request, scope.GetExceptionState());
@@ -206,7 +175,7 @@ TEST_F(IDBRequestTest, EventsAfterEarlyDeathStopWithQueuedResult) {
EXPECT_EQ(request->readyState(), "pending");
ASSERT_TRUE(!scope.GetExceptionState().HadException());
ASSERT_TRUE(request->transaction());
- request->HandleResponse(CreateIDBValue(scope.GetIsolate(), true));
+ request->HandleResponse(CreateIDBValueForTesting(scope.GetIsolate(), true));
scope.GetExecutionContext()->NotifyContextDestroyed();
EnsureIDBCallbacksDontThrow(request, scope.GetExceptionState());
@@ -234,8 +203,8 @@ TEST_F(IDBRequestTest, EventsAfterEarlyDeathStopWithTwoQueuedResults) {
ASSERT_TRUE(!scope.GetExceptionState().HadException());
ASSERT_TRUE(request1->transaction());
ASSERT_TRUE(request2->transaction());
- request1->HandleResponse(CreateIDBValue(scope.GetIsolate(), true));
- request2->HandleResponse(CreateIDBValue(scope.GetIsolate(), true));
+ request1->HandleResponse(CreateIDBValueForTesting(scope.GetIsolate(), true));
+ request2->HandleResponse(CreateIDBValueForTesting(scope.GetIsolate(), true));
scope.GetExecutionContext()->NotifyContextDestroyed();
EnsureIDBCallbacksDontThrow(request1, scope.GetExceptionState());
« no previous file with comments | « third_party/WebKit/Source/modules/fetch/BUILD.gn ('k') | third_party/WebKit/Source/modules/indexeddb/IDBTestHelper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698