88#include " flutter/fml/synchronization/waitable_event.h"
99#include " flutter/impeller/core/allocator.h"
1010#include " flutter/impeller/core/device_buffer.h"
11- #include " flutter/impeller/display_list/aiks_context.h"
1211#include " flutter/impeller/display_list/dl_image_impeller.h"
1312#include " flutter/impeller/geometry/size.h"
1413#include " flutter/impeller/renderer/context.h"
@@ -46,7 +45,9 @@ namespace impeller {
4645
4746class TestImpellerContext : public impeller ::Context {
4847 public:
49- TestImpellerContext () : impeller::Context(impeller::Flags{}) {}
48+ TestImpellerContext ()
49+ : impeller::Context(impeller::Flags{}),
50+ allocator_ (std::make_shared<TestImpellerAllocator>()) {}
5051
5152 BackendType GetBackendType () const override { return BackendType::kMetal ; }
5253
@@ -59,7 +60,11 @@ class TestImpellerContext : public impeller::Context {
5960 }
6061
6162 std::shared_ptr<Allocator> GetResourceAllocator () const override {
62- return std::make_shared<TestImpellerAllocator>();
63+ return allocator_;
64+ }
65+
66+ std::shared_ptr<TestImpellerTexture> GetLastCreatedTexture () const {
67+ return allocator_->last_created_texture ();
6368 }
6469
6570 std::shared_ptr<ShaderLibrary> GetShaderLibrary () const override {
@@ -122,6 +127,7 @@ class TestImpellerContext : public impeller::Context {
122127 };
123128 std::vector<PendingTask> tasks_;
124129 std::shared_ptr<const Capabilities> capabilities_;
130+ std::shared_ptr<TestImpellerAllocator> allocator_;
125131 bool did_dispose_ = false ;
126132};
127133
@@ -404,10 +410,10 @@ TEST_F(ImageDecoderFixtureTest, ImpellerUploadToSharedNoGpu) {
404410
405411 ASSERT_EQ (no_gpu_access_context->command_buffer_count_ , 0ul );
406412 ASSERT_EQ (result.second , " " );
407- EXPECT_EQ (no_gpu_access_context-> DidDisposeResources (), true );
408- impeller::AiksContext aiks_context (no_gpu_access_context, nullptr );
409- EXPECT_EQ (result. first -> asImpellerImage ()
410- -> GetImpellerTexture (aiks_context. GetContentContext () )
413+ ASSERT_NE (result. first , nullptr );
414+ EXPECT_EQ (result. first -> GetSize (), DlISize::MakeWH ( 10 , 10 ) );
415+ ASSERT_NE (no_gpu_access_context-> GetLastCreatedTexture (), nullptr );
416+ EXPECT_EQ (no_gpu_access_context-> GetLastCreatedTexture ( )
411417 ->GetTextureDescriptor ()
412418 .storage_mode ,
413419 impeller::StorageMode::kHostVisible );
0 commit comments