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

Side by Side Diff: ios/chrome/browser/net/image_fetcher_unittest.mm

Issue 1861593005: Convert //ios from scoped_ptr to std::unique_ptr. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase? 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 unified diff | Download patch
OLDNEW
1 // Copyright 2011 The Chromium Authors. All rights reserved. 1 // Copyright 2011 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 #import "ios/chrome/browser/net/image_fetcher.h" 5 #import "ios/chrome/browser/net/image_fetcher.h"
6 6
7 #import <UIKit/UIKit.h> 7 #import <UIKit/UIKit.h>
8 8
9 #include "base/ios/ios_util.h" 9 #include "base/ios/ios_util.h"
10 #include "base/mac/scoped_block.h" 10 #include "base/mac/scoped_block.h"
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 net::TestURLFetcher* fetcher = factory_.GetFetcherByID(0); 96 net::TestURLFetcher* fetcher = factory_.GetFetcherByID(0);
97 DCHECK(fetcher); 97 DCHECK(fetcher);
98 DCHECK(fetcher->delegate()); 98 DCHECK(fetcher->delegate());
99 return fetcher; 99 return fetcher;
100 } 100 }
101 101
102 base::MessageLoop loop_; 102 base::MessageLoop loop_;
103 base::mac::ScopedBlock<image_fetcher::ImageFetchedCallback> callback_; 103 base::mac::ScopedBlock<image_fetcher::ImageFetchedCallback> callback_;
104 net::TestURLFetcherFactory factory_; 104 net::TestURLFetcherFactory factory_;
105 scoped_refptr<base::SequencedWorkerPool> pool_; 105 scoped_refptr<base::SequencedWorkerPool> pool_;
106 scoped_ptr<image_fetcher::ImageFetcher> image_fetcher_; 106 std::unique_ptr<image_fetcher::ImageFetcher> image_fetcher_;
107 UIImage* result_; 107 UIImage* result_;
108 bool called_; 108 bool called_;
109 }; 109 };
110 110
111 TEST_F(ImageFetcherTest, TestError) { 111 TEST_F(ImageFetcherTest, TestError) {
112 net::TestURLFetcher* fetcher = SetupFetcher(); 112 net::TestURLFetcher* fetcher = SetupFetcher();
113 fetcher->set_response_code(404); 113 fetcher->set_response_code(404);
114 fetcher->delegate()->OnURLFetchComplete(fetcher); 114 fetcher->delegate()->OnURLFetchComplete(fetcher);
115 EXPECT_EQ(static_cast<UIImage*>(nil), result_); 115 EXPECT_EQ(static_cast<UIImage*>(nil), result_);
116 EXPECT_TRUE(called_); 116 EXPECT_TRUE(called_);
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 EXPECT_EQ(static_cast<UIImage*>(nil), result_); 184 EXPECT_EQ(static_cast<UIImage*>(nil), result_);
185 EXPECT_FALSE(called_); 185 EXPECT_FALSE(called_);
186 } 186 }
187 187
188 TEST_F(ImageFetcherTest, TestCallbacksNotCalledDuringDeletion) { 188 TEST_F(ImageFetcherTest, TestCallbacksNotCalledDuringDeletion) {
189 image_fetcher_->StartDownload(GURL(kTestUrl), callback_); 189 image_fetcher_->StartDownload(GURL(kTestUrl), callback_);
190 image_fetcher_.reset(); 190 image_fetcher_.reset();
191 EXPECT_FALSE(called_); 191 EXPECT_FALSE(called_);
192 } 192 }
193 193
OLDNEW
« no previous file with comments | « ios/chrome/browser/net/image_fetcher.mm ('k') | ios/chrome/browser/net/ios_chrome_network_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698