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

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

Issue 16392011: Move FileEnumerator to its own file, do some refactoring. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix incorrect includes Created 7 years, 6 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 "content/test/image_decoder_test.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_enumerator.h"
8 #include "base/files/file_path.h" 9 #include "base/files/file_path.h"
9 #include "base/md5.h" 10 #include "base/md5.h"
10 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
11 #include "base/path_service.h" 12 #include "base/path_service.h"
12 #include "base/string_util.h" 13 #include "base/string_util.h"
13 #include "third_party/WebKit/public/platform/WebData.h" 14 #include "third_party/WebKit/public/platform/WebData.h"
14 #include "third_party/WebKit/public/platform/WebImage.h" 15 #include "third_party/WebKit/public/platform/WebImage.h"
15 #include "third_party/WebKit/public/platform/WebSize.h" 16 #include "third_party/WebKit/public/platform/WebSize.h"
16 #include "third_party/WebKit/Source/WebKit/chromium/public/WebImageDecoder.h" 17 #include "third_party/WebKit/Source/WebKit/chromium/public/WebImageDecoder.h"
17 18
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 LOG(INFO) << test_info->name() << 115 LOG(INFO) << test_info->name() <<
115 " not running because test data wasn't found."; 116 " not running because test data wasn't found.";
116 data_dir_.clear(); 117 data_dir_.clear();
117 return; 118 return;
118 } 119 }
119 } 120 }
120 121
121 std::vector<base::FilePath> ImageDecoderTest::GetImageFiles() const { 122 std::vector<base::FilePath> ImageDecoderTest::GetImageFiles() const {
122 std::string pattern = "*." + format_; 123 std::string pattern = "*." + format_;
123 124
124 file_util::FileEnumerator enumerator(data_dir_, 125 base::FileEnumerator enumerator(data_dir_,
125 false, 126 false,
126 file_util::FileEnumerator::FILES); 127 base::FileEnumerator::FILES);
127 128
128 std::vector<base::FilePath> image_files; 129 std::vector<base::FilePath> image_files;
129 base::FilePath next_file_name; 130 base::FilePath next_file_name;
130 while (!(next_file_name = enumerator.Next()).empty()) { 131 while (!(next_file_name = enumerator.Next()).empty()) {
131 base::FilePath base_name = next_file_name.BaseName(); 132 base::FilePath base_name = next_file_name.BaseName();
132 #if defined(OS_WIN) 133 #if defined(OS_WIN)
133 std::string base_name_ascii = WideToASCII(base_name.value()); 134 std::string base_name_ascii = WideToASCII(base_name.value());
134 #else 135 #else
135 std::string base_name_ascii = base_name.value(); 136 std::string base_name_ascii = base_name.value();
136 #endif 137 #endif
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 // Since WebImage does not expose get data by frame, get the size 217 // Since WebImage does not expose get data by frame, get the size
217 // through decoder and pass it to fromData so that the closest 218 // through decoder and pass it to fromData so that the closest
218 // image dats to the size is returned. 219 // image dats to the size is returned.
219 WebKit::WebSize size(decoder->getImage(desired_frame_index).size()); 220 WebKit::WebSize size(decoder->getImage(desired_frame_index).size());
220 const WebKit::WebImage& image = WebKit::WebImage::fromData(data, size); 221 const WebKit::WebImage& image = WebKit::WebImage::fromData(data, size);
221 SaveMD5Sum(md5_sum_path, image); 222 SaveMD5Sum(md5_sum_path, image);
222 #else 223 #else
223 VerifyImage(*decoder, image_path, md5_sum_path, desired_frame_index); 224 VerifyImage(*decoder, image_path, md5_sum_path, desired_frame_index);
224 #endif 225 #endif
225 } 226 }
OLDNEW
« no previous file with comments | « content/browser/zygote_host/zygote_host_impl_linux.cc ('k') | gpu/config/gpu_info_collector_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698