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

Side by Side Diff: content/browser/fileapi/blob_storage_context_unittest.cc

Issue 1545243002: Convert Pass()→std::move() in //content/browser (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 12 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "storage/browser/blob/blob_storage_context.h" 5 #include "storage/browser/blob/blob_storage_context.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <limits> 9 #include <limits>
10 #include <string> 10 #include <string>
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 scoped_ptr<disk_cache::Backend> CreateInMemoryDiskCache() { 47 scoped_ptr<disk_cache::Backend> CreateInMemoryDiskCache() {
48 scoped_ptr<disk_cache::Backend> cache; 48 scoped_ptr<disk_cache::Backend> cache;
49 net::TestCompletionCallback callback; 49 net::TestCompletionCallback callback;
50 int rv = disk_cache::CreateCacheBackend(net::MEMORY_CACHE, 50 int rv = disk_cache::CreateCacheBackend(net::MEMORY_CACHE,
51 net::CACHE_BACKEND_DEFAULT, 51 net::CACHE_BACKEND_DEFAULT,
52 base::FilePath(), 0, 52 base::FilePath(), 0,
53 false, nullptr, nullptr, &cache, 53 false, nullptr, nullptr, &cache,
54 callback.callback()); 54 callback.callback());
55 EXPECT_EQ(net::OK, callback.GetResult(rv)); 55 EXPECT_EQ(net::OK, callback.GetResult(rv));
56 56
57 return cache.Pass(); 57 return cache;
58 } 58 }
59 59
60 disk_cache::ScopedEntryPtr CreateDiskCacheEntry(disk_cache::Backend* cache, 60 disk_cache::ScopedEntryPtr CreateDiskCacheEntry(disk_cache::Backend* cache,
61 const char* key, 61 const char* key,
62 const std::string& data) { 62 const std::string& data) {
63 disk_cache::Entry* temp_entry = nullptr; 63 disk_cache::Entry* temp_entry = nullptr;
64 net::TestCompletionCallback callback; 64 net::TestCompletionCallback callback;
65 int rv = cache->CreateEntry(key, &temp_entry, callback.callback()); 65 int rv = cache->CreateEntry(key, &temp_entry, callback.callback());
66 if (callback.GetResult(rv) != net::OK) 66 if (callback.GetResult(rv) != net::OK)
67 return nullptr; 67 return nullptr;
68 disk_cache::ScopedEntryPtr entry(temp_entry); 68 disk_cache::ScopedEntryPtr entry(temp_entry);
69 69
70 scoped_refptr<net::StringIOBuffer> iobuffer = new net::StringIOBuffer(data); 70 scoped_refptr<net::StringIOBuffer> iobuffer = new net::StringIOBuffer(data);
71 rv = entry->WriteData(kTestDiskCacheStreamIndex, 0, iobuffer.get(), 71 rv = entry->WriteData(kTestDiskCacheStreamIndex, 0, iobuffer.get(),
72 iobuffer->size(), callback.callback(), false); 72 iobuffer->size(), callback.callback(), false);
73 EXPECT_EQ(static_cast<int>(data.size()), callback.GetResult(rv)); 73 EXPECT_EQ(static_cast<int>(data.size()), callback.GetResult(rv));
74 return entry.Pass(); 74 return entry;
75 } 75 }
76 76
77 void SetupBasicBlob(BlobStorageHost* host, const std::string& id) { 77 void SetupBasicBlob(BlobStorageHost* host, const std::string& id) {
78 EXPECT_TRUE(host->StartBuildingBlob(id)); 78 EXPECT_TRUE(host->StartBuildingBlob(id));
79 DataElement item; 79 DataElement item;
80 item.SetToBytes("1", 1); 80 item.SetToBytes("1", 1);
81 EXPECT_TRUE(host->AppendBlobDataItem(id, item)); 81 EXPECT_TRUE(host->AppendBlobDataItem(id, item));
82 EXPECT_TRUE(host->FinishBuildingBlob(id, "text/plain")); 82 EXPECT_TRUE(host->FinishBuildingBlob(id, "text/plain"));
83 EXPECT_FALSE(host->StartBuildingBlob(id)); 83 EXPECT_FALSE(host->StartBuildingBlob(id));
84 } 84 }
(...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after
485 EXPECT_FALSE(host.FinishBuildingBlob(kId, "text/plain")); 485 EXPECT_FALSE(host.FinishBuildingBlob(kId, "text/plain"));
486 EXPECT_FALSE(host.RegisterPublicBlobURL(kUrl, kId)); 486 EXPECT_FALSE(host.RegisterPublicBlobURL(kUrl, kId));
487 EXPECT_FALSE(host.IncrementBlobRefCount(kId)); 487 EXPECT_FALSE(host.IncrementBlobRefCount(kId));
488 EXPECT_FALSE(host.DecrementBlobRefCount(kId)); 488 EXPECT_FALSE(host.DecrementBlobRefCount(kId));
489 EXPECT_FALSE(host.RevokePublicBlobURL(kUrl)); 489 EXPECT_FALSE(host.RevokePublicBlobURL(kUrl));
490 } 490 }
491 491
492 // TODO(michaeln): tests for the depcrecated url stuff 492 // TODO(michaeln): tests for the depcrecated url stuff
493 493
494 } // namespace content 494 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/fileapi/blob_reader_unittest.cc ('k') | content/browser/fileapi/blob_url_request_job_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698