[embedder] Expose metal surface from test context (flutter/engine#38133)

This is a minor cleanup that exposes the test metal surface to tests via
EmbedderTestContextMeta::GetTestMetalSurface for parity with the
GetTestMetalContext method which exposes the test metal context. This
eliminates the need for the more specific GetTextureInfo method since
the texture info is accessible via the test context.

This is a test refactoring with no semantic differences to the engine.

Issue: https://github.com/flutter/flutter/issues/116381
This commit is contained in:
Chris Bracken
2022-12-08 10:23:29 -08:00
committed by GitHub
parent 493eaa6275
commit 354ce9ffe0
3 changed files with 7 additions and 7 deletions

View File

@@ -47,6 +47,10 @@ TestMetalContext* EmbedderTestContextMetal::GetTestMetalContext() {
return metal_context_.get();
}
TestMetalSurface* EmbedderTestContextMetal::GetTestMetalSurface() {
return metal_surface_.get();
}
void EmbedderTestContextMetal::SetPresentCallback(
PresentCallback present_callback) {
present_callback_ = std::move(present_callback);
@@ -79,10 +83,6 @@ bool EmbedderTestContextMetal::PopulateExternalTexture(
}
}
TestMetalContext::TextureInfo EmbedderTestContextMetal::GetTextureInfo() {
return metal_surface_->GetTextureInfo();
}
void EmbedderTestContextMetal::SetNextDrawableCallback(
NextDrawableCallback next_drawable_callback) {
next_drawable_callback_ = std::move(next_drawable_callback);

View File

@@ -53,8 +53,7 @@ class EmbedderTestContextMetal : public EmbedderTestContext {
TestMetalContext* GetTestMetalContext();
// Returns the TextureInfo for the test Metal surface.
TestMetalContext::TextureInfo GetTextureInfo();
TestMetalSurface* GetTestMetalSurface();
// Override the default handling for GetNextDrawable.
void SetNextDrawableCallback(NextDrawableCallback next_drawable_callback);

View File

@@ -242,7 +242,8 @@ TEST_F(EmbedderTest, TextureDestructionCallbackCalledWithoutCustomCompositorMeta
auto collect_context = std::make_unique<CollectContext>();
context.SetNextDrawableCallback([&context, &collect_context](const FlutterFrameInfo* frame_info) {
auto texture_info = context.GetTextureInfo();
auto texture_info = context.GetTestMetalSurface()->GetTextureInfo();
FlutterMetalTexture texture;
texture.struct_size = sizeof(FlutterMetalTexture);
texture.texture_id = texture_info.texture_id;