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

Side by Side Diff: Source/modules/fetch/FetchBlobDataConsumerHandleTest.cpp

Issue 1311923004: Rename FormData/FormDataBuilder to EncodedFormData/FormDataEncoder respectively. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: update comments Created 5 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "config.h" 5 #include "config.h"
6 #include "modules/fetch/FetchBlobDataConsumerHandle.h" 6 #include "modules/fetch/FetchBlobDataConsumerHandle.h"
7 7
8 #include "core/dom/ExecutionContext.h" 8 #include "core/dom/ExecutionContext.h"
9 #include "core/fetch/ResourceLoaderOptions.h" 9 #include "core/fetch/ResourceLoaderOptions.h"
10 #include "core/loader/ThreadableLoader.h" 10 #include "core/loader/ThreadableLoader.h"
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after
358 } 358 }
359 359
360 TEST_F(FetchBlobDataConsumerHandleTest, DrainAsFormData) 360 TEST_F(FetchBlobDataConsumerHandleTest, DrainAsFormData)
361 { 361 {
362 auto factory = new StrictMock<MockLoaderFactory>; 362 auto factory = new StrictMock<MockLoaderFactory>;
363 363
364 RefPtr<BlobDataHandle> blobDataHandle = createBlobDataHandle("Once upon a ti me"); 364 RefPtr<BlobDataHandle> blobDataHandle = createBlobDataHandle("Once upon a ti me");
365 OwnPtr<FetchDataConsumerHandle> handle 365 OwnPtr<FetchDataConsumerHandle> handle
366 = FetchBlobDataConsumerHandle::create(&document(), blobDataHandle, facto ry); 366 = FetchBlobDataConsumerHandle::create(&document(), blobDataHandle, facto ry);
367 367
368 RefPtr<FormData> formData = handle->obtainReader(nullptr)->drainAsFormData() ; 368 RefPtr<EncodedFormData> formData = handle->obtainReader(nullptr)->drainAsFor mData();
369 ASSERT_TRUE(formData); 369 ASSERT_TRUE(formData);
370 EXPECT_TRUE(formData->isSafeToSendToAnotherThread()); 370 EXPECT_TRUE(formData->isSafeToSendToAnotherThread());
371 ASSERT_EQ(1u, formData->elements().size()); 371 ASSERT_EQ(1u, formData->elements().size());
372 EXPECT_EQ(FormDataElement::encodedBlob, formData->elements()[0].m_type); 372 EXPECT_EQ(FormDataElement::encodedBlob, formData->elements()[0].m_type);
373 EXPECT_EQ(blobDataHandle->uuid(), formData->elements()[0].m_blobUUID); 373 EXPECT_EQ(blobDataHandle->uuid(), formData->elements()[0].m_blobUUID);
374 EXPECT_EQ(blobDataHandle, formData->elements()[0].m_optionalBlobDataHandle); 374 EXPECT_EQ(blobDataHandle, formData->elements()[0].m_optionalBlobDataHandle);
375 375
376 EXPECT_FALSE(handle->obtainReader(nullptr)->drainAsBlobDataHandle()); 376 EXPECT_FALSE(handle->obtainReader(nullptr)->drainAsBlobDataHandle());
377 size_t size; 377 size_t size;
378 EXPECT_EQ(kDone, handle->obtainReader(nullptr)->read(nullptr, 0, kNone, &siz e)); 378 EXPECT_EQ(kDone, handle->obtainReader(nullptr)->read(nullptr, 0, kNone, &siz e));
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
417 OwnPtr<FetchDataConsumerHandle::Reader> reader = handle->obtainReader(nullpt r); 417 OwnPtr<FetchDataConsumerHandle::Reader> reader = handle->obtainReader(nullpt r);
418 418
419 const void* buffer; 419 const void* buffer;
420 size_t available; 420 size_t available;
421 EXPECT_EQ(kShouldWait, reader->beginRead(&buffer, kNone, &available)); 421 EXPECT_EQ(kShouldWait, reader->beginRead(&buffer, kNone, &available));
422 EXPECT_FALSE(reader->drainAsBlobDataHandle()); 422 EXPECT_FALSE(reader->drainAsBlobDataHandle());
423 } 423 }
424 424
425 } // namespace 425 } // namespace
426 } // namespace blink 426 } // namespace blink
OLDNEW
« no previous file with comments | « Source/modules/fetch/FetchBlobDataConsumerHandle.cpp ('k') | Source/modules/fetch/FetchDataConsumerHandle.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698