Flutter Engine
The Flutter Engine
Functions
GraphitePromiseImageTest.cpp File Reference
#include "include/gpu/graphite/BackendTexture.h"
#include "include/core/SkCanvas.h"
#include "include/core/SkColorFilter.h"
#include "include/core/SkColorSpace.h"
#include "include/core/SkSurface.h"
#include "include/gpu/graphite/Context.h"
#include "include/gpu/graphite/Image.h"
#include "include/gpu/graphite/Recording.h"
#include "include/gpu/graphite/Surface.h"
#include "src/gpu/graphite/Caps.h"
#include "src/gpu/graphite/ContextPriv.h"
#include "src/gpu/graphite/RecordingPriv.h"
#include "tests/Test.h"
#include "tools/graphite/GraphiteTestContext.h"

Go to the source code of this file.

Functions

 DEF_CONDITIONAL_GRAPHITE_TEST_FOR_RENDERING_CONTEXTS (NonVolatileGraphitePromiseImageTest, reporter, context, testGpuContext, true, CtsEnforcement::kNextRelease)
 
 DEF_CONDITIONAL_GRAPHITE_TEST_FOR_RENDERING_CONTEXTS (NonVolatileGraphitePromiseImageFulfillFailureTest, reporter, context, testGpuContext, true, CtsEnforcement::kNextRelease)
 
 DEF_CONDITIONAL_GRAPHITE_TEST_FOR_RENDERING_CONTEXTS (NonVolatileGraphitePromiseImageCreationFailureTest, reporter, context, testGpuContext, true, CtsEnforcement::kNextRelease)
 
 DEF_CONDITIONAL_GRAPHITE_TEST_FOR_RENDERING_CONTEXTS (VolatileGraphitePromiseImageTest, reporter, context, testGpuContext, true, CtsEnforcement::kNextRelease)
 
 DEF_CONDITIONAL_GRAPHITE_TEST_FOR_RENDERING_CONTEXTS (VolatileGraphitePromiseImageFulfillFailureTest, reporter, context, testGpuContext, true, CtsEnforcement::kNextRelease)
 
 DEF_CONDITIONAL_GRAPHITE_TEST_FOR_RENDERING_CONTEXTS (GraphitePromiseImageRecorderLoss, reporter, context, testGpuContext, true, CtsEnforcement::kNextRelease)
 
 DEF_CONDITIONAL_GRAPHITE_TEST_FOR_RENDERING_CONTEXTS (GraphitePromiseImageMultipleImgUses, reporter, context, testGpuContext, true, CtsEnforcement::kNextRelease)
 

Function Documentation

◆ DEF_CONDITIONAL_GRAPHITE_TEST_FOR_RENDERING_CONTEXTS() [1/7]

DEF_CONDITIONAL_GRAPHITE_TEST_FOR_RENDERING_CONTEXTS ( GraphitePromiseImageMultipleImgUses  ,
reporter  ,
context  ,
testGpuContext  ,
true  ,
CtsEnforcement::kNextRelease   
)

Definition at line 631 of file GraphitePromiseImageTest.cpp.

