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

Unified Diff: components/precache/core/fetcher_pool_unittest.cc

Issue 1921923002: Convert //components/[o-t]* from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/precache/core/fetcher_pool.h ('k') | components/precache/core/precache_database.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/precache/core/fetcher_pool_unittest.cc
diff --git a/components/precache/core/fetcher_pool_unittest.cc b/components/precache/core/fetcher_pool_unittest.cc
index 19dfc4ba454f3b0cf46b523a54a07b20aa160cf4..a15388ed91ff010722be90a451c5aa01879b3bd0 100644
--- a/components/precache/core/fetcher_pool_unittest.cc
+++ b/components/precache/core/fetcher_pool_unittest.cc
@@ -8,10 +8,10 @@
#include <array>
#include <functional>
#include <list>
+#include <memory>
#include <string>
#include "base/logging.h"
-#include "base/memory/scoped_ptr.h"
#include "base/message_loop/message_loop.h"
#include "net/http/http_status_code.h"
#include "net/url_request/test_url_fetcher_factory.h"
@@ -48,7 +48,7 @@ TEST(FetcherPoolTest, AddDelete) {
// It also tests IsAvailable.
base::MessageLoop loop;
MockURLFetcherDelegate delegate;
- scoped_ptr<URLFetcher> url_fetcher(
+ std::unique_ptr<URLFetcher> url_fetcher(
new FakeURLFetcher(GURL("http://a.com"), &delegate, "irrelevant", HTTP_OK,
URLRequestStatus::SUCCESS));
URLFetcher* url_fetcher_ptr = url_fetcher.get();
@@ -73,7 +73,7 @@ TEST(FetcherPoolTest, Delete) {
const size_t kSize = 42;
base::MessageLoop loop;
MockURLFetcherDelegate delegate;
- scoped_ptr<URLFetcher> url_fetcher(
+ std::unique_ptr<URLFetcher> url_fetcher(
new FakeURLFetcher(GURL("http://a.com"), &delegate, "irrelevant", HTTP_OK,
URLRequestStatus::SUCCESS));
URLFetcher* url_fetcher_ptr = url_fetcher.get();
@@ -100,7 +100,7 @@ TEST(FetcherPoolTest, ParallelURLFetchers) {
EXPECT_CALL(delegate, OnURLFetchComplete(_)).Times(0);
int num_requests_in_flight = 0;
for (const auto& url : urls) {
- scoped_ptr<URLFetcher> url_fetcher(
+ std::unique_ptr<URLFetcher> url_fetcher(
new FakeURLFetcher(GURL(url), &delegate, "irrelevant", HTTP_OK,
URLRequestStatus::SUCCESS));
num_requests_in_flight++;
@@ -130,7 +130,7 @@ TEST(FetcherPoolTest, DeleteAll) {
std::string urls[] = {"http://a.com", "http://b.com", "http://c.com"};
EXPECT_CALL(delegate, OnURLFetchComplete(_)).Times(0);
for (const auto& url : urls) {
- scoped_ptr<URLFetcher> url_fetcher(
+ std::unique_ptr<URLFetcher> url_fetcher(
new FakeURLFetcher(GURL(url), &delegate, "irrelevant", HTTP_OK,
URLRequestStatus::SUCCESS));
url_fetcher->Start();
@@ -150,7 +150,7 @@ TEST(FetcherPoolTest, DeleteAll) {
TEST(FetcherPoolTest, AddTooManyURLFetchers) {
MockURLFetcherDelegate delegate;
FetcherPool<URLFetcher> pool(0);
- scoped_ptr<URLFetcher> url_fetcher(
+ std::unique_ptr<URLFetcher> url_fetcher(
new FakeURLFetcher(GURL("http://queso.es"), &delegate, "irrelevant",
HTTP_OK, URLRequestStatus::SUCCESS));
EXPECT_DEBUG_DEATH(pool.Add(std::move(url_fetcher)),
@@ -159,7 +159,7 @@ TEST(FetcherPoolTest, AddTooManyURLFetchers) {
TEST(FetcherPoolTest, AddNullURLFetcher) {
FetcherPool<URLFetcher> pool(1);
- scoped_ptr<URLFetcher> null_ptr;
+ std::unique_ptr<URLFetcher> null_ptr;
EXPECT_DEBUG_DEATH(pool.Add(std::move(null_ptr)), "cannot be null");
}
@@ -185,7 +185,7 @@ TEST(FetcherPoolTest, ExampleUsage) {
std::function<void()> start_next_batch = [&pending_urls, &pool, &delegate]() {
while (!pending_urls.empty() && pool.IsAvailable()) {
// Called CreateAndStartUrlFetcher in the documentation.
- scoped_ptr<URLFetcher> fetcher(
+ std::unique_ptr<URLFetcher> fetcher(
new FakeURLFetcher(GURL(pending_urls.front()), &delegate,
"irrelevant", HTTP_OK, URLRequestStatus::SUCCESS));
fetcher->Start();
« no previous file with comments | « components/precache/core/fetcher_pool.h ('k') | components/precache/core/precache_database.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698