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

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

Issue 2496663002: Merge css3/image/ and fast/images/ to images/ (Closed)
Patch Set: Address failing tests (3 of them) Created 4 years, 1 month 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 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "platform/graphics/DeferredImageDecoder.h" 5 #include "platform/graphics/DeferredImageDecoder.h"
6 6
7 #include "platform/SharedBuffer.h" 7 #include "platform/SharedBuffer.h"
8 #include "platform/image-decoders/ImageDecoderTestHelpers.h" 8 #include "platform/image-decoders/ImageDecoderTestHelpers.h"
9 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
10 #include "third_party/skia/include/core/SkImage.h" 10 #include "third_party/skia/include/core/SkImage.h"
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 RefPtr<SharedBuffer> almostCompleteFile = 47 RefPtr<SharedBuffer> almostCompleteFile =
48 SharedBuffer::create(file->data(), file->size() - 1); 48 SharedBuffer::create(file->data(), file->size() - 1);
49 decoder->setData(almostCompleteFile, false); 49 decoder->setData(almostCompleteFile, false);
50 sk_sp<SkImage> imageWithMoreData = decoder->createFrameAtIndex(laterFrame); 50 sk_sp<SkImage> imageWithMoreData = decoder->createFrameAtIndex(laterFrame);
51 51
52 imageWithMoreData->preroll(); 52 imageWithMoreData->preroll();
53 partialImage->preroll(); 53 partialImage->preroll();
54 } 54 }
55 55
56 TEST(DeferredImageDecoderTestWoPlatform, mixImagesGif) { 56 TEST(DeferredImageDecoderTestWoPlatform, mixImagesGif) {
57 mixImages("/LayoutTests/fast/images/resources/animated.gif", 818u, 1u); 57 mixImages("/LayoutTests/images/resources/animated.gif", 818u, 1u);
58 } 58 }
59 59
60 TEST(DeferredImageDecoderTestWoPlatform, mixImagesPng) { 60 TEST(DeferredImageDecoderTestWoPlatform, mixImagesPng) {
61 mixImages("/LayoutTests/fast/images/resources/mu.png", 910u, 0u); 61 mixImages("/LayoutTests/images/resources/mu.png", 910u, 0u);
62 } 62 }
63 63
64 TEST(DeferredImageDecoderTestWoPlatform, mixImagesJpg) { 64 TEST(DeferredImageDecoderTestWoPlatform, mixImagesJpg) {
65 mixImages("/LayoutTests/fast/images/resources/2-dht.jpg", 177u, 0u); 65 mixImages("/LayoutTests/images/resources/2-dht.jpg", 177u, 0u);
66 } 66 }
67 67
68 TEST(DeferredImageDecoderTestWoPlatform, mixImagesWebp) { 68 TEST(DeferredImageDecoderTestWoPlatform, mixImagesWebp) {
69 mixImages("/LayoutTests/fast/images/resources/webp-animated.webp", 142u, 1u); 69 mixImages("/LayoutTests/images/resources/webp-animated.webp", 142u, 1u);
70 } 70 }
71 71
72 TEST(DeferredImageDecoderTestWoPlatform, mixImagesBmp) { 72 TEST(DeferredImageDecoderTestWoPlatform, mixImagesBmp) {
73 mixImages("/LayoutTests/fast/images/resources/lenna.bmp", 122u, 0u); 73 mixImages("/LayoutTests/images/resources/lenna.bmp", 122u, 0u);
74 } 74 }
75 75
76 TEST(DeferredImageDecoderTestWoPlatform, mixImagesIco) { 76 TEST(DeferredImageDecoderTestWoPlatform, mixImagesIco) {
77 mixImages("/LayoutTests/fast/images/resources/wrong-frame-dimensions.ico", 77 mixImages("/LayoutTests/images/resources/wrong-frame-dimensions.ico", 1376u,
78 1376u, 1u); 78 1u);
79 } 79 }
80 80
81 TEST(DeferredImageDecoderTestWoPlatform, fragmentedSignature) { 81 TEST(DeferredImageDecoderTestWoPlatform, fragmentedSignature) {
82 const char* testFiles[] = { 82 const char* testFiles[] = {
83 "/LayoutTests/fast/images/resources/animated.gif", 83 "/LayoutTests/images/resources/animated.gif",
84 "/LayoutTests/fast/images/resources/mu.png", 84 "/LayoutTests/images/resources/mu.png",
85 "/LayoutTests/fast/images/resources/2-dht.jpg", 85 "/LayoutTests/images/resources/2-dht.jpg",
86 "/LayoutTests/fast/images/resources/webp-animated.webp", 86 "/LayoutTests/images/resources/webp-animated.webp",
87 "/LayoutTests/fast/images/resources/lenna.bmp", 87 "/LayoutTests/images/resources/lenna.bmp",
88 "/LayoutTests/fast/images/resources/wrong-frame-dimensions.ico", 88 "/LayoutTests/images/resources/wrong-frame-dimensions.ico",
89 }; 89 };
90 90
91 for (size_t i = 0; i < SK_ARRAY_COUNT(testFiles); ++i) { 91 for (size_t i = 0; i < SK_ARRAY_COUNT(testFiles); ++i) {
92 RefPtr<SharedBuffer> fileBuffer = readFile(testFiles[i]); 92 RefPtr<SharedBuffer> fileBuffer = readFile(testFiles[i]);
93 ASSERT_NE(fileBuffer, nullptr); 93 ASSERT_NE(fileBuffer, nullptr);
94 // We need contiguous data, which SharedBuffer doesn't guarantee. 94 // We need contiguous data, which SharedBuffer doesn't guarantee.
95 sk_sp<SkData> skData = fileBuffer->getAsSkData(); 95 sk_sp<SkData> skData = fileBuffer->getAsSkData();
96 EXPECT_EQ(skData->size(), fileBuffer->size()); 96 EXPECT_EQ(skData->size(), fileBuffer->size());
97 const char* data = reinterpret_cast<const char*>(skData->bytes()); 97 const char* data = reinterpret_cast<const char*>(skData->bytes());
98 98
(...skipping 11 matching lines...) Expand all
110 std::unique_ptr<DeferredImageDecoder> decoder = 110 std::unique_ptr<DeferredImageDecoder> decoder =
111 DeferredImageDecoder::create(buffer, false, 111 DeferredImageDecoder::create(buffer, false,
112 ImageDecoder::AlphaPremultiplied, 112 ImageDecoder::AlphaPremultiplied,
113 ImageDecoder::ColorSpaceIgnored); 113 ImageDecoder::ColorSpaceIgnored);
114 ASSERT_NE(decoder, nullptr); 114 ASSERT_NE(decoder, nullptr);
115 EXPECT_TRUE(String(testFiles[i]).endsWith(decoder->filenameExtension())); 115 EXPECT_TRUE(String(testFiles[i]).endsWith(decoder->filenameExtension()));
116 } 116 }
117 } 117 }
118 118
119 } // namespace blink 119 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698