[email protected] | e0d92f28 | 2010-04-03 06:04:27 | [diff] [blame] | 1 | // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
2 | // Use of this source code is governed by a BSD-style license that can be | ||||
3 | // found in the LICENSE file. | ||||
[email protected] | 3cb4fcb | 2010-03-17 19:46:11 | [diff] [blame] | 4 | |
[email protected] | 0b9c840 | 2013-03-13 02:01:03 | [diff] [blame] | 5 | #include "base/files/file_path.h" |
6 | #include "content/test/image_decoder_test.h" | ||||
[email protected] | 2255a933 | 2013-06-17 05:12:31 | [diff] [blame] | 7 | #include "third_party/WebKit/public/web/WebImageDecoder.h" |
initial.commit | f5b16fe | 2008-07-27 00:20:51 | [diff] [blame] | 8 | |
[email protected] | 180ef24 | 2013-11-07 06:50:46 | [diff] [blame] | 9 | using blink::WebImageDecoder; |
initial.commit | f5b16fe | 2008-07-27 00:20:51 | [diff] [blame] | 10 | |
initial.commit | f5b16fe | 2008-07-27 00:20:51 | [diff] [blame] | 11 | class ICOImageDecoderTest : public ImageDecoderTest { |
12 | public: | ||||
[email protected] | 66ff735 | 2009-10-15 05:09:50 | [diff] [blame] | 13 | ICOImageDecoderTest() : ImageDecoderTest("ico") { } |
initial.commit | f5b16fe | 2008-07-27 00:20:51 | [diff] [blame] | 14 | |
15 | protected: | ||||
dcheng | 6d18e40 | 2014-10-21 12:32:52 | [diff] [blame] | 16 | blink::WebImageDecoder* CreateWebKitImageDecoder() const override { |
Blink Reformat | 1c4d759e | 2017-04-09 16:34:54 | [diff] [blame] | 17 | return new blink::WebImageDecoder(blink::WebImageDecoder::kTypeICO); |
initial.commit | f5b16fe | 2008-07-27 00:20:51 | [diff] [blame] | 18 | } |
19 | }; | ||||
20 | |||||
pkasting | 1393047 | 2015-04-07 09:00:45 | [diff] [blame] | 21 | TEST_F(ICOImageDecoderTest, Decoding) { |
initial.commit | f5b16fe | 2008-07-27 00:20:51 | [diff] [blame] | 22 | TestDecoding(); |
23 | } | ||||
24 | |||||
[email protected] | 3cb4fcb | 2010-03-17 19:46:11 | [diff] [blame] | 25 | TEST_F(ICOImageDecoderTest, ImageNonZeroFrameIndex) { |
[email protected] | 7b9fc9c | 2014-03-27 18:37:28 | [diff] [blame] | 26 | if (data_dir().empty()) |
[email protected] | 0b9c840 | 2013-03-13 02:01:03 | [diff] [blame] | 27 | return; |
[email protected] | cc4ba24 | 2009-08-05 19:55:40 | [diff] [blame] | 28 | // Test that the decoder decodes multiple sizes of icons which have them. |
initial.commit | f5b16fe | 2008-07-27 00:20:51 | [diff] [blame] | 29 | // Load an icon that has both favicon-size and larger entries. |
[email protected] | 7b9fc9c | 2014-03-27 18:37:28 | [diff] [blame] | 30 | base::FilePath multisize_icon_path(data_dir().AppendASCII("yahoo.ico")); |
[email protected] | a3ef483 | 2013-02-02 05:12:33 | [diff] [blame] | 31 | const base::FilePath md5_sum_path( |
[email protected] | 66ff735 | 2009-10-15 05:09:50 | [diff] [blame] | 32 | GetMD5SumPath(multisize_icon_path).value() + FILE_PATH_LITERAL("2")); |
[email protected] | cc4ba24 | 2009-08-05 19:55:40 | [diff] [blame] | 33 | static const int kDesiredFrameIndex = 3; |
[email protected] | 3cb4fcb | 2010-03-17 19:46:11 | [diff] [blame] | 34 | TestWebKitImageDecoder(multisize_icon_path, md5_sum_path, kDesiredFrameIndex); |
initial.commit | f5b16fe | 2008-07-27 00:20:51 | [diff] [blame] | 35 | } |