| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 "config.h" | 5 #include "config.h" |
| 6 | 6 |
| 7 #include "webkit/tools/test_shell/image_decoder_unittest.h" | 7 #include "webkit/tools/test_shell/image_decoder_unittest.h" |
| 8 | 8 |
| 9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
| 10 #include "base/md5.h" | 10 #include "base/md5.h" |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 ASSERT_TRUE(PathService::Get(base::DIR_SOURCE_ROOT, &data_dir_)); | 81 ASSERT_TRUE(PathService::Get(base::DIR_SOURCE_ROOT, &data_dir_)); |
| 82 file_util::AppendToPath(&data_dir_, L"webkit"); | 82 file_util::AppendToPath(&data_dir_, L"webkit"); |
| 83 file_util::AppendToPath(&data_dir_, L"data"); | 83 file_util::AppendToPath(&data_dir_, L"data"); |
| 84 file_util::AppendToPath(&data_dir_, format_ + L"_decoder"); | 84 file_util::AppendToPath(&data_dir_, format_ + L"_decoder"); |
| 85 ASSERT_TRUE(file_util::PathExists(data_dir_)); | 85 ASSERT_TRUE(file_util::PathExists(data_dir_)); |
| 86 } | 86 } |
| 87 | 87 |
| 88 std::vector<std::wstring> ImageDecoderTest::GetImageFiles() const { | 88 std::vector<std::wstring> ImageDecoderTest::GetImageFiles() const { |
| 89 std::wstring pattern = L"*." + format_; | 89 std::wstring pattern = L"*." + format_; |
| 90 | 90 |
| 91 file_util::FileEnumerator enumerator(data_dir_, false, | 91 file_util::FileEnumerator enumerator(FilePath::FromWStringHack(data_dir_), |
| 92 false, |
| 92 file_util::FileEnumerator::FILES); | 93 file_util::FileEnumerator::FILES); |
| 93 | 94 |
| 94 std::vector<std::wstring> image_files; | 95 std::vector<std::wstring> image_files; |
| 95 std::wstring next_file_name; | 96 std::wstring next_file_name; |
| 96 while ((next_file_name = enumerator.Next()) != L"") { | 97 while ((next_file_name = enumerator.Next().ToWStringHack()) != L"") { |
| 97 if (!MatchPattern(next_file_name, pattern)) { | 98 if (!MatchPattern(next_file_name, pattern)) { |
| 98 continue; | 99 continue; |
| 99 } | 100 } |
| 100 image_files.push_back(next_file_name); | 101 image_files.push_back(next_file_name); |
| 101 } | 102 } |
| 102 | 103 |
| 103 return image_files; | 104 return image_files; |
| 104 } | 105 } |
| 105 | 106 |
| 106 bool ImageDecoderTest::ShouldImageFail(const std::wstring& path) const { | 107 bool ImageDecoderTest::ShouldImageFail(const std::wstring& path) const { |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 // Make sure passing the complete image results in successful decoding. | 178 // Make sure passing the complete image results in successful decoding. |
| 178 partial_contents->append( | 179 partial_contents->append( |
| 179 &image_contents.data()[partial_size], | 180 &image_contents.data()[partial_size], |
| 180 static_cast<int>(image_contents.size() - partial_size)); | 181 static_cast<int>(image_contents.size() - partial_size)); |
| 181 decoder->setData(partial_contents.get(), true); | 182 decoder->setData(partial_contents.get(), true); |
| 182 VerifyImage(decoder.get(), *i, GetMD5SumPath(*i)); | 183 VerifyImage(decoder.get(), *i, GetMD5SumPath(*i)); |
| 183 } | 184 } |
| 184 } | 185 } |
| 185 #endif | 186 #endif |
| 186 | 187 |
| OLD | NEW |