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.
5 #include "base/file_util.h"
6 #include "base/files/file_path.h"
7 #include "content/test/image_decoder_test.h"
8 #include "third_party/WebKit/Source/WebKit/chromium/public/WebImageDecoder.h"
10 using WebKit::WebImageDecoder
;
12 class ICOImageDecoderTest
: public ImageDecoderTest
{
14 ICOImageDecoderTest() : ImageDecoderTest("ico") { }
17 virtual WebKit::WebImageDecoder
* CreateWebKitImageDecoder() const OVERRIDE
{
18 return new WebKit::WebImageDecoder(WebKit::WebImageDecoder::TypeICO
);
22 TEST_F(ICOImageDecoderTest
, Decoding
) {
26 TEST_F(ICOImageDecoderTest
, ImageNonZeroFrameIndex
) {
27 if (data_dir_
.empty())
29 // Test that the decoder decodes multiple sizes of icons which have them.
30 // Load an icon that has both favicon-size and larger entries.
31 base::FilePath
multisize_icon_path(data_dir_
.AppendASCII("yahoo.ico"));
32 const base::FilePath
md5_sum_path(
33 GetMD5SumPath(multisize_icon_path
).value() + FILE_PATH_LITERAL("2"));
34 static const int kDesiredFrameIndex
= 3;
35 TestWebKitImageDecoder(multisize_icon_path
, md5_sum_path
, kDesiredFrameIndex
);