chromium/third_party/angle/src/tests/egl_tests/EGLBlobCacheTest.cpp

//
// Copyright 2018 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// EGLBlobCacheTest:
//   Unit tests for the EGL_ANDROID_blob_cache extension.

// Must be included first to prevent errors with "None".
#include "test_utils/ANGLETest.h"

#include <map>
#include <vector>

#include "common/PackedEnums.h"
#include "common/angleutils.h"
#include "test_utils/ANGLETest.h"
#include "test_utils/MultiThreadSteps.h"
#include "test_utils/gl_raii.h"
#include "util/EGLWindow.h"
#include "util/test_utils.h"

usingnamespaceangle;

constexpr char kEGLExtName[] =;

enum class CacheOpResult
{};

angle::PackedEnumMap<CacheOpResult, std::string> kCacheOpToString =;

std::ostream &operator<<(std::ostream &os, CacheOpResult result)
{}

namespace
{
std::map<std::vector<uint8_t>, std::vector<uint8_t>> gApplicationCache;
CacheOpResult gLastCacheOpResult =;

void SetBlob(const void *key, EGLsizeiANDROID keySize, const void *value, EGLsizeiANDROID valueSize)
{}

void SetCorruptedBlob(const void *key,
                      EGLsizeiANDROID keySize,
                      const void *value,
                      EGLsizeiANDROID valueSize)
{}

EGLsizeiANDROID GetBlob(const void *key,
                        EGLsizeiANDROID keySize,
                        void *value,
                        EGLsizeiANDROID valueSize)
{}

void WaitProgramBinaryReady(GLuint program)
{}
}  // anonymous namespace

class EGLBlobCacheTest : public ANGLETest<>
{};

// Makes sure the extension exists and works
TEST_P(EGLBlobCacheTest, Functional)
{}

// Makes sure the caching is always done without an explicit wait for post-link events (if any)
TEST_P(EGLBlobCacheTest, FunctionalWithoutWait)
{}

// Tests error conditions of the APIs.
TEST_P(EGLBlobCacheTest, NegativeAPI)
{}

// Regression test for including the fragment output locatins in the program key.
// http://anglebug.com/42263144
TEST_P(EGLBlobCacheTest, FragmentOutputLocationKey)
{}

// Checks that the shader cache, which is used when this extension is available, is working
// properly.
TEST_P(EGLBlobCacheTest, ShaderCacheFunctional)
{}

// Tests compiling a program in multiple threads, then fetching the compiled program/shaders from
// the cache. We then perform a draw call and test the result to ensure nothing was corrupted.
TEST_P(EGLBlobCacheTest, ThreadSafety)
{}

// Makes sure ANGLE recovers from corrupted cache.
TEST_P(EGLBlobCacheTest, CacheCorruption)
{}

class EGLBlobCacheInternalRejectionTest : public EGLBlobCacheTest
{};

// Makes sure ANGLE recovers from internal (backend) rejection of the program blob, while everything
// seems fine to ANGLE.
TEST_P(EGLBlobCacheInternalRejectionTest, Functional)
{}

// Makes sure ANGLE recovers from internal (backend) rejection of the shader blob, while everything
// seems fine to ANGLE.
TEST_P(EGLBlobCacheInternalRejectionTest, ShaderCacheFunctional)
{}

ANGLE_INSTANTIATE_TEST();

GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST();
ANGLE_INSTANTIATE_TEST();