Switch tests to use TestGpuServiceHolder
GpuFenceTest and SignalTest were both using InProcessGpuThreadHolder to initialize GPU state. This doesn't support graphite and the tests would crash trying to initialize graphite if the feature is enabled. Switch the tests to use TestGpuServiceHolder, which is similar to InProcessGpuThreadHolder, but works with graphite. Bug: 41494082 Change-Id: I26bec691cf028ef51de35ae3dc6b8fc2b9633d3a Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5676228 Reviewed-by: Saifuddin Hitawala <hitawala@chromium.org> Commit-Queue: Kyle Charbonneau <kylechar@chromium.org> Cr-Commit-Position: refs/heads/main@{#1323372}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
187136c66f
commit
065f5e5bdb
components/viz/test
gpu/ipc/client
@ -138,8 +138,7 @@ TestGpuServiceHolder* TestGpuServiceHolder::GetInstance() {
|
||||
}
|
||||
|
||||
if (!g_holder) {
|
||||
g_holder = new TestGpuServiceHolder(gpu::gles2::ParseGpuPreferences(
|
||||
base::CommandLine::ForCurrentProcess()));
|
||||
g_holder = new TestGpuServiceHolder();
|
||||
}
|
||||
return g_holder;
|
||||
}
|
||||
@ -180,6 +179,10 @@ TestGpuServiceHolder::ScopedAllowRacyFeatureListOverrides::
|
||||
g_disallow_feature_list_overrides = true;
|
||||
}
|
||||
|
||||
TestGpuServiceHolder::TestGpuServiceHolder()
|
||||
: TestGpuServiceHolder(gpu::gles2::ParseGpuPreferences(
|
||||
base::CommandLine::ForCurrentProcess())) {}
|
||||
|
||||
TestGpuServiceHolder::TestGpuServiceHolder(
|
||||
const gpu::GpuPreferences& gpu_preferences)
|
||||
: gpu_main_thread_("GPUMainThread"), io_thread_("GPUIOThread") {
|
||||
|
@ -93,6 +93,7 @@ class TestGpuServiceHolder : public gpu::GpuInProcessThreadServiceDelegate {
|
||||
// GetInstance().
|
||||
static void DoNotResetOnTestExit();
|
||||
|
||||
TestGpuServiceHolder();
|
||||
explicit TestGpuServiceHolder(const gpu::GpuPreferences& preferences);
|
||||
|
||||
TestGpuServiceHolder(const TestGpuServiceHolder&) = delete;
|
||||
|
@ -9,6 +9,7 @@ include_rules = [
|
||||
specific_include_rules = {
|
||||
"gpu_in_process_context_tests.cc": [
|
||||
"+components/viz/test/test_gpu_memory_buffer_manager.h",
|
||||
"+components/viz/test/test_gpu_service_holder.h",
|
||||
],
|
||||
"image_decode_accelerator_proxy(_unittest)?\.cc": [
|
||||
"+cc/paint/paint_image.h",
|
||||
|
@ -11,12 +11,12 @@
|
||||
|
||||
#include "base/memory/raw_ptr.h"
|
||||
#include "build/build_config.h"
|
||||
#include "components/viz/test/test_gpu_service_holder.h"
|
||||
#include "gpu/command_buffer/client/gles2_implementation.h"
|
||||
#include "gpu/command_buffer/client/shared_memory_limits.h"
|
||||
#include "gpu/command_buffer/client/test_gpu_memory_buffer_manager.h"
|
||||
#include "gpu/ipc/common/surface_handle.h"
|
||||
#include "gpu/ipc/gl_in_process_context.h"
|
||||
#include "gpu/ipc/in_process_gpu_thread_holder.h"
|
||||
#include "testing/gtest/include/gtest/gtest.h"
|
||||
|
||||
namespace {
|
||||
@ -28,7 +28,7 @@ class ContextTestBase : public testing::Test {
|
||||
attributes.bind_generates_resource = false;
|
||||
|
||||
auto context = std::make_unique<gpu::GLInProcessContext>();
|
||||
auto result = context->Initialize(gpu_thread_holder_.GetTaskExecutor(),
|
||||
auto result = context->Initialize(gpu_thread_holder_.task_executor(),
|
||||
attributes, gpu::SharedMemoryLimits());
|
||||
DCHECK_EQ(result, gpu::ContextResult::kSuccess);
|
||||
return context;
|
||||
@ -51,7 +51,7 @@ class ContextTestBase : public testing::Test {
|
||||
raw_ptr<gpu::ContextSupport> context_support_;
|
||||
|
||||
private:
|
||||
gpu::InProcessGpuThreadHolder gpu_thread_holder_;
|
||||
viz::TestGpuServiceHolder gpu_thread_holder_;
|
||||
std::unique_ptr<gpu::GLInProcessContext> context_;
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user