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

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

Issue 176843022: Move UTF16ToASCII, remove WideToASCII. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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 "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_enumerator.h"
9 #include "base/files/file_path.h" 9 #include "base/files/file_path.h"
10 #include "base/md5.h" 10 #include "base/md5.h"
11 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
12 #include "base/path_service.h" 12 #include "base/path_service.h"
13 #include "base/strings/string_util.h" 13 #include "base/strings/string_util.h"
14 #include "base/strings/utf_string_conversions.h"
14 #include "third_party/WebKit/public/platform/WebData.h" 15 #include "third_party/WebKit/public/platform/WebData.h"
15 #include "third_party/WebKit/public/platform/WebImage.h" 16 #include "third_party/WebKit/public/platform/WebImage.h"
16 #include "third_party/WebKit/public/platform/WebSize.h" 17 #include "third_party/WebKit/public/platform/WebSize.h"
17 #include "third_party/WebKit/public/web/WebImageDecoder.h" 18 #include "third_party/WebKit/public/web/WebImageDecoder.h"
18 19
19 using base::Time; 20 using base::Time;
20 21
21 namespace { 22 namespace {
22 23
23 const int kFirstFrameIndex = 0; 24 const int kFirstFrameIndex = 0;
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 125
125 base::FileEnumerator enumerator(data_dir_, 126 base::FileEnumerator enumerator(data_dir_,
126 false, 127 false,
127 base::FileEnumerator::FILES); 128 base::FileEnumerator::FILES);
128 129
129 std::vector<base::FilePath> image_files; 130 std::vector<base::FilePath> image_files;
130 base::FilePath next_file_name; 131 base::FilePath next_file_name;
131 while (!(next_file_name = enumerator.Next()).empty()) { 132 while (!(next_file_name = enumerator.Next()).empty()) {
132 base::FilePath base_name = next_file_name.BaseName(); 133 base::FilePath base_name = next_file_name.BaseName();
133 #if defined(OS_WIN) 134 #if defined(OS_WIN)
134 std::string base_name_ascii = WideToASCII(base_name.value()); 135 std::string base_name_ascii = base::UTF16ToASCII(base_name.value());
135 #else 136 #else
136 std::string base_name_ascii = base_name.value(); 137 std::string base_name_ascii = base_name.value();
137 #endif 138 #endif
138 if (!MatchPattern(base_name_ascii, pattern)) 139 if (!MatchPattern(base_name_ascii, pattern))
139 continue; 140 continue;
140 image_files.push_back(next_file_name); 141 image_files.push_back(next_file_name);
141 } 142 }
142 143
143 return image_files; 144 return image_files;
144 } 145 }
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 // Since WebImage does not expose get data by frame, get the size 218 // Since WebImage does not expose get data by frame, get the size
218 // through decoder and pass it to fromData so that the closest 219 // through decoder and pass it to fromData so that the closest
219 // image dats to the size is returned. 220 // image dats to the size is returned.
220 blink::WebSize size(decoder->getImage(desired_frame_index).size()); 221 blink::WebSize size(decoder->getImage(desired_frame_index).size());
221 const blink::WebImage& image = blink::WebImage::fromData(data, size); 222 const blink::WebImage& image = blink::WebImage::fromData(data, size);
222 SaveMD5Sum(md5_sum_path, image); 223 SaveMD5Sum(md5_sum_path, image);
223 #else 224 #else
224 VerifyImage(*decoder, image_path, md5_sum_path, desired_frame_index); 225 VerifyImage(*decoder, image_path, md5_sum_path, desired_frame_index);
225 #endif 226 #endif
226 } 227 }
OLDNEW
« no previous file with comments | « content/renderer/renderer_webkitplatformsupport_impl.cc ('k') | device/serial/serial_device_enumerator_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698