flutter_flutter/lib/web_ui/dev/firefox_installer_test.dart
Yegor b2a7470748
Reland "add limited analysis options (#17332)" (#17374)
* Reland "add limited analysis options (#17332)"

This time I'm starting without Cirrus. Will add Cirrus serpartely from code changes.

This reverts commit 6d33ee1a2ca7d404ebd5cb434d8ab859bf8ac0b7.

* disable Cirrus analysis check
2020-03-27 11:06:10 -07:00

47 lines
1.2 KiB
Dart

// Copyright 2013 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// @dart = 2.6
@TestOn('vm && linux')
import 'dart:io' as io;
import 'package:path/path.dart' as path;
import 'package:test/test.dart';
import 'common.dart';
import 'environment.dart';
import 'firefox_installer.dart';
void main() async {
void deleteFirefoxInstallIfExists() {
final io.Directory firefoxInstallationDir = io.Directory(
path.join(environment.webUiDartToolDir.path, 'firefox'),
);
if (firefoxInstallationDir.existsSync()) {
firefoxInstallationDir.deleteSync(recursive: true);
}
}
setUpAll(() {
deleteFirefoxInstallIfExists();
});
tearDown(() {
deleteFirefoxInstallIfExists();
});
test('installs a given version of Firefox', () async {
FirefoxInstaller installer = FirefoxInstaller(version: '69.0.2');
expect(installer.isInstalled, isFalse);
BrowserInstallation installation = await getOrInstallFirefox('69.0.2');
expect(installation.version, '69.0.2');
expect(installer.isInstalled, isTrue);
expect(io.File(installation.executable).existsSync(), isTrue);
});
}