OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "base/file_path.h" | 5 #include "base/file_path.h" |
6 #include "base/file_util.h" | 6 #include "base/file_util.h" |
7 #include "third_party/WebKit/Source/WebKit/chromium/public/WebImageDecoder.h" | 7 #include "third_party/WebKit/Source/WebKit/chromium/public/WebImageDecoder.h" |
8 #include "webkit/tools/test_shell/image_decoder_unittest.h" | 8 #include "webkit/tools/test_shell/image_decoder_unittest.h" |
9 | 9 |
10 using WebKit::WebImageDecoder; | 10 using WebKit::WebImageDecoder; |
11 | 11 |
12 class ICOImageDecoderTest : public ImageDecoderTest { | 12 class ICOImageDecoderTest : public ImageDecoderTest { |
13 public: | 13 public: |
14 ICOImageDecoderTest() : ImageDecoderTest("ico") { } | 14 ICOImageDecoderTest() : ImageDecoderTest("ico") { } |
15 | 15 |
16 protected: | 16 protected: |
17 virtual WebKit::WebImageDecoder* CreateWebKitImageDecoder() const { | 17 virtual WebKit::WebImageDecoder* CreateWebKitImageDecoder() const { |
18 return new WebKit::WebImageDecoder(WebKit::WebImageDecoder::TypeICO); | 18 return new WebKit::WebImageDecoder(WebKit::WebImageDecoder::TypeICO); |
19 } | 19 } |
20 }; | 20 }; |
21 | 21 |
22 TEST_F(ICOImageDecoderTest, Decoding) { | 22 TEST_F(ICOImageDecoderTest, Decoding) { |
23 TestDecoding(); | 23 TestDecoding(); |
24 } | 24 } |
25 | 25 |
26 TEST_F(ICOImageDecoderTest, ImageNonZeroFrameIndex) { | 26 TEST_F(ICOImageDecoderTest, ImageNonZeroFrameIndex) { |
27 // Test that the decoder decodes multiple sizes of icons which have them. | 27 // Test that the decoder decodes multiple sizes of icons which have them. |
28 // Load an icon that has both favicon-size and larger entries. | 28 // Load an icon that has both favicon-size and larger entries. |
29 FilePath multisize_icon_path(data_dir_.AppendASCII("yahoo.ico")); | 29 base::FilePath multisize_icon_path(data_dir_.AppendASCII("yahoo.ico")); |
30 const FilePath md5_sum_path( | 30 const base::FilePath md5_sum_path( |
31 GetMD5SumPath(multisize_icon_path).value() + FILE_PATH_LITERAL("2")); | 31 GetMD5SumPath(multisize_icon_path).value() + FILE_PATH_LITERAL("2")); |
32 static const int kDesiredFrameIndex = 3; | 32 static const int kDesiredFrameIndex = 3; |
33 TestWebKitImageDecoder(multisize_icon_path, md5_sum_path, kDesiredFrameIndex); | 33 TestWebKitImageDecoder(multisize_icon_path, md5_sum_path, kDesiredFrameIndex); |
34 } | 34 } |
OLD | NEW |