636 {
637 constexpr SkISize kDimensions{ 16, 16 };
638
639 static constexpr int kNumRecordings = 3;
640
641 for (Volatile isVolatile : { Volatile::kNo, Volatile::kYes }) {
642 int expectedVolatile = (isVolatile == Volatile::kYes) ? 1 : 0;
643 int expectedNonVolatile = 1 - expectedVolatile;
644
645 TestCtx testContext;
646 setup_test_context(context, reporter, &testContext,
647 kDimensions, isVolatile, /* invalidBackendTex= */ false);
648
649 std::unique_ptr<Recording> recordings[kNumRecordings];
650
651 SkCanvas* canvas = testContext.fSurface->getCanvas();
652
653 for (int i = 0; i < kNumRecordings; ++i) {
654 canvas->drawImage(testContext.fImg, 0, 0);
655
656 recordings[i] = testContext.fRecorder->snap();
657
658 if (isVolatile == Volatile::kYes) {
659 check_fulfills_only(reporter, testContext.fPromiseChecker,
660 /* expectedFulfillCnt= */ i);
661 } else {
662 check_fulfills_only(reporter, testContext.fPromiseChecker,
663 /* expectedFulfillCnt= */ i > 0 ? 1 : 0);
664 }
665
667 recordings[i]->priv().numVolatilePromiseImages() == expectedVolatile);
669 recordings[i]->priv().numNonVolatilePromiseImages() ==
670 expectedNonVolatile);
671
672 REPORTER_ASSERT(reporter, context->insertRecording({ recordings[i].get() }));
673
674 if (isVolatile == Volatile::kYes) {
675 check_fulfills_only(reporter, testContext.fPromiseChecker,
676 /* expectedFulfillCnt= */ i+1);
677 } else {
678 check_fulfills_only(reporter, testContext.fPromiseChecker,
679 /* expectedFulfillCnt= */ 1);
680 }
681
682 // Non-volatiles are cleared out after a successful insertion
683 REPORTER_ASSERT(reporter, recordings[i]->priv().numNonVolatilePromiseImages() == 0);
684 }
685
686 testGpuContext->syncedSubmit(context);
687
688 testContext.fSurface.reset();
689 testContext.fImg.reset();
690 for (int i = 0; i < kNumRecordings; ++i) {
691 recordings[i].reset();
692 }
693
694 if (isVolatile == Volatile::kYes) {
695 check_all_done(reporter, testContext.fPromiseChecker,
696 /* expectedFulfillCnt= */ kNumRecordings);
697 } else {
698 check_all_done(reporter, testContext.fPromiseChecker, /* expectedFulfillCnt= */ 1);
699 }
700 }
701}
reporter
Definition: FontMgrTest.cpp:39
static void check_all_done(skiatest::Reporter *reporter, const PromiseTextureChecker &promiseChecker, int expectedFulfillCnt=1)
#define REPORTER_ASSERT(r, cond,...)
Definition: Test.h:286
void drawImage(const SkImage *image, SkScalar left, SkScalar top)
Definition: SkCanvas.h:1528
FlPixelBufferTexturePrivate * priv
Definition: SkSize.h:16

◆ DEF_CONDITIONAL_GRAPHITE_TEST_FOR_RENDERING_CONTEXTS() [2/7]

DEF_CONDITIONAL_GRAPHITE_TEST_FOR_RENDERING_CONTEXTS ( GraphitePromiseImageRecorderLoss  ,
reporter  ,
context  ,
testGpuContext  ,
true  ,
CtsEnforcement::kNextRelease   
)

Definition at line 593 of file GraphitePromiseImageTest.cpp.

598 {
599 constexpr SkISize kDimensions{ 16, 16 };
600
601 for (Volatile isVolatile : { Volatile::kNo, Volatile::kYes }) {
602 TestCtx testContext;
603 setup_test_context(context, reporter, &testContext,
604 kDimensions, isVolatile, /* invalidBackendTex= */ false);
605
606 SkCanvas* canvas = testContext.fSurface->getCanvas();
607
608 canvas->drawImage(testContext.fImg, 0, 0);
609 check_unfulfilled(testContext.fPromiseChecker, reporter);
610
611 std::unique_ptr<Recording> recording = testContext.fRecorder->snap();
612 check_unfulfilled(testContext.fPromiseChecker, reporter);
613
614 testContext.fRecorder.reset(); // Recorder drop
615
616 REPORTER_ASSERT(reporter, context->insertRecording({ recording.get() }));
617 check_fulfills_only(reporter, testContext.fPromiseChecker, /* expectedFulfillCnt= */ 1);
618
619 testGpuContext->syncedSubmit(context);
620
621 testContext.fSurface.reset();
622 testContext.fImg.reset();
623 recording.reset();
624
625 check_all_done(reporter, testContext.fPromiseChecker, /* expectedFulfillCnt= */ 1);
626 }
627}
static void check_unfulfilled(const PromiseTextureChecker &promiseChecker, skiatest::Reporter *reporter)

◆ DEF_CONDITIONAL_GRAPHITE_TEST_FOR_RENDERING_CONTEXTS() [3/7]

DEF_CONDITIONAL_GRAPHITE_TEST_FOR_RENDERING_CONTEXTS ( NonVolatileGraphitePromiseImageCreationFailureTest  ,
reporter  ,
context  ,
testGpuContext  ,
true  ,
CtsEnforcement::kNextRelease   
)

Definition at line 402 of file GraphitePromiseImageTest.cpp.

