diff options
author | hbono@chromium.org <hbono@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-05-23 06:43:44 +0000 |
---|---|---|
committer | hbono@chromium.org <hbono@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-05-23 06:43:44 +0000 |
commit | 6cccb7b38d5a013c6a48a0758a10ea6c61691cd9 (patch) | |
tree | a0fd7e1e6c6bbedbbee32fadbd3f29da4e2f9928 | |
parent | 2654a16a87f36912fd76c33e96b9d49f72f5a67b (diff) | |
download | chromium_src-6cccb7b38d5a013c6a48a0758a10ea6c61691cd9.zip chromium_src-6cccb7b38d5a013c6a48a0758a10ea6c61691cd9.tar.gz chromium_src-6cccb7b38d5a013c6a48a0758a10ea6c61691cd9.tar.bz2 |
Add a unit test for Motion JPEG frames.
This change adds a new unit test that verifies we can decode a JPEG image that does not have DHT markers. (This is a unit test for r85600 <http://crrev.com/85600>.)
BUG=none
TEST=JPEGCodec.DecodeMotionJPEG
Review URL: http://codereview.chromium.org/7012034
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@86258 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | DEPS | 2 | ||||
-rw-r--r-- | ui/gfx/codec/jpeg_codec_unittest.cc | 39 |
2 files changed, 40 insertions, 1 deletions
@@ -214,7 +214,7 @@ deps = { "/trunk/deps/third_party/yasm/patched-yasm@73761", "src/third_party/libjpeg_turbo": - "/trunk/deps/third_party/libjpeg_turbo@83675", + "/trunk/deps/third_party/libjpeg_turbo@85600", "src/third_party/flac": "/trunk/deps/third_party/flac@75901", diff --git a/ui/gfx/codec/jpeg_codec_unittest.cc b/ui/gfx/codec/jpeg_codec_unittest.cc index 7a8756a..2327149 100644 --- a/ui/gfx/codec/jpeg_codec_unittest.cc +++ b/ui/gfx/codec/jpeg_codec_unittest.cc @@ -54,6 +54,26 @@ const uint8 kTopSitesMigrationTestImage[] = "\xfa\xff\xda\x00\x0c\x03\x01\x00\x02\x11\x03\x11\x00\x3f\x00\xf9" "\xd2\x8a\x28\xaf\xc3\x0f\xf5\x4c\xff\xd9"; +// A typical Motion JPEG frame which do not have DHT markers. +const uint8 kMotionJPEGFrame[] = + "\xff\xd8\xff\xe0\x00\x10\x4a\x46\x49\x46\x00\x01\x01\x01\x00\x60" + "\x00\x60\x00\x00\xff\xdb\x00\x43\x00\x02\x01\x01\x02\x01\x01\x02" + "\x02\x02\x02\x02\x02\x02\x02\x03\x05\x03\x03\x03\x03\x03\x06\x04" + "\x04\x03\x05\x07\x06\x07\x07\x07\x06\x07\x07\x08\x09\x0b\x09\x08" + "\x08\x0a\x08\x07\x07\x0a\x0d\x0a\x0a\x0b\x0c\x0c\x0c\x0c\x07\x09" + "\x0e\x0f\x0d\x0c\x0e\x0b\x0c\x0c\x0c\xff\xdb\x00\x43\x01\x02\x02" + "\x02\x03\x03\x03\x06\x03\x03\x06\x0c\x08\x07\x08\x0c\x0c\x0c\x0c" + "\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c" + "\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c" + "\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\xff\xc0" + "\x00\x11\x08\x00\x40\x00\x40\x03\x01\x22\x00\x02\x11\x01\x03\x11" + "\x01\xff\xda\x00\x0c\x03\x01\x00\x02\x11\x03\x11\x00\x3f\x00\xf8" + "\xbe\x8a\x28\xaf\xe5\x33\xfd\xfc\x0a\x28\xa2\x80\x0a\x28\xa2\x80" + "\x0a\x28\xa2\x80\x0a\x28\xa2\x80\x0a\x28\xa2\x80\x0a\x28\xa2\x80" + "\x0a\x28\xa2\x80\x0a\x28\xa2\x80\x0a\x28\xa2\x80\x0a\x28\xa2\x80" + "\x0a\x28\xa2\x80\x0a\x28\xa2\x80\x0a\x28\xa2\x80\x0a\x28\xa2\x80" + "\x0a\x28\xa2\x80\x3f\xff\xd9"; + } // namespace namespace gfx { @@ -214,4 +234,23 @@ TEST(JPEGCodec, InvalidRead) { &outw, &outh); } +// Test that we can decode a motion JPEG frame. +TEST(JPEGCodec, DecodeMotionJPEG) { + std::vector<unsigned char> output; + int outw, outh; + ASSERT_TRUE(JPEGCodec::Decode(kMotionJPEGFrame, + arraysize(kMotionJPEGFrame), + JPEGCodec::FORMAT_RGB, &output, + &outw, &outh)); + EXPECT_EQ(64, outw); + EXPECT_EQ(64, outh); + + ASSERT_TRUE(JPEGCodec::Decode(kMotionJPEGFrame, + arraysize(kMotionJPEGFrame), + JPEGCodec::FORMAT_RGBA, &output, + &outw, &outh)); + EXPECT_EQ(64, outw); + EXPECT_EQ(64, outh); +} + } // namespace gfx |