blob: 42813799976c7576b2b52471c0e103c7f3bc82ef [file] [log] [blame]
[email protected]e0d92f282010-04-03 06:04:271// 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]3cb4fcb2010-03-17 19:46:114
[email protected]0b9c8402013-03-13 02:01:035#include "base/files/file_path.h"
6#include "content/test/image_decoder_test.h"
[email protected]2255a9332013-06-17 05:12:317#include "third_party/WebKit/public/web/WebImageDecoder.h"
initial.commitf5b16fe2008-07-27 00:20:518
[email protected]180ef242013-11-07 06:50:469using blink::WebImageDecoder;
initial.commitf5b16fe2008-07-27 00:20:5110
initial.commitf5b16fe2008-07-27 00:20:5111class ICOImageDecoderTest : public ImageDecoderTest {
12 public:
[email protected]66ff7352009-10-15 05:09:5013 ICOImageDecoderTest() : ImageDecoderTest("ico") { }
initial.commitf5b16fe2008-07-27 00:20:5114
15 protected:
dcheng6d18e402014-10-21 12:32:5216 blink::WebImageDecoder* CreateWebKitImageDecoder() const override {
Blink Reformat1c4d759e2017-04-09 16:34:5417 return new blink::WebImageDecoder(blink::WebImageDecoder::kTypeICO);
initial.commitf5b16fe2008-07-27 00:20:5118 }
19};
20
pkasting13930472015-04-07 09:00:4521TEST_F(ICOImageDecoderTest, Decoding) {
initial.commitf5b16fe2008-07-27 00:20:5122 TestDecoding();
23}
24
[email protected]3cb4fcb2010-03-17 19:46:1125TEST_F(ICOImageDecoderTest, ImageNonZeroFrameIndex) {
[email protected]7b9fc9c2014-03-27 18:37:2826 if (data_dir().empty())
[email protected]0b9c8402013-03-13 02:01:0327 return;
[email protected]cc4ba242009-08-05 19:55:4028 // Test that the decoder decodes multiple sizes of icons which have them.
initial.commitf5b16fe2008-07-27 00:20:5129 // Load an icon that has both favicon-size and larger entries.
[email protected]7b9fc9c2014-03-27 18:37:2830 base::FilePath multisize_icon_path(data_dir().AppendASCII("yahoo.ico"));
[email protected]a3ef4832013-02-02 05:12:3331 const base::FilePath md5_sum_path(
[email protected]66ff7352009-10-15 05:09:5032 GetMD5SumPath(multisize_icon_path).value() + FILE_PATH_LITERAL("2"));
[email protected]cc4ba242009-08-05 19:55:4033 static const int kDesiredFrameIndex = 3;
[email protected]3cb4fcb2010-03-17 19:46:1134 TestWebKitImageDecoder(multisize_icon_path, md5_sum_path, kDesiredFrameIndex);
initial.commitf5b16fe2008-07-27 00:20:5135}