408 {
409 // Note: these dimensions are invalid and will cause MakeGraphitePromiseTexture to fail
410 constexpr SkISize kDimensions { 0, 0 };
411
412 TestCtx testContext;
413 setup_test_context(context, reporter, &testContext,
414 kDimensions, Volatile::kNo, /* invalidBackendTex= */ true);
415
416 SkASSERT(!testContext.fImg);
417
418 // Despite MakeGraphitePromiseTexture failing, ImageRelease is called
419 REPORTER_ASSERT(reporter, testContext.fPromiseChecker.fFulfillCount == 0);
420 REPORTER_ASSERT(reporter, testContext.fPromiseChecker.fImageReleaseCount == 1);
421 REPORTER_ASSERT(reporter, testContext.fPromiseChecker.totalReleaseCount() == 0);
422}
#define SkASSERT(cond)
Definition: SkAssert.h:116

◆ DEF_CONDITIONAL_GRAPHITE_TEST_FOR_RENDERING_CONTEXTS() [4/7]

DEF_CONDITIONAL_GRAPHITE_TEST_FOR_RENDERING_CONTEXTS ( NonVolatileGraphitePromiseImageFulfillFailureTest  ,
reporter  ,
context  ,
testGpuContext  ,
true  ,
CtsEnforcement::kNextRelease   
)

Definition at line 328 of file GraphitePromiseImageTest.cpp.

334 {
335 constexpr SkISize kDimensions { 16, 16 };
336
337 TestCtx testContext;
338 setup_test_context(context, reporter, &testContext,
339 kDimensions, Volatile::kNo, /* invalidBackendTex= */ true);
340
341 // Draw the image a few different ways.
342 {
343 SkCanvas* canvas = testContext.fSurface->getCanvas();
344
345 canvas->drawImage(testContext.fImg, 0, 0);
346 check_unfulfilled(testContext.fPromiseChecker, reporter);
347
348 std::unique_ptr<Recording> recording = testContext.fRecorder->snap();
349 check_unfulfilled(testContext.fPromiseChecker, reporter);
350
351 REPORTER_ASSERT(reporter, !context->insertRecording({ recording.get() }));
352 check_fulfilled_ahead_by_one(reporter, testContext.fPromiseChecker,
353 /* expectedFulfillCnt= */ 1);
354
355 // Test that reinserting gives uninstantiated PromiseImages a second chance
356 REPORTER_ASSERT(reporter, !context->insertRecording({ recording.get() }));
357 check_fulfills_only(reporter, testContext.fPromiseChecker, /* expectedFulfillCnt= */ 2);
358 }
359
360 {
361 SkCanvas* canvas = testContext.fSurface->getCanvas();
362
365 canvas->drawImage(testContext.fImg, 0, 0, SkSamplingOptions(), &paint);
366
367 std::unique_ptr<Recording> recording = testContext.fRecorder->snap();
368 check_fulfills_only(reporter, testContext.fPromiseChecker, /* expectedFulfillCnt= */ 2);
369
370 REPORTER_ASSERT(reporter, !context->insertRecording({ recording.get() }));
371 check_fulfills_only(reporter, testContext.fPromiseChecker, /* expectedFulfillCnt= */ 3);
372 }
373
374 {
375 SkCanvas* canvas = testContext.fSurface->getCanvas();
376
377 sk_sp<SkShader> shader = testContext.fImg->makeShader(SkSamplingOptions());
378 REPORTER_ASSERT(reporter, shader);
379
381 paint.setShader(std::move(shader));
382 canvas->drawRect(SkRect::MakeWH(1, 1), paint);
383
384 std::unique_ptr<Recording> recording = testContext.fRecorder->snap();
385 check_fulfills_only(reporter, testContext.fPromiseChecker, /* expectedFulfillCnt= */ 3);
386
387 REPORTER_ASSERT(reporter, !context->insertRecording({ recording.get() }));
388 check_fulfills_only(reporter, testContext.fPromiseChecker, /* expectedFulfillCnt= */ 4);
389 }
390
391 testContext.fSurface.reset();
392 testContext.fImg.reset();
393
394 // Despite fulfill failing 4x, the imageRelease callback still fires
395 testContext.fPromiseChecker.checkImageReleased(reporter, /* expectedReleaseCnt= */ 1);
396
397 testGpuContext->syncedSubmit(context);
398 // fulfill should've been called 4x while release should never have been called
399 check_fulfills_only(reporter, testContext.fPromiseChecker, /* expectedFulfillCnt= */ 4);
400}
void drawRect(const SkRect &rect, const SkPaint &paint)
Definition: SkCanvas.cpp:1673
static sk_sp< SkColorFilter > LinearToSRGBGamma()
const Paint & paint
Definition: color_source.cc:38
SkSamplingOptions(SkFilterMode::kLinear))
static constexpr SkRect MakeWH(float w, float h)
Definition: SkRect.h:609

