| Index: content/child/blob_storage/blob_transport_controller_unittest.cc
|
| diff --git a/content/child/blob_storage/blob_transport_controller_unittest.cc b/content/child/blob_storage/blob_transport_controller_unittest.cc
|
| index 1d28136456985a9a777bb953efb1d51bf3446fa2..c59c37518e46aaebdb65cde36c51cca4c1f0fe6f 100644
|
| --- a/content/child/blob_storage/blob_transport_controller_unittest.cc
|
| +++ b/content/child/blob_storage/blob_transport_controller_unittest.cc
|
| @@ -8,7 +8,11 @@
|
| #include <stdint.h>
|
|
|
| #include "base/memory/shared_memory.h"
|
| +#include "base/tuple.h"
|
| #include "content/child/blob_storage/blob_consolidation.h"
|
| +#include "content/common/fileapi/webblob_messages.h"
|
| +#include "ipc/ipc_sender.h"
|
| +#include "ipc/ipc_test_sink.h"
|
| #include "storage/common/blob_storage/blob_item_bytes_request.h"
|
| #include "storage/common/blob_storage/blob_item_bytes_response.h"
|
| #include "testing/gmock/include/gmock/gmock.h"
|
| @@ -103,8 +107,7 @@ TEST_F(BlobTransportControllerTest, Responses) {
|
| consolidation->AddDataItem(CreateData("Hello3"));
|
| // See the above test for the expected descriptions layout.
|
|
|
| - holder->blob_storage_.insert(
|
| - std::make_pair(kBlobUUID, make_scoped_ptr(consolidation)));
|
| + holder->blob_storage_[kBlobUUID] = make_scoped_ptr(consolidation);
|
|
|
| std::vector<BlobItemBytesRequest> requests;
|
| std::vector<base::SharedMemoryHandle> memory_handles;
|
| @@ -162,8 +165,7 @@ TEST_F(BlobTransportControllerTest, SharedMemory) {
|
| consolidation->AddDataItem(CreateData("Hello3"));
|
| // See the above test for the expected descriptions layout.
|
|
|
| - holder->blob_storage_.insert(
|
| - std::make_pair(kBlobUUID, make_scoped_ptr(consolidation)));
|
| + holder->blob_storage_[kBlobUUID] = make_scoped_ptr(consolidation);
|
|
|
| std::vector<BlobItemBytesRequest> requests;
|
| std::vector<base::SharedMemoryHandle> memory_handles;
|
| @@ -202,19 +204,37 @@ TEST_F(BlobTransportControllerTest, TestPublicMethods) {
|
| const std::string KRefBlobUUID = "refuuid";
|
| const std::string kBadBlobUUID = "uuuidBad";
|
| BlobTransportController* holder = BlobTransportController::GetInstance();
|
| + IPC::TestSink sink;
|
|
|
| BlobConsolidation* consolidation = new BlobConsolidation();
|
| consolidation->AddBlobItem(KRefBlobUUID, 10, 10);
|
| - holder->InitiateBlobTransfer(kBlobUUID, "", make_scoped_ptr(consolidation),
|
| - nullptr);
|
| + holder->InitiateBlobTransfer(kBlobUUID, make_scoped_ptr(consolidation),
|
| + &sink);
|
| +
|
| + // Check that we got the correct start message.
|
| + const IPC::Message* message =
|
| + sink.GetUniqueMessageMatching(BlobStorageMsg_StartBuildingBlob::ID);
|
| + ASSERT_TRUE(message);
|
| + std::vector<DataElement> expected;
|
| + expected.push_back(MakeBlobElement(KRefBlobUUID, 10, 10));
|
| + base::Tuple<std::string, std::vector<DataElement>> message_contents;
|
| + BlobStorageMsg_StartBuildingBlob::Read(message, &message_contents);
|
| + EXPECT_EQ(kBlobUUID, base::get<0>(message_contents));
|
| + EXPECT_EQ(MakeBlobElement(KRefBlobUUID, 10, 10),
|
| + base::get<1>(message_contents)[0]);
|
| +
|
| holder->OnCancel(kBlobUUID,
|
| storage::IPCBlobCreationCancelCode::OUT_OF_MEMORY);
|
| EXPECT_FALSE(holder->IsTransporting(kBlobUUID));
|
| + message = nullptr;
|
| + sink.ClearMessages();
|
|
|
| consolidation = new BlobConsolidation();
|
| consolidation->AddBlobItem(KRefBlobUUID, 10, 10);
|
| - holder->InitiateBlobTransfer(kBlobUUID, "", make_scoped_ptr(consolidation),
|
| - nullptr);
|
| + holder->InitiateBlobTransfer(kBlobUUID, make_scoped_ptr(consolidation),
|
| + &sink);
|
| + EXPECT_TRUE(
|
| + sink.GetUniqueMessageMatching(BlobStorageMsg_StartBuildingBlob::ID));
|
| holder->OnDone(kBlobUUID);
|
| EXPECT_FALSE(holder->IsTransporting(kBlobUUID));
|
| }
|
| @@ -229,8 +249,7 @@ TEST_F(BlobTransportControllerTest, ResponsesErrors) {
|
| BlobConsolidation* consolidation = new BlobConsolidation();
|
| consolidation->AddBlobItem(KRefBlobUUID, 10, 10);
|
|
|
| - holder->blob_storage_.insert(
|
| - std::make_pair(kBlobUUID, make_scoped_ptr(consolidation)));
|
| + holder->blob_storage_[kBlobUUID] = make_scoped_ptr(consolidation);
|
|
|
| std::vector<BlobItemBytesRequest> requests;
|
| std::vector<base::SharedMemoryHandle> memory_handles;
|
|
|