#include "gpu/command_buffer/service/shared_image/gl_texture_image_backing_factory.h"
#include <thread>
#include "base/command_line.h"
#include "build/build_config.h"
#include "cc/test/pixel_comparator.h"
#include "cc/test/pixel_test_utils.h"
#include "components/viz/common/resources/resource_sizes.h"
#include "components/viz/common/resources/shared_image_format.h"
#include "gpu/command_buffer/common/mailbox.h"
#include "gpu/command_buffer/common/shared_image_usage.h"
#include "gpu/command_buffer/service/service_utils.h"
#include "gpu/command_buffer/service/shared_context_state.h"
#include "gpu/command_buffer/service/shared_image/shared_image_backing.h"
#include "gpu/command_buffer/service/shared_image/shared_image_factory.h"
#include "gpu/command_buffer/service/shared_image/shared_image_format_service_utils.h"
#include "gpu/command_buffer/service/shared_image/shared_image_manager.h"
#include "gpu/command_buffer/service/shared_image/shared_image_representation.h"
#include "gpu/command_buffer/service/shared_image/shared_image_test_base.h"
#include "gpu/command_buffer/service/texture_manager.h"
#include "gpu/config/gpu_driver_bug_workarounds.h"
#include "gpu/config/gpu_feature_info.h"
#include "gpu/config/gpu_preferences.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/skia/include/core/SkBitmap.h"
#include "third_party/skia/include/gpu/GrBackendSemaphore.h"
#include "third_party/skia/include/gpu/GrBackendSurface.h"
#include "third_party/skia/include/private/chromium/GrPromiseImageTexture.h"
#include "ui/gfx/color_space.h"
#include "ui/gfx/gpu_memory_buffer.h"
#include "ui/gl/gl_version_info.h"
#include "ui/gl/progress_reporter.h"
AtLeast;
namespace gpu {
namespace {
class MockProgressReporter : public gl::ProgressReporter { … };
class GLTextureImageBackingFactoryTestBase : public SharedImageTestBase { … };
class GLTextureImageBackingFactoryTest
: public GLTextureImageBackingFactoryTestBase { … };
class GLTextureImageBackingFactoryWithFormatTest
: public GLTextureImageBackingFactoryTest,
public testing::WithParamInterface<viz::SharedImageFormat> { … };
GLTextureImageBackingFactoryInitialDataTest;
class GLTextureImageBackingFactoryWithUploadTest
: public GLTextureImageBackingFactoryTestBase,
public testing::WithParamInterface<viz::SharedImageFormat> { … };
GLTextureImageBackingFactoryWithReadbackTest;
TEST_F(GLTextureImageBackingFactoryTest, InvalidFormat) { … }
TEST_F(GLTextureImageBackingFactoryTest, InvalidUsageWithANGLEMetal) { … }
TEST_F(GLTextureImageBackingFactoryTest,
GLES2UsageAllowedWithANGLEMetalIfRasterOnly) { … }
TEST_F(GLTextureImageBackingFactoryTest,
I420SIUsedOnlyForRasterOverGLESAllowedWithANGLEMetal) { … }
TEST_F(GLTextureImageBackingFactoryTest, InvalidUsageWithGraphite) { … }
TEST_F(GLTextureImageBackingFactoryTest,
RasterUsageWithGraphiteAllowedWhenOverGLES2Only) { … }
TEST_F(GLTextureImageBackingFactoryTest,
I420SIUsedOnlyForRasterOverGLESAllowedWithGraphite) { … }
TEST_F(GLTextureImageBackingFactoryTest, EstimatedSize) { … }
TEST_F(GLTextureImageBackingFactoryTest, TexImageTexStorageEquivalence) { … }
TEST_P(GLTextureImageBackingFactoryWithFormatTest, IsSupported) { … }
TEST_P(GLTextureImageBackingFactoryWithFormatTest, Basic) { … }
TEST_P(GLTextureImageBackingFactoryWithFormatTest, InvalidSize) { … }
TEST_P(GLTextureImageBackingFactoryInitialDataTest, InitialData) { … }
TEST_P(GLTextureImageBackingFactoryInitialDataTest, InitialDataWrongSize) { … }
TEST_F(GLTextureImageBackingFactoryWithUploadTest, InvalidUsageWithANGLEMetal) { … }
TEST_P(GLTextureImageBackingFactoryWithUploadTest, UploadFromMemory) { … }
TEST_P(GLTextureImageBackingFactoryWithReadbackTest, ReadbackToMemory) { … }
std::string TestParamToString(
const testing::TestParamInfo<viz::SharedImageFormat>& param_info) { … }
const auto kInitialDataFormats = …;
INSTANTIATE_TEST_SUITE_P(…);
const auto kSharedImageFormats = …;
INSTANTIATE_TEST_SUITE_P(…);
INSTANTIATE_TEST_SUITE_P(…);
const auto kReadbackFormats = …;
INSTANTIATE_TEST_SUITE_P(…);
}
}