summaryrefslogtreecommitdiffstats
path: root/content/renderer/ico_image_decoder_unittest.cc
blob: fca7393ae6b771a0579587966f4594008dfdcc59 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "base/files/file_path.h"
#include "content/test/image_decoder_test.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebImageDecoder.h"

using WebKit::WebImageDecoder;

class ICOImageDecoderTest : public ImageDecoderTest {
 public:
  ICOImageDecoderTest() : ImageDecoderTest("ico") { }

 protected:
  virtual WebKit::WebImageDecoder* CreateWebKitImageDecoder() const OVERRIDE {
     return new WebKit::WebImageDecoder(WebKit::WebImageDecoder::TypeICO);
  }
};

#if defined(OS_LINUX)
#define MAYBE_Decoding DISABLED_Decoding
#else
#define MAYBE_Decoding Decoding
#endif
TEST_F(ICOImageDecoderTest, MAYBE_Decoding) {
  TestDecoding();
}

TEST_F(ICOImageDecoderTest, ImageNonZeroFrameIndex) {
  if (data_dir_.empty())
    return;
  // Test that the decoder decodes multiple sizes of icons which have them.
  // Load an icon that has both favicon-size and larger entries.
  base::FilePath multisize_icon_path(data_dir_.AppendASCII("yahoo.ico"));
  const base::FilePath md5_sum_path(
      GetMD5SumPath(multisize_icon_path).value() + FILE_PATH_LITERAL("2"));
  static const int kDesiredFrameIndex = 3;
  TestWebKitImageDecoder(multisize_icon_path, md5_sum_path, kDesiredFrameIndex);
}