OLD | NEW |
1 // Copyright (c) 2008, Google Inc. | 1 // Copyright (c) 2008, Google Inc. |
2 // All rights reserved. | 2 // All rights reserved. |
3 // | 3 // |
4 // Redistribution and use in source and binary forms, with or without | 4 // Redistribution and use in source and binary forms, with or without |
5 // modification, are permitted provided that the following conditions are | 5 // modification, are permitted provided that the following conditions are |
6 // met: | 6 // met: |
7 // | 7 // |
8 // * Redistributions of source code must retain the above copyright | 8 // * Redistributions of source code must retain the above copyright |
9 // notice, this list of conditions and the following disclaimer. | 9 // notice, this list of conditions and the following disclaimer. |
10 // * Redistributions in binary form must reproduce the above | 10 // * Redistributions in binary form must reproduce the above |
(...skipping 19 matching lines...) Expand all Loading... |
30 #include "config.h" | 30 #include "config.h" |
31 #include "base/file_util.h" | 31 #include "base/file_util.h" |
32 #include "base/scoped_ptr.h" | 32 #include "base/scoped_ptr.h" |
33 #include "webkit/tools/test_shell/image_decoder_unittest.h" | 33 #include "webkit/tools/test_shell/image_decoder_unittest.h" |
34 | 34 |
35 #include "ICOImageDecoder.h" | 35 #include "ICOImageDecoder.h" |
36 #include "SharedBuffer.h" | 36 #include "SharedBuffer.h" |
37 | 37 |
38 class ICOImageDecoderTest : public ImageDecoderTest { | 38 class ICOImageDecoderTest : public ImageDecoderTest { |
39 public: | 39 public: |
40 ICOImageDecoderTest() : ImageDecoderTest("ico") { } | 40 ICOImageDecoderTest() : ImageDecoderTest(L"ico") { } |
41 | 41 |
42 protected: | 42 protected: |
43 virtual WebCore::ImageDecoder* CreateDecoder() const { | 43 virtual WebCore::ImageDecoder* CreateDecoder() const { |
44 return new WebCore::ICOImageDecoder(); | 44 return new WebCore::ICOImageDecoder(); |
45 } | 45 } |
46 }; | 46 }; |
47 | 47 |
48 TEST_F(ICOImageDecoderTest, Decoding) { | 48 TEST_F(ICOImageDecoderTest, Decoding) { |
49 TestDecoding(); | 49 TestDecoding(); |
50 } | 50 } |
51 | 51 |
52 #ifndef CALCULATE_MD5_SUMS | 52 #ifndef CALCULATE_MD5_SUMS |
53 TEST_F(ICOImageDecoderTest, ChunkedDecoding) { | 53 TEST_F(ICOImageDecoderTest, ChunkedDecoding) { |
54 TestChunkedDecoding(); | 54 TestChunkedDecoding(); |
55 } | 55 } |
56 #endif | 56 #endif |
57 | 57 |
58 TEST_F(ICOImageDecoderTest, FaviconSize) { | 58 TEST_F(ICOImageDecoderTest, FaviconSize) { |
59 // Test that the decoder decodes multiple sizes of icons which have them. | 59 // Test that the decoder decodes multiple sizes of icons which have them. |
60 | 60 |
61 // Load an icon that has both favicon-size and larger entries. | 61 // Load an icon that has both favicon-size and larger entries. |
62 FilePath multisize_icon_path(data_dir_.AppendASCII("yahoo.ico")); | 62 std::wstring multisize_icon_path(data_dir_); |
| 63 file_util::AppendToPath(&multisize_icon_path, L"yahoo.ico"); |
63 scoped_ptr<WebCore::ImageDecoder> decoder(SetupDecoder(multisize_icon_path, | 64 scoped_ptr<WebCore::ImageDecoder> decoder(SetupDecoder(multisize_icon_path, |
64 false)); | 65 false)); |
65 | 66 |
66 // Verify the decoding. | 67 // Verify the decoding. |
67 const FilePath md5_sum_path( | 68 const std::wstring md5_sum_path(GetMD5SumPath(multisize_icon_path) + L"2"); |
68 GetMD5SumPath(multisize_icon_path).value() + FILE_PATH_LITERAL("2")); | |
69 static const int kDesiredFrameIndex = 3; | 69 static const int kDesiredFrameIndex = 3; |
70 #ifdef CALCULATE_MD5_SUMS | 70 #ifdef CALCULATE_MD5_SUMS |
71 SaveMD5Sum(md5_sum_path, decoder->frameBufferAtIndex(kDesiredFrameIndex)); | 71 SaveMD5Sum(md5_sum_path, decoder->frameBufferAtIndex(kDesiredFrameIndex)); |
72 #else | 72 #else |
73 VerifyImage(decoder.get(), multisize_icon_path, md5_sum_path, | 73 VerifyImage(decoder.get(), multisize_icon_path, md5_sum_path, |
74 kDesiredFrameIndex); | 74 kDesiredFrameIndex); |
75 #endif | 75 #endif |
76 } | 76 } |
OLD | NEW |