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

Side by Side Diff: content/child/blob_storage/blob_transport_controller_unittest.cc

Issue 2055053003: [BlobAsync] Disk support for blob storage (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added back transport controller test, small cleanups Created 4 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 unified diff | Download patch
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 "content/child/blob_storage/blob_transport_controller.h" 5 #include "content/child/blob_storage/blob_transport_controller.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 #include <tuple> 9 #include <tuple>
10 10
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 FilePath path; 122 FilePath path;
123 EXPECT_TRUE(base::CreateTemporaryFile(&path)); 123 EXPECT_TRUE(base::CreateTemporaryFile(&path));
124 files_opened_.push_back(path); 124 files_opened_.push_back(path);
125 return path; 125 return path;
126 } 126 }
127 127
128 void ExpectRegisterAndStartMessage(const std::string& expected_uuid, 128 void ExpectRegisterAndStartMessage(const std::string& expected_uuid,
129 const std::string& expected_content_type, 129 const std::string& expected_content_type,
130 std::vector<DataElement>* descriptions) { 130 std::vector<DataElement>* descriptions) {
131 const IPC::Message* register_message = 131 const IPC::Message* register_message =
132 sink_.GetUniqueMessageMatching(BlobStorageMsg_RegisterBlobUUID::ID); 132 sink_.GetUniqueMessageMatching(BlobStorageMsg_RegisterBlob::ID);
133 const IPC::Message* start_message =
134 sink_.GetUniqueMessageMatching(BlobStorageMsg_StartBuildingBlob::ID);
135 ASSERT_TRUE(register_message); 133 ASSERT_TRUE(register_message);
136 ASSERT_TRUE(start_message); 134 std::tuple<std::string, std::string, std::string, std::vector<DataElement>>
137 std::tuple<std::string, std::string, std::string, std::set<std::string>>
138 register_contents; 135 register_contents;
139 std::tuple<std::string, std::vector<DataElement>> start_contents; 136 BlobStorageMsg_RegisterBlob::Read(register_message, &register_contents);
140 BlobStorageMsg_RegisterBlobUUID::Read(register_message, &register_contents);
141 BlobStorageMsg_StartBuildingBlob::Read(start_message, &start_contents);
142 EXPECT_EQ(expected_uuid, std::get<0>(register_contents)); 137 EXPECT_EQ(expected_uuid, std::get<0>(register_contents));
143 EXPECT_EQ(expected_uuid, std::get<0>(start_contents));
144 EXPECT_EQ(expected_content_type, std::get<1>(register_contents)); 138 EXPECT_EQ(expected_content_type, std::get<1>(register_contents));
145 if (descriptions) 139 if (descriptions)
146 *descriptions = std::get<1>(start_contents); 140 *descriptions = std::get<3>(register_contents);
147 // We don't have dispositions from the renderer. 141 // We don't have dispositions from the renderer.
148 EXPECT_TRUE(std::get<2>(register_contents).empty()); 142 EXPECT_TRUE(std::get<2>(register_contents).empty());
149 sink_.ClearMessages(); 143 sink_.ClearMessages();
150 } 144 }
151 145
152 void ExpectMemoryResponses( 146 void ExpectMemoryResponses(
153 const std::string& expected_uuid, 147 const std::string& expected_uuid,
154 std::vector<storage::BlobItemBytesResponse> expected_responses) { 148 std::vector<storage::BlobItemBytesResponse> expected_responses) {
155 const IPC::Message* responses_message = 149 const IPC::Message* responses_message =
156 sink_.GetUniqueMessageMatching(BlobStorageMsg_MemoryItemResponse::ID); 150 sink_.GetUniqueMessageMatching(BlobStorageMsg_MemoryItemResponse::ID);
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after
474 EXPECT_FALSE(main_thread_runner_->HasPendingTask()); 468 EXPECT_FALSE(main_thread_runner_->HasPendingTask());
475 469
476 // Finish the second one. 470 // Finish the second one.
477 holder->OnDone(kBlob2UUID); 471 holder->OnDone(kBlob2UUID);
478 EXPECT_FALSE(holder->IsTransporting(kBlob2UUID)); 472 EXPECT_FALSE(holder->IsTransporting(kBlob2UUID));
479 EXPECT_TRUE(main_thread_runner_->HasPendingTask()); 473 EXPECT_TRUE(main_thread_runner_->HasPendingTask());
480 main_thread_runner_->ClearPendingTasks(); 474 main_thread_runner_->ClearPendingTasks();
481 } 475 }
482 476
483 } // namespace content 477 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698