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

Side by Side Diff: chrome/browser/extensions/api/image_writer_private/write_from_url_operation_unittest.cc

Issue 1871713002: Convert //chrome/browser/extensions from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase and fix header 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 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 "chrome/browser/extensions/api/image_writer_private/error_messages.h" 5 #include "chrome/browser/extensions/api/image_writer_private/error_messages.h"
6 #include "chrome/browser/extensions/api/image_writer_private/test_utils.h" 6 #include "chrome/browser/extensions/api/image_writer_private/test_utils.h"
7 #include "chrome/browser/extensions/api/image_writer_private/write_from_url_oper ation.h" 7 #include "chrome/browser/extensions/api/image_writer_private/write_from_url_oper ation.h"
8 #include "chrome/test/base/testing_profile.h" 8 #include "chrome/test/base/testing_profile.h"
9 #include "content/public/browser/browser_thread.h" 9 #include "content/public/browser/browser_thread.h"
10 #include "net/url_request/test_url_request_interceptor.h" 10 #include "net/url_request/test_url_request_interceptor.h"
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 kDummyExtensionId, 95 kDummyExtensionId,
96 test_profile_.GetRequestContext(), 96 test_profile_.GetRequestContext(),
97 url, 97 url,
98 hash, 98 hash,
99 test_utils_.GetDevicePath().AsUTF8Unsafe())); 99 test_utils_.GetDevicePath().AsUTF8Unsafe()));
100 operation->Start(); 100 operation->Start();
101 return operation; 101 return operation;
102 } 102 }
103 103
104 TestingProfile test_profile_; 104 TestingProfile test_profile_;
105 scoped_ptr<GetInterceptor> get_interceptor_; 105 std::unique_ptr<GetInterceptor> get_interceptor_;
106 106
107 MockOperationManager manager_; 107 MockOperationManager manager_;
108 }; 108 };
109 109
110 TEST_F(ImageWriterWriteFromUrlOperationTest, SelectTargetWithoutExtension) { 110 TEST_F(ImageWriterWriteFromUrlOperationTest, SelectTargetWithoutExtension) {
111 scoped_refptr<OperationForTest> operation = 111 scoped_refptr<OperationForTest> operation =
112 CreateOperation(GURL("http://localhost/foo/bar"), ""); 112 CreateOperation(GURL("http://localhost/foo/bar"), "");
113 113
114 operation->GetDownloadTarget(base::Bind(&base::DoNothing)); 114 operation->GetDownloadTarget(base::Bind(&base::DoNothing));
115 115
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 167
168 EXPECT_TRUE(base::ContentsEqual(test_utils_.GetImagePath(), 168 EXPECT_TRUE(base::ContentsEqual(test_utils_.GetImagePath(),
169 operation->GetImagePath())); 169 operation->GetImagePath()));
170 170
171 EXPECT_EQ(1, get_interceptor_->GetHitCount()); 171 EXPECT_EQ(1, get_interceptor_->GetHitCount());
172 172
173 operation->Cancel(); 173 operation->Cancel();
174 } 174 }
175 175
176 TEST_F(ImageWriterWriteFromUrlOperationTest, VerifyFile) { 176 TEST_F(ImageWriterWriteFromUrlOperationTest, VerifyFile) {
177 scoped_ptr<char[]> data_buffer(new char[kTestFileSize]); 177 std::unique_ptr<char[]> data_buffer(new char[kTestFileSize]);
178 base::ReadFile(test_utils_.GetImagePath(), data_buffer.get(), kTestFileSize); 178 base::ReadFile(test_utils_.GetImagePath(), data_buffer.get(), kTestFileSize);
179 base::MD5Digest expected_digest; 179 base::MD5Digest expected_digest;
180 base::MD5Sum(data_buffer.get(), kTestFileSize, &expected_digest); 180 base::MD5Sum(data_buffer.get(), kTestFileSize, &expected_digest);
181 std::string expected_hash = base::MD5DigestToBase16(expected_digest); 181 std::string expected_hash = base::MD5DigestToBase16(expected_digest);
182 182
183 scoped_refptr<OperationForTest> operation = 183 scoped_refptr<OperationForTest> operation =
184 CreateOperation(GURL(""), expected_hash); 184 CreateOperation(GURL(""), expected_hash);
185 185
186 EXPECT_CALL( 186 EXPECT_CALL(
187 manager_, 187 manager_,
(...skipping 17 matching lines...) Expand all
205 205
206 base::RunLoop().RunUntilIdle(); 206 base::RunLoop().RunUntilIdle();
207 207
208 operation->Cancel(); 208 operation->Cancel();
209 } 209 }
210 210
211 } // namespace 211 } // namespace
212 212
213 } // namespace image_writer 213 } // namespace image_writer
214 } // namespace extensions 214 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698