◆ DEF_CONDITIONAL_GRAPHITE_TEST_FOR_RENDERING_CONTEXTS() [5/7]

DEF_CONDITIONAL_GRAPHITE_TEST_FOR_RENDERING_CONTEXTS ( NonVolatileGraphitePromiseImageTest  ,
reporter  ,
context  ,
testGpuContext  ,
true  ,
CtsEnforcement::kNextRelease   
)

Definition at line 242 of file GraphitePromiseImageTest.cpp.

247 {
248 constexpr SkISize kDimensions { 16, 16 };
249
250 TestCtx testContext;
251 setup_test_context(context, reporter, &testContext,
252 kDimensions, Volatile::kNo, /* invalidBackendTex= */ false);
253
254 {
255 SkCanvas* canvas = testContext.fSurface->getCanvas();
256
257 canvas->drawImage(testContext.fImg, 0, 0);
258 check_unfulfilled(testContext.fPromiseChecker, reporter);
259
260 std::unique_ptr<Recording> recording = testContext.fRecorder->snap();
261 check_unfulfilled(testContext.fPromiseChecker, reporter); // NVPIs not fulfilled at snap
262
263 REPORTER_ASSERT(reporter, context->insertRecording({ recording.get() }));
264 check_fulfilled_ahead_by_one(reporter, testContext.fPromiseChecker,
265 /* expectedFulfillCnt= */ 1); // NVPIs fulfilled at insert
266 }
267
268 context->submit(SyncToCpu::kNo);
269 // testContext.fImg still has a ref so we should not have called TextureRelease.
270 check_fulfilled_ahead_by_one(reporter, testContext.fPromiseChecker,
271 /* expectedFulfillCnt= */ 1);
272
273 testGpuContext->syncedSubmit(context);
274 check_fulfilled_ahead_by_one(reporter, testContext.fPromiseChecker,
275 /* expectedFulfillCnt= */ 1);
276
277 // Test that more draws and insertions don't refulfill the NVPI
278 {
279 SkCanvas* canvas = testContext.fSurface->getCanvas();
280
281 canvas->drawImage(testContext.fImg, 0, 0);
282 canvas->drawImage(testContext.fImg, 0, 0);
283
284 std::unique_ptr<Recording> recording = testContext.fRecorder->snap();
285 check_fulfilled_ahead_by_one(reporter, testContext.fPromiseChecker,
286 /* expectedFulfillCnt= */ 1); // No new fulfill
287
288 REPORTER_ASSERT(reporter, context->insertRecording({ recording.get() }));
289 // testContext.fImg should still be fulfilled from the first time we inserted a Recording.
290 check_fulfilled_ahead_by_one(reporter, testContext.fPromiseChecker,
291 /* expectedFulfillCnt= */ 1);
292 }
293
294 testGpuContext->syncedSubmit(context);
295 check_fulfilled_ahead_by_one(reporter, testContext.fPromiseChecker,
296 /* expectedFulfillCnt= */ 1);
297
298 // Test that dropping the SkImage's ref doesn't change anything
299 {
300 SkCanvas* canvas = testContext.fSurface->getCanvas();
301
302 canvas->drawImage(testContext.fImg, 0, 0);
303 testContext.fImg.reset();
304
305 std::unique_ptr<Recording> recording = testContext.fRecorder->snap();
306 check_fulfilled_ahead_by_one(reporter, testContext.fPromiseChecker,
307 /* expectedFulfillCnt= */ 1);
308
309 REPORTER_ASSERT(reporter, context->insertRecording({ recording.get() }));
310 check_fulfilled_ahead_by_one(reporter, testContext.fPromiseChecker,
311 /* expectedFulfillCnt= */ 1);
312 }
313
314 // fImg's proxy is reffed by the recording so, despite fImg being reset earlier,
315 // the imageRelease callback doesn't occur until the recording is deleted.
316 testContext.fPromiseChecker.checkImageReleased(reporter, /* expectedReleaseCnt= */ 1);
317
318 // testContext.fImg no longer holds a ref but the last recording is still not submitted.
319 check_fulfilled_ahead_by_one(reporter, testContext.fPromiseChecker,
320 /* expectedFulfillCnt= */ 1);
321
322 testGpuContext->syncedSubmit(context);
323
324 // Now TextureRelease should definitely have been called.
325 check_all_done(reporter, testContext.fPromiseChecker, /* expectedFulfillCnt= */ 1);
326}

