Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(15)

Side by Side Diff: third_party/WebKit/Source/platform/graphics/BitmapImageTest.cpp

Issue 2810423003: Schedule bitmap animation timers on the compositor task runner. (Closed)
Patch Set: merge recent BitmapImage changes Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 17 matching lines...) Expand all
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */ 29 */
30 30
31 #include "platform/graphics/BitmapImage.h" 31 #include "platform/graphics/BitmapImage.h"
32 32
33 #include "platform/SharedBuffer.h" 33 #include "platform/SharedBuffer.h"
34 #include "platform/graphics/BitmapImageMetrics.h" 34 #include "platform/graphics/BitmapImageMetrics.h"
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/TestingPlatformSupport.h"
38 #include "platform/testing/UnitTestHelpers.h" 39 #include "platform/testing/UnitTestHelpers.h"
39 #include "platform/wtf/StdLibExtras.h" 40 #include "platform/wtf/StdLibExtras.h"
40 #include "testing/gtest/include/gtest/gtest.h" 41 #include "testing/gtest/include/gtest/gtest.h"
41 #include "third_party/skia/include/core/SkImage.h" 42 #include "third_party/skia/include/core/SkImage.h"
42 43
43 namespace blink { 44 namespace blink {
44 45
45 class BitmapImageTest : public ::testing::Test { 46 class BitmapImageTest : public ::testing::Test {
46 public: 47 public:
47 class FakeImageObserver : public GarbageCollectedFinalized<FakeImageObserver>, 48 class FakeImageObserver : public GarbageCollectedFinalized<FakeImageObserver>,
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 PassRefPtr<SharedBuffer> Data() { return image_->Data(); } 133 PassRefPtr<SharedBuffer> Data() { return image_->Data(); }
133 134
134 protected: 135 protected:
135 void SetUp() override { 136 void SetUp() override {
136 image_observer_ = new FakeImageObserver; 137 image_observer_ = new FakeImageObserver;
137 image_ = BitmapImage::Create(image_observer_.Get()); 138 image_ = BitmapImage::Create(image_observer_.Get());
138 } 139 }
139 140
140 Persistent<FakeImageObserver> image_observer_; 141 Persistent<FakeImageObserver> image_observer_;
141 RefPtr<BitmapImage> image_; 142 RefPtr<BitmapImage> image_;
143 ScopedTestingPlatformSupport<TestingPlatformSupportWithMockScheduler>
144 platform_;
142 }; 145 };
143 146
144 TEST_F(BitmapImageTest, destroyDecodedData) { 147 TEST_F(BitmapImageTest, destroyDecodedData) {
145 LoadImage("/LayoutTests/images/resources/animated-10color.gif"); 148 LoadImage("/LayoutTests/images/resources/animated-10color.gif");
146 size_t total_size = DecodedSize(); 149 size_t total_size = DecodedSize();
147 EXPECT_GT(total_size, 0u); 150 EXPECT_GT(total_size, 0u);
148 DestroyDecodedData(); 151 DestroyDecodedData();
149 EXPECT_EQ(-static_cast<int>(total_size), LastDecodedSizeChange()); 152 EXPECT_EQ(-static_cast<int>(total_size), LastDecodedSizeChange());
150 EXPECT_EQ(0u, DecodedSize()); 153 EXPECT_EQ(0u, DecodedSize());
151 } 154 }
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
327 kOriginRightBottom}, 330 kOriginRightBottom},
328 {"/LayoutTests/images/resources/exif-orientation-8-llo.jpg", 331 {"/LayoutTests/images/resources/exif-orientation-8-llo.jpg",
329 kOriginLeftBottom}}; 332 kOriginLeftBottom}};
330 333
331 INSTANTIATE_TEST_CASE_P( 334 INSTANTIATE_TEST_CASE_P(
332 DecodedImageOrientationHistogramTest, 335 DecodedImageOrientationHistogramTest,
333 DecodedImageOrientationHistogramTest, 336 DecodedImageOrientationHistogramTest,
334 ::testing::ValuesIn(kDecodedImageOrientationHistogramTestParams)); 337 ::testing::ValuesIn(kDecodedImageOrientationHistogramTestParams));
335 338
336 } // namespace blink 339 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698