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

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: fixes, working w/ Layout tests 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 //
11 #include "base/bind.h" 11 //#include "base/bind.h"
12 #include "base/bind_helpers.h" 12 //#include "base/bind_helpers.h"
13 #include "base/files/file.h" 13 //#include "base/files/file.h"
14 #include "base/files/file_path.h" 14 //#include "base/files/file_path.h"
15 #include "base/files/file_util.h" 15 //#include "base/files/file_util.h"
16 #include "base/memory/shared_memory.h" 16 //#include "base/memory/shared_memory.h"
17 #include "base/message_loop/message_loop.h" 17 //#include "base/message_loop/message_loop.h"
18 #include "base/process/process_handle.h" 18 //#include "base/process/process_handle.h"
19 #include "base/test/test_file_util.h" 19 //#include "base/test/test_file_util.h"
20 #include "base/test/test_simple_task_runner.h" 20 //#include "base/test/test_simple_task_runner.h"
21 #include "base/threading/thread_task_runner_handle.h" 21 //#include "base/threading/thread_task_runner_handle.h"
22 #include "content/child/blob_storage/blob_consolidation.h" 22 //#include "content/child/blob_storage/blob_consolidation.h"
23 #include "content/child/thread_safe_sender.h" 23 //#include "content/child/thread_safe_sender.h"
24 #include "content/common/fileapi/webblob_messages.h" 24 //#include "content/common/fileapi/webblob_messages.h"
25 #include "ipc/ipc_message.h" 25 //#include "ipc/ipc_message.h"
26 #include "ipc/ipc_platform_file.h" 26 //#include "ipc/ipc_platform_file.h"
27 #include "ipc/ipc_sender.h" 27 //#include "ipc/ipc_sender.h"
28 #include "ipc/ipc_sync_message_filter.h" 28 //#include "ipc/ipc_sync_message_filter.h"
29 #include "ipc/ipc_test_sink.h" 29 //#include "ipc/ipc_test_sink.h"
30 #include "storage/common/blob_storage/blob_item_bytes_request.h" 30 //#include "storage/common/blob_storage/blob_item_bytes_request.h"
31 #include "storage/common/blob_storage/blob_item_bytes_response.h" 31 //#include "storage/common/blob_storage/blob_item_bytes_response.h"
32 #include "testing/gmock/include/gmock/gmock.h" 32 //#include "testing/gmock/include/gmock/gmock.h"
33 #include "testing/gtest/include/gtest/gtest.h" 33 //#include "testing/gtest/include/gtest/gtest.h"
34 34 //
35 using base::File; 35 // using base::File;
36 using base::FilePath; 36 // using base::FilePath;
37 using base::TestSimpleTaskRunner; 37 // using base::TestSimpleTaskRunner;
38 using storage::BlobItemBytesRequest; 38 // using storage::BlobItemBytesRequest;
39 using storage::BlobItemBytesResponse; 39 // using storage::BlobItemBytesResponse;
40 using storage::DataElement; 40 // using storage::DataElement;
41 using storage::IPCBlobCreationCancelCode; 41 // using storage::IPCBlobCreationCancelCode;
42 42 //
43 namespace content { 43 // namespace content {
44 namespace { 44 // namespace {
45 45 //
46 class OtherThreadTestSimpleTaskRunner : public base::TestSimpleTaskRunner { 46 // class OtherThreadTestSimpleTaskRunner : public base::TestSimpleTaskRunner {
47 public: 47 // public:
48 bool RunsTasksOnCurrentThread() const override { return false; } 48 // bool RunsTasksOnCurrentThread() const override { return false; }
49 49 //
50 protected: 50 // protected:
51 ~OtherThreadTestSimpleTaskRunner() override {} 51 // ~OtherThreadTestSimpleTaskRunner() override {}
52 }; 52 //};
53 53 //
54 class BlobTransportControllerTestSender : public ThreadSafeSender { 54 // class BlobTransportControllerTestSender : public ThreadSafeSender {
55 public: 55 // public:
56 explicit BlobTransportControllerTestSender(IPC::TestSink* ipc_sink) 56 // explicit BlobTransportControllerTestSender(IPC::TestSink* ipc_sink)
57 : ThreadSafeSender(nullptr, nullptr), ipc_sink_(ipc_sink) {} 57 // : ThreadSafeSender(nullptr, nullptr), ipc_sink_(ipc_sink) {}
58 58 //
59 bool Send(IPC::Message* message) override { return ipc_sink_->Send(message); } 59 // bool Send(IPC::Message* message) override { return ipc_sink_->Send(message);
60 60 // }
61 private: 61 //
62 ~BlobTransportControllerTestSender() override {} 62 // private:
63 63 // ~BlobTransportControllerTestSender() override {}
64 IPC::TestSink* ipc_sink_; 64 //
65 65 // IPC::TestSink* ipc_sink_;
66 DISALLOW_COPY_AND_ASSIGN(BlobTransportControllerTestSender); 66 //
67 }; 67 // DISALLOW_COPY_AND_ASSIGN(BlobTransportControllerTestSender);
68 68 //};
69 BlobItemBytesResponse ResponseWithData(size_t request_number, 69 //
70 const std::string& str) { 70 // BlobItemBytesResponse ResponseWithData(size_t request_number,
71 BlobItemBytesResponse response(request_number); 71 // const std::string& str) {
72 response.inline_data.assign(str.begin(), str.end()); 72 // BlobItemBytesResponse response(request_number);
73 return response; 73 // response.inline_data.assign(str.begin(), str.end());
74 } 74 // return response;
75 75 //}
76 static DataElement MakeBlobElement(const std::string& uuid, 76 //
77 uint64_t offset, 77 // static DataElement MakeBlobElement(const std::string& uuid,
78 uint64_t size) { 78 // uint64_t offset,
79 DataElement element; 79 // uint64_t size) {
80 element.SetToBlobRange(uuid, offset, size); 80 // DataElement element;
81 return element; 81 // element.SetToBlobRange(uuid, offset, size);
82 } 82 // return element;
83 83 //}
84 static DataElement MakeDataDescriptionElement(size_t size) { 84 //
85 DataElement element; 85 // static DataElement MakeDataDescriptionElement(size_t size) {
86 element.SetToBytesDescription(size); 86 // DataElement element;
87 return element; 87 // element.SetToBytesDescription(size);
88 } 88 // return element;
89 89 //}
90 static DataElement MakeDataElement(const std::string& str) { 90 //
91 DataElement element; 91 // static DataElement MakeDataElement(const std::string& str) {
92 element.SetToBytes(str.c_str(), str.size()); 92 // DataElement element;
93 return element; 93 // element.SetToBytes(str.c_str(), str.size());
94 } 94 // return element;
95 95 //}
96 static blink::WebThreadSafeData CreateData(const std::string& str) { 96 //
97 return blink::WebThreadSafeData(str.c_str(), str.size()); 97 // static blink::WebThreadSafeData CreateData(const std::string& str) {
98 } 98 // return blink::WebThreadSafeData(str.c_str(), str.size());
99 99 //}
100 } // namespace 100 //
101 101 //} // namespace
102 class BlobTransportControllerTest : public testing::Test { 102 //
103 public: 103 // class BlobTransportControllerTest : public testing::Test {
104 BlobTransportControllerTest() : thread_runner_handle_(io_thread_runner_) {} 104 // public:
105 105 // BlobTransportControllerTest() : thread_runner_handle_(io_thread_runner_) {}
106 void SetUp() override { 106 //
107 sender_ = new BlobTransportControllerTestSender(&sink_); 107 // void SetUp() override {
108 BlobTransportController::GetInstance()->CancelAllBlobTransfers(); 108 // sender_ = new BlobTransportControllerTestSender(&sink_);
109 } 109 // BlobTransportController::GetInstance()->CancelAllBlobTransfers();
110 110 // }
111 void OnMemoryRequest( 111 //
112 BlobTransportController* holder, 112 // void OnMemoryRequest(
113 const std::string uuid, 113 // BlobTransportController* holder,
114 const std::vector<storage::BlobItemBytesRequest>& requests, 114 // const std::string uuid,
115 std::vector<base::SharedMemoryHandle>* memory_handles, 115 // const std::vector<storage::BlobItemBytesRequest>& requests,
116 std::vector<IPC::PlatformFileForTransit> file_handles) { 116 // std::vector<base::SharedMemoryHandle>* memory_handles,
117 holder->OnMemoryRequest(uuid, requests, memory_handles, file_handles, 117 // std::vector<IPC::PlatformFileForTransit> file_handles) {
118 file_thread_runner_.get(), &sink_); 118 // holder->OnMemoryRequest(uuid, requests, memory_handles, file_handles,
119 } 119 // file_thread_runner_.get(), &sink_);
120 120 // }
121 FilePath CreateTemporaryFile() { 121 //
122 FilePath path; 122 // FilePath CreateTemporaryFile() {
123 EXPECT_TRUE(base::CreateTemporaryFile(&path)); 123 // FilePath path;
124 files_opened_.push_back(path); 124 // EXPECT_TRUE(base::CreateTemporaryFile(&path));
125 return path; 125 // files_opened_.push_back(path);
126 } 126 // return path;
127 127 // }
128 void ExpectRegisterAndStartMessage(const std::string& expected_uuid, 128 //
129 const std::string& expected_content_type, 129 // void ExpectRegisterAndStartMessage(const std::string& expected_uuid,
130 std::vector<DataElement>* descriptions) { 130 // const std::string& expected_content_type,
131 const IPC::Message* register_message = 131 // std::vector<DataElement>* descriptions) {
132 sink_.GetUniqueMessageMatching(BlobStorageMsg_RegisterBlobUUID::ID); 132 // const IPC::Message* register_message =
133 const IPC::Message* start_message = 133 // sink_.GetUniqueMessageMatching(BlobStorageMsg_RegisterBlobUUID::ID);
134 sink_.GetUniqueMessageMatching(BlobStorageMsg_StartBuildingBlob::ID); 134 // const IPC::Message* start_message =
135 ASSERT_TRUE(register_message); 135 // sink_.GetUniqueMessageMatching(BlobStorageMsg_StartBuildingBlob::ID);
136 ASSERT_TRUE(start_message); 136 // ASSERT_TRUE(register_message);
137 std::tuple<std::string, std::string, std::string, std::set<std::string>> 137 // ASSERT_TRUE(start_message);
138 register_contents; 138 // std::tuple<std::string, std::string, std::string, std::set<std::string>>
139 std::tuple<std::string, std::vector<DataElement>> start_contents; 139 // register_contents;
140 BlobStorageMsg_RegisterBlobUUID::Read(register_message, &register_contents); 140 // std::tuple<std::string, std::vector<DataElement>> start_contents;
141 BlobStorageMsg_StartBuildingBlob::Read(start_message, &start_contents); 141 // BlobStorageMsg_RegisterBlobUUID::Read(register_message,
142 EXPECT_EQ(expected_uuid, std::get<0>(register_contents)); 142 // &register_contents);
143 EXPECT_EQ(expected_uuid, std::get<0>(start_contents)); 143 // BlobStorageMsg_StartBuildingBlob::Read(start_message, &start_contents);
144 EXPECT_EQ(expected_content_type, std::get<1>(register_contents)); 144 // EXPECT_EQ(expected_uuid, std::get<0>(register_contents));
145 if (descriptions) 145 // EXPECT_EQ(expected_uuid, std::get<0>(start_contents));
146 *descriptions = std::get<1>(start_contents); 146 // EXPECT_EQ(expected_content_type, std::get<1>(register_contents));
147 // We don't have dispositions from the renderer. 147 // if (descriptions)
148 EXPECT_TRUE(std::get<2>(register_contents).empty()); 148 // *descriptions = std::get<1>(start_contents);
149 sink_.ClearMessages(); 149 // // We don't have dispositions from the renderer.
150 } 150 // EXPECT_TRUE(std::get<2>(register_contents).empty());
151 151 // sink_.ClearMessages();
152 void ExpectMemoryResponses( 152 // }
153 const std::string& expected_uuid, 153 //
154 std::vector<storage::BlobItemBytesResponse> expected_responses) { 154 // void ExpectMemoryResponses(
155 const IPC::Message* responses_message = 155 // const std::string& expected_uuid,
156 sink_.GetUniqueMessageMatching(BlobStorageMsg_MemoryItemResponse::ID); 156 // std::vector<storage::BlobItemBytesResponse> expected_responses) {
157 ASSERT_TRUE(responses_message); 157 // const IPC::Message* responses_message =
158 std::tuple<std::string, std::vector<storage::BlobItemBytesResponse>> 158 // sink_.GetUniqueMessageMatching(BlobStorageMsg_MemoryItemResponse::ID);
159 responses_content; 159 // ASSERT_TRUE(responses_message);
160 BlobStorageMsg_MemoryItemResponse::Read(responses_message, 160 // std::tuple<std::string, std::vector<storage::BlobItemBytesResponse>>
161 &responses_content); 161 // responses_content;
162 EXPECT_EQ(expected_uuid, std::get<0>(responses_content)); 162 // BlobStorageMsg_MemoryItemResponse::Read(responses_message,
163 EXPECT_EQ(expected_responses, std::get<1>(responses_content)); 163 // &responses_content);
164 sink_.ClearMessages(); 164 // EXPECT_EQ(expected_uuid, std::get<0>(responses_content));
165 } 165 // EXPECT_EQ(expected_responses, std::get<1>(responses_content));
166 166 // sink_.ClearMessages();
167 void ExpectCancel(const std::string& expected_uuid, 167 // }
168 storage::IPCBlobCreationCancelCode expected_code) { 168 //
169 const IPC::Message* cancel_message = 169 // void ExpectCancel(const std::string& expected_uuid,
170 sink_.GetUniqueMessageMatching(BlobStorageMsg_CancelBuildingBlob::ID); 170 // storage::IPCBlobCreationCancelCode expected_code) {
171 ASSERT_TRUE(cancel_message); 171 // const IPC::Message* cancel_message =
172 std::tuple<std::string, storage::IPCBlobCreationCancelCode> cancel_content; 172 // sink_.GetUniqueMessageMatching(BlobStorageMsg_CancelBuildingBlob::ID);
173 BlobStorageMsg_CancelBuildingBlob::Read(cancel_message, &cancel_content); 173 // ASSERT_TRUE(cancel_message);
174 EXPECT_EQ(expected_uuid, std::get<0>(cancel_content)); 174 // std::tuple<std::string, storage::IPCBlobCreationCancelCode>
175 EXPECT_EQ(expected_code, std::get<1>(cancel_content)); 175 // cancel_content;
176 } 176 // BlobStorageMsg_CancelBuildingBlob::Read(cancel_message, &cancel_content);
177 177 // EXPECT_EQ(expected_uuid, std::get<0>(cancel_content));
178 void TearDown() override { 178 // EXPECT_EQ(expected_code, std::get<1>(cancel_content));
179 BlobTransportController::GetInstance()->CancelAllBlobTransfers(); 179 // }
180 for (const FilePath& path : files_opened_) { 180 //
181 EXPECT_TRUE(base::DeleteFile(path, false)); 181 // void TearDown() override {
182 } 182 // BlobTransportController::GetInstance()->CancelAllBlobTransfers();
183 EXPECT_FALSE(io_thread_runner_->HasPendingTask()); 183 // for (const FilePath& path : files_opened_) {
184 EXPECT_FALSE(file_thread_runner_->HasPendingTask()); 184 // EXPECT_TRUE(base::DeleteFile(path, false));
185 EXPECT_FALSE(main_thread_runner_->HasPendingTask()); 185 // }
186 } 186 // EXPECT_FALSE(io_thread_runner_->HasPendingTask());
187 187 // EXPECT_FALSE(file_thread_runner_->HasPendingTask());
188 protected: 188 // EXPECT_FALSE(main_thread_runner_->HasPendingTask());
189 std::vector<FilePath> files_opened_; 189 // }
190 190 //
191 IPC::TestSink sink_; 191 // protected:
192 scoped_refptr<BlobTransportControllerTestSender> sender_; 192 // std::vector<FilePath> files_opened_;
193 193 //
194 // Thread runners. 194 // IPC::TestSink sink_;
195 scoped_refptr<base::TestSimpleTaskRunner> io_thread_runner_ = 195 // scoped_refptr<BlobTransportControllerTestSender> sender_;
196 new TestSimpleTaskRunner(); 196 //
197 scoped_refptr<base::TestSimpleTaskRunner> file_thread_runner_ = 197 // // Thread runners.
198 new TestSimpleTaskRunner(); 198 // scoped_refptr<base::TestSimpleTaskRunner> io_thread_runner_ =
199 scoped_refptr<OtherThreadTestSimpleTaskRunner> main_thread_runner_ = 199 // new TestSimpleTaskRunner();
200 new OtherThreadTestSimpleTaskRunner(); 200 // scoped_refptr<base::TestSimpleTaskRunner> file_thread_runner_ =
201 201 // new TestSimpleTaskRunner();
202 // We set this to the IO thread runner, as this is used for the 202 // scoped_refptr<OtherThreadTestSimpleTaskRunner> main_thread_runner_ =
203 // OnMemoryRequest calls, which are on that thread. 203 // new OtherThreadTestSimpleTaskRunner();
204 base::ThreadTaskRunnerHandle thread_runner_handle_; 204 //
205 }; 205 // // We set this to the IO thread runner, as this is used for the
206 206 // // OnMemoryRequest calls, which are on that thread.
207 TEST_F(BlobTransportControllerTest, Descriptions) { 207 // base::ThreadTaskRunnerHandle thread_runner_handle_;
208 const std::string kBlobUUID = "uuid"; 208 //};
209 const std::string KRefBlobUUID = "refuuid"; 209 //
210 const std::string kBadBlobUUID = "uuuidBad"; 210 // TEST_F(BlobTransportControllerTest, Descriptions) {
211 const size_t kShortcutSize = 11; 211 // const std::string kBlobUUID = "uuid";
212 212 // const std::string KRefBlobUUID = "refuuid";
213 // The first two data elements should be combined and the data shortcut. 213 // const std::string kBadBlobUUID = "uuuidBad";
214 scoped_refptr<BlobConsolidation> consolidation(new BlobConsolidation()); 214 // const size_t kShortcutSize = 11;
215 consolidation->AddBlobItem(KRefBlobUUID, 10, 10); 215 //
216 consolidation->AddDataItem(CreateData("Hello")); 216 // // The first two data elements should be combined and the data shortcut.
217 consolidation->AddDataItem(CreateData("Hello2")); 217 // scoped_refptr<BlobConsolidation> consolidation(new BlobConsolidation());
218 consolidation->AddBlobItem(KRefBlobUUID, 0, 10); 218 // consolidation->AddBlobItem(KRefBlobUUID, 10, 10);
219 consolidation->AddDataItem(CreateData("Hello3")); 219 // consolidation->AddDataItem(CreateData("Hello"));
220 220 // consolidation->AddDataItem(CreateData("Hello2"));
221 std::vector<DataElement> out; 221 // consolidation->AddBlobItem(KRefBlobUUID, 0, 10);
222 BlobTransportController::GetDescriptions(consolidation.get(), kShortcutSize, 222 // consolidation->AddDataItem(CreateData("Hello3"));
223 &out); 223 //
224 224 // std::vector<DataElement> out;
225 std::vector<DataElement> expected; 225 // BlobTransportController::GetDescriptions(consolidation.get(), kShortcutSize,
226 expected.push_back(MakeBlobElement(KRefBlobUUID, 10, 10)); 226 // &out);
227 expected.push_back(MakeDataElement("HelloHello2")); 227 //
228 expected.push_back(MakeBlobElement(KRefBlobUUID, 0, 10)); 228 // std::vector<DataElement> expected;
229 expected.push_back(MakeDataDescriptionElement(6)); 229 // expected.push_back(MakeBlobElement(KRefBlobUUID, 10, 10));
230 EXPECT_EQ(expected, out); 230 // expected.push_back(MakeDataElement("HelloHello2"));
231 } 231 // expected.push_back(MakeBlobElement(KRefBlobUUID, 0, 10));
232 232 // expected.push_back(MakeDataDescriptionElement(6));
233 TEST_F(BlobTransportControllerTest, Responses) { 233 // EXPECT_EQ(expected, out);
234 const std::string kBlobUUID = "uuid"; 234 //}
235 const std::string KRefBlobUUID = "refuuid"; 235 //
236 const std::string kBadBlobUUID = "uuuidBad"; 236 // TEST_F(BlobTransportControllerTest, Responses) {
237 BlobTransportController* holder = BlobTransportController::GetInstance(); 237 // const std::string kBlobUUID = "uuid";
238 238 // const std::string KRefBlobUUID = "refuuid";
239 // The first two data elements should be combined. 239 // const std::string kBadBlobUUID = "uuuidBad";
240 scoped_refptr<BlobConsolidation> consolidation = new BlobConsolidation(); 240 // BlobTransportController* holder = BlobTransportController::GetInstance();
241 consolidation->AddBlobItem(KRefBlobUUID, 10, 10); 241 //
242 consolidation->AddDataItem(CreateData("Hello")); 242 // // The first two data elements should be combined.
243 consolidation->AddDataItem(CreateData("Hello2")); 243 // scoped_refptr<BlobConsolidation> consolidation = new BlobConsolidation();
244 consolidation->AddBlobItem(KRefBlobUUID, 0, 10); 244 // consolidation->AddBlobItem(KRefBlobUUID, 10, 10);
245 consolidation->AddDataItem(CreateData("Hello3")); 245 // consolidation->AddDataItem(CreateData("Hello"));
246 // See the above test for the expected descriptions layout. 246 // consolidation->AddDataItem(CreateData("Hello2"));
247 247 // consolidation->AddBlobItem(KRefBlobUUID, 0, 10);
248 holder->blob_storage_[kBlobUUID] = consolidation; 248 // consolidation->AddDataItem(CreateData("Hello3"));
249 249 // // See the above test for the expected descriptions layout.
250 std::vector<BlobItemBytesRequest> requests; 250 //
251 std::vector<base::SharedMemoryHandle> memory_handles; 251 // holder->blob_storage_[kBlobUUID] = consolidation;
252 std::vector<IPC::PlatformFileForTransit> file_handles; 252 //
253 253 // std::vector<BlobItemBytesRequest> requests;
254 // Request for all of first data 254 // std::vector<base::SharedMemoryHandle> memory_handles;
255 requests.push_back(BlobItemBytesRequest::CreateIPCRequest(0, 1, 0, 11)); 255 // std::vector<IPC::PlatformFileForTransit> file_handles;
256 OnMemoryRequest(holder, kBlobUUID, requests, &memory_handles, file_handles); 256 //
257 std::vector<storage::BlobItemBytesResponse> expected; 257 // // Request for all of first data
258 expected.push_back(ResponseWithData(0, "HelloHello2")); 258 // requests.push_back(BlobItemBytesRequest::CreateIPCRequest(0, 1, 0, 11));
259 ExpectMemoryResponses(kBlobUUID, expected); 259 // OnMemoryRequest(holder, kBlobUUID, requests, &memory_handles, file_handles);
260 260 // std::vector<storage::BlobItemBytesResponse> expected;
261 // Part of second data 261 // expected.push_back(ResponseWithData(0, "HelloHello2"));
262 requests[0] = BlobItemBytesRequest::CreateIPCRequest(1000, 3, 1, 5); 262 // ExpectMemoryResponses(kBlobUUID, expected);
263 OnMemoryRequest(holder, kBlobUUID, requests, &memory_handles, file_handles); 263 //
264 expected.clear(); 264 // // Part of second data
265 expected.push_back(ResponseWithData(1000, "ello3")); 265 // requests[0] = BlobItemBytesRequest::CreateIPCRequest(1000, 3, 1, 5);
266 ExpectMemoryResponses(kBlobUUID, expected); 266 // OnMemoryRequest(holder, kBlobUUID, requests, &memory_handles, file_handles);
267 267 // expected.clear();
268 // Both data segments 268 // expected.push_back(ResponseWithData(1000, "ello3"));
269 requests[0] = BlobItemBytesRequest::CreateIPCRequest(0, 1, 0, 11); 269 // ExpectMemoryResponses(kBlobUUID, expected);
270 requests.push_back(BlobItemBytesRequest::CreateIPCRequest(1, 3, 0, 6)); 270 //
271 OnMemoryRequest(holder, kBlobUUID, requests, &memory_handles, file_handles); 271 // // Both data segments
272 expected.clear(); 272 // requests[0] = BlobItemBytesRequest::CreateIPCRequest(0, 1, 0, 11);
273 expected.push_back(ResponseWithData(0, "HelloHello2")); 273 // requests.push_back(BlobItemBytesRequest::CreateIPCRequest(1, 3, 0, 6));
274 expected.push_back(ResponseWithData(1, "Hello3")); 274 // OnMemoryRequest(holder, kBlobUUID, requests, &memory_handles, file_handles);
275 ExpectMemoryResponses(kBlobUUID, expected); 275 // expected.clear();
276 } 276 // expected.push_back(ResponseWithData(0, "HelloHello2"));
277 277 // expected.push_back(ResponseWithData(1, "Hello3"));
278 TEST_F(BlobTransportControllerTest, SharedMemory) { 278 // ExpectMemoryResponses(kBlobUUID, expected);
279 const std::string kBlobUUID = "uuid"; 279 //}
280 const std::string KRefBlobUUID = "refuuid"; 280 //
281 const std::string kBadBlobUUID = "uuuidBad"; 281 // TEST_F(BlobTransportControllerTest, SharedMemory) {
282 BlobTransportController* holder = BlobTransportController::GetInstance(); 282 // const std::string kBlobUUID = "uuid";
283 283 // const std::string KRefBlobUUID = "refuuid";
284 // The first two data elements should be combined. 284 // const std::string kBadBlobUUID = "uuuidBad";
285 scoped_refptr<BlobConsolidation> consolidation = new BlobConsolidation(); 285 // BlobTransportController* holder = BlobTransportController::GetInstance();
286 consolidation->AddBlobItem(KRefBlobUUID, 10, 10); 286 //
287 consolidation->AddDataItem(CreateData("Hello")); 287 // // The first two data elements should be combined.
288 consolidation->AddDataItem(CreateData("Hello2")); 288 // scoped_refptr<BlobConsolidation> consolidation = new BlobConsolidation();
289 consolidation->AddBlobItem(KRefBlobUUID, 0, 10); 289 // consolidation->AddBlobItem(KRefBlobUUID, 10, 10);
290 consolidation->AddDataItem(CreateData("Hello3")); 290 // consolidation->AddDataItem(CreateData("Hello"));
291 // See the above test for the expected descriptions layout. 291 // consolidation->AddDataItem(CreateData("Hello2"));
292 292 // consolidation->AddBlobItem(KRefBlobUUID, 0, 10);
293 holder->blob_storage_[kBlobUUID] = consolidation; 293 // consolidation->AddDataItem(CreateData("Hello3"));
294 294 // // See the above test for the expected descriptions layout.
295 std::vector<BlobItemBytesRequest> requests; 295 //
296 std::vector<base::SharedMemoryHandle> memory_handles; 296 // holder->blob_storage_[kBlobUUID] = consolidation;
297 std::vector<IPC::PlatformFileForTransit> file_handles; 297 //
298 298 // std::vector<BlobItemBytesRequest> requests;
299 // Request for all data in shared memory 299 // std::vector<base::SharedMemoryHandle> memory_handles;
300 requests.push_back( 300 // std::vector<IPC::PlatformFileForTransit> file_handles;
301 BlobItemBytesRequest::CreateSharedMemoryRequest(0, 1, 0, 11, 0, 0)); 301 //
302 requests.push_back( 302 // // Request for all data in shared memory
303 BlobItemBytesRequest::CreateSharedMemoryRequest(1, 3, 0, 6, 0, 11)); 303 // requests.push_back(
304 base::SharedMemory memory; 304 // BlobItemBytesRequest::CreateSharedMemoryRequest(0, 1, 0, 11, 0, 0));
305 memory.CreateAndMapAnonymous(11 + 6); 305 // requests.push_back(
306 base::SharedMemoryHandle handle = 306 // BlobItemBytesRequest::CreateSharedMemoryRequest(1, 3, 0, 6, 0, 11));
307 base::SharedMemory::DuplicateHandle(memory.handle()); 307 // base::SharedMemory memory;
308 CHECK(base::SharedMemory::NULLHandle() != handle); 308 // memory.CreateAndMapAnonymous(11 + 6);
309 memory_handles.push_back(handle); 309 // base::SharedMemoryHandle handle =
310 310 // base::SharedMemory::DuplicateHandle(memory.handle());
311 OnMemoryRequest(holder, kBlobUUID, requests, &memory_handles, file_handles); 311 // CHECK(base::SharedMemory::NULLHandle() != handle);
312 std::vector<storage::BlobItemBytesResponse> expected; 312 // memory_handles.push_back(handle);
313 expected.push_back(BlobItemBytesResponse(0)); 313 //
314 expected.push_back(BlobItemBytesResponse(1)); 314 // OnMemoryRequest(holder, kBlobUUID, requests, &memory_handles, file_handles);
315 ExpectMemoryResponses(kBlobUUID, expected); 315 // std::vector<storage::BlobItemBytesResponse> expected;
316 std::string expected_memory = "HelloHello2Hello3"; 316 // expected.push_back(BlobItemBytesResponse(0));
317 const char* mem_location = static_cast<const char*>(memory.memory()); 317 // expected.push_back(BlobItemBytesResponse(1));
318 std::vector<char> value(mem_location, mem_location + memory.requested_size()); 318 // ExpectMemoryResponses(kBlobUUID, expected);
319 EXPECT_THAT(value, testing::ElementsAreArray(expected_memory.c_str(), 319 // std::string expected_memory = "HelloHello2Hello3";
320 expected_memory.size())); 320 // const char* mem_location = static_cast<const char*>(memory.memory());
321 } 321 // std::vector<char> value(mem_location, mem_location +
322 322 // memory.requested_size());
323 TEST_F(BlobTransportControllerTest, Disk) { 323 // EXPECT_THAT(value, testing::ElementsAreArray(expected_memory.c_str(),
324 const std::string kBlobUUID = "uuid"; 324 // expected_memory.size()));
325 const std::string kRefBlobUUID = "refuuid"; 325 //}
326 const std::string kBadBlobUUID = "uuuidBad"; 326 //
327 const std::string kDataPart1 = "Hello"; 327 // TEST_F(BlobTransportControllerTest, Disk) {
328 const std::string kDataPart2 = "Hello2"; 328 // const std::string kBlobUUID = "uuid";
329 const std::string kDataPart3 = "Hello3"; 329 // const std::string kRefBlobUUID = "refuuid";
330 const std::string kData = "HelloHello2Hello3"; 330 // const std::string kBadBlobUUID = "uuuidBad";
331 BlobTransportController* holder = BlobTransportController::GetInstance(); 331 // const std::string kDataPart1 = "Hello";
332 FilePath path1 = CreateTemporaryFile(); 332 // const std::string kDataPart2 = "Hello2";
333 File file(path1, File::FLAG_OPEN | File::FLAG_WRITE | File::FLAG_READ); 333 // const std::string kDataPart3 = "Hello3";
334 ASSERT_TRUE(file.IsValid()); 334 // const std::string kData = "HelloHello2Hello3";
335 ASSERT_TRUE(file.SetLength(11 + 6)); 335 // BlobTransportController* holder = BlobTransportController::GetInstance();
336 // The first two data elements should be combined. 336 // FilePath path1 = CreateTemporaryFile();
337 scoped_refptr<BlobConsolidation> consolidation(new BlobConsolidation()); 337 // File file(path1, File::FLAG_OPEN | File::FLAG_WRITE | File::FLAG_READ);
338 consolidation->AddBlobItem(kRefBlobUUID, 10, 10); 338 // ASSERT_TRUE(file.IsValid());
339 consolidation->AddDataItem(CreateData(kDataPart1)); 339 // ASSERT_TRUE(file.SetLength(11 + 6));
340 consolidation->AddDataItem(CreateData(kDataPart2)); 340 // // The first two data elements should be combined.
341 consolidation->AddBlobItem(kRefBlobUUID, 0, 10); 341 // scoped_refptr<BlobConsolidation> consolidation(new BlobConsolidation());
342 consolidation->AddDataItem(CreateData(kDataPart3)); 342 // consolidation->AddBlobItem(kRefBlobUUID, 10, 10);
343 // See the above test for the expected descriptions layout. 343 // consolidation->AddDataItem(CreateData(kDataPart1));
344 holder->blob_storage_[kBlobUUID] = consolidation; 344 // consolidation->AddDataItem(CreateData(kDataPart2));
345 holder->main_thread_runner_ = main_thread_runner_; 345 // consolidation->AddBlobItem(kRefBlobUUID, 0, 10);
346 std::vector<BlobItemBytesRequest> requests; 346 // consolidation->AddDataItem(CreateData(kDataPart3));
347 std::vector<base::SharedMemoryHandle> memory_handles; 347 // // See the above test for the expected descriptions layout.
348 std::vector<IPC::PlatformFileForTransit> file_handles; 348 // holder->blob_storage_[kBlobUUID] = consolidation;
349 // Request for all data in files. 349 // holder->main_thread_runner_ = main_thread_runner_;
350 requests.push_back( 350 // std::vector<BlobItemBytesRequest> requests;
351 BlobItemBytesRequest::CreateFileRequest(0, 1, 0, 11, 0, 0)); 351 // std::vector<base::SharedMemoryHandle> memory_handles;
352 requests.push_back( 352 // std::vector<IPC::PlatformFileForTransit> file_handles;
353 BlobItemBytesRequest::CreateFileRequest(1, 3, 0, 6, 0, 11)); 353 // // Request for all data in files.
354 file_handles.push_back(IPC::TakePlatformFileForTransit(std::move(file))); 354 // requests.push_back(
355 OnMemoryRequest(holder, kBlobUUID, requests, &memory_handles, file_handles); 355 // BlobItemBytesRequest::CreateFileRequest(0, 1, 0, 11, 0, 0));
356 file_handles.clear(); 356 // requests.push_back(
357 EXPECT_TRUE(file_thread_runner_->HasPendingTask()); 357 // BlobItemBytesRequest::CreateFileRequest(1, 3, 0, 6, 0, 11));
358 EXPECT_FALSE(io_thread_runner_->HasPendingTask()); 358 // file_handles.push_back(IPC::TakePlatformFileForTransit(std::move(file)));
359 file_thread_runner_->RunPendingTasks(); 359 // OnMemoryRequest(holder, kBlobUUID, requests, &memory_handles, file_handles);
360 EXPECT_FALSE(file_thread_runner_->HasPendingTask()); 360 // file_handles.clear();
361 EXPECT_TRUE(io_thread_runner_->HasPendingTask()); 361 // EXPECT_TRUE(file_thread_runner_->HasPendingTask());
362 io_thread_runner_->RunPendingTasks(); 362 // EXPECT_FALSE(io_thread_runner_->HasPendingTask());
363 std::vector<storage::BlobItemBytesResponse> expected = { 363 // file_thread_runner_->RunPendingTasks();
364 BlobItemBytesResponse(0), BlobItemBytesResponse(1)}; 364 // EXPECT_FALSE(file_thread_runner_->HasPendingTask());
365 ExpectMemoryResponses(kBlobUUID, expected); 365 // EXPECT_TRUE(io_thread_runner_->HasPendingTask());
366 file = File(path1, File::FLAG_OPEN | File::FLAG_READ); 366 // io_thread_runner_->RunPendingTasks();
367 char data[11 + 6]; 367 // std::vector<storage::BlobItemBytesResponse> expected = {
368 file.Read(0, data, 11 + 6); 368 // BlobItemBytesResponse(0), BlobItemBytesResponse(1)};
369 std::vector<char> value(data, data + 11 + 6); 369 // ExpectMemoryResponses(kBlobUUID, expected);
370 EXPECT_THAT(value, testing::ElementsAreArray(kData.c_str(), kData.size())); 370 // file = File(path1, File::FLAG_OPEN | File::FLAG_READ);
371 371 // char data[11 + 6];
372 // Finally, test that we get errors correctly. 372 // file.Read(0, data, 11 + 6);
373 FilePath path2 = CreateTemporaryFile(); 373 // std::vector<char> value(data, data + 11 + 6);
374 EXPECT_TRUE(base::MakeFileUnwritable(path2)); 374 // EXPECT_THAT(value, testing::ElementsAreArray(kData.c_str(), kData.size()));
375 File file2(path2, File::FLAG_OPEN | File::FLAG_WRITE); 375 //
376 EXPECT_FALSE(file2.IsValid()); 376 // // Finally, test that we get errors correctly.
377 file_handles.push_back(IPC::TakePlatformFileForTransit(std::move(file2))); 377 // FilePath path2 = CreateTemporaryFile();
378 OnMemoryRequest(holder, kBlobUUID, requests, &memory_handles, file_handles); 378 // EXPECT_TRUE(base::MakeFileUnwritable(path2));
379 EXPECT_TRUE(file_thread_runner_->HasPendingTask()); 379 // File file2(path2, File::FLAG_OPEN | File::FLAG_WRITE);
380 file_thread_runner_->RunPendingTasks(); 380 // EXPECT_FALSE(file2.IsValid());
381 EXPECT_TRUE(io_thread_runner_->HasPendingTask()); 381 // file_handles.push_back(IPC::TakePlatformFileForTransit(std::move(file2)));
382 io_thread_runner_->RunPendingTasks(); 382 // OnMemoryRequest(holder, kBlobUUID, requests, &memory_handles, file_handles);
383 // Clear the main thread task, as it has the AddRef job. 383 // EXPECT_TRUE(file_thread_runner_->HasPendingTask());
384 EXPECT_TRUE(main_thread_runner_->HasPendingTask()); 384 // file_thread_runner_->RunPendingTasks();
385 main_thread_runner_->ClearPendingTasks(); 385 // EXPECT_TRUE(io_thread_runner_->HasPendingTask());
386 ExpectCancel(kBlobUUID, IPCBlobCreationCancelCode::FILE_WRITE_FAILED); 386 // io_thread_runner_->RunPendingTasks();
387 } 387 // // Clear the main thread task, as it has the AddRef job.
388 388 // EXPECT_TRUE(main_thread_runner_->HasPendingTask());
389 TEST_F(BlobTransportControllerTest, PublicMethods) { 389 // main_thread_runner_->ClearPendingTasks();
390 const std::string kBlobUUID = "uuid"; 390 // ExpectCancel(kBlobUUID, IPCBlobCreationCancelCode::FILE_WRITE_FAILED);
391 const std::string kBlobContentType = "content_type"; 391 //}
392 const std::string kBlob2UUID = "uuid2"; 392 //
393 const std::string kBlob2ContentType = "content_type2"; 393 // TEST_F(BlobTransportControllerTest, PublicMethods) {
394 const std::string KRefBlobUUID = "refuuid"; 394 // const std::string kBlobUUID = "uuid";
395 const std::string kDataPart1 = "Hello"; 395 // const std::string kBlobContentType = "content_type";
396 const std::string kDataPart2 = "Hello2"; 396 // const std::string kBlob2UUID = "uuid2";
397 const std::string kDataPart3 = "Hello3"; 397 // const std::string kBlob2ContentType = "content_type2";
398 const std::string kData = "HelloHello2Hello3"; 398 // const std::string KRefBlobUUID = "refuuid";
399 std::vector<DataElement> message_descriptions; 399 // const std::string kDataPart1 = "Hello";
400 BlobTransportController* holder = BlobTransportController::GetInstance(); 400 // const std::string kDataPart2 = "Hello2";
401 401 // const std::string kDataPart3 = "Hello3";
402 // Here we test that the 402 // const std::string kData = "HelloHello2Hello3";
403 scoped_refptr<BlobConsolidation> consolidation = new BlobConsolidation(); 403 // std::vector<DataElement> message_descriptions;
404 consolidation->AddBlobItem(KRefBlobUUID, 10, 10); 404 // BlobTransportController* holder = BlobTransportController::GetInstance();
405 BlobTransportController::InitiateBlobTransfer( 405 //
406 kBlobUUID, kBlobContentType, consolidation, sender_, 406 // // Here we test that the
407 io_thread_runner_.get(), main_thread_runner_); 407 // scoped_refptr<BlobConsolidation> consolidation = new BlobConsolidation();
408 // Check that we have the 'increase ref' pending task. 408 // consolidation->AddBlobItem(KRefBlobUUID, 10, 10);
409 EXPECT_TRUE(main_thread_runner_->HasPendingTask()); 409 // BlobTransportController::InitiateBlobTransfer(
410 // Check that we have the 'store' pending task. 410 // kBlobUUID, kBlobContentType, consolidation, sender_,
411 EXPECT_TRUE(io_thread_runner_->HasPendingTask()); 411 // io_thread_runner_.get(), main_thread_runner_);
412 // Check that we've sent the data. 412 // // Check that we have the 'increase ref' pending task.
413 ExpectRegisterAndStartMessage(kBlobUUID, kBlobContentType, 413 // EXPECT_TRUE(main_thread_runner_->HasPendingTask());
414 &message_descriptions); 414 // // Check that we have the 'store' pending task.
415 main_thread_runner_->ClearPendingTasks(); 415 // EXPECT_TRUE(io_thread_runner_->HasPendingTask());
416 416 // // Check that we've sent the data.
417 // Check that we got the correct start message. 417 // ExpectRegisterAndStartMessage(kBlobUUID, kBlobContentType,
418 EXPECT_FALSE(holder->IsTransporting(kBlobUUID)); 418 // &message_descriptions);
419 io_thread_runner_->RunPendingTasks(); 419 // main_thread_runner_->ClearPendingTasks();
420 EXPECT_TRUE(holder->IsTransporting(kBlobUUID)); 420 //
421 std::tuple<std::string, std::vector<DataElement>> message_contents; 421 // // Check that we got the correct start message.
422 EXPECT_TRUE(holder->IsTransporting(kBlobUUID)); 422 // EXPECT_FALSE(holder->IsTransporting(kBlobUUID));
423 EXPECT_EQ(MakeBlobElement(KRefBlobUUID, 10, 10), message_descriptions[0]); 423 // io_thread_runner_->RunPendingTasks();
424 424 // EXPECT_TRUE(holder->IsTransporting(kBlobUUID));
425 holder->OnCancel(kBlobUUID, IPCBlobCreationCancelCode::OUT_OF_MEMORY); 425 // std::tuple<std::string, std::vector<DataElement>> message_contents;
426 EXPECT_FALSE(holder->IsTransporting(kBlobUUID)); 426 // EXPECT_TRUE(holder->IsTransporting(kBlobUUID));
427 // Check we have the 'decrease ref' task. 427 // EXPECT_EQ(MakeBlobElement(KRefBlobUUID, 10, 10), message_descriptions[0]);
428 EXPECT_TRUE(main_thread_runner_->HasPendingTask()); 428 //
429 main_thread_runner_->ClearPendingTasks(); 429 // holder->OnCancel(kBlobUUID, IPCBlobCreationCancelCode::OUT_OF_MEMORY);
430 sink_.ClearMessages(); 430 // EXPECT_FALSE(holder->IsTransporting(kBlobUUID));
431 431 // // Check we have the 'decrease ref' task.
432 // Add the second. 432 // EXPECT_TRUE(main_thread_runner_->HasPendingTask());
433 scoped_refptr<BlobConsolidation> consolidation2 = new BlobConsolidation(); 433 // main_thread_runner_->ClearPendingTasks();
434 consolidation2->AddBlobItem(KRefBlobUUID, 10, 10); 434 // sink_.ClearMessages();
435 // These items should be combined. 435 //
436 consolidation2->AddDataItem(CreateData(kDataPart1)); 436 // // Add the second.
437 consolidation2->AddDataItem(CreateData(kDataPart2)); 437 // scoped_refptr<BlobConsolidation> consolidation2 = new BlobConsolidation();
438 consolidation2->AddDataItem(CreateData(kDataPart3)); 438 // consolidation2->AddBlobItem(KRefBlobUUID, 10, 10);
439 BlobTransportController::InitiateBlobTransfer( 439 // // These items should be combined.
440 kBlob2UUID, kBlob2ContentType, consolidation2, sender_, 440 // consolidation2->AddDataItem(CreateData(kDataPart1));
441 io_thread_runner_.get(), main_thread_runner_); 441 // consolidation2->AddDataItem(CreateData(kDataPart2));
442 // Check that we have the 'increase ref' pending task. 442 // consolidation2->AddDataItem(CreateData(kDataPart3));
443 EXPECT_TRUE(main_thread_runner_->HasPendingTask()); 443 // BlobTransportController::InitiateBlobTransfer(
444 // Check that we have the 'store' pending task. 444 // kBlob2UUID, kBlob2ContentType, consolidation2, sender_,
445 EXPECT_TRUE(io_thread_runner_->HasPendingTask()); 445 // io_thread_runner_.get(), main_thread_runner_);
446 // Check that we've sent the data. 446 // // Check that we have the 'increase ref' pending task.
447 message_descriptions.clear(); 447 // EXPECT_TRUE(main_thread_runner_->HasPendingTask());
448 ExpectRegisterAndStartMessage(kBlob2UUID, kBlob2ContentType, 448 // // Check that we have the 'store' pending task.
449 &message_descriptions); 449 // EXPECT_TRUE(io_thread_runner_->HasPendingTask());
450 main_thread_runner_->ClearPendingTasks(); 450 // // Check that we've sent the data.
451 451 // message_descriptions.clear();
452 // Check that we got the correct start message. 452 // ExpectRegisterAndStartMessage(kBlob2UUID, kBlob2ContentType,
453 EXPECT_FALSE(holder->IsTransporting(kBlob2UUID)); 453 // &message_descriptions);
454 io_thread_runner_->RunPendingTasks(); 454 // main_thread_runner_->ClearPendingTasks();
455 EXPECT_TRUE(holder->IsTransporting(kBlob2UUID)); 455 //
456 ASSERT_EQ(2u, message_descriptions.size()); 456 // // Check that we got the correct start message.
457 EXPECT_EQ(MakeBlobElement(KRefBlobUUID, 10, 10), message_descriptions[0]); 457 // EXPECT_FALSE(holder->IsTransporting(kBlob2UUID));
458 EXPECT_EQ(MakeDataElement(kData), message_descriptions[1]); 458 // io_thread_runner_->RunPendingTasks();
459 EXPECT_FALSE(main_thread_runner_->HasPendingTask()); 459 // EXPECT_TRUE(holder->IsTransporting(kBlob2UUID));
460 460 // ASSERT_EQ(2u, message_descriptions.size());
461 // Now we request the memory. 461 // EXPECT_EQ(MakeBlobElement(KRefBlobUUID, 10, 10), message_descriptions[0]);
462 std::vector<BlobItemBytesRequest> requests; 462 // EXPECT_EQ(MakeDataElement(kData), message_descriptions[1]);
463 std::vector<base::SharedMemoryHandle> memory_handles; 463 // EXPECT_FALSE(main_thread_runner_->HasPendingTask());
464 std::vector<IPC::PlatformFileForTransit> file_handles; 464 //
465 requests.push_back( 465 // // Now we request the memory.
466 BlobItemBytesRequest::CreateIPCRequest(0, 1, 0, kData.size())); 466 // std::vector<BlobItemBytesRequest> requests;
467 OnMemoryRequest(holder, kBlob2UUID, requests, &memory_handles, file_handles); 467 // std::vector<base::SharedMemoryHandle> memory_handles;
468 468 // std::vector<IPC::PlatformFileForTransit> file_handles;
469 std::vector<BlobItemBytesResponse> expected_responses; 469 // requests.push_back(
470 BlobItemBytesResponse expected(0); 470 // BlobItemBytesRequest::CreateIPCRequest(0, 1, 0, kData.size()));
471 expected.inline_data = std::vector<char>(kData.begin(), kData.end()); 471 // OnMemoryRequest(holder, kBlob2UUID, requests, &memory_handles,
472 expected_responses.push_back(expected); 472 // file_handles);
473 ExpectMemoryResponses(kBlob2UUID, expected_responses); 473 //
474 EXPECT_FALSE(main_thread_runner_->HasPendingTask()); 474 // std::vector<BlobItemBytesResponse> expected_responses;
475 475 // BlobItemBytesResponse expected(0);
476 // Finish the second one. 476 // expected.inline_data = std::vector<char>(kData.begin(), kData.end());
477 holder->OnDone(kBlob2UUID); 477 // expected_responses.push_back(expected);
478 EXPECT_FALSE(holder->IsTransporting(kBlob2UUID)); 478 // ExpectMemoryResponses(kBlob2UUID, expected_responses);
479 EXPECT_TRUE(main_thread_runner_->HasPendingTask()); 479 // EXPECT_FALSE(main_thread_runner_->HasPendingTask());
480 main_thread_runner_->ClearPendingTasks(); 480 //
481 } 481 // // Finish the second one.
482 482 // holder->OnDone(kBlob2UUID);
483 } // namespace content 483 // EXPECT_FALSE(holder->IsTransporting(kBlob2UUID));
484 // EXPECT_TRUE(main_thread_runner_->HasPendingTask());
485 // main_thread_runner_->ClearPendingTasks();
486 //}
487 //
488 //} // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698