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

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

Issue 1988983003: [BlobStorage] Fix IPC race in sending IPC and posting to IO thread (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix one test Created 4 years, 7 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
« no previous file with comments | « content/child/blob_storage/blob_transport_controller.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 9
10 #include "base/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after
274 274
275 BlobConsolidation* consolidation = new BlobConsolidation(); 275 BlobConsolidation* consolidation = new BlobConsolidation();
276 consolidation->AddBlobItem(KRefBlobUUID, 10, 10); 276 consolidation->AddBlobItem(KRefBlobUUID, 10, 10);
277 BlobTransportController::InitiateBlobTransfer( 277 BlobTransportController::InitiateBlobTransfer(
278 kBlobUUID, kBlobContentType, base::WrapUnique(consolidation), sender_, 278 kBlobUUID, kBlobContentType, base::WrapUnique(consolidation), sender_,
279 io_thread_runner_.get(), main_thread_runner_); 279 io_thread_runner_.get(), main_thread_runner_);
280 // Check that we have the 'increase ref' pending task. 280 // Check that we have the 'increase ref' pending task.
281 EXPECT_TRUE(main_thread_runner_->HasPendingTask()); 281 EXPECT_TRUE(main_thread_runner_->HasPendingTask());
282 // Check that we have the 'store' pending task. 282 // Check that we have the 'store' pending task.
283 EXPECT_TRUE(io_thread_runner_->HasPendingTask()); 283 EXPECT_TRUE(io_thread_runner_->HasPendingTask());
284
285 io_thread_runner_->RunPendingTasks();
284 // Check that we've sent the data. 286 // Check that we've sent the data.
285 ExpectRegisterAndStartMessage(kBlobUUID, kBlobContentType, 287 ExpectRegisterAndStartMessage(kBlobUUID, kBlobContentType,
286 &message_descriptions); 288 &message_descriptions);
287 main_thread_runner_->ClearPendingTasks(); 289 main_thread_runner_->ClearPendingTasks();
288 290
289 // Check that we got the correct start message. 291 // Check that we got the correct start message.
290 EXPECT_FALSE(holder->IsTransporting(kBlobUUID));
291 io_thread_runner_->RunPendingTasks();
292 EXPECT_TRUE(holder->IsTransporting(kBlobUUID)); 292 EXPECT_TRUE(holder->IsTransporting(kBlobUUID));
293 base::Tuple<std::string, std::vector<DataElement>> message_contents; 293 base::Tuple<std::string, std::vector<DataElement>> message_contents;
294 EXPECT_EQ(MakeBlobElement(KRefBlobUUID, 10, 10), message_descriptions[0]); 294 EXPECT_EQ(MakeBlobElement(KRefBlobUUID, 10, 10), message_descriptions[0]);
295 295
296 holder->OnCancel(kBlobUUID, 296 holder->OnCancel(kBlobUUID,
297 storage::IPCBlobCreationCancelCode::OUT_OF_MEMORY); 297 storage::IPCBlobCreationCancelCode::OUT_OF_MEMORY);
298 EXPECT_FALSE(holder->IsTransporting(kBlobUUID)); 298 EXPECT_FALSE(holder->IsTransporting(kBlobUUID));
299 // Check we have the 'decrease ref' task. 299 // Check we have the 'decrease ref' task.
300 EXPECT_TRUE(main_thread_runner_->HasPendingTask()); 300 EXPECT_TRUE(main_thread_runner_->HasPendingTask());
301 main_thread_runner_->ClearPendingTasks(); 301 main_thread_runner_->ClearPendingTasks();
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
339 std::vector<storage::BlobItemBytesResponse> output; 339 std::vector<storage::BlobItemBytesResponse> output;
340 340
341 // Error conditions 341 // Error conditions
342 EXPECT_EQ(ResponsesStatus::BLOB_NOT_FOUND, 342 EXPECT_EQ(ResponsesStatus::BLOB_NOT_FOUND,
343 holder->GetResponses(kBadBlobUUID, requests, &memory_handles, 343 holder->GetResponses(kBadBlobUUID, requests, &memory_handles,
344 file_handles, &output)); 344 file_handles, &output));
345 EXPECT_EQ(0u, output.size()); 345 EXPECT_EQ(0u, output.size());
346 } 346 }
347 347
348 } // namespace content 348 } // namespace content
OLDNEW
« no previous file with comments | « content/child/blob_storage/blob_transport_controller.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698