flutter / flutter

Flutter makes it easy and fast to build beautiful apps for mobile and beyond
https://flutter.dev
BSD 3-Clause "New" or "Revised" License
164.55k stars 27.13k forks source link

[camerax] ☂️ Clean up Dart Tests #125928

Open camsim99 opened 1 year ago

camsim99 commented 1 year ago

As the android_camera_camerax plugin has been under development, there have a number of tasks that have not blocked PRs but are important technical debt to pay down. This umbrella issue covers those tasks that apply to cleaning up tests in this plugin:

camsim99 commented 10 months ago
  • [ ] Consider refactoring the FakeAndroidCameraCameraX classed used in the plugin Dart test for testing, since it is likely these objects used in the test can be mocked without using it.

Concerning this point, this may become easier for future wrappings with https://github.com/flutter/flutter/issues/134777, but I think a good starting point would be to follow WebView and use a proxy class like https://github.com/flutter/packages/blob/main/packages/webview_flutter/webview_flutter_android/lib/src/android_proxy.dart#L16 (which can be used to created detached or mock objects) that is passed to the WebViewController (https://github.com/flutter/packages/blob/main/packages/webview_flutter/webview_flutter_android/lib/src/android_webview_controller.dart#L31).

cc @gmackall as this is a follow up to https://github.com/flutter/packages/pull/5287#issuecomment-1789271416