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

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

Issue 2843113002: make base::SharedMemoryHandle a class on POSIX. (Closed)
Patch Set: Fix test error. Created 3 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
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 282 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 293
294 // Request for all data in shared memory 294 // Request for all data in shared memory
295 requests.push_back( 295 requests.push_back(
296 BlobItemBytesRequest::CreateSharedMemoryRequest(0, 1, 0, 11, 0, 0)); 296 BlobItemBytesRequest::CreateSharedMemoryRequest(0, 1, 0, 11, 0, 0));
297 requests.push_back( 297 requests.push_back(
298 BlobItemBytesRequest::CreateSharedMemoryRequest(1, 3, 0, 6, 0, 11)); 298 BlobItemBytesRequest::CreateSharedMemoryRequest(1, 3, 0, 6, 0, 11));
299 base::SharedMemory memory; 299 base::SharedMemory memory;
300 memory.CreateAnonymous(11 + 6); 300 memory.CreateAnonymous(11 + 6);
301 base::SharedMemoryHandle handle = 301 base::SharedMemoryHandle handle =
302 base::SharedMemory::DuplicateHandle(memory.handle()); 302 base::SharedMemory::DuplicateHandle(memory.handle());
303 CHECK(base::SharedMemory::NULLHandle() != handle); 303 CHECK(handle.IsValid());
304 memory_handles.push_back(handle); 304 memory_handles.push_back(handle);
305 305
306 OnMemoryRequest(holder, kBlobUUID, requests, &memory_handles, file_handles); 306 OnMemoryRequest(holder, kBlobUUID, requests, &memory_handles, file_handles);
307 std::vector<storage::BlobItemBytesResponse> expected; 307 std::vector<storage::BlobItemBytesResponse> expected;
308 expected.push_back(BlobItemBytesResponse(0)); 308 expected.push_back(BlobItemBytesResponse(0));
309 expected.push_back(BlobItemBytesResponse(1)); 309 expected.push_back(BlobItemBytesResponse(1));
310 ExpectMemoryResponses(kBlobUUID, expected); 310 ExpectMemoryResponses(kBlobUUID, expected);
311 std::string expected_memory = "HelloHello2Hello3"; 311 std::string expected_memory = "HelloHello2Hello3";
312 memory.Map(11 + 6); 312 memory.Map(11 + 6);
313 const char* mem_location = static_cast<const char*>(memory.memory()); 313 const char* mem_location = static_cast<const char*>(memory.memory());
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
470 EXPECT_FALSE(main_thread_runner_->HasPendingTask()); 470 EXPECT_FALSE(main_thread_runner_->HasPendingTask());
471 471
472 // Finish the second one. 472 // Finish the second one.
473 holder->OnBlobFinalStatus(kBlob2UUID, BlobStatus::DONE); 473 holder->OnBlobFinalStatus(kBlob2UUID, BlobStatus::DONE);
474 EXPECT_FALSE(holder->IsTransporting(kBlob2UUID)); 474 EXPECT_FALSE(holder->IsTransporting(kBlob2UUID));
475 EXPECT_TRUE(main_thread_runner_->HasPendingTask()); 475 EXPECT_TRUE(main_thread_runner_->HasPendingTask());
476 main_thread_runner_->ClearPendingTasks(); 476 main_thread_runner_->ClearPendingTasks();
477 } 477 }
478 478
479 } // namespace content 479 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698