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 #ifndef CONTENT_TEST_IMAGE_DECODER_TEST_H_ | 5 #ifndef CONTENT_TEST_IMAGE_DECODER_TEST_H_ |
6 #define CONTENT_TEST_IMAGE_DECODER_TEST_H_ | 6 #define CONTENT_TEST_IMAGE_DECODER_TEST_H_ |
7 | 7 |
| 8 #include <stdint.h> |
| 9 |
8 #include <string> | 10 #include <string> |
9 #include <vector> | 11 #include <vector> |
10 | 12 |
11 #include "base/basictypes.h" | |
12 #include "base/compiler_specific.h" | 13 #include "base/compiler_specific.h" |
13 #include "base/files/file_path.h" | 14 #include "base/files/file_path.h" |
| 15 #include "base/macros.h" |
14 | 16 |
15 #include "testing/gtest/include/gtest/gtest.h" | 17 #include "testing/gtest/include/gtest/gtest.h" |
16 | 18 |
17 namespace blink { class WebImageDecoder; } | 19 namespace blink { class WebImageDecoder; } |
18 | 20 |
19 // Decodes a handful of image files and compares their MD5 sums to the stored | 21 // Decodes a handful of image files and compares their MD5 sums to the stored |
20 // sums on disk. To recalculate the MD5 sums, uncomment the CALCULATE_MD5_SUMS | 22 // sums on disk. To recalculate the MD5 sums, uncomment the CALCULATE_MD5_SUMS |
21 // #define in the .cc file. | 23 // #define in the .cc file. |
22 // | 24 // |
23 // The image files and corresponding MD5 sums live in the directory | 25 // The image files and corresponding MD5 sums live in the directory |
(...skipping 30 matching lines...) Expand all Loading... |
54 // asked to generate one, i.e. if #define CALCULATE_MD5_SUMS is not set. | 56 // asked to generate one, i.e. if #define CALCULATE_MD5_SUMS is not set. |
55 void TestWebKitImageDecoder(const base::FilePath& image_path, | 57 void TestWebKitImageDecoder(const base::FilePath& image_path, |
56 const base::FilePath& md5_sum_path, | 58 const base::FilePath& md5_sum_path, |
57 int desired_frame_index) const; | 59 int desired_frame_index) const; |
58 | 60 |
59 // Verifies each of the test image files is decoded correctly and matches the | 61 // Verifies each of the test image files is decoded correctly and matches the |
60 // expected state. |file_selection| and |threshold| can be used to select | 62 // expected state. |file_selection| and |threshold| can be used to select |
61 // files to test based on file size. | 63 // files to test based on file size. |
62 // If just the MD5 sum is wanted, this skips chunking. | 64 // If just the MD5 sum is wanted, this skips chunking. |
63 void TestDecoding(ImageDecoderTestFileSelection file_selection, | 65 void TestDecoding(ImageDecoderTestFileSelection file_selection, |
64 const int64 threshold); | 66 const int64_t threshold); |
65 | 67 |
66 void TestDecoding() { | 68 void TestDecoding() { |
67 TestDecoding(TEST_ALL, 0); | 69 TestDecoding(TEST_ALL, 0); |
68 } | 70 } |
69 | 71 |
70 // Creates WebKit API's decoder. | 72 // Creates WebKit API's decoder. |
71 virtual blink::WebImageDecoder* CreateWebKitImageDecoder() const = 0; | 73 virtual blink::WebImageDecoder* CreateWebKitImageDecoder() const = 0; |
72 | 74 |
73 // The format to be decoded, like "bmp" or "ico". | 75 // The format to be decoded, like "bmp" or "ico". |
74 std::string format_; | 76 std::string format_; |
75 | 77 |
76 protected: | 78 protected: |
77 const base::FilePath& data_dir() const { return data_dir_; } | 79 const base::FilePath& data_dir() const { return data_dir_; } |
78 | 80 |
79 private: | 81 private: |
80 // Path to the test files. | 82 // Path to the test files. |
81 base::FilePath data_dir_; | 83 base::FilePath data_dir_; |
82 | 84 |
83 DISALLOW_COPY_AND_ASSIGN(ImageDecoderTest); | 85 DISALLOW_COPY_AND_ASSIGN(ImageDecoderTest); |
84 }; | 86 }; |
85 | 87 |
86 #endif // CONTENT_TEST_IMAGE_DECODER_TEST_H_ | 88 #endif // CONTENT_TEST_IMAGE_DECODER_TEST_H_ |
OLD | NEW |