chromium/third_party/blink/renderer/platform/graphics/bitmap_image_test.cc

/*
 * Copyright (c) 2013, Google Inc. All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are
 * met:
 *
 *     * Redistributions of source code must retain the above copyright
 * notice, this list of conditions and the following disclaimer.
 *     * Redistributions in binary form must reproduce the above
 * copyright notice, this list of conditions and the following disclaimer
 * in the documentation and/or other materials provided with the
 * distribution.
 *     * Neither the name of Google Inc. nor the names of its
 * contributors may be used to endorse or promote products derived from
 * this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */

#ifdef UNSAFE_BUFFERS_BUILD
// TODO(crbug.com/351564777): Remove this and convert code to safer constructs.
#pragma allow_unsafe_buffers
#endif

#include "third_party/blink/renderer/platform/graphics/bitmap_image.h"

#include "base/feature_list.h"
#include "base/functional/bind.h"
#include "base/numerics/safe_conversions.h"
#include "base/test/metrics/histogram_tester.h"
#include "base/test/simple_test_tick_clock.h"
#include "base/time/time.h"
#include "cc/paint/image_provider.h"
#include "cc/paint/skia_paint_canvas.h"
#include "cc/tiles/mipmap_util.h"
#include "media/media_buildflags.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/blink/public/common/features.h"
#include "third_party/blink/renderer/platform/graphics/bitmap_image_metrics.h"
#include "third_party/blink/renderer/platform/graphics/deferred_image_decoder.h"
#include "third_party/blink/renderer/platform/graphics/image_observer.h"
#include "third_party/blink/renderer/platform/graphics/test/mock_image_decoder.h"
#include "third_party/blink/renderer/platform/scheduler/test/fake_task_runner.h"
#include "third_party/blink/renderer/platform/testing/testing_platform_support_with_mock_scheduler.h"
#include "third_party/blink/renderer/platform/testing/unit_test_helpers.h"
#include "third_party/blink/renderer/platform/wtf/shared_buffer.h"
#include "third_party/skia/include/core/SkColor.h"
#include "third_party/skia/include/core/SkImage.h"
#include "ui/gfx/geometry/rect_f.h"

namespace blink {
namespace {

class FrameSettingImageProvider : public cc::ImageProvider {};

void GenerateBitmapForPaintImage(cc::PaintImage paint_image,
                                 size_t frame_index,
                                 cc::PaintImage::GeneratorClientId client_id,
                                 SkBitmap* bitmap) {}

}  // namespace

// Extends TestingPlatformSupportWithMockScheduler to add the ability to set the
// return value of MaxDecodedImageBytes().
class TestingPlatformSupportWithMaxDecodedBytes
    : public TestingPlatformSupportWithMockScheduler {};

class BitmapImageTest : public testing::Test {};

TEST_F(BitmapImageTest, destroyDecodedData) {}

TEST_F(BitmapImageTest, maybeAnimated) {}

TEST_F(BitmapImageTest, isAllDataReceived) {}

TEST_F(BitmapImageTest, noColorProfile) {}

TEST_F(BitmapImageTest, jpegHasColorProfile) {}

TEST_F(BitmapImageTest, pngHasColorProfile) {}

TEST_F(BitmapImageTest, webpHasColorProfile) {}

TEST_F(BitmapImageTest, icoHasWrongFrameDimensions) {}

TEST_F(BitmapImageTest, correctDecodedDataSize) {}

TEST_F(BitmapImageTest, recachingFrameAfterDataChanged) {}

TEST_F(BitmapImageTest, ConstantImageIdForPartiallyLoadedImages) {}

TEST_F(BitmapImageTest, ImageForDefaultFrame_MultiFrame) {}

TEST_F(BitmapImageTest, ImageForDefaultFrame_SingleFrame) {}

TEST_F(BitmapImageTest, GifDecoderFrame0) {}

TEST_F(BitmapImageTest, GifDecoderFrame1) {}

TEST_F(BitmapImageTest, GifDecoderFrame2) {}

TEST_F(BitmapImageTest, GifDecoderFrame3) {}

TEST_F(BitmapImageTest, GifDecoderMultiThreaded) {}

TEST_F(BitmapImageTest, APNGDecoder00) {}

// Jump to the final frame of each image.
TEST_F(BitmapImageTest, APNGDecoder01) {}

TEST_F(BitmapImageTest, APNGDecoder02) {}

TEST_F(BitmapImageTest, APNGDecoder04) {}

TEST_F(BitmapImageTest, APNGDecoder08) {}

TEST_F(BitmapImageTest, APNGDecoder10) {}

TEST_F(BitmapImageTest, APNGDecoder11) {}

TEST_F(BitmapImageTest, APNGDecoder12) {}

TEST_F(BitmapImageTest, APNGDecoder14) {}

TEST_F(BitmapImageTest, APNGDecoder18) {}

TEST_F(BitmapImageTest, APNGDecoder19) {}

TEST_F(BitmapImageTest, APNGDecoderDisposePrevious) {}

TEST_F(BitmapImageTest, GIFRepetitionCount) {}

TEST_F(BitmapImageTest, DecoderAndCacheMipLevels) {}

class BitmapImageTestWithMockDecoder : public BitmapImageTest,
                                       public MockImageDecoderClient {};

TEST_F(BitmapImageTestWithMockDecoder, ImageMetadataTracking) {}

TEST_F(BitmapImageTestWithMockDecoder,
       AnimationPolicyOverrideOriginalRepetitionNone) {}

TEST_F(BitmapImageTestWithMockDecoder,
       AnimationPolicyOverrideOriginalRepetitionOnce) {}

TEST_F(BitmapImageTestWithMockDecoder,
       AnimationPolicyOverrideOriginalRepetitionInfinite) {}

TEST_F(BitmapImageTestWithMockDecoder, ResetAnimation) {}

TEST_F(BitmapImageTestWithMockDecoder, PaintImageForStaticBitmapImage) {}

class BitmapHistogramTest : public BitmapImageTest {};

TEST_F(BitmapHistogramTest, DecodedImageType) {}

TEST_F(BitmapHistogramTest, DecodedImageDensityKiBWeighted) {}

}  // namespace blink