| 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 24 matching lines...) Expand all Loading... |
| 35 #include "platform/graphics/DeferredImageDecoder.h" | 35 #include "platform/graphics/DeferredImageDecoder.h" |
| 36 #include "platform/graphics/ImageObserver.h" | 36 #include "platform/graphics/ImageObserver.h" |
| 37 #include "platform/testing/HistogramTester.h" | 37 #include "platform/testing/HistogramTester.h" |
| 38 #include "platform/testing/UnitTestHelpers.h" | 38 #include "platform/testing/UnitTestHelpers.h" |
| 39 #include "testing/gtest/include/gtest/gtest.h" | 39 #include "testing/gtest/include/gtest/gtest.h" |
| 40 | 40 |
| 41 namespace blink { | 41 namespace blink { |
| 42 | 42 |
| 43 class BitmapImageTest : public ::testing::Test { | 43 class BitmapImageTest : public ::testing::Test { |
| 44 public: | 44 public: |
| 45 class FakeImageObserver : public NoBaseWillBeGarbageCollectedFinalized<FakeI
mageObserver>, public ImageObserver { | 45 class FakeImageObserver : public GarbageCollectedFinalized<FakeImageObserver
>, public ImageObserver { |
| 46 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(FakeImageObserver); | 46 USING_GARBAGE_COLLECTED_MIXIN(FakeImageObserver); |
| 47 public: | 47 public: |
| 48 FakeImageObserver() : m_lastDecodedSizeChangedDelta(0) { } | 48 FakeImageObserver() : m_lastDecodedSizeChangedDelta(0) { } |
| 49 | 49 |
| 50 virtual void decodedSizeChanged(const Image*, int delta) | 50 virtual void decodedSizeChanged(const Image*, int delta) |
| 51 { | 51 { |
| 52 m_lastDecodedSizeChangedDelta = delta; | 52 m_lastDecodedSizeChangedDelta = delta; |
| 53 } | 53 } |
| 54 void didDraw(const Image*) override { } | 54 void didDraw(const Image*) override { } |
| 55 bool shouldPauseAnimation(const Image*) override { return false; } | 55 bool shouldPauseAnimation(const Image*) override { return false; } |
| 56 void animationAdvanced(const Image*) override { } | 56 void animationAdvanced(const Image*) override { } |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 } | 133 } |
| 134 | 134 |
| 135 protected: | 135 protected: |
| 136 void SetUp() override | 136 void SetUp() override |
| 137 { | 137 { |
| 138 DeferredImageDecoder::setEnabled(m_enableDeferredDecoding); | 138 DeferredImageDecoder::setEnabled(m_enableDeferredDecoding); |
| 139 m_imageObserver = adoptPtrWillBeNoop(new FakeImageObserver); | 139 m_imageObserver = adoptPtrWillBeNoop(new FakeImageObserver); |
| 140 m_image = BitmapImage::create(m_imageObserver.get()); | 140 m_image = BitmapImage::create(m_imageObserver.get()); |
| 141 } | 141 } |
| 142 | 142 |
| 143 OwnPtrWillBePersistent<FakeImageObserver> m_imageObserver; | 143 Persistent<FakeImageObserver> m_imageObserver; |
| 144 RefPtr<BitmapImage> m_image; | 144 RefPtr<BitmapImage> m_image; |
| 145 | 145 |
| 146 private: | 146 private: |
| 147 bool m_enableDeferredDecoding; | 147 bool m_enableDeferredDecoding; |
| 148 }; | 148 }; |
| 149 | 149 |
| 150 TEST_F(BitmapImageTest, destroyDecodedDataExceptCurrentFrame) | 150 TEST_F(BitmapImageTest, destroyDecodedDataExceptCurrentFrame) |
| 151 { | 151 { |
| 152 loadImage("/LayoutTests/fast/images/resources/animated-10color.gif"); | 152 loadImage("/LayoutTests/fast/images/resources/animated-10color.gif"); |
| 153 size_t totalSize = decodedSize(); | 153 size_t totalSize = decodedSize(); |
| (...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 368 {"/LayoutTests/fast/images/resources/exif-orientation-5-lu.jpg", OriginLeftT
op}, | 368 {"/LayoutTests/fast/images/resources/exif-orientation-5-lu.jpg", OriginLeftT
op}, |
| 369 {"/LayoutTests/fast/images/resources/exif-orientation-6-ru.jpg", OriginRight
Top}, | 369 {"/LayoutTests/fast/images/resources/exif-orientation-6-ru.jpg", OriginRight
Top}, |
| 370 {"/LayoutTests/fast/images/resources/exif-orientation-7-rl.jpg", OriginRight
Bottom}, | 370 {"/LayoutTests/fast/images/resources/exif-orientation-7-rl.jpg", OriginRight
Bottom}, |
| 371 {"/LayoutTests/fast/images/resources/exif-orientation-8-llo.jpg", OriginLeft
Bottom} | 371 {"/LayoutTests/fast/images/resources/exif-orientation-8-llo.jpg", OriginLeft
Bottom} |
| 372 }; | 372 }; |
| 373 | 373 |
| 374 INSTANTIATE_TEST_CASE_P(DecodedImageOrientationHistogramTest, DecodedImageOrient
ationHistogramTest, | 374 INSTANTIATE_TEST_CASE_P(DecodedImageOrientationHistogramTest, DecodedImageOrient
ationHistogramTest, |
| 375 ::testing::ValuesIn(kDecodedImageOrientationHistogramTestParams)); | 375 ::testing::ValuesIn(kDecodedImageOrientationHistogramTestParams)); |
| 376 | 376 |
| 377 } // namespace blink | 377 } // namespace blink |
| OLD | NEW |