Roll ANGLE bc75f36:ef9d63e
[chromium-blink-merge.git] / content / renderer / ico_image_decoder_unittest.cc
blobb59cfe38251c8395a50bde02b1a1b0f9f3d67b98
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/files/file_path.h"
6 #include "content/test/image_decoder_test.h"
7 #include "third_party/WebKit/public/web/WebImageDecoder.h"
9 using blink::WebImageDecoder;
11 class ICOImageDecoderTest : public ImageDecoderTest {
12 public:
13 ICOImageDecoderTest() : ImageDecoderTest("ico") { }
15 protected:
16 virtual blink::WebImageDecoder* CreateWebKitImageDecoder() const OVERRIDE {
17 return new blink::WebImageDecoder(blink::WebImageDecoder::TypeICO);
21 TEST_F(ICOImageDecoderTest, Decoding) {
22 TestDecoding();
25 TEST_F(ICOImageDecoderTest, ImageNonZeroFrameIndex) {
26 if (data_dir().empty())
27 return;
28 // Test that the decoder decodes multiple sizes of icons which have them.
29 // Load an icon that has both favicon-size and larger entries.
30 base::FilePath multisize_icon_path(data_dir().AppendASCII("yahoo.ico"));
31 const base::FilePath md5_sum_path(
32 GetMD5SumPath(multisize_icon_path).value() + FILE_PATH_LITERAL("2"));
33 static const int kDesiredFrameIndex = 3;
34 TestWebKitImageDecoder(multisize_icon_path, md5_sum_path, kDesiredFrameIndex);