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

Side by Side Diff: content/test/image_decoder_test.cc

Issue 1874903002: Convert //content from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix indent 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
« no previous file with comments | « content/test/fake_renderer_scheduler.cc ('k') | content/test/layouttest_support.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/test/image_decoder_test.h" 5 #include "content/test/image_decoder_test.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <memory>
10
9 #include "base/files/file_enumerator.h" 11 #include "base/files/file_enumerator.h"
10 #include "base/files/file_path.h" 12 #include "base/files/file_path.h"
11 #include "base/files/file_util.h" 13 #include "base/files/file_util.h"
12 #include "base/md5.h" 14 #include "base/md5.h"
13 #include "base/memory/scoped_ptr.h"
14 #include "base/path_service.h" 15 #include "base/path_service.h"
15 #include "base/strings/pattern.h" 16 #include "base/strings/pattern.h"
16 #include "base/strings/string_util.h" 17 #include "base/strings/string_util.h"
17 #include "base/strings/utf_string_conversions.h" 18 #include "base/strings/utf_string_conversions.h"
18 #include "build/build_config.h" 19 #include "build/build_config.h"
19 #include "third_party/WebKit/public/platform/WebData.h" 20 #include "third_party/WebKit/public/platform/WebData.h"
20 #include "third_party/WebKit/public/platform/WebImage.h" 21 #include "third_party/WebKit/public/platform/WebImage.h"
21 #include "third_party/WebKit/public/platform/WebSize.h" 22 #include "third_party/WebKit/public/platform/WebSize.h"
22 #include "third_party/WebKit/public/web/WebImageDecoder.h" 23 #include "third_party/WebKit/public/web/WebImageDecoder.h"
23 24
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 int desired_frame_index) const { 171 int desired_frame_index) const {
171 #if defined(CALCULATE_MD5_SUMS) 172 #if defined(CALCULATE_MD5_SUMS)
172 // If we're just calculating the MD5 sums, skip failing images quickly. 173 // If we're just calculating the MD5 sums, skip failing images quickly.
173 if (ShouldImageFail(image_path)) 174 if (ShouldImageFail(image_path))
174 return; 175 return;
175 #endif 176 #endif
176 177
177 std::vector<char> image_contents; 178 std::vector<char> image_contents;
178 ReadFileToVector(image_path, &image_contents); 179 ReadFileToVector(image_path, &image_contents);
179 EXPECT_TRUE(image_contents.size()); 180 EXPECT_TRUE(image_contents.size());
180 scoped_ptr<blink::WebImageDecoder> decoder(CreateWebKitImageDecoder()); 181 std::unique_ptr<blink::WebImageDecoder> decoder(CreateWebKitImageDecoder());
181 EXPECT_FALSE(decoder->isFailed()); 182 EXPECT_FALSE(decoder->isFailed());
182 183
183 #if !defined(CALCULATE_MD5_SUMS) 184 #if !defined(CALCULATE_MD5_SUMS)
184 // Test chunking file into half. 185 // Test chunking file into half.
185 const int partial_size = image_contents.size()/2; 186 const int partial_size = image_contents.size()/2;
186 187
187 blink::WebData partial_data( 188 blink::WebData partial_data(
188 reinterpret_cast<const char*>(&(image_contents.at(0))), partial_size); 189 reinterpret_cast<const char*>(&(image_contents.at(0))), partial_size);
189 190
190 // Make Sure the image decoder doesn't fail when we ask for the frame 191 // Make Sure the image decoder doesn't fail when we ask for the frame
(...skipping 14 matching lines...) Expand all
205 EXPECT_TRUE(decoder->isFailed()); 206 EXPECT_TRUE(decoder->isFailed());
206 } else { 207 } else {
207 EXPECT_FALSE(decoder->isFailed()) << image_path.value(); 208 EXPECT_FALSE(decoder->isFailed()) << image_path.value();
208 #if defined(CALCULATE_MD5_SUMS) 209 #if defined(CALCULATE_MD5_SUMS)
209 SaveMD5Sum(md5_sum_path, decoder->getFrameAtIndex(desired_frame_index)); 210 SaveMD5Sum(md5_sum_path, decoder->getFrameAtIndex(desired_frame_index));
210 #else 211 #else
211 VerifyImage(*decoder, image_path, md5_sum_path, desired_frame_index); 212 VerifyImage(*decoder, image_path, md5_sum_path, desired_frame_index);
212 #endif 213 #endif
213 } 214 }
214 } 215 }
OLDNEW
« no previous file with comments | « content/test/fake_renderer_scheduler.cc ('k') | content/test/layouttest_support.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698