◆ DEF_CONDITIONAL_GRAPHITE_TEST_FOR_RENDERING_CONTEXTS() [6/7]

DEF_CONDITIONAL_GRAPHITE_TEST_FOR_RENDERING_CONTEXTS ( VolatileGraphitePromiseImageFulfillFailureTest  ,
reporter  ,
context  ,
testGpuContext  ,
true  ,
CtsEnforcement::kNextRelease   
)

Definition at line 519 of file GraphitePromiseImageTest.cpp.

524 {
525 constexpr SkISize kDimensions { 16, 16 };
526
527 TestCtx testContext;
528 setup_test_context(context, reporter, &testContext,
529 kDimensions, Volatile::kYes, /* invalidBackendTex= */ true);
530
531 // Draw the image a few different ways.
532 {
533 SkCanvas* canvas = testContext.fSurface->getCanvas();
534
535 canvas->drawImage(testContext.fImg, 0, 0);
536 check_unfulfilled(testContext.fPromiseChecker, reporter);
537
538 std::unique_ptr<Recording> recording = testContext.fRecorder->snap();
539 check_unfulfilled(testContext.fPromiseChecker, reporter);
540
541 REPORTER_ASSERT(reporter, !context->insertRecording({ recording.get() }));
542 check_fulfills_only(reporter, testContext.fPromiseChecker, /* expectedFulfillCnt= */ 1);
543
544 REPORTER_ASSERT(reporter, !context->insertRecording({ recording.get() }));
545 check_fulfills_only(reporter, testContext.fPromiseChecker, /* expectedFulfillCnt= */ 2);
546 }
547
548 {
549 SkCanvas* canvas = testContext.fSurface->getCanvas();
550
553 canvas->drawImage(testContext.fImg, 0, 0, SkSamplingOptions(), &paint);
554
555 std::unique_ptr<Recording> recording = testContext.fRecorder->snap();
556 check_fulfills_only(reporter, testContext.fPromiseChecker, /* expectedFulfillCnt= */ 2);
557
558 REPORTER_ASSERT(reporter, !context->insertRecording({ recording.get() }));
559 check_fulfills_only(reporter, testContext.fPromiseChecker, /* expectedFulfillCnt= */ 3);
560
561 REPORTER_ASSERT(reporter, !context->insertRecording({ recording.get() }));
562 check_fulfills_only(reporter, testContext.fPromiseChecker, /* expectedFulfillCnt= */ 4);
563 }
564
565 {
566 SkCanvas* canvas = testContext.fSurface->getCanvas();
567
568 sk_sp<SkShader> shader = testContext.fImg->makeShader(SkSamplingOptions());
569 REPORTER_ASSERT(reporter, shader);
570
572 paint.setShader(std::move(shader));
573 canvas->drawRect(SkRect::MakeWH(1, 1), paint);
574
575 std::unique_ptr<Recording> recording = testContext.fRecorder->snap();
576 check_fulfills_only(reporter, testContext.fPromiseChecker, /* expectedFulfillCnt= */ 4);
577
578 REPORTER_ASSERT(reporter, !context->insertRecording({ recording.get() }));
579 check_fulfills_only(reporter, testContext.fPromiseChecker, /* expectedFulfillCnt= */ 5);
580
581 REPORTER_ASSERT(reporter, !context->insertRecording({ recording.get() }));
582 check_fulfills_only(reporter, testContext.fPromiseChecker, /* expectedFulfillCnt= */ 6);
583 }
584
585 testContext.fSurface.reset();
586 testContext.fImg.reset();
587
588 testGpuContext->syncedSubmit(context);
589 check_fulfills_only(reporter, testContext.fPromiseChecker, /* expectedFulfillCnt= */ 6);
590}

◆ DEF_CONDITIONAL_GRAPHITE_TEST_FOR_RENDERING_CONTEXTS() [7/7]

DEF_CONDITIONAL_GRAPHITE_TEST_FOR_RENDERING_CONTEXTS ( VolatileGraphitePromiseImageTest  ,
reporter  ,
context  ,
testGpuContext  ,
true  ,
CtsEnforcement::kNextRelease   
)

Definition at line 424 of file GraphitePromiseImageTest.cpp.

