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

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

Issue 12725006: Move image decoder unit tests to content_unittests (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Now with more MANUAL_ Created 7 years, 9 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 | Annotate | Revision Log
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 "webkit/tools/test_shell/image_decoder_unittest.h" 5 #include "content/test/image_decoder_test.h"
6 6
7 #include "base/file_util.h" 7 #include "base/file_util.h"
8 #include "base/files/file_path.h" 8 #include "base/files/file_path.h"
9 #include "base/md5.h" 9 #include "base/md5.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
11 #include "base/path_service.h" 11 #include "base/path_service.h"
12 #include "base/string_util.h" 12 #include "base/string_util.h"
13 #include "third_party/WebKit/Source/Platform/chromium/public/WebData.h" 13 #include "third_party/WebKit/Source/Platform/chromium/public/WebData.h"
14 #include "third_party/WebKit/Source/Platform/chromium/public/WebImage.h" 14 #include "third_party/WebKit/Source/Platform/chromium/public/WebImage.h"
15 #include "third_party/WebKit/Source/Platform/chromium/public/WebSize.h" 15 #include "third_party/WebKit/Source/Platform/chromium/public/WebSize.h"
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 #endif 129 #endif
130 if (!MatchPattern(base_name_ascii, pattern)) 130 if (!MatchPattern(base_name_ascii, pattern))
131 continue; 131 continue;
132 image_files.push_back(next_file_name); 132 image_files.push_back(next_file_name);
133 } 133 }
134 134
135 return image_files; 135 return image_files;
136 } 136 }
137 137
138 bool ImageDecoderTest::ShouldImageFail(const base::FilePath& path) const { 138 bool ImageDecoderTest::ShouldImageFail(const base::FilePath& path) const {
139 static const base::FilePath::StringType kBadSuffix(FILE_PATH_LITERAL(".bad.")) ; 139 const base::FilePath::StringType kBadSuffix(FILE_PATH_LITERAL(".bad."));
140 return (path.value().length() > (kBadSuffix.length() + format_.length()) && 140 return (path.value().length() > (kBadSuffix.length() + format_.length()) &&
141 !path.value().compare(path.value().length() - format_.length() - 141 !path.value().compare(path.value().length() - format_.length() -
142 kBadSuffix.length(), 142 kBadSuffix.length(),
143 kBadSuffix.length(), kBadSuffix)); 143 kBadSuffix.length(), kBadSuffix));
144 } 144 }
145 145
146 void ImageDecoderTest::TestDecoding( 146 void ImageDecoderTest::TestDecoding(
147 ImageDecoderTestFileSelection file_selection, 147 ImageDecoderTestFileSelection file_selection,
148 const int64 threshold) { 148 const int64 threshold) {
149 const std::vector<base::FilePath> image_files(GetImageFiles()); 149 const std::vector<base::FilePath> image_files(GetImageFiles());
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 // Since WebImage does not expose get data by frame, get the size 207 // Since WebImage does not expose get data by frame, get the size
208 // through decoder and pass it to fromData so that the closest 208 // through decoder and pass it to fromData so that the closest
209 // image dats to the size is returned. 209 // image dats to the size is returned.
210 WebKit::WebSize size(decoder->getImage(desired_frame_index).size()); 210 WebKit::WebSize size(decoder->getImage(desired_frame_index).size());
211 const WebKit::WebImage& image = WebKit::WebImage::fromData(data, size); 211 const WebKit::WebImage& image = WebKit::WebImage::fromData(data, size);
212 SaveMD5Sum(md5_sum_path, image); 212 SaveMD5Sum(md5_sum_path, image);
213 #else 213 #else
214 VerifyImage(*decoder, image_path, md5_sum_path, desired_frame_index); 214 VerifyImage(*decoder, image_path, md5_sum_path, desired_frame_index);
215 #endif 215 #endif
216 } 216 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698