| OLD | NEW |
| 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" |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 web_image.getSkBitmap().unlockPixels(); | 102 web_image.getSkBitmap().unlockPixels(); |
| 103 } | 103 } |
| 104 #endif | 104 #endif |
| 105 | 105 |
| 106 void ImageDecoderTest::SetUp() { | 106 void ImageDecoderTest::SetUp() { |
| 107 base::FilePath data_dir; | 107 base::FilePath data_dir; |
| 108 ASSERT_TRUE(PathService::Get(base::DIR_SOURCE_ROOT, &data_dir)); | 108 ASSERT_TRUE(PathService::Get(base::DIR_SOURCE_ROOT, &data_dir)); |
| 109 data_dir_ = data_dir.AppendASCII("webkit"). | 109 data_dir_ = data_dir.AppendASCII("webkit"). |
| 110 AppendASCII("data"). | 110 AppendASCII("data"). |
| 111 AppendASCII(format_ + "_decoder"); | 111 AppendASCII(format_ + "_decoder"); |
| 112 if (!file_util::PathExists(data_dir_)) { | 112 if (!base::PathExists(data_dir_)) { |
| 113 const testing::TestInfo* const test_info = | 113 const testing::TestInfo* const test_info = |
| 114 testing::UnitTest::GetInstance()->current_test_info(); | 114 testing::UnitTest::GetInstance()->current_test_info(); |
| 115 LOG(INFO) << test_info->name() << | 115 LOG(INFO) << test_info->name() << |
| 116 " not running because test data wasn't found."; | 116 " not running because test data wasn't found."; |
| 117 data_dir_.clear(); | 117 data_dir_.clear(); |
| 118 return; | 118 return; |
| 119 } | 119 } |
| 120 } | 120 } |
| 121 | 121 |
| 122 std::vector<base::FilePath> ImageDecoderTest::GetImageFiles() const { | 122 std::vector<base::FilePath> ImageDecoderTest::GetImageFiles() const { |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 217 // 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 |
| 218 // through decoder and pass it to fromData so that the closest | 218 // through decoder and pass it to fromData so that the closest |
| 219 // image dats to the size is returned. | 219 // image dats to the size is returned. |
| 220 WebKit::WebSize size(decoder->getImage(desired_frame_index).size()); | 220 WebKit::WebSize size(decoder->getImage(desired_frame_index).size()); |
| 221 const WebKit::WebImage& image = WebKit::WebImage::fromData(data, size); | 221 const WebKit::WebImage& image = WebKit::WebImage::fromData(data, size); |
| 222 SaveMD5Sum(md5_sum_path, image); | 222 SaveMD5Sum(md5_sum_path, image); |
| 223 #else | 223 #else |
| 224 VerifyImage(*decoder, image_path, md5_sum_path, desired_frame_index); | 224 VerifyImage(*decoder, image_path, md5_sum_path, desired_frame_index); |
| 225 #endif | 225 #endif |
| 226 } | 226 } |
| OLD | NEW |