429 {
430 constexpr SkISize kDimensions { 16, 16 };
431
432 TestCtx testContext;
433 setup_test_context(context, reporter, &testContext,
434 kDimensions, Volatile::kYes, /* invalidBackendTex= */ false);
435
436 {
437 SkCanvas* canvas = testContext.fSurface->getCanvas();
438
439 canvas->drawImage(testContext.fImg, 0, 0);
440 check_unfulfilled(testContext.fPromiseChecker, reporter);
441
442 std::unique_ptr<Recording> recording = testContext.fRecorder->snap();
443 // Nothing happens at snap time for VPIs
444 check_unfulfilled(testContext.fPromiseChecker, reporter);
445
446 REPORTER_ASSERT(reporter, context->insertRecording({ recording.get() }));
447 check_fulfilled_ahead_by_one(reporter, testContext.fPromiseChecker,
448 /* expectedFulfillCnt= */ 1); // VPIs fulfilled on insert
449
450 // Test that multiple insertions will clobber prior fulfills
451 REPORTER_ASSERT(reporter, context->insertRecording({ recording.get() }));
452 check_fulfilled_ahead_by_two(reporter, testContext.fPromiseChecker,
453 /* expectedFulfillCnt= */ 2);
454 }
455
456 testGpuContext->syncedSubmit(context);
457 check_all_done(reporter, testContext.fPromiseChecker, /* expectedFulfillCnt= */ 2);
458
459 REPORTER_ASSERT(reporter, testContext.fPromiseChecker.fTextureReleaseCounts[0] == 1);
460 REPORTER_ASSERT(reporter, testContext.fPromiseChecker.fTextureReleaseCounts[1] == 1);
461
462 {
463 SkCanvas* canvas = testContext.fSurface->getCanvas();
464
465 canvas->drawImage(testContext.fImg, 0, 0);
466 canvas->drawImage(testContext.fImg, 0, 0);
467
468 std::unique_ptr<Recording> recording = testContext.fRecorder->snap();
469 // Nothing happens at snap time for volatile images
470 check_all_done(reporter, testContext.fPromiseChecker, /* expectedFulfillCnt= */ 2);
471
472 REPORTER_ASSERT(reporter, context->insertRecording({ recording.get() }));
473 check_fulfilled_ahead_by_one(reporter, testContext.fPromiseChecker,
474 /* expectedFulfillCnt= */ 3);
475
476 REPORTER_ASSERT(reporter, context->insertRecording({ recording.get() }));
477 check_fulfilled_ahead_by_two(reporter, testContext.fPromiseChecker,
478 /* expectedFulfillCnt= */ 4);
479 }
480
481 testGpuContext->syncedSubmit(context);
482 check_all_done(reporter, testContext.fPromiseChecker, /* expectedFulfillCnt= */ 4);
483
484 REPORTER_ASSERT(reporter, testContext.fPromiseChecker.fTextureReleaseCounts[0] == 2);
485 REPORTER_ASSERT(reporter, testContext.fPromiseChecker.fTextureReleaseCounts[1] == 2);
486
487 {
488 SkCanvas* canvas = testContext.fSurface->getCanvas();
489
490 canvas->drawImage(testContext.fImg, 0, 0);
491 testContext.fImg.reset();
492
493 std::unique_ptr<Recording> recording = testContext.fRecorder->snap();
494 // Nothing happens at snap time for volatile images
495 check_all_done(reporter, testContext.fPromiseChecker, /* expectedFulfillCnt= */ 4);
496
497 REPORTER_ASSERT(reporter, context->insertRecording({ recording.get() }));
498 check_fulfilled_ahead_by_one(reporter, testContext.fPromiseChecker,
499 /* expectedFulfillCnt= */ 5);
500
501 REPORTER_ASSERT(reporter, context->insertRecording({ recording.get() }));
502 check_fulfilled_ahead_by_two(reporter, testContext.fPromiseChecker,
503 /* expectedFulfillCnt= */ 6);
504 }
505
506 // testContext.fImg no longer holds a ref but the last recordings are still not submitted.
507 check_fulfilled_ahead_by_two(reporter, testContext.fPromiseChecker,
508 /* expectedFulfillCnt= */ 6);
509
510 testGpuContext->syncedSubmit(context);
511
512 // Now all Releases should definitely have been called.
513 check_all_done(reporter, testContext.fPromiseChecker, /* expectedFulfillCnt= */ 6);
514
515 REPORTER_ASSERT(reporter, testContext.fPromiseChecker.fTextureReleaseCounts[0] == 3);
516 REPORTER_ASSERT(reporter, testContext.fPromiseChecker.fTextureReleaseCounts[1] == 3);
517}