Skip to content

Commit

Permalink
And in camera tests
Browse files Browse the repository at this point in the history
  • Loading branch information
stuartmorgan committed Oct 7, 2024
1 parent a975fcb commit bd61b88
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ public void createSurfaceProducer_setsExpectedSurfaceProducerCallback() {
reset(mockSurfaceRequest);

// Verify callback's onSurfaceCreated does not interact with the SurfaceRequest.
callback.onSurfaceCreated();
simulateSurfaceCreation(callback);
verifyNoMoreInteractions(mockSurfaceRequest);
}

Expand Down Expand Up @@ -262,4 +262,12 @@ public void setTargetRotation_makesCallToSetTargetRotation() {

verify(mockPreview).setTargetRotation(targetRotation);
}

// TODO(matanlurey): Replace with inline calls to onSurfaceAvailable once
// available on stable; see https://github.com/flutter/flutter/issues/155131.
// This seperate method only exists to scope the suppression.
@SuppressWarnings({"deprecation", "removal"})
void simulateSurfaceCreation(TextureRegistry.SurfaceProducer.Callback producerLifecycle) {
producerLifecycle.onSurfaceCreated();
}
}

0 comments on commit bd61b88

Please sign in to comment.