| Index: ui/gfx/codec/jpeg_codec_unittest.cc
|
| ===================================================================
|
| --- ui/gfx/codec/jpeg_codec_unittest.cc (revision 85576)
|
| +++ ui/gfx/codec/jpeg_codec_unittest.cc (working copy)
|
| @@ -54,6 +54,26 @@
|
| "\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 @@
|
| &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
|
|
|