| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2013, Google Inc. All rights reserved. | 2 * Copyright (c) 2013, Google Inc. 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 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 PassRefPtr<Image> imageForDefaultFrame() | 133 PassRefPtr<Image> imageForDefaultFrame() |
| 134 { | 134 { |
| 135 return m_image->imageForDefaultFrame(); | 135 return m_image->imageForDefaultFrame(); |
| 136 } | 136 } |
| 137 | 137 |
| 138 int lastDecodedSizeChange() | 138 int lastDecodedSizeChange() |
| 139 { | 139 { |
| 140 return m_imageObserver->m_lastDecodedSizeChangedDelta; | 140 return m_imageObserver->m_lastDecodedSizeChangedDelta; |
| 141 } | 141 } |
| 142 | 142 |
| 143 PassRefPtr<SharedBuffer> data() { return m_image->data(); } |
| 144 SharedBuffer* cachedData() { return m_image->cachedData(); } |
| 145 |
| 143 protected: | 146 protected: |
| 144 void SetUp() override | 147 void SetUp() override |
| 145 { | 148 { |
| 146 m_imageObserver = new FakeImageObserver; | 149 m_imageObserver = new FakeImageObserver; |
| 147 m_image = BitmapImage::create(m_imageObserver.get()); | 150 m_image = BitmapImage::create(m_imageObserver.get()); |
| 148 } | 151 } |
| 149 | 152 |
| 150 Persistent<FakeImageObserver> m_imageObserver; | 153 Persistent<FakeImageObserver> m_imageObserver; |
| 151 RefPtr<BitmapImage> m_image; | 154 RefPtr<BitmapImage> m_image; |
| 152 }; | 155 }; |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 209 } | 212 } |
| 210 | 213 |
| 211 TEST_F(BitmapImageTest, noColorProfile) | 214 TEST_F(BitmapImageTest, noColorProfile) |
| 212 { | 215 { |
| 213 loadImage("/LayoutTests/fast/images/resources/green.jpg"); | 216 loadImage("/LayoutTests/fast/images/resources/green.jpg"); |
| 214 EXPECT_EQ(1u, decodedFramesCount()); | 217 EXPECT_EQ(1u, decodedFramesCount()); |
| 215 EXPECT_EQ(1024u, decodedSize()); | 218 EXPECT_EQ(1024u, decodedSize()); |
| 216 EXPECT_FALSE(m_image->hasColorProfile()); | 219 EXPECT_FALSE(m_image->hasColorProfile()); |
| 217 } | 220 } |
| 218 | 221 |
| 222 TEST_F(BitmapImageTest, noCachedData) |
| 223 { |
| 224 loadImage("/LayoutTests/fast/images/resources/green.jpg"); |
| 225 EXPECT_TRUE(m_image->isAllDataReceived()); |
| 226 // m_image doesn't have its encoded image data. Instead, its |
| 227 // DeferredImageDecoder has it and data() returns this. |
| 228 EXPECT_FALSE(cachedData()); |
| 229 EXPECT_TRUE(data()); |
| 230 } |
| 231 |
| 219 #if USE(QCMSLIB) | 232 #if USE(QCMSLIB) |
| 220 | 233 |
| 221 TEST_F(BitmapImageTest, jpegHasColorProfile) | 234 TEST_F(BitmapImageTest, jpegHasColorProfile) |
| 222 { | 235 { |
| 223 loadImage("/LayoutTests/fast/images/resources/icc-v2-gbr.jpg"); | 236 loadImage("/LayoutTests/fast/images/resources/icc-v2-gbr.jpg"); |
| 224 EXPECT_EQ(1u, decodedFramesCount()); | 237 EXPECT_EQ(1u, decodedFramesCount()); |
| 225 EXPECT_EQ(227700u, decodedSize()); | 238 EXPECT_EQ(227700u, decodedSize()); |
| 226 EXPECT_TRUE(m_image->hasColorProfile()); | 239 EXPECT_TRUE(m_image->hasColorProfile()); |
| 227 } | 240 } |
| 228 | 241 |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 329 {"/LayoutTests/fast/images/resources/exif-orientation-5-lu.jpg", OriginLeftT
op}, | 342 {"/LayoutTests/fast/images/resources/exif-orientation-5-lu.jpg", OriginLeftT
op}, |
| 330 {"/LayoutTests/fast/images/resources/exif-orientation-6-ru.jpg", OriginRight
Top}, | 343 {"/LayoutTests/fast/images/resources/exif-orientation-6-ru.jpg", OriginRight
Top}, |
| 331 {"/LayoutTests/fast/images/resources/exif-orientation-7-rl.jpg", OriginRight
Bottom}, | 344 {"/LayoutTests/fast/images/resources/exif-orientation-7-rl.jpg", OriginRight
Bottom}, |
| 332 {"/LayoutTests/fast/images/resources/exif-orientation-8-llo.jpg", OriginLeft
Bottom} | 345 {"/LayoutTests/fast/images/resources/exif-orientation-8-llo.jpg", OriginLeft
Bottom} |
| 333 }; | 346 }; |
| 334 | 347 |
| 335 INSTANTIATE_TEST_CASE_P(DecodedImageOrientationHistogramTest, DecodedImageOrient
ationHistogramTest, | 348 INSTANTIATE_TEST_CASE_P(DecodedImageOrientationHistogramTest, DecodedImageOrient
ationHistogramTest, |
| 336 ::testing::ValuesIn(kDecodedImageOrientationHistogramTestParams)); | 349 ::testing::ValuesIn(kDecodedImageOrientationHistogramTestParams)); |
| 337 | 350 |
| 338 } // namespace blink | 351 } // namespace blink |
| OLD | NEW |