DesktopUpdaterController.forTesting constructor
DesktopUpdaterController.forTesting({
- required Uri? appArchiveUrl,
- DesktopUpdateLocalization? localization,
- bool allowUnsignedMacOSUpdates = false,
- String channel = "stable",
- String? installationIdentity,
- UpdatePreferences? preferences,
- UpdateRecoveryStore? recoveryStore,
- String? diagnosticsLogPath,
- DesktopUpdaterTelemetry? telemetry,
- MinimumOSSupportChecker? isMinimumOSSupported,
- UpdateDiagnosticsRecorder? diagnosticsRecorder,
- Future<
void> onProblemReport(- UpdateProblemReport report
- FutureOr<
void> onCleanupReport(- UpdateCleanupReport report
- bool skipInitialVersionCheck = false,
- ReleaseNotesLoader? releaseNotesLoader,
- Uri? releaseNotesUrl,
- ReleaseNotesFetcher? releaseNotesFetcher,
Creates a controller with injected collaborators for unit testing.
Identical to the default constructor but accepts an optional
releaseNotesFetcher so tests can substitute a fake HTTP layer without
exposing that seam in the public API.
Implementation
@visibleForTesting
DesktopUpdaterController.forTesting({
required Uri? appArchiveUrl,
this.localization,
this.allowUnsignedMacOSUpdates = false,
this.channel = "stable",
this.installationIdentity,
this.preferences,
this.recoveryStore,
this.diagnosticsLogPath,
this.telemetry,
this.isMinimumOSSupported,
UpdateDiagnosticsRecorder? diagnosticsRecorder,
Future<void> Function(UpdateProblemReport report)? onProblemReport,
FutureOr<void> Function(UpdateCleanupReport report)? onCleanupReport,
bool skipInitialVersionCheck = false,
ReleaseNotesLoader? releaseNotesLoader,
Uri? releaseNotesUrl,
ReleaseNotesFetcher? releaseNotesFetcher,
}) : _skipInitialVersionCheck = skipInitialVersionCheck,
_diagnosticsRecorder =
diagnosticsRecorder ?? UpdateDiagnosticsRecorder(channel: channel),
_onProblemReport = onProblemReport,
_onCleanupReport = onCleanupReport,
_releaseNotesLoader = releaseNotesLoader,
_releaseNotesUrl = releaseNotesUrl,
_releaseNotesFetcher = releaseNotesFetcher ??
(releaseNotesUrl == null ? null : ReleaseNotesFetcher()) {
if (appArchiveUrl != null) {
init(appArchiveUrl);
}
}