| 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 <windows.h> | 7 #include <windows.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" |
| 11 #include "base/path_service.h" | 11 #include "base/path_service.h" |
| 12 #include "base/scoped_handle.h" | 12 #include "base/scoped_handle.h" |
| 13 #include "base/scoped_ptr.h" | 13 #include "base/scoped_ptr.h" |
| 14 #include "base/time.h" | 14 #include "base/time.h" |
| 15 #include "webkit/tools/test_shell/image_decoder_unittest.h" | 15 #include "webkit/tools/test_shell/image_decoder_unittest.h" |
| 16 | 16 |
| 17 using base::Time; |
| 18 |
| 17 void ReadFileToVector(const std::wstring& path, Vector<char>* contents) { | 19 void ReadFileToVector(const std::wstring& path, Vector<char>* contents) { |
| 18 std::string contents_str; | 20 std::string contents_str; |
| 19 file_util::ReadFileToString(path, &contents_str); | 21 file_util::ReadFileToString(path, &contents_str); |
| 20 contents->resize(contents_str.size()); | 22 contents->resize(contents_str.size()); |
| 21 memcpy(&contents->first(), contents_str.data(), contents_str.size()); | 23 memcpy(&contents->first(), contents_str.data(), contents_str.size()); |
| 22 } | 24 } |
| 23 | 25 |
| 24 std::wstring GetMD5SumPath(const std::wstring& path) { | 26 std::wstring GetMD5SumPath(const std::wstring& path) { |
| 25 static const std::wstring kDecodedDataExtension(L".md5sum"); | 27 static const std::wstring kDecodedDataExtension(L".md5sum"); |
| 26 return path + kDecodedDataExtension; | 28 return path + kDecodedDataExtension; |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 // Make sure passing the complete image results in successful decoding. | 180 // Make sure passing the complete image results in successful decoding. |
| 179 partial_contents->append( | 181 partial_contents->append( |
| 180 &image_contents.data()[partial_size], | 182 &image_contents.data()[partial_size], |
| 181 static_cast<int>(image_contents.size() - partial_size)); | 183 static_cast<int>(image_contents.size() - partial_size)); |
| 182 decoder->setData(partial_contents.get(), true); | 184 decoder->setData(partial_contents.get(), true); |
| 183 VerifyImage(decoder.get(), *i, GetMD5SumPath(*i)); | 185 VerifyImage(decoder.get(), *i, GetMD5SumPath(*i)); |
| 184 } | 186 } |
| 185 } | 187 } |
| 186 #endif | 188 #endif |
| 187 | 189 |
| OLD | NEW |