Unnecessary new (#20138) * enable lint unnecessary_new * fix tests * fix tests * fix tests
diff --git a/packages/flutter_tools/test/analytics_test.dart b/packages/flutter_tools/test/analytics_test.dart index f6f2b75..ee99ace 100644 --- a/packages/flutter_tools/test/analytics_test.dart +++ b/packages/flutter_tools/test/analytics_test.dart
@@ -51,13 +51,13 @@ count = 0; flutterUsage.enabled = false; - final DoctorCommand doctorCommand = new DoctorCommand(); + final DoctorCommand doctorCommand = DoctorCommand(); final CommandRunner<Null>runner = createTestCommandRunner(doctorCommand); await runner.run(<String>['doctor']); expect(count, 0); }, overrides: <Type, Generator>{ - FlutterVersion: () => new FlutterVersion(const Clock()), - Usage: () => new Usage(configDirOverride: tempDir.path), + FlutterVersion: () => FlutterVersion(const Clock()), + Usage: () => Usage(configDirOverride: tempDir.path), }); // Ensure we don't send for the 'flutter config' command. @@ -66,7 +66,7 @@ flutterUsage.onSend.listen((Map<String, dynamic> data) => count++); flutterUsage.enabled = false; - final ConfigCommand command = new ConfigCommand(); + final ConfigCommand command = ConfigCommand(); final CommandRunner<Null> runner = createTestCommandRunner(command); await runner.run(<String>['config']); expect(count, 0); @@ -75,8 +75,8 @@ await runner.run(<String>['config']); expect(count, 0); }, overrides: <Type, Generator>{ - FlutterVersion: () => new FlutterVersion(const Clock()), - Usage: () => new Usage(configDirOverride: tempDir.path), + FlutterVersion: () => FlutterVersion(const Clock()), + Usage: () => Usage(configDirOverride: tempDir.path), }); }); @@ -87,19 +87,19 @@ List<int> mockTimes; setUp(() { - mockUsage = new MockUsage(); + mockUsage = MockUsage(); when(mockUsage.isFirstRun).thenReturn(false); - mockClock = new MockClock(); - mockDoctor = new MockDoctor(); + mockClock = MockClock(); + mockDoctor = MockDoctor(); when(mockClock.now()).thenAnswer( - (Invocation _) => new DateTime.fromMillisecondsSinceEpoch(mockTimes.removeAt(0)) + (Invocation _) => DateTime.fromMillisecondsSinceEpoch(mockTimes.removeAt(0)) ); }); testUsingContext('flutter commands send timing events', () async { mockTimes = <int>[1000, 2000]; when(mockDoctor.diagnose(androidLicenses: false, verbose: false)).thenAnswer((_) async => true); - final DoctorCommand command = new DoctorCommand(); + final DoctorCommand command = DoctorCommand(); final CommandRunner<Null> runner = createTestCommandRunner(command); await runner.run(<String>['doctor']); @@ -118,7 +118,7 @@ testUsingContext('doctor fail sends warning', () async { mockTimes = <int>[1000, 2000]; when(mockDoctor.diagnose(androidLicenses: false, verbose: false)).thenAnswer((_) async => false); - final DoctorCommand command = new DoctorCommand(); + final DoctorCommand command = DoctorCommand(); final CommandRunner<Null> runner = createTestCommandRunner(command); await runner.run(<String>['doctor']); @@ -135,14 +135,14 @@ }); testUsingContext('single command usage path', () async { - final FlutterCommand doctorCommand = new DoctorCommand(); + final FlutterCommand doctorCommand = DoctorCommand(); expect(await doctorCommand.usagePath, 'doctor'); }, overrides: <Type, Generator>{ Usage: () => mockUsage, }); testUsingContext('compound command usage path', () async { - final BuildCommand buildCommand = new BuildCommand(); + final BuildCommand buildCommand = BuildCommand(); final FlutterCommand buildApkCommand = buildCommand.subcommands['apk']; expect(await buildApkCommand.usagePath, 'build/apk'); }, overrides: <Type, Generator>{ @@ -168,7 +168,7 @@ await createTestCommandRunner().run(<String>['--version']); expect(count, 0); }, overrides: <Type, Generator>{ - Usage: () => new Usage( + Usage: () => Usage( settingsName: 'flutter_bot_test', versionOverride: 'dev/unknown', configDirOverride: tempDir.path, @@ -183,7 +183,7 @@ await createTestCommandRunner().run(<String>['--version']); expect(count, 0); }, overrides: <Type, Generator>{ - Usage: () => new Usage( + Usage: () => Usage( settingsName: 'flutter_bot_test', versionOverride: 'dev/unknown', configDirOverride: tempDir.path,
diff --git a/packages/flutter_tools/test/android/android_device_test.dart b/packages/flutter_tools/test/android/android_device_test.dart index 46edcff..e29a7ef 100644 --- a/packages/flutter_tools/test/android/android_device_test.dart +++ b/packages/flutter_tools/test/android/android_device_test.dart
@@ -16,7 +16,7 @@ group('android_device', () { testUsingContext('stores the requested id', () { const String deviceId = '1234'; - final AndroidDevice device = new AndroidDevice(deviceId); + final AndroidDevice device = AndroidDevice(deviceId); expect(device.id, deviceId); }); }); @@ -81,7 +81,7 @@ }); group('isLocalEmulator', () { - final ProcessManager mockProcessManager = new MockProcessManager(); + final ProcessManager mockProcessManager = MockProcessManager(); String hardware; String buildCharacteristics; @@ -91,17 +91,17 @@ when(mockProcessManager.run(argThat(contains('getprop')), stderrEncoding: anyNamed('stderrEncoding'), stdoutEncoding: anyNamed('stdoutEncoding'))).thenAnswer((_) { - final StringBuffer buf = new StringBuffer() + final StringBuffer buf = StringBuffer() ..writeln('[ro.hardware]: [$hardware]') ..writeln('[ro.build.characteristics]: [$buildCharacteristics]'); - final ProcessResult result = new ProcessResult(1, 0, buf.toString(), ''); - return new Future<ProcessResult>.value(result); + final ProcessResult result = ProcessResult(1, 0, buf.toString(), ''); + return Future<ProcessResult>.value(result); }); }); testUsingContext('knownPhysical', () async { hardware = 'samsungexynos7420'; - final AndroidDevice device = new AndroidDevice('test'); + final AndroidDevice device = AndroidDevice('test'); expect(await device.isLocalEmulator, false); }, overrides: <Type, Generator>{ ProcessManager: () => mockProcessManager, @@ -109,7 +109,7 @@ testUsingContext('knownEmulator', () async { hardware = 'goldfish'; - final AndroidDevice device = new AndroidDevice('test'); + final AndroidDevice device = AndroidDevice('test'); expect(await device.isLocalEmulator, true); expect(await device.supportsHardwareRendering, true); }, overrides: <Type, Generator>{ @@ -118,7 +118,7 @@ testUsingContext('unknownPhysical', () async { buildCharacteristics = 'att'; - final AndroidDevice device = new AndroidDevice('test'); + final AndroidDevice device = AndroidDevice('test'); expect(await device.isLocalEmulator, false); }, overrides: <Type, Generator>{ ProcessManager: () => mockProcessManager, @@ -126,7 +126,7 @@ testUsingContext('unknownEmulator', () async { buildCharacteristics = 'att,emulator'; - final AndroidDevice device = new AndroidDevice('test'); + final AndroidDevice device = AndroidDevice('test'); expect(await device.isLocalEmulator, true); expect(await device.supportsHardwareRendering, true); }, overrides: <Type, Generator>{
diff --git a/packages/flutter_tools/test/android/android_emulator_test.dart b/packages/flutter_tools/test/android/android_emulator_test.dart index e4256d8..28046c1 100644 --- a/packages/flutter_tools/test/android/android_emulator_test.dart +++ b/packages/flutter_tools/test/android/android_emulator_test.dart
@@ -11,14 +11,14 @@ group('android_emulator', () { testUsingContext('flags emulators without config', () { const String emulatorID = '1234'; - final AndroidEmulator emulator = new AndroidEmulator(emulatorID); + final AndroidEmulator emulator = AndroidEmulator(emulatorID); expect(emulator.id, emulatorID); expect(emulator.hasConfig, false); }); testUsingContext('flags emulators with config', () { const String emulatorID = '1234'; final AndroidEmulator emulator = - new AndroidEmulator(emulatorID, <String, String>{'name': 'test'}); + AndroidEmulator(emulatorID, <String, String>{'name': 'test'}); expect(emulator.id, emulatorID); expect(emulator.hasConfig, true); }); @@ -33,7 +33,7 @@ 'avd.ini.displayname': label }; final AndroidEmulator emulator = - new AndroidEmulator(emulatorID, properties); + AndroidEmulator(emulatorID, properties); expect(emulator.id, emulatorID); expect(emulator.name, name); expect(emulator.manufacturer, manufacturer);
diff --git a/packages/flutter_tools/test/android/android_sdk_test.dart b/packages/flutter_tools/test/android/android_sdk_test.dart index 870a0bf..d2b6522 100644 --- a/packages/flutter_tools/test/android/android_sdk_test.dart +++ b/packages/flutter_tools/test/android/android_sdk_test.dart
@@ -22,8 +22,8 @@ MockProcessManager processManager; setUp(() { - fs = new MemoryFileSystem(); - processManager = new MockProcessManager(); + fs = MemoryFileSystem(); + processManager = MockProcessManager(); }); group('android_sdk AndroidSdk', () { @@ -76,7 +76,7 @@ when(processManager.canRun(sdk.sdkManagerPath)).thenReturn(true); when(processManager.runSync(<String>[sdk.sdkManagerPath, '--version'], environment: argThat(isNotNull, named: 'environment'))) - .thenReturn(new ProcessResult(1, 0, '26.1.1\n', '')); + .thenReturn(ProcessResult(1, 0, '26.1.1\n', '')); expect(sdk.sdkManagerVersion, '26.1.1'); }, overrides: <Type, Generator>{ FileSystem: () => fs, @@ -91,7 +91,7 @@ when(processManager.canRun(sdk.sdkManagerPath)).thenReturn(true); when(processManager.runSync(<String>[sdk.sdkManagerPath, '--version'], environment: argThat(isNotNull, named: 'environment'))) - .thenReturn(new ProcessResult(1, 1, '26.1.1\n', 'Mystery error')); + .thenReturn(ProcessResult(1, 1, '26.1.1\n', 'Mystery error')); expect(sdk.sdkManagerVersion, isNull); }, overrides: <Type, Generator>{ FileSystem: () => fs, @@ -141,7 +141,7 @@ expect(sdk.ndk.compilerArgs, <String>['--sysroot', realNdkSysroot]); }, overrides: <Type, Generator>{ FileSystem: () => fs, - Platform: () => new FakePlatform(operatingSystem: os), + Platform: () => FakePlatform(operatingSystem: os), }); }); @@ -158,7 +158,7 @@ expect(explanation, contains('Can not locate ndk-bundle')); }, overrides: <Type, Generator>{ FileSystem: () => fs, - Platform: () => new FakePlatform(operatingSystem: os), + Platform: () => FakePlatform(operatingSystem: os), }); } });
diff --git a/packages/flutter_tools/test/android/android_workflow_test.dart b/packages/flutter_tools/test/android/android_workflow_test.dart index 0f3f916..73c9dc1 100644 --- a/packages/flutter_tools/test/android/android_workflow_test.dart +++ b/packages/flutter_tools/test/android/android_workflow_test.dart
@@ -24,35 +24,35 @@ MockStdio stdio; setUp(() { - sdk = new MockAndroidSdk(); - fs = new MemoryFileSystem(); + sdk = MockAndroidSdk(); + fs = MemoryFileSystem(); fs.directory('/home/me').createSync(recursive: true); - processManager = new MockProcessManager(); - stdio = new MockStdio(); + processManager = MockProcessManager(); + stdio = MockStdio(); }); MockProcess Function(List<String>) processMetaFactory(List<String> stdout) { - final Stream<List<int>> stdoutStream = new Stream<List<int>>.fromIterable( + final Stream<List<int>> stdoutStream = Stream<List<int>>.fromIterable( stdout.map((String s) => s.codeUnits)); - return (List<String> command) => new MockProcess(stdout: stdoutStream); + return (List<String> command) => MockProcess(stdout: stdoutStream); } testUsingContext('licensesAccepted throws if cannot run sdkmanager', () async { processManager.succeed = false; when(sdk.sdkManagerPath).thenReturn('/foo/bar/sdkmanager'); - final AndroidValidator androidValidator = new AndroidValidator(); + final AndroidValidator androidValidator = AndroidValidator(); expect(androidValidator.licensesAccepted, throwsToolExit()); }, overrides: <Type, Generator>{ AndroidSdk: () => sdk, FileSystem: () => fs, - Platform: () => new FakePlatform()..environment = <String, String>{'HOME': '/home/me'}, + Platform: () => FakePlatform()..environment = <String, String>{'HOME': '/home/me'}, ProcessManager: () => processManager, Stdio: () => stdio, }); testUsingContext('licensesAccepted handles garbage/no output', () async { when(sdk.sdkManagerPath).thenReturn('/foo/bar/sdkmanager'); - final AndroidValidator androidValidator = new AndroidValidator(); + final AndroidValidator androidValidator = AndroidValidator(); final LicensesAccepted result = await androidValidator.licensesAccepted; expect(result, equals(LicensesAccepted.unknown)); expect(processManager.commands.first, equals('/foo/bar/sdkmanager')); @@ -60,7 +60,7 @@ }, overrides: <Type, Generator>{ AndroidSdk: () => sdk, FileSystem: () => fs, - Platform: () => new FakePlatform()..environment = <String, String>{'HOME': '/home/me'}, + Platform: () => FakePlatform()..environment = <String, String>{'HOME': '/home/me'}, ProcessManager: () => processManager, Stdio: () => stdio, }); @@ -72,13 +72,13 @@ 'All SDK package licenses accepted.' ]); - final AndroidValidator androidValidator = new AndroidValidator(); + final AndroidValidator androidValidator = AndroidValidator(); final LicensesAccepted result = await androidValidator.licensesAccepted; expect(result, equals(LicensesAccepted.all)); }, overrides: <Type, Generator>{ AndroidSdk: () => sdk, FileSystem: () => fs, - Platform: () => new FakePlatform()..environment = <String, String>{'HOME': '/home/me'}, + Platform: () => FakePlatform()..environment = <String, String>{'HOME': '/home/me'}, ProcessManager: () => processManager, Stdio: () => stdio, }); @@ -91,13 +91,13 @@ 'Review licenses that have not been accepted (y/N)?', ]); - final AndroidValidator androidValidator = new AndroidValidator(); + final AndroidValidator androidValidator = AndroidValidator(); final LicensesAccepted result = await androidValidator.licensesAccepted; expect(result, equals(LicensesAccepted.some)); }, overrides: <Type, Generator>{ AndroidSdk: () => sdk, FileSystem: () => fs, - Platform: () => new FakePlatform()..environment = <String, String>{'HOME': '/home/me'}, + Platform: () => FakePlatform()..environment = <String, String>{'HOME': '/home/me'}, ProcessManager: () => processManager, Stdio: () => stdio, }); @@ -110,13 +110,13 @@ 'Review licenses that have not been accepted (y/N)?', ]); - final AndroidValidator androidValidator = new AndroidValidator(); + final AndroidValidator androidValidator = AndroidValidator(); final LicensesAccepted result = await androidValidator.licensesAccepted; expect(result, equals(LicensesAccepted.none)); }, overrides: <Type, Generator>{ AndroidSdk: () => sdk, FileSystem: () => fs, - Platform: () => new FakePlatform()..environment = <String, String>{'HOME': '/home/me'}, + Platform: () => FakePlatform()..environment = <String, String>{'HOME': '/home/me'}, ProcessManager: () => processManager, Stdio: () => stdio, }); @@ -129,7 +129,7 @@ }, overrides: <Type, Generator>{ AndroidSdk: () => sdk, FileSystem: () => fs, - Platform: () => new FakePlatform()..environment = <String, String>{'HOME': '/home/me'}, + Platform: () => FakePlatform()..environment = <String, String>{'HOME': '/home/me'}, ProcessManager: () => processManager, Stdio: () => stdio, }); @@ -142,7 +142,7 @@ }, overrides: <Type, Generator>{ AndroidSdk: () => sdk, FileSystem: () => fs, - Platform: () => new FakePlatform()..environment = <String, String>{'HOME': '/home/me'}, + Platform: () => FakePlatform()..environment = <String, String>{'HOME': '/home/me'}, ProcessManager: () => processManager, Stdio: () => stdio, }); @@ -155,7 +155,7 @@ }, overrides: <Type, Generator>{ AndroidSdk: () => sdk, FileSystem: () => fs, - Platform: () => new FakePlatform()..environment = <String, String>{'HOME': '/home/me'}, + Platform: () => FakePlatform()..environment = <String, String>{'HOME': '/home/me'}, ProcessManager: () => processManager, Stdio: () => stdio, }); @@ -168,7 +168,7 @@ }, overrides: <Type, Generator>{ AndroidSdk: () => sdk, FileSystem: () => fs, - Platform: () => new FakePlatform()..environment = <String, String>{'HOME': '/home/me'}, + Platform: () => FakePlatform()..environment = <String, String>{'HOME': '/home/me'}, ProcessManager: () => processManager, Stdio: () => stdio, });
diff --git a/packages/flutter_tools/test/android/gradle_test.dart b/packages/flutter_tools/test/android/gradle_test.dart index 634ddc7..af6b012 100644 --- a/packages/flutter_tools/test/android/gradle_test.dart +++ b/packages/flutter_tools/test/android/gradle_test.dart
@@ -63,7 +63,7 @@ }); group('gradle project', () { - GradleProject projectFrom(String properties) => new GradleProject.fromAppProperties(properties); + GradleProject projectFrom(String properties) => GradleProject.fromAppProperties(properties); test('should extract build directory from app properties', () { final GradleProject project = projectFrom(''' @@ -115,27 +115,27 @@ expect(project.productFlavors, <String>['free', 'paid']); }); test('should provide apk file name for default build types', () { - final GradleProject project = new GradleProject(<String>['debug', 'profile', 'release'], <String>[], fs.directory('/some/dir')); + final GradleProject project = GradleProject(<String>['debug', 'profile', 'release'], <String>[], fs.directory('/some/dir')); expect(project.apkFileFor(BuildInfo.debug), 'app-debug.apk'); expect(project.apkFileFor(BuildInfo.profile), 'app-profile.apk'); expect(project.apkFileFor(BuildInfo.release), 'app-release.apk'); expect(project.apkFileFor(const BuildInfo(BuildMode.release, 'unknown')), isNull); }); test('should provide apk file name for flavored build types', () { - final GradleProject project = new GradleProject(<String>['debug', 'profile', 'release'], <String>['free', 'paid'], fs.directory('/some/dir')); + final GradleProject project = GradleProject(<String>['debug', 'profile', 'release'], <String>['free', 'paid'], fs.directory('/some/dir')); expect(project.apkFileFor(const BuildInfo(BuildMode.debug, 'free')), 'app-free-debug.apk'); expect(project.apkFileFor(const BuildInfo(BuildMode.release, 'paid')), 'app-paid-release.apk'); expect(project.apkFileFor(const BuildInfo(BuildMode.release, 'unknown')), isNull); }); test('should provide assemble task name for default build types', () { - final GradleProject project = new GradleProject(<String>['debug', 'profile', 'release'], <String>[], fs.directory('/some/dir')); + final GradleProject project = GradleProject(<String>['debug', 'profile', 'release'], <String>[], fs.directory('/some/dir')); expect(project.assembleTaskFor(BuildInfo.debug), 'assembleDebug'); expect(project.assembleTaskFor(BuildInfo.profile), 'assembleProfile'); expect(project.assembleTaskFor(BuildInfo.release), 'assembleRelease'); expect(project.assembleTaskFor(const BuildInfo(BuildMode.release, 'unknown')), isNull); }); test('should provide assemble task name for flavored build types', () { - final GradleProject project = new GradleProject(<String>['debug', 'profile', 'release'], <String>['free', 'paid'], fs.directory('/some/dir')); + final GradleProject project = GradleProject(<String>['debug', 'profile', 'release'], <String>['free', 'paid'], fs.directory('/some/dir')); expect(project.assembleTaskFor(const BuildInfo(BuildMode.debug, 'free')), 'assembleFreeDebug'); expect(project.assembleTaskFor(const BuildInfo(BuildMode.release, 'paid')), 'assemblePaidRelease'); expect(project.assembleTaskFor(const BuildInfo(BuildMode.release, 'unknown')), isNull); @@ -149,9 +149,9 @@ FileSystem fs; setUp(() { - fs = new MemoryFileSystem(); - mockArtifacts = new MockLocalEngineArtifacts(); - mockProcessManager = new MockProcessManager(); + fs = MemoryFileSystem(); + mockArtifacts = MockLocalEngineArtifacts(); + mockProcessManager = MockProcessManager(); android = fakePlatform('android'); }); @@ -331,7 +331,7 @@ } Platform fakePlatform(String name) { - return new FakePlatform.fromPlatform(const LocalPlatform())..operatingSystem = name; + return FakePlatform.fromPlatform(const LocalPlatform())..operatingSystem = name; } class MockLocalEngineArtifacts extends Mock implements LocalEngineArtifacts {}
diff --git a/packages/flutter_tools/test/application_package_test.dart b/packages/flutter_tools/test/application_package_test.dart index bdd6792..3b15cc3 100644 --- a/packages/flutter_tools/test/application_package_test.dart +++ b/packages/flutter_tools/test/application_package_test.dart
@@ -43,12 +43,12 @@ group('PrebuiltIOSApp', () { final Map<Type, Generator> overrides = <Type, Generator>{ - FileSystem: () => new MemoryFileSystem(), - IOSWorkflow: () => new MockIosWorkFlow() + FileSystem: () => MemoryFileSystem(), + IOSWorkflow: () => MockIosWorkFlow() }; testUsingContext('Error on non-existing file', () { final PrebuiltIOSApp iosApp = - new IOSApp.fromPrebuiltApp(fs.file('not_existing.ipa')); + IOSApp.fromPrebuiltApp(fs.file('not_existing.ipa')); expect(iosApp, isNull); final BufferLogger logger = context[Logger]; expect( @@ -59,7 +59,7 @@ testUsingContext('Error on non-app-bundle folder', () { fs.directory('regular_folder').createSync(); final PrebuiltIOSApp iosApp = - new IOSApp.fromPrebuiltApp(fs.file('regular_folder')); + IOSApp.fromPrebuiltApp(fs.file('regular_folder')); expect(iosApp, isNull); final BufferLogger logger = context[Logger]; expect( @@ -67,7 +67,7 @@ }, overrides: overrides); testUsingContext('Error on no info.plist', () { fs.directory('bundle.app').createSync(); - final PrebuiltIOSApp iosApp = new IOSApp.fromPrebuiltApp(fs.file('bundle.app')); + final PrebuiltIOSApp iosApp = IOSApp.fromPrebuiltApp(fs.file('bundle.app')); expect(iosApp, isNull); final BufferLogger logger = context[Logger]; expect( @@ -78,7 +78,7 @@ testUsingContext('Error on bad info.plist', () { fs.directory('bundle.app').createSync(); fs.file('bundle.app/Info.plist').writeAsStringSync(badPlistData); - final PrebuiltIOSApp iosApp = new IOSApp.fromPrebuiltApp(fs.file('bundle.app')); + final PrebuiltIOSApp iosApp = IOSApp.fromPrebuiltApp(fs.file('bundle.app')); expect(iosApp, isNull); final BufferLogger logger = context[Logger]; expect( @@ -90,7 +90,7 @@ testUsingContext('Success with app bundle', () { fs.directory('bundle.app').createSync(); fs.file('bundle.app/Info.plist').writeAsStringSync(plistData); - final PrebuiltIOSApp iosApp = new IOSApp.fromPrebuiltApp(fs.file('bundle.app')); + final PrebuiltIOSApp iosApp = IOSApp.fromPrebuiltApp(fs.file('bundle.app')); final BufferLogger logger = context[Logger]; expect(logger.errorText, isEmpty); expect(iosApp.bundleDir.path, 'bundle.app'); @@ -100,7 +100,7 @@ testUsingContext('Bad ipa zip-file, no payload dir', () { fs.file('app.ipa').createSync(); when(os.unzip(fs.file('app.ipa'), any)).thenAnswer((Invocation _) {}); - final PrebuiltIOSApp iosApp = new IOSApp.fromPrebuiltApp(fs.file('app.ipa')); + final PrebuiltIOSApp iosApp = IOSApp.fromPrebuiltApp(fs.file('app.ipa')); expect(iosApp, isNull); final BufferLogger logger = context[Logger]; expect( @@ -123,7 +123,7 @@ fs.directory(bundlePath1).createSync(recursive: true); fs.directory(bundlePath2).createSync(recursive: true); }); - final PrebuiltIOSApp iosApp = new IOSApp.fromPrebuiltApp(fs.file('app.ipa')); + final PrebuiltIOSApp iosApp = IOSApp.fromPrebuiltApp(fs.file('app.ipa')); expect(iosApp, isNull); final BufferLogger logger = context[Logger]; expect(logger.errorText, @@ -144,7 +144,7 @@ .file(fs.path.join(bundleAppDir.path, 'Info.plist')) .writeAsStringSync(plistData); }); - final PrebuiltIOSApp iosApp = new IOSApp.fromPrebuiltApp(fs.file('app.ipa')); + final PrebuiltIOSApp iosApp = IOSApp.fromPrebuiltApp(fs.file('app.ipa')); final BufferLogger logger = context[Logger]; expect(logger.errorText, isEmpty); expect(iosApp.bundleDir.path, endsWith('bundle.app'));
diff --git a/packages/flutter_tools/test/artifacts_test.dart b/packages/flutter_tools/test/artifacts_test.dart index ac1c8fe..24a8c82 100644 --- a/packages/flutter_tools/test/artifacts_test.dart +++ b/packages/flutter_tools/test/artifacts_test.dart
@@ -19,7 +19,7 @@ setUp(() { tempDir = fs.systemTempDirectory.createTempSync('flutter_tools_artifacts_test_cached.'); - artifacts = new CachedArtifacts(); + artifacts = CachedArtifacts(); }); tearDown(() { @@ -40,8 +40,8 @@ fs.path.join(tempDir.path, 'bin', 'cache', 'artifacts', 'engine', 'linux-x64', 'flutter_tester') ); }, overrides: <Type, Generator> { - Cache: () => new Cache(rootOverride: tempDir), - Platform: () => new FakePlatform(operatingSystem: 'linux') + Cache: () => Cache(rootOverride: tempDir), + Platform: () => FakePlatform(operatingSystem: 'linux') }); testUsingContext('getEngineType', () { @@ -58,8 +58,8 @@ 'darwin-x64' ); }, overrides: <Type, Generator> { - Cache: () => new Cache(rootOverride: tempDir), - Platform: () => new FakePlatform(operatingSystem: 'linux') + Cache: () => Cache(rootOverride: tempDir), + Platform: () => FakePlatform(operatingSystem: 'linux') }); }); @@ -70,7 +70,7 @@ setUp(() { tempDir = fs.systemTempDirectory.createTempSync('flutter_tools_artifacts_test_local.'); - artifacts = new LocalEngineArtifacts(tempDir.path, + artifacts = LocalEngineArtifacts(tempDir.path, fs.path.join(tempDir.path, 'out', 'android_debug_unopt'), fs.path.join(tempDir.path, 'out', 'host_debug_unopt'), ); @@ -102,7 +102,7 @@ fs.path.join(tempDir.path, 'out', 'host_debug_unopt', 'dart-sdk') ); }, overrides: <Type, Generator> { - Platform: () => new FakePlatform(operatingSystem: 'linux') + Platform: () => FakePlatform(operatingSystem: 'linux') }); testUsingContext('getEngineType', () { @@ -119,7 +119,7 @@ 'android_debug_unopt' ); }, overrides: <Type, Generator> { - Platform: () => new FakePlatform(operatingSystem: 'linux') + Platform: () => FakePlatform(operatingSystem: 'linux') }); }); }
diff --git a/packages/flutter_tools/test/asset_bundle_package_fonts_test.dart b/packages/flutter_tools/test/asset_bundle_package_fonts_test.dart index 393b89d..4c4eb21 100644 --- a/packages/flutter_tools/test/asset_bundle_package_fonts_test.dart +++ b/packages/flutter_tools/test/asset_bundle_package_fonts_test.dart
@@ -104,7 +104,7 @@ FileSystem testFileSystem; setUp(() async { - testFileSystem = new MemoryFileSystem( + testFileSystem = MemoryFileSystem( style: platform.isWindows ? FileSystemStyle.windows : FileSystemStyle.posix,
diff --git a/packages/flutter_tools/test/asset_bundle_package_test.dart b/packages/flutter_tools/test/asset_bundle_package_test.dart index 8e63c6c..17b3c42 100644 --- a/packages/flutter_tools/test/asset_bundle_package_test.dart +++ b/packages/flutter_tools/test/asset_bundle_package_test.dart
@@ -31,7 +31,7 @@ if (assets == null) { assetsSection = ''; } else { - final StringBuffer buffer = new StringBuffer(); + final StringBuffer buffer = StringBuffer(); buffer.write(''' flutter: assets: @@ -104,7 +104,7 @@ FileSystem testFileSystem; setUp(() async { - testFileSystem = new MemoryFileSystem( + testFileSystem = MemoryFileSystem( style: platform.isWindows ? FileSystemStyle.windows : FileSystemStyle.posix,
diff --git a/packages/flutter_tools/test/asset_bundle_test.dart b/packages/flutter_tools/test/asset_bundle_test.dart index 50991b2..7a0bb00 100644 --- a/packages/flutter_tools/test/asset_bundle_test.dart +++ b/packages/flutter_tools/test/asset_bundle_test.dart
@@ -24,7 +24,7 @@ FileSystem testFileSystem; setUp(() async { - testFileSystem = new MemoryFileSystem( + testFileSystem = MemoryFileSystem( style: platform.isWindows ? FileSystemStyle.windows : FileSystemStyle.posix,
diff --git a/packages/flutter_tools/test/asset_bundle_variant_test.dart b/packages/flutter_tools/test/asset_bundle_variant_test.dart index fd50929..9a7b9f5 100644 --- a/packages/flutter_tools/test/asset_bundle_variant_test.dart +++ b/packages/flutter_tools/test/asset_bundle_variant_test.dart
@@ -29,7 +29,7 @@ group('AssetBundle asset variants', () { FileSystem testFileSystem; setUp(() async { - testFileSystem = new MemoryFileSystem( + testFileSystem = MemoryFileSystem( style: platform.isWindows ? FileSystemStyle.windows : FileSystemStyle.posix,
diff --git a/packages/flutter_tools/test/asset_test.dart b/packages/flutter_tools/test/asset_test.dart index 79bd611..c681ca5 100644 --- a/packages/flutter_tools/test/asset_test.dart +++ b/packages/flutter_tools/test/asset_test.dart
@@ -47,5 +47,5 @@ } Future<String> getValueAsString(String key, AssetBundle asset) async { - return new String.fromCharCodes(await asset.entries[key].contentsAsBytes()); + return String.fromCharCodes(await asset.entries[key].contentsAsBytes()); }
diff --git a/packages/flutter_tools/test/base/build_test.dart b/packages/flutter_tools/test/base/build_test.dart index b95e72b..663b6b0 100644 --- a/packages/flutter_tools/test/base/build_test.dart +++ b/packages/flutter_tools/test/base/build_test.dart
@@ -75,12 +75,12 @@ group('SnapshotType', () { test('throws, if build mode is null', () { expect( - () => new SnapshotType(TargetPlatform.android_x64, null), + () => SnapshotType(TargetPlatform.android_x64, null), throwsA(anything), ); }); test('does not throw, if target platform is null', () { - expect(new SnapshotType(null, BuildMode.release), isNotNull); + expect(SnapshotType(null, BuildMode.release), isNotNull); }); }); @@ -100,7 +100,7 @@ MockXcode mockXcode; setUp(() async { - fs = new MemoryFileSystem(); + fs = MemoryFileSystem(); fs.file(kVmEntrypoints).createSync(); fs.file(kIoEntries).createSync(); fs.file(kSnapshotDart).createSync(); @@ -108,18 +108,18 @@ fs.file(kEntrypointsExtraJson).createSync(); fs.file('.packages').writeAsStringSync('sky_engine:file:///flutter/bin/cache/pkg/sky_engine/lib/'); - skyEnginePath = fs.path.fromUri(new Uri.file('/flutter/bin/cache/pkg/sky_engine')); + skyEnginePath = fs.path.fromUri(Uri.file('/flutter/bin/cache/pkg/sky_engine')); fs.directory(fs.path.join(skyEnginePath, 'lib', 'ui')).createSync(recursive: true); fs.directory(fs.path.join(skyEnginePath, 'sdk_ext')).createSync(recursive: true); fs.file(fs.path.join(skyEnginePath, '.packages')).createSync(); fs.file(fs.path.join(skyEnginePath, 'lib', 'ui', 'ui.dart')).createSync(); fs.file(fs.path.join(skyEnginePath, 'sdk_ext', 'vmservice_io.dart')).createSync(); - genSnapshot = new _FakeGenSnapshot(); - snapshotter = new AOTSnapshotter(); - mockAndroidSdk = new MockAndroidSdk(); - mockArtifacts = new MockArtifacts(); - mockXcode = new MockXcode(); + genSnapshot = _FakeGenSnapshot(); + snapshotter = AOTSnapshotter(); + mockAndroidSdk = MockAndroidSdk(); + mockArtifacts = MockArtifacts(); + mockXcode = MockXcode(); for (BuildMode mode in BuildMode.values) { when(mockArtifacts.getArtifactPath(Artifact.dartVmEntryPointsTxt, any, mode)).thenReturn(kVmEntrypoints); when(mockArtifacts.getArtifactPath(Artifact.dartIoEntriesTxt, any, mode)).thenReturn(kIoEntries); @@ -184,9 +184,9 @@ fs.path.join(outputPath, 'snapshot.d'): '${fs.path.join(outputPath, 'snapshot_assembly.S')} : ', }; - final RunResult successResult = new RunResult(new ProcessResult(1, 0, '', ''), <String>['command name', 'arguments...']); - when(xcode.cc(any)).thenAnswer((_) => new Future<RunResult>.value(successResult)); - when(xcode.clang(any)).thenAnswer((_) => new Future<RunResult>.value(successResult)); + final RunResult successResult = RunResult(ProcessResult(1, 0, '', ''), <String>['command name', 'arguments...']); + when(xcode.cc(any)).thenAnswer((_) => Future<RunResult>.value(successResult)); + when(xcode.clang(any)).thenAnswer((_) => Future<RunResult>.value(successResult)); final int genSnapshotExitCode = await snapshotter.build( platform: TargetPlatform.ios, @@ -230,9 +230,9 @@ fs.path.join(outputPath, 'snapshot.d'): '${fs.path.join(outputPath, 'snapshot_assembly.S')} : ', }; - final RunResult successResult = new RunResult(new ProcessResult(1, 0, '', ''), <String>['command name', 'arguments...']); - when(xcode.cc(any)).thenAnswer((_) => new Future<RunResult>.value(successResult)); - when(xcode.clang(any)).thenAnswer((_) => new Future<RunResult>.value(successResult)); + final RunResult successResult = RunResult(ProcessResult(1, 0, '', ''), <String>['command name', 'arguments...']); + when(xcode.cc(any)).thenAnswer((_) => Future<RunResult>.value(successResult)); + when(xcode.clang(any)).thenAnswer((_) => Future<RunResult>.value(successResult)); final int genSnapshotExitCode = await snapshotter.build( platform: TargetPlatform.ios, @@ -277,9 +277,9 @@ fs.path.join(outputPath, 'snapshot.d'): '${fs.path.join(outputPath, 'vm_snapshot_data')} : ', }; - final RunResult successResult = new RunResult(new ProcessResult(1, 0, '', ''), <String>['command name', 'arguments...']); - when(xcode.cc(any)).thenAnswer((_) => new Future<RunResult>.value(successResult)); - when(xcode.clang(any)).thenAnswer((_) => new Future<RunResult>.value(successResult)); + final RunResult successResult = RunResult(ProcessResult(1, 0, '', ''), <String>['command name', 'arguments...']); + when(xcode.cc(any)).thenAnswer((_) => Future<RunResult>.value(successResult)); + when(xcode.clang(any)).thenAnswer((_) => Future<RunResult>.value(successResult)); final int genSnapshotExitCode = await snapshotter.build( platform: TargetPlatform.android_arm, @@ -328,9 +328,9 @@ fs.path.join(outputPath, 'snapshot.d'): '${fs.path.join(outputPath, 'vm_snapshot_data')} : ', }; - final RunResult successResult = new RunResult(new ProcessResult(1, 0, '', ''), <String>['command name', 'arguments...']); - when(xcode.cc(any)).thenAnswer((_) => new Future<RunResult>.value(successResult)); - when(xcode.clang(any)).thenAnswer((_) => new Future<RunResult>.value(successResult)); + final RunResult successResult = RunResult(ProcessResult(1, 0, '', ''), <String>['command name', 'arguments...']); + when(xcode.cc(any)).thenAnswer((_) => Future<RunResult>.value(successResult)); + when(xcode.clang(any)).thenAnswer((_) => Future<RunResult>.value(successResult)); final int genSnapshotExitCode = await snapshotter.build( platform: TargetPlatform.android_arm64, @@ -374,9 +374,9 @@ fs.path.join(outputPath, 'snapshot.d'): '${fs.path.join(outputPath, 'snapshot_assembly.S')} : ', }; - final RunResult successResult = new RunResult(new ProcessResult(1, 0, '', ''), <String>['command name', 'arguments...']); - when(xcode.cc(any)).thenAnswer((_) => new Future<RunResult>.value(successResult)); - when(xcode.clang(any)).thenAnswer((_) => new Future<RunResult>.value(successResult)); + final RunResult successResult = RunResult(ProcessResult(1, 0, '', ''), <String>['command name', 'arguments...']); + when(xcode.cc(any)).thenAnswer((_) => Future<RunResult>.value(successResult)); + when(xcode.clang(any)).thenAnswer((_) => Future<RunResult>.value(successResult)); final int genSnapshotExitCode = await snapshotter.build( platform: TargetPlatform.ios, @@ -420,9 +420,9 @@ fs.path.join(outputPath, 'snapshot.d'): '${fs.path.join(outputPath, 'snapshot_assembly.S')} : ', }; - final RunResult successResult = new RunResult(new ProcessResult(1, 0, '', ''), <String>['command name', 'arguments...']); - when(xcode.cc(any)).thenAnswer((_) => new Future<RunResult>.value(successResult)); - when(xcode.clang(any)).thenAnswer((_) => new Future<RunResult>.value(successResult)); + final RunResult successResult = RunResult(ProcessResult(1, 0, '', ''), <String>['command name', 'arguments...']); + when(xcode.cc(any)).thenAnswer((_) => Future<RunResult>.value(successResult)); + when(xcode.clang(any)).thenAnswer((_) => Future<RunResult>.value(successResult)); final int genSnapshotExitCode = await snapshotter.build( platform: TargetPlatform.ios, @@ -485,9 +485,9 @@ fs.path.join(outputPath, 'snapshot.d'): '${fs.path.join(outputPath, 'vm_snapshot_data')} : ', }; - final RunResult successResult = new RunResult(new ProcessResult(1, 0, '', ''), <String>['command name', 'arguments...']); - when(xcode.cc(any)).thenAnswer((_) => new Future<RunResult>.value(successResult)); - when(xcode.clang(any)).thenAnswer((_) => new Future<RunResult>.value(successResult)); + final RunResult successResult = RunResult(ProcessResult(1, 0, '', ''), <String>['command name', 'arguments...']); + when(xcode.cc(any)).thenAnswer((_) => Future<RunResult>.value(successResult)); + when(xcode.clang(any)).thenAnswer((_) => Future<RunResult>.value(successResult)); final int genSnapshotExitCode = await snapshotter.build( platform: TargetPlatform.android_arm, @@ -536,9 +536,9 @@ fs.path.join(outputPath, 'snapshot.d'): '${fs.path.join(outputPath, 'vm_snapshot_data')} : ', }; - final RunResult successResult = new RunResult(new ProcessResult(1, 0, '', ''), <String>['command name', 'arguments...']); - when(xcode.cc(any)).thenAnswer((_) => new Future<RunResult>.value(successResult)); - when(xcode.clang(any)).thenAnswer((_) => new Future<RunResult>.value(successResult)); + final RunResult successResult = RunResult(ProcessResult(1, 0, '', ''), <String>['command name', 'arguments...']); + when(xcode.cc(any)).thenAnswer((_) => Future<RunResult>.value(successResult)); + when(xcode.clang(any)).thenAnswer((_) => Future<RunResult>.value(successResult)); final int genSnapshotExitCode = await snapshotter.build( platform: TargetPlatform.android_arm64, @@ -583,13 +583,13 @@ MockArtifacts mockArtifacts; setUp(() async { - fs = new MemoryFileSystem(); + fs = MemoryFileSystem(); fs.file(kTrace).createSync(); - genSnapshot = new _FakeGenSnapshot(); - snapshotter = new CoreJITSnapshotter(); - mockAndroidSdk = new MockAndroidSdk(); - mockArtifacts = new MockArtifacts(); + genSnapshot = _FakeGenSnapshot(); + snapshotter = CoreJITSnapshotter(); + mockAndroidSdk = MockAndroidSdk(); + mockArtifacts = MockArtifacts(); }); final Map<Type, Generator> contextOverrides = <Type, Generator>{
diff --git a/packages/flutter_tools/test/base/context_test.dart b/packages/flutter_tools/test/base/context_test.dart index 6b79495..f7291dc 100644 --- a/packages/flutter_tools/test/base/context_test.dart +++ b/packages/flutter_tools/test/base/context_test.dart
@@ -74,8 +74,8 @@ group('operator[]', () { test('still finds values if async code runs after body has finished', () async { - final Completer<void> outer = new Completer<void>(); - final Completer<void> inner = new Completer<void>(); + final Completer<void> outer = Completer<void>(); + final Completer<void> inner = Completer<void>(); String value; await context.run<void>( body: () { @@ -99,7 +99,7 @@ String value; await context.run<void>( body: () async { - final StringBuffer buf = new StringBuffer(context[String]); + final StringBuffer buf = StringBuffer(context[String]); buf.write(context[String]); await context.run<void>(body: () { buf.write(context[String]); @@ -122,7 +122,7 @@ String value; await context.run( body: () async { - final StringBuffer buf = new StringBuffer(context[String]); + final StringBuffer buf = StringBuffer(context[String]); buf.write(context[String]); await context.run<void>(body: () { buf.write(context[String]);
diff --git a/packages/flutter_tools/test/base/file_system_test.dart b/packages/flutter_tools/test/base/file_system_test.dart index 7f6c6c9..3652e79 100644 --- a/packages/flutter_tools/test/base/file_system_test.dart +++ b/packages/flutter_tools/test/base/file_system_test.dart
@@ -14,7 +14,7 @@ MemoryFileSystem fs; setUp(() { - fs = new MemoryFileSystem(); + fs = MemoryFileSystem(); }); testUsingContext('recursively creates a directory if it does not exist', () async { @@ -32,7 +32,7 @@ /// Test file_systems.copyDirectorySync() using MemoryFileSystem. /// Copies between 2 instances of file systems which is also supported by copyDirectorySync(). test('test directory copy', () async { - final MemoryFileSystem sourceMemoryFs = new MemoryFileSystem(); + final MemoryFileSystem sourceMemoryFs = MemoryFileSystem(); const String sourcePath = '/some/origin'; final Directory sourceDirectory = await sourceMemoryFs.directory(sourcePath).create(recursive: true); sourceMemoryFs.currentDirectory = sourcePath; @@ -42,7 +42,7 @@ sourceMemoryFs.directory('empty_directory').createSync(); // Copy to another memory file system instance. - final MemoryFileSystem targetMemoryFs = new MemoryFileSystem(); + final MemoryFileSystem targetMemoryFs = MemoryFileSystem(); const String targetPath = '/some/non-existent/target'; final Directory targetDirectory = targetMemoryFs.directory(targetPath); copyDirectorySync(sourceDirectory, targetDirectory); @@ -92,7 +92,7 @@ expect(escapePath('foo\\bar\\cool.dart'), 'foo\\\\bar\\\\cool.dart'); expect(escapePath('C:/foo/bar/cool.dart'), 'C:/foo/bar/cool.dart'); }, overrides: <Type, Generator>{ - Platform: () => new FakePlatform(operatingSystem: 'windows') + Platform: () => FakePlatform(operatingSystem: 'windows') }); testUsingContext('on Linux', () { @@ -100,7 +100,7 @@ expect(escapePath('foo/bar/cool.dart'), 'foo/bar/cool.dart'); expect(escapePath('foo\\cool.dart'), 'foo\\cool.dart'); }, overrides: <Type, Generator>{ - Platform: () => new FakePlatform(operatingSystem: 'linux') + Platform: () => FakePlatform(operatingSystem: 'linux') }); }); }
diff --git a/packages/flutter_tools/test/base/fingerprint_test.dart b/packages/flutter_tools/test/base/fingerprint_test.dart index bf989fc..e9e15e7 100644 --- a/packages/flutter_tools/test/base/fingerprint_test.dart +++ b/packages/flutter_tools/test/base/fingerprint_test.dart
@@ -22,8 +22,8 @@ MockFlutterVersion mockVersion; setUp(() { - fs = new MemoryFileSystem(); - mockVersion = new MockFlutterVersion(); + fs = MemoryFileSystem(); + mockVersion = MockFlutterVersion(); when(mockVersion.frameworkRevision).thenReturn(kVersion); }); @@ -36,7 +36,7 @@ await fs.file('b.dart').create(); await fs.file('depfile').create(); - final Fingerprinter fingerprinter = new Fingerprinter( + final Fingerprinter fingerprinter = Fingerprinter( fingerprintPath: 'out.fingerprint', paths: <String>['a.dart'], depfilePaths: <String>['depfile'], @@ -51,7 +51,7 @@ testUsingContext('creates fingerprint with specified properties and files', () async { await fs.file('a.dart').create(); - final Fingerprinter fingerprinter = new Fingerprinter( + final Fingerprinter fingerprinter = Fingerprinter( fingerprintPath: 'out.fingerprint', paths: <String>['a.dart'], properties: <String, String>{ @@ -60,7 +60,7 @@ }, ); final Fingerprint fingerprint = await fingerprinter.buildFingerprint(); - expect(fingerprint, new Fingerprint.fromBuildInputs(<String, String>{ + expect(fingerprint, Fingerprint.fromBuildInputs(<String, String>{ 'foo': 'bar', 'wibble': 'wobble', }, <String>['a.dart'])); @@ -71,7 +71,7 @@ await fs.file('b.dart').create(); await fs.file('depfile').writeAsString('depfile : b.dart'); - final Fingerprinter fingerprinter = new Fingerprinter( + final Fingerprinter fingerprinter = Fingerprinter( fingerprintPath: 'out.fingerprint', paths: <String>['a.dart'], depfilePaths: <String>['depfile'], @@ -81,7 +81,7 @@ }, ); final Fingerprint fingerprint = await fingerprinter.buildFingerprint(); - expect(fingerprint, new Fingerprint.fromBuildInputs(<String, String>{ + expect(fingerprint, Fingerprint.fromBuildInputs(<String, String>{ 'bar': 'baz', 'wobble': 'womble', }, <String>['a.dart', 'b.dart'])); @@ -91,7 +91,7 @@ await fs.file('a.dart').create(); await fs.file('b.dart').create(); - final Fingerprinter fingerprinter = new Fingerprinter( + final Fingerprinter fingerprinter = Fingerprinter( fingerprintPath: 'out.fingerprint', paths: <String>['a.dart', 'b.dart'], properties: <String, String>{ @@ -106,7 +106,7 @@ await fs.file('a.dart').create(); await fs.file('b.dart').create(); - final Fingerprinter fingerprinter1 = new Fingerprinter( + final Fingerprinter fingerprinter1 = Fingerprinter( fingerprintPath: 'out.fingerprint', paths: <String>['a.dart', 'b.dart'], properties: <String, String>{ @@ -116,7 +116,7 @@ ); await fingerprinter1.writeFingerprint(); - final Fingerprinter fingerprinter2 = new Fingerprinter( + final Fingerprinter fingerprinter2 = Fingerprinter( fingerprintPath: 'out.fingerprint', paths: <String>['a.dart', 'b.dart'], properties: <String, String>{ @@ -133,7 +133,7 @@ await fs.file('depfile').writeAsString('depfile : b.dart'); // Write a valid fingerprint - final Fingerprinter fingerprinter = new Fingerprinter( + final Fingerprinter fingerprinter = Fingerprinter( fingerprintPath: 'out.fingerprint', paths: <String>['a.dart', 'b.dart'], depfilePaths: <String>['depfile'], @@ -146,7 +146,7 @@ // Write a corrupt depfile. await fs.file('depfile').writeAsString(''); - final Fingerprinter badFingerprinter = new Fingerprinter( + final Fingerprinter badFingerprinter = Fingerprinter( fingerprintPath: 'out.fingerprint', paths: <String>['a.dart', 'b.dart'], depfilePaths: <String>['depfile'], @@ -164,7 +164,7 @@ await fs.file('b.dart').create(); await fs.file('out.fingerprint').writeAsString('** not JSON **'); - final Fingerprinter fingerprinter = new Fingerprinter( + final Fingerprinter fingerprinter = Fingerprinter( fingerprintPath: 'out.fingerprint', paths: <String>['a.dart', 'b.dart'], depfilePaths: <String>['depfile'], @@ -180,7 +180,7 @@ await fs.file('a.dart').create(); await fs.file('b.dart').create(); - final Fingerprinter fingerprinter = new Fingerprinter( + final Fingerprinter fingerprinter = Fingerprinter( fingerprintPath: 'out.fingerprint', paths: <String>['a.dart', 'b.dart'], properties: <String, String>{ @@ -193,7 +193,7 @@ }, overrides: contextOverrides); testUsingContext('fails to write fingerprint if inputs are missing', () async { - final Fingerprinter fingerprinter = new Fingerprinter( + final Fingerprinter fingerprinter = Fingerprinter( fingerprintPath: 'out.fingerprint', paths: <String>['a.dart'], properties: <String, String>{ @@ -210,7 +210,7 @@ await fs.file('ab.dart').create(); await fs.file('depfile').writeAsString('depfile : ab.dart c.dart'); - final Fingerprinter fingerprinter = new Fingerprinter( + final Fingerprinter fingerprinter = Fingerprinter( fingerprintPath: 'out.fingerprint', paths: <String>['a.dart'], depfilePaths: <String>['depfile'], @@ -230,7 +230,7 @@ const String kVersion = '123456abcdef'; setUp(() { - mockVersion = new MockFlutterVersion(); + mockVersion = MockFlutterVersion(); when(mockVersion.frameworkRevision).thenReturn(kVersion); }); @@ -238,13 +238,13 @@ MemoryFileSystem fs; setUp(() { - fs = new MemoryFileSystem(); + fs = MemoryFileSystem(); }); testUsingContext('throws if any input file does not exist', () async { await fs.file('a.dart').create(); expect( - () => new Fingerprint.fromBuildInputs(<String, String>{}, <String>['a.dart', 'b.dart']), + () => Fingerprint.fromBuildInputs(<String, String>{}, <String>['a.dart', 'b.dart']), throwsArgumentError, ); }, overrides: <Type, Generator>{ FileSystem: () => fs }); @@ -252,7 +252,7 @@ testUsingContext('populates checksums for valid files', () async { await fs.file('a.dart').writeAsString('This is a'); await fs.file('b.dart').writeAsString('This is b'); - final Fingerprint fingerprint = new Fingerprint.fromBuildInputs(<String, String>{}, <String>['a.dart', 'b.dart']); + final Fingerprint fingerprint = Fingerprint.fromBuildInputs(<String, String>{}, <String>['a.dart', 'b.dart']); final Map<String, dynamic> jsonObject = json.decode(fingerprint.toJson()); expect(jsonObject['files'], hasLength(2)); @@ -261,14 +261,14 @@ }, overrides: <Type, Generator>{ FileSystem: () => fs }); testUsingContext('includes framework version', () { - final Fingerprint fingerprint = new Fingerprint.fromBuildInputs(<String, String>{}, <String>[]); + final Fingerprint fingerprint = Fingerprint.fromBuildInputs(<String, String>{}, <String>[]); final Map<String, dynamic> jsonObject = json.decode(fingerprint.toJson()); expect(jsonObject['version'], mockVersion.frameworkRevision); }, overrides: <Type, Generator>{ FlutterVersion: () => mockVersion }); testUsingContext('includes provided properties', () { - final Fingerprint fingerprint = new Fingerprint.fromBuildInputs(<String, String>{'a': 'A', 'b': 'B'}, <String>[]); + final Fingerprint fingerprint = Fingerprint.fromBuildInputs(<String, String>{'a': 'A', 'b': 'B'}, <String>[]); final Map<String, dynamic> jsonObject = json.decode(fingerprint.toJson()); expect(jsonObject['properties'], hasLength(2)); @@ -279,7 +279,7 @@ group('fromJson', () { testUsingContext('throws if JSON is invalid', () async { - expect(() => new Fingerprint.fromJson('<xml></xml>'), throwsA(anything)); + expect(() => Fingerprint.fromJson('<xml></xml>'), throwsA(anything)); }, overrides: <Type, Generator>{ FlutterVersion: () => mockVersion, }); @@ -297,7 +297,7 @@ 'b.dart': '6f144e08b58cd0925328610fad7ac07c', }, }); - final Fingerprint fingerprint = new Fingerprint.fromJson(jsonString); + final Fingerprint fingerprint = Fingerprint.fromJson(jsonString); final Map<String, dynamic> content = json.decode(fingerprint.toJson()); expect(content, hasLength(3)); expect(content['version'], mockVersion.frameworkRevision); @@ -318,7 +318,7 @@ 'properties':<String, String>{}, 'files':<String, String>{}, }); - expect(() => new Fingerprint.fromJson(jsonString), throwsArgumentError); + expect(() => Fingerprint.fromJson(jsonString), throwsArgumentError); }, overrides: <Type, Generator>{ FlutterVersion: () => mockVersion, }); @@ -328,7 +328,7 @@ 'properties':<String, String>{}, 'files':<String, String>{}, }); - expect(() => new Fingerprint.fromJson(jsonString), throwsArgumentError); + expect(() => Fingerprint.fromJson(jsonString), throwsArgumentError); }, overrides: <Type, Generator>{ FlutterVersion: () => mockVersion, }); @@ -337,7 +337,7 @@ final String jsonString = json.encode(<String, dynamic>{ 'version': kVersion, }); - expect(new Fingerprint.fromJson(jsonString), new Fingerprint.fromBuildInputs(<String, String>{}, <String>[])); + expect(Fingerprint.fromJson(jsonString), Fingerprint.fromBuildInputs(<String, String>{}, <String>[])); }, overrides: <Type, Generator>{ FlutterVersion: () => mockVersion, }); @@ -352,11 +352,11 @@ }, 'files': <String, dynamic>{}, }; - final Map<String, dynamic> b = new Map<String, dynamic>.from(a); + final Map<String, dynamic> b = Map<String, dynamic>.from(a); b['properties'] = <String, String>{ 'buildMode': BuildMode.release.toString(), }; - expect(new Fingerprint.fromJson(json.encode(a)) == new Fingerprint.fromJson(json.encode(b)), isFalse); + expect(Fingerprint.fromJson(json.encode(a)) == Fingerprint.fromJson(json.encode(b)), isFalse); }, overrides: <Type, Generator>{ FlutterVersion: () => mockVersion, }); @@ -370,12 +370,12 @@ 'b.dart': '6f144e08b58cd0925328610fad7ac07c', }, }; - final Map<String, dynamic> b = new Map<String, dynamic>.from(a); + final Map<String, dynamic> b = Map<String, dynamic>.from(a); b['files'] = <String, dynamic>{ 'a.dart': '8a21a15fad560b799f6731d436c1b698', 'b.dart': '6f144e08b58cd0925328610fad7ac07d', }; - expect(new Fingerprint.fromJson(json.encode(a)) == new Fingerprint.fromJson(json.encode(b)), isFalse); + expect(Fingerprint.fromJson(json.encode(a)) == Fingerprint.fromJson(json.encode(b)), isFalse); }, overrides: <Type, Generator>{ FlutterVersion: () => mockVersion, }); @@ -389,12 +389,12 @@ 'b.dart': '6f144e08b58cd0925328610fad7ac07c', }, }; - final Map<String, dynamic> b = new Map<String, dynamic>.from(a); + final Map<String, dynamic> b = Map<String, dynamic>.from(a); b['files'] = <String, dynamic>{ 'a.dart': '8a21a15fad560b799f6731d436c1b698', 'c.dart': '6f144e08b58cd0925328610fad7ac07d', }; - expect(new Fingerprint.fromJson(json.encode(a)) == new Fingerprint.fromJson(json.encode(b)), isFalse); + expect(Fingerprint.fromJson(json.encode(a)) == Fingerprint.fromJson(json.encode(b)), isFalse); }, overrides: <Type, Generator>{ FlutterVersion: () => mockVersion, }); @@ -412,15 +412,15 @@ 'b.dart': '6f144e08b58cd0925328610fad7ac07c', }, }; - expect(new Fingerprint.fromJson(json.encode(a)) == new Fingerprint.fromJson(json.encode(a)), isTrue); + expect(Fingerprint.fromJson(json.encode(a)) == Fingerprint.fromJson(json.encode(a)), isTrue); }, overrides: <Type, Generator>{ FlutterVersion: () => mockVersion, }); }); group('hashCode', () { testUsingContext('is consistent with equals, even if map entries are reordered', () async { - final Fingerprint a = new Fingerprint.fromJson('{"version":"$kVersion","properties":{"a":"A","b":"B"},"files":{}}'); - final Fingerprint b = new Fingerprint.fromJson('{"version":"$kVersion","properties":{"b":"B","a":"A"},"files":{}}'); + final Fingerprint a = Fingerprint.fromJson('{"version":"$kVersion","properties":{"a":"A","b":"B"},"files":{}}'); + final Fingerprint b = Fingerprint.fromJson('{"version":"$kVersion","properties":{"b":"B","a":"A"},"files":{}}'); expect(a, b); expect(a.hashCode, b.hashCode); }, overrides: <Type, Generator>{ @@ -434,7 +434,7 @@ MemoryFileSystem fs; setUp(() { - fs = new MemoryFileSystem(); + fs = MemoryFileSystem(); }); final Map<Type, Generator> contextOverrides = <Type, Generator>{ FileSystem: () => fs };
diff --git a/packages/flutter_tools/test/base/flags_test.dart b/packages/flutter_tools/test/base/flags_test.dart index cd79cbf..8f65690 100644 --- a/packages/flutter_tools/test/base/flags_test.dart +++ b/packages/flutter_tools/test/base/flags_test.dart
@@ -18,7 +18,7 @@ Future<Null> runCommand(Iterable<String> flags, _TestMethod testMethod) async { final List<String> args = <String>['test']..addAll(flags); - final _TestCommand command = new _TestCommand(testMethod); + final _TestCommand command = _TestCommand(testMethod); await createTestCommandRunner(command).run(args); }
diff --git a/packages/flutter_tools/test/base/io_test.dart b/packages/flutter_tools/test/base/io_test.dart index be3cd3c..21013d5 100644 --- a/packages/flutter_tools/test/base/io_test.dart +++ b/packages/flutter_tools/test/base/io_test.dart
@@ -15,9 +15,9 @@ group('ProcessSignal', () { testUsingContext('signals are properly delegated', () async { - final MockIoProcessSignal mockSignal = new MockIoProcessSignal(); - final ProcessSignal signalUnderTest = new ProcessSignal(mockSignal); - final StreamController<io.ProcessSignal> controller = new StreamController<io.ProcessSignal>(); + final MockIoProcessSignal mockSignal = MockIoProcessSignal(); + final ProcessSignal signalUnderTest = ProcessSignal(mockSignal); + final StreamController<io.ProcessSignal> controller = StreamController<io.ProcessSignal>(); when(mockSignal.watch()).thenAnswer((Invocation invocation) => controller.stream); controller.add(mockSignal);
diff --git a/packages/flutter_tools/test/base/logger_test.dart b/packages/flutter_tools/test/base/logger_test.dart index c2fe605..fd8a1bd 100644 --- a/packages/flutter_tools/test/base/logger_test.dart +++ b/packages/flutter_tools/test/base/logger_test.dart
@@ -15,8 +15,8 @@ void main() { group('AppContext', () { test('error', () async { - final BufferLogger mockLogger = new BufferLogger(); - final VerboseLogger verboseLogger = new VerboseLogger(mockLogger); + final BufferLogger mockLogger = BufferLogger(); + final VerboseLogger verboseLogger = VerboseLogger(mockLogger); verboseLogger.supportsColor = false; verboseLogger.printStatus('Hey Hey Hey Hey'); @@ -35,13 +35,13 @@ AnsiSpinner ansiSpinner; AnsiStatus ansiStatus; int called; - final RegExp secondDigits = new RegExp(r'[^\b]\b\b\b\b\b[0-9]+[.][0-9]+(?:s|ms)'); + final RegExp secondDigits = RegExp(r'[^\b]\b\b\b\b\b[0-9]+[.][0-9]+(?:s|ms)'); setUp(() { - mockStdio = new MockStdio(); - ansiSpinner = new AnsiSpinner(); + mockStdio = MockStdio(); + ansiSpinner = AnsiSpinner(); called = 0; - ansiStatus = new AnsiStatus( + ansiStatus = AnsiStatus( message: 'Hello world', expectSlowOperation: true, padding: 20, @@ -133,7 +133,7 @@ ]); }, overrides: <Type, Generator>{ Stdio: () => mockStdio, - Logger: () => new StdoutLogger(), + Logger: () => StdoutLogger(), }); testUsingContext('sequential startProgress calls with VerboseLogger and StdoutLogger', () async { @@ -148,7 +148,7 @@ ]); }, overrides: <Type, Generator>{ Stdio: () => mockStdio, - Logger: () => new VerboseLogger(new StdoutLogger()), + Logger: () => VerboseLogger(StdoutLogger()), }); testUsingContext('sequential startProgress calls with BufferLogger', () async { @@ -157,7 +157,7 @@ final BufferLogger logger = context[Logger]; expect(logger.statusText, 'AAA\nBBB\n'); }, overrides: <Type, Generator>{ - Logger: () => new BufferLogger(), + Logger: () => BufferLogger(), }); }); }
diff --git a/packages/flutter_tools/test/base/logs_test.dart b/packages/flutter_tools/test/base/logs_test.dart index ff74ed1..ab503c6 100644 --- a/packages/flutter_tools/test/base/logs_test.dart +++ b/packages/flutter_tools/test/base/logs_test.dart
@@ -12,7 +12,7 @@ void main() { group('logs', () { testUsingContext('fail with a bad device id', () async { - final LogsCommand command = new LogsCommand(); + final LogsCommand command = LogsCommand(); applyMocksToCommand(command); try { await createTestCommandRunner(command).run(<String>['-d', 'abc123', 'logs']);
diff --git a/packages/flutter_tools/test/base/net_test.dart b/packages/flutter_tools/test/base/net_test.dart index 05ef212..9eb65b0 100644 --- a/packages/flutter_tools/test/base/net_test.dart +++ b/packages/flutter_tools/test/base/net_test.dart
@@ -14,7 +14,7 @@ void main() { testUsingContext('retry from 500', () async { String error; - new FakeAsync().run((FakeAsync time) { + FakeAsync().run((FakeAsync time) { fetchUrl(Uri.parse('http://example.invalid/')).then((List<int> value) { error = 'test completed unexpectedly'; }, onError: (dynamic exception) { @@ -32,12 +32,12 @@ expect(testLogger.errorText, isEmpty); expect(error, isNull); }, overrides: <Type, Generator>{ - HttpClientFactory: () => () => new MockHttpClient(500), + HttpClientFactory: () => () => MockHttpClient(500), }); testUsingContext('retry from network error', () async { String error; - new FakeAsync().run((FakeAsync time) { + FakeAsync().run((FakeAsync time) { fetchUrl(Uri.parse('http://example.invalid/')).then((List<int> value) { error = 'test completed unexpectedly'; }, onError: (dynamic exception) { @@ -55,12 +55,12 @@ expect(testLogger.errorText, isEmpty); expect(error, isNull); }, overrides: <Type, Generator>{ - HttpClientFactory: () => () => new MockHttpClient(200), + HttpClientFactory: () => () => MockHttpClient(200), }); testUsingContext('retry from SocketException', () async { String error; - new FakeAsync().run((FakeAsync time) { + FakeAsync().run((FakeAsync time) { fetchUrl(Uri.parse('http://example.invalid/')).then((List<int> value) { error = 'test completed unexpectedly'; }, onError: (dynamic exception) { @@ -79,14 +79,14 @@ expect(error, isNull); expect(testLogger.traceText, contains('Download error: SocketException')); }, overrides: <Type, Generator>{ - HttpClientFactory: () => () => new MockHttpClientThrowing( + HttpClientFactory: () => () => MockHttpClientThrowing( const io.SocketException('test exception handling'), ), }); testUsingContext('no retry from HandshakeException', () async { String error; - new FakeAsync().run((FakeAsync time) { + FakeAsync().run((FakeAsync time) { fetchUrl(Uri.parse('http://example.invalid/')).then((List<int> value) { error = 'test completed unexpectedly'; }, onError: (dynamic exception) { @@ -99,7 +99,7 @@ expect(error, startsWith('test failed')); expect(testLogger.traceText, contains('HandshakeException')); }, overrides: <Type, Generator>{ - HttpClientFactory: () => () => new MockHttpClientThrowing( + HttpClientFactory: () => () => MockHttpClientThrowing( const io.HandshakeException('test exception handling'), ), }); @@ -128,7 +128,7 @@ @override Future<io.HttpClientRequest> getUrl(Uri url) async { - return new MockHttpClientRequest(statusCode); + return MockHttpClientRequest(statusCode); } @override @@ -144,7 +144,7 @@ @override Future<io.HttpClientResponse> close() async { - return new MockHttpClientResponse(statusCode); + return MockHttpClientResponse(statusCode); } @override @@ -166,7 +166,7 @@ StreamSubscription<List<int>> listen(void onData(List<int> event), { Function onError, void onDone(), bool cancelOnError }) { - return new Stream<List<int>>.fromFuture(new Future<List<int>>.error(const io.SocketException('test'))) + return Stream<List<int>>.fromFuture(Future<List<int>>.error(const io.SocketException('test'))) .listen(onData, onError: onError, onDone: onDone, cancelOnError: cancelOnError); }
diff --git a/packages/flutter_tools/test/base/os_test.dart b/packages/flutter_tools/test/base/os_test.dart index d4385d7..21752a4 100644 --- a/packages/flutter_tools/test/base/os_test.dart +++ b/packages/flutter_tools/test/base/os_test.dart
@@ -20,42 +20,42 @@ ProcessManager mockProcessManager; setUp(() { - mockProcessManager = new MockProcessManager(); + mockProcessManager = MockProcessManager(); }); group('which on POSIX', () { testUsingContext('returns null when executable does not exist', () async { when(mockProcessManager.runSync(<String>['which', kExecutable])) - .thenReturn(new ProcessResult(0, 1, null, null)); - final OperatingSystemUtils utils = new OperatingSystemUtils(); + .thenReturn(ProcessResult(0, 1, null, null)); + final OperatingSystemUtils utils = OperatingSystemUtils(); expect(utils.which(kExecutable), isNull); }, overrides: <Type, Generator>{ ProcessManager: () => mockProcessManager, - Platform: () => new FakePlatform(operatingSystem: 'linux') + Platform: () => FakePlatform(operatingSystem: 'linux') }); testUsingContext('returns exactly one result', () async { when(mockProcessManager.runSync(<String>['which', 'foo'])) - .thenReturn(new ProcessResult(0, 0, kPath1, null)); - final OperatingSystemUtils utils = new OperatingSystemUtils(); + .thenReturn(ProcessResult(0, 0, kPath1, null)); + final OperatingSystemUtils utils = OperatingSystemUtils(); expect(utils.which(kExecutable).path, kPath1); }, overrides: <Type, Generator>{ ProcessManager: () => mockProcessManager, - Platform: () => new FakePlatform(operatingSystem: 'linux') + Platform: () => FakePlatform(operatingSystem: 'linux') }); testUsingContext('returns all results for whichAll', () async { when(mockProcessManager.runSync(<String>['which', '-a', kExecutable])) - .thenReturn(new ProcessResult(0, 0, '$kPath1\n$kPath2', null)); - final OperatingSystemUtils utils = new OperatingSystemUtils(); + .thenReturn(ProcessResult(0, 0, '$kPath1\n$kPath2', null)); + final OperatingSystemUtils utils = OperatingSystemUtils(); final List<File> result = utils.whichAll(kExecutable); expect(result, hasLength(2)); expect(result[0].path, kPath1); expect(result[1].path, kPath2); }, overrides: <Type, Generator>{ ProcessManager: () => mockProcessManager, - Platform: () => new FakePlatform(operatingSystem: 'linux') + Platform: () => FakePlatform(operatingSystem: 'linux') }); }); @@ -63,35 +63,35 @@ testUsingContext('returns null when executable does not exist', () async { when(mockProcessManager.runSync(<String>['where', kExecutable])) - .thenReturn(new ProcessResult(0, 1, null, null)); - final OperatingSystemUtils utils = new OperatingSystemUtils(); + .thenReturn(ProcessResult(0, 1, null, null)); + final OperatingSystemUtils utils = OperatingSystemUtils(); expect(utils.which(kExecutable), isNull); }, overrides: <Type, Generator>{ ProcessManager: () => mockProcessManager, - Platform: () => new FakePlatform(operatingSystem: 'windows') + Platform: () => FakePlatform(operatingSystem: 'windows') }); testUsingContext('returns exactly one result', () async { when(mockProcessManager.runSync(<String>['where', 'foo'])) - .thenReturn(new ProcessResult(0, 0, '$kPath1\n$kPath2', null)); - final OperatingSystemUtils utils = new OperatingSystemUtils(); + .thenReturn(ProcessResult(0, 0, '$kPath1\n$kPath2', null)); + final OperatingSystemUtils utils = OperatingSystemUtils(); expect(utils.which(kExecutable).path, kPath1); }, overrides: <Type, Generator>{ ProcessManager: () => mockProcessManager, - Platform: () => new FakePlatform(operatingSystem: 'windows') + Platform: () => FakePlatform(operatingSystem: 'windows') }); testUsingContext('returns all results for whichAll', () async { when(mockProcessManager.runSync(<String>['where', kExecutable])) - .thenReturn(new ProcessResult(0, 0, '$kPath1\n$kPath2', null)); - final OperatingSystemUtils utils = new OperatingSystemUtils(); + .thenReturn(ProcessResult(0, 0, '$kPath1\n$kPath2', null)); + final OperatingSystemUtils utils = OperatingSystemUtils(); final List<File> result = utils.whichAll(kExecutable); expect(result, hasLength(2)); expect(result[0].path, kPath1); expect(result[1].path, kPath2); }, overrides: <Type, Generator>{ ProcessManager: () => mockProcessManager, - Platform: () => new FakePlatform(operatingSystem: 'windows') + Platform: () => FakePlatform(operatingSystem: 'windows') }); }); }
diff --git a/packages/flutter_tools/test/base/os_utils_test.dart b/packages/flutter_tools/test/base/os_utils_test.dart index 27c9849..6df3407 100644 --- a/packages/flutter_tools/test/base/os_utils_test.dart +++ b/packages/flutter_tools/test/base/os_utils_test.dart
@@ -33,7 +33,7 @@ expect(mode.substring(0, 3), endsWith('x')); } }, overrides: <Type, Generator> { - OperatingSystemUtils: () => new OperatingSystemUtils(), + OperatingSystemUtils: () => OperatingSystemUtils(), }); }); }
diff --git a/packages/flutter_tools/test/base/terminal_test.dart b/packages/flutter_tools/test/base/terminal_test.dart index 9660fc0..53d9221 100644 --- a/packages/flutter_tools/test/base/terminal_test.dart +++ b/packages/flutter_tools/test/base/terminal_test.dart
@@ -14,14 +14,14 @@ AnsiTerminal terminalUnderTest; setUp(() { - terminalUnderTest = new TestTerminal(); + terminalUnderTest = TestTerminal(); }); testUsingContext('character prompt', () async { - mockStdInStream = new Stream<String>.fromFutures(<Future<String>>[ - new Future<String>.value('d'), // Not in accepted list. - new Future<String>.value('\n'), // Not in accepted list - new Future<String>.value('b'), + mockStdInStream = Stream<String>.fromFutures(<Future<String>>[ + Future<String>.value('d'), // Not in accepted list. + Future<String>.value('\n'), // Not in accepted list + Future<String>.value('b'), ]).asBroadcastStream(); final String choice = await terminalUnderTest.promptForCharInput( @@ -39,8 +39,8 @@ }); testUsingContext('default character choice without displayAcceptedCharacters', () async { - mockStdInStream = new Stream<String>.fromFutures(<Future<String>>[ - new Future<String>.value('\n'), // Not in accepted list + mockStdInStream = Stream<String>.fromFutures(<Future<String>>[ + Future<String>.value('\n'), // Not in accepted list ]).asBroadcastStream(); final String choice = await terminalUnderTest.promptForCharInput(
diff --git a/packages/flutter_tools/test/base_utils_test.dart b/packages/flutter_tools/test/base_utils_test.dart index d4d032f..8cb771a 100644 --- a/packages/flutter_tools/test/base_utils_test.dart +++ b/packages/flutter_tools/test/base_utils_test.dart
@@ -11,7 +11,7 @@ void main() { group('ItemListNotifier', () { test('sends notifications', () async { - final ItemListNotifier<String> list = new ItemListNotifier<String>(); + final ItemListNotifier<String> list = ItemListNotifier<String>(); expect(list.items, isEmpty); final Future<List<String>> addedStreamItems = list.onAdded.toList();
diff --git a/packages/flutter_tools/test/cache_test.dart b/packages/flutter_tools/test/cache_test.dart index 4797379..2c3e03f 100644 --- a/packages/flutter_tools/test/cache_test.dart +++ b/packages/flutter_tools/test/cache_test.dart
@@ -40,55 +40,55 @@ await Cache.lock(); Cache.checkLockAcquired(); }, overrides: <Type, Generator>{ - FileSystem: () => new MockFileSystem(), + FileSystem: () => MockFileSystem(), }); testUsingContext('should not throw when FLUTTER_ALREADY_LOCKED is set', () async { Cache.checkLockAcquired(); }, overrides: <Type, Generator>{ - Platform: () => new FakePlatform()..environment = <String, String>{'FLUTTER_ALREADY_LOCKED': 'true'}, + Platform: () => FakePlatform()..environment = <String, String>{'FLUTTER_ALREADY_LOCKED': 'true'}, }); }); group('Cache', () { test('should not be up to date, if some cached artifact is not', () { - final CachedArtifact artifact1 = new MockCachedArtifact(); - final CachedArtifact artifact2 = new MockCachedArtifact(); + final CachedArtifact artifact1 = MockCachedArtifact(); + final CachedArtifact artifact2 = MockCachedArtifact(); when(artifact1.isUpToDate()).thenReturn(true); when(artifact2.isUpToDate()).thenReturn(false); - final Cache cache = new Cache(artifacts: <CachedArtifact>[artifact1, artifact2]); + final Cache cache = Cache(artifacts: <CachedArtifact>[artifact1, artifact2]); expect(cache.isUpToDate(), isFalse); }); test('should be up to date, if all cached artifacts are', () { - final CachedArtifact artifact1 = new MockCachedArtifact(); - final CachedArtifact artifact2 = new MockCachedArtifact(); + final CachedArtifact artifact1 = MockCachedArtifact(); + final CachedArtifact artifact2 = MockCachedArtifact(); when(artifact1.isUpToDate()).thenReturn(true); when(artifact2.isUpToDate()).thenReturn(true); - final Cache cache = new Cache(artifacts: <CachedArtifact>[artifact1, artifact2]); + final Cache cache = Cache(artifacts: <CachedArtifact>[artifact1, artifact2]); expect(cache.isUpToDate(), isTrue); }); test('should update cached artifacts which are not up to date', () async { - final CachedArtifact artifact1 = new MockCachedArtifact(); - final CachedArtifact artifact2 = new MockCachedArtifact(); + final CachedArtifact artifact1 = MockCachedArtifact(); + final CachedArtifact artifact2 = MockCachedArtifact(); when(artifact1.isUpToDate()).thenReturn(true); when(artifact2.isUpToDate()).thenReturn(false); - final Cache cache = new Cache(artifacts: <CachedArtifact>[artifact1, artifact2]); + final Cache cache = Cache(artifacts: <CachedArtifact>[artifact1, artifact2]); await cache.updateAll(); verifyNever(artifact1.update()); verify(artifact2.update()); }); testUsingContext('failed storage.googleapis.com download shows China warning', () async { - final CachedArtifact artifact1 = new MockCachedArtifact(); - final CachedArtifact artifact2 = new MockCachedArtifact(); + final CachedArtifact artifact1 = MockCachedArtifact(); + final CachedArtifact artifact2 = MockCachedArtifact(); when(artifact1.isUpToDate()).thenReturn(false); when(artifact2.isUpToDate()).thenReturn(false); - final MockInternetAddress address = new MockInternetAddress(); + final MockInternetAddress address = MockInternetAddress(); when(address.host).thenReturn('storage.googleapis.com'); - when(artifact1.update()).thenThrow(new SocketException( + when(artifact1.update()).thenThrow(SocketException( 'Connection reset by peer', address: address, )); - final Cache cache = new Cache(artifacts: <CachedArtifact>[artifact1, artifact2]); + final Cache cache = Cache(artifacts: <CachedArtifact>[artifact1, artifact2]); try { await cache.updateAll(); fail('Mock thrown exception expected'); @@ -109,23 +109,23 @@ expect(flattenNameSubdirs(Uri.parse('http://docs.flutter.io/foo/bar')), 'docs.flutter.io/foo/bar'); expect(flattenNameSubdirs(Uri.parse('https://www.flutter.io')), 'www.flutter.io'); }, overrides: <Type, Generator>{ - FileSystem: () => new MockFileSystem(), + FileSystem: () => MockFileSystem(), }); } class MockFileSystem extends ForwardingFileSystem { - MockFileSystem() : super(new MemoryFileSystem()); + MockFileSystem() : super(MemoryFileSystem()); @override File file(dynamic path) { - return new MockFile(); + return MockFile(); } } class MockFile extends Mock implements File { @override Future<RandomAccessFile> open({FileMode mode = FileMode.read}) async { - return new MockRandomAccessFile(); + return MockRandomAccessFile(); } }
diff --git a/packages/flutter_tools/test/channel_test.dart b/packages/flutter_tools/test/channel_test.dart index ff832d5..ed12ded 100644 --- a/packages/flutter_tools/test/channel_test.dart +++ b/packages/flutter_tools/test/channel_test.dart
@@ -19,30 +19,30 @@ import 'src/context.dart'; Process createMockProcess({int exitCode = 0, String stdout = '', String stderr = ''}) { - final Stream<List<int>> stdoutStream = new Stream<List<int>>.fromIterable(<List<int>>[ + final Stream<List<int>> stdoutStream = Stream<List<int>>.fromIterable(<List<int>>[ utf8.encode(stdout), ]); - final Stream<List<int>> stderrStream = new Stream<List<int>>.fromIterable(<List<int>>[ + final Stream<List<int>> stderrStream = Stream<List<int>>.fromIterable(<List<int>>[ utf8.encode(stderr), ]); - final Process process = new MockProcess(); + final Process process = MockProcess(); when(process.stdout).thenAnswer((_) => stdoutStream); when(process.stderr).thenAnswer((_) => stderrStream); - when(process.exitCode).thenAnswer((_) => new Future<int>.value(exitCode)); + when(process.exitCode).thenAnswer((_) => Future<int>.value(exitCode)); return process; } void main() { group('channel', () { - final MockProcessManager mockProcessManager = new MockProcessManager(); + final MockProcessManager mockProcessManager = MockProcessManager(); setUpAll(() { Cache.disableLocking(); }); testUsingContext('list', () async { - final ChannelCommand command = new ChannelCommand(); + final ChannelCommand command = ChannelCommand(); final CommandRunner<Null> runner = createTestCommandRunner(command); await runner.run(<String>['channel']); expect(testLogger.errorText, hasLength(0)); @@ -62,9 +62,9 @@ <String>['git', 'branch', '-r'], workingDirectory: anyNamed('workingDirectory'), environment: anyNamed('environment'), - )).thenAnswer((_) => new Future<Process>.value(process)); + )).thenAnswer((_) => Future<Process>.value(process)); - final ChannelCommand command = new ChannelCommand(); + final ChannelCommand command = ChannelCommand(); final CommandRunner<Null> runner = createTestCommandRunner(command); await runner.run(<String>['channel']); @@ -93,19 +93,19 @@ <String>['git', 'fetch'], workingDirectory: anyNamed('workingDirectory'), environment: anyNamed('environment'), - )).thenAnswer((_) => new Future<Process>.value(createMockProcess())); + )).thenAnswer((_) => Future<Process>.value(createMockProcess())); when(mockProcessManager.start( <String>['git', 'show-ref', '--verify', '--quiet', 'refs/heads/beta'], workingDirectory: anyNamed('workingDirectory'), environment: anyNamed('environment'), - )).thenAnswer((_) => new Future<Process>.value(createMockProcess())); + )).thenAnswer((_) => Future<Process>.value(createMockProcess())); when(mockProcessManager.start( <String>['git', 'checkout', 'beta', '--'], workingDirectory: anyNamed('workingDirectory'), environment: anyNamed('environment'), - )).thenAnswer((_) => new Future<Process>.value(createMockProcess())); + )).thenAnswer((_) => Future<Process>.value(createMockProcess())); - final ChannelCommand command = new ChannelCommand(); + final ChannelCommand command = ChannelCommand(); final CommandRunner<Null> runner = createTestCommandRunner(command); await runner.run(<String>['channel', 'beta']); @@ -129,7 +129,7 @@ expect(testLogger.errorText, hasLength(0)); }, overrides: <Type, Generator>{ ProcessManager: () => mockProcessManager, - FileSystem: () => new MemoryFileSystem(), + FileSystem: () => MemoryFileSystem(), }); // This verifies that bug https://github.com/flutter/flutter/issues/21134 @@ -139,17 +139,17 @@ <String>['git', 'fetch'], workingDirectory: anyNamed('workingDirectory'), environment: anyNamed('environment'), - )).thenAnswer((_) => new Future<Process>.value(createMockProcess())); + )).thenAnswer((_) => Future<Process>.value(createMockProcess())); when(mockProcessManager.start( <String>['git', 'show-ref', '--verify', '--quiet', 'refs/heads/beta'], workingDirectory: anyNamed('workingDirectory'), environment: anyNamed('environment'), - )).thenAnswer((_) => new Future<Process>.value(createMockProcess())); + )).thenAnswer((_) => Future<Process>.value(createMockProcess())); when(mockProcessManager.start( <String>['git', 'checkout', 'beta', '--'], workingDirectory: anyNamed('workingDirectory'), environment: anyNamed('environment'), - )).thenAnswer((_) => new Future<Process>.value(createMockProcess())); + )).thenAnswer((_) => Future<Process>.value(createMockProcess())); final File versionCheckFile = Cache.instance.getStampFileFor( VersionCheckStamp.kFlutterVersionCheckStampFile, @@ -165,7 +165,7 @@ } '''); - final ChannelCommand command = new ChannelCommand(); + final ChannelCommand command = ChannelCommand(); final CommandRunner<Null> runner = createTestCommandRunner(command); await runner.run(<String>['channel', 'beta']); @@ -190,7 +190,7 @@ expect(versionCheckFile.existsSync(), isFalse); }, overrides: <Type, Generator>{ ProcessManager: () => mockProcessManager, - FileSystem: () => new MemoryFileSystem(), + FileSystem: () => MemoryFileSystem(), }); }); }
diff --git a/packages/flutter_tools/test/commands/analyze_continuously_test.dart b/packages/flutter_tools/test/commands/analyze_continuously_test.dart index 49763f5..d03cf66 100644 --- a/packages/flutter_tools/test/commands/analyze_continuously_test.dart +++ b/packages/flutter_tools/test/commands/analyze_continuously_test.dart
@@ -34,7 +34,7 @@ await pubGet(context: PubContext.flutterTests, directory: tempDir.path); - server = new AnalysisServer(dartSdkPath, <String>[tempDir.path]); + server = AnalysisServer(dartSdkPath, <String>[tempDir.path]); int errorCount = 0; final Future<bool> onDone = server.onAnalyzing.where((bool analyzing) => analyzing == false).first; @@ -54,7 +54,7 @@ await pubGet(context: PubContext.flutterTests, directory: tempDir.path); - server = new AnalysisServer(dartSdkPath, <String>[tempDir.path]); + server = AnalysisServer(dartSdkPath, <String>[tempDir.path]); int errorCount = 0; final Future<bool> onDone = server.onAnalyzing.where((bool analyzing) => analyzing == false).first; @@ -73,7 +73,7 @@ testUsingContext('Returns no errors when source is error-free', () async { const String contents = "StringBuffer bar = StringBuffer('baz');"; tempDir.childFile('main.dart').writeAsStringSync(contents); - server = new AnalysisServer(dartSdkPath, <String>[tempDir.path]); + server = AnalysisServer(dartSdkPath, <String>[tempDir.path]); int errorCount = 0; final Future<bool> onDone = server.onAnalyzing.where((bool analyzing) => analyzing == false).first;
diff --git a/packages/flutter_tools/test/commands/analyze_once_test.dart b/packages/flutter_tools/test/commands/analyze_once_test.dart index 8ada5d0..638c60e 100644 --- a/packages/flutter_tools/test/commands/analyze_once_test.dart +++ b/packages/flutter_tools/test/commands/analyze_once_test.dart
@@ -40,7 +40,7 @@ // Create a project to be analyzed testUsingContext('flutter create', () async { await runCommand( - command: new CreateCommand(), + command: CreateCommand(), arguments: <String>['create', projectPath], statusTextContains: <String>[ 'All done!', @@ -53,7 +53,7 @@ // Analyze in the current directory - no arguments testUsingContext('working directory', () async { await runCommand( - command: new AnalyzeCommand(workingDirectory: fs.directory(projectPath)), + command: AnalyzeCommand(workingDirectory: fs.directory(projectPath)), arguments: <String>['analyze'], statusTextContains: <String>['No issues found!'], ); @@ -62,7 +62,7 @@ // Analyze a specific file outside the current directory testUsingContext('passing one file throws', () async { await runCommand( - command: new AnalyzeCommand(), + command: AnalyzeCommand(), arguments: <String>['analyze', libMain.path], toolExit: true, exitMessageContains: 'is not a directory', @@ -89,7 +89,7 @@ // Analyze in the current directory - no arguments await runCommand( - command: new AnalyzeCommand(workingDirectory: fs.directory(projectPath)), + command: AnalyzeCommand(workingDirectory: fs.directory(projectPath)), arguments: <String>['analyze'], statusTextContains: <String>[ 'Analyzing', @@ -115,7 +115,7 @@ // Analyze in the current directory - no arguments await runCommand( - command: new AnalyzeCommand(workingDirectory: fs.directory(projectPath)), + command: AnalyzeCommand(workingDirectory: fs.directory(projectPath)), arguments: <String>['analyze'], statusTextContains: <String>[ 'Analyzing', @@ -149,7 +149,7 @@ // Analyze in the current directory - no arguments await runCommand( - command: new AnalyzeCommand(workingDirectory: tempDir), + command: AnalyzeCommand(workingDirectory: tempDir), arguments: <String>['analyze'], statusTextContains: <String>[ 'Analyzing', @@ -170,7 +170,7 @@ tempDir.childFile('main.dart').writeAsStringSync(contents); try { await runCommand( - command: new AnalyzeCommand(workingDirectory: fs.directory(tempDir)), + command: AnalyzeCommand(workingDirectory: fs.directory(tempDir)), arguments: <String>['analyze'], statusTextContains: <String>['No issues found!'], );
diff --git a/packages/flutter_tools/test/commands/analyze_test.dart b/packages/flutter_tools/test/commands/analyze_test.dart index d86b574..115a3d0 100644 --- a/packages/flutter_tools/test/commands/analyze_test.dart +++ b/packages/flutter_tools/test/commands/analyze_test.dart
@@ -17,7 +17,7 @@ Directory tempDir; setUp(() { - fs = new MemoryFileSystem(); + fs = MemoryFileSystem(); fs.directory(_kFlutterRoot).createSync(recursive: true); Cache.flutterRoot = _kFlutterRoot; tempDir = fs.systemTempDirectory.createTempSync('flutter_analysis_test.');
diff --git a/packages/flutter_tools/test/commands/attach_test.dart b/packages/flutter_tools/test/commands/attach_test.dart index 8326f2b..9f4e67c 100644 --- a/packages/flutter_tools/test/commands/attach_test.dart +++ b/packages/flutter_tools/test/commands/attach_test.dart
@@ -21,7 +21,7 @@ void main() { group('attach', () { - final FileSystem testFileSystem = new MemoryFileSystem( + final FileSystem testFileSystem = MemoryFileSystem( style: platform.isWindows ? FileSystemStyle.windows : FileSystemStyle .posix, ); @@ -41,9 +41,9 @@ MockAndroidDevice device; setUp(() { - mockLogReader = new MockDeviceLogReader(); - portForwarder = new MockPortForwarder(); - device = new MockAndroidDevice(); + mockLogReader = MockDeviceLogReader(); + portForwarder = MockPortForwarder(); + device = MockAndroidDevice(); when(device.getLogReader()).thenAnswer((_) { // Now that the reader is used, start writing messages to it. Timer.run(() { @@ -58,7 +58,7 @@ when(portForwarder.forward(devicePort, hostPort: anyNamed('hostPort'))) .thenAnswer((_) async => hostPort); when(portForwarder.forwardedPorts).thenReturn( - <ForwardedPort>[new ForwardedPort(hostPort, devicePort)]); + <ForwardedPort>[ForwardedPort(hostPort, devicePort)]); when(portForwarder.unforward(any)).thenAnswer((_) async => null); // We cannot add the device to a device manager because that is @@ -75,7 +75,7 @@ testUsingContext('finds observatory port and forwards', () async { testDeviceManager.addDevice(device); - final AttachCommand command = new AttachCommand(); + final AttachCommand command = AttachCommand(); await createTestCommandRunner(command).run(<String>['attach']); @@ -94,7 +94,7 @@ const String projectRoot = '/build-output/project-root'; const String outputDill = '/tmp/output.dill'; - final MockHotRunnerFactory mockHotRunnerFactory = new MockHotRunnerFactory(); + final MockHotRunnerFactory mockHotRunnerFactory = MockHotRunnerFactory(); when( mockHotRunnerFactory.build( any, @@ -105,9 +105,9 @@ packagesFilePath: anyNamed('packagesFilePath'), usesTerminalUI: anyNamed('usesTerminalUI'), ), - )..thenReturn(new MockHotRunner()); + )..thenReturn(MockHotRunner()); - final AttachCommand command = new AttachCommand( + final AttachCommand command = AttachCommand( hotRunnerFactory: mockHotRunnerFactory, ); await createTestCommandRunner(command).run(<String>[ @@ -156,22 +156,22 @@ testUsingContext('selects specified target', () async { const int devicePort = 499; const int hostPort = 42; - final MockDeviceLogReader mockLogReader = new MockDeviceLogReader(); - final MockPortForwarder portForwarder = new MockPortForwarder(); - final MockAndroidDevice device = new MockAndroidDevice(); - final MockHotRunnerFactory mockHotRunnerFactory = new MockHotRunnerFactory(); + final MockDeviceLogReader mockLogReader = MockDeviceLogReader(); + final MockPortForwarder portForwarder = MockPortForwarder(); + final MockAndroidDevice device = MockAndroidDevice(); + final MockHotRunnerFactory mockHotRunnerFactory = MockHotRunnerFactory(); when(device.portForwarder).thenReturn(portForwarder); when(portForwarder.forward(devicePort, hostPort: anyNamed('hostPort'))) .thenAnswer((_) async => hostPort); when(portForwarder.forwardedPorts).thenReturn( - <ForwardedPort>[new ForwardedPort(hostPort, devicePort)]); + <ForwardedPort>[ForwardedPort(hostPort, devicePort)]); when(portForwarder.unforward(any)).thenAnswer((_) async => null); when(mockHotRunnerFactory.build(any, target: anyNamed('target'), debuggingOptions: anyNamed('debuggingOptions'), packagesFilePath: anyNamed('packagesFilePath'), usesTerminalUI: anyNamed('usesTerminalUI'))).thenReturn( - new MockHotRunner()); + MockHotRunner()); testDeviceManager.addDevice(device); when(device.getLogReader()).thenAnswer((_) { @@ -190,7 +190,7 @@ // Delete the main.dart file to be sure that attach works without it. fs.file('lib/main.dart').deleteSync(); - final AttachCommand command = new AttachCommand( + final AttachCommand command = AttachCommand( hotRunnerFactory: mockHotRunnerFactory); await createTestCommandRunner(command).run( <String>['attach', '-t', foo.path, '-v']); @@ -207,17 +207,17 @@ testUsingContext('forwards to given port', () async { const int devicePort = 499; const int hostPort = 42; - final MockPortForwarder portForwarder = new MockPortForwarder(); - final MockAndroidDevice device = new MockAndroidDevice(); + final MockPortForwarder portForwarder = MockPortForwarder(); + final MockAndroidDevice device = MockAndroidDevice(); when(device.portForwarder).thenReturn(portForwarder); when(portForwarder.forward(devicePort)).thenAnswer((_) async => hostPort); when(portForwarder.forwardedPorts).thenReturn( - <ForwardedPort>[new ForwardedPort(hostPort, devicePort)]); + <ForwardedPort>[ForwardedPort(hostPort, devicePort)]); when(portForwarder.unforward(any)).thenAnswer((_) async => null); testDeviceManager.addDevice(device); - final AttachCommand command = new AttachCommand(); + final AttachCommand command = AttachCommand(); await createTestCommandRunner(command).run( <String>['attach', '--debug-port', '$devicePort']); @@ -228,7 +228,7 @@ },); testUsingContext('exits when no device connected', () async { - final AttachCommand command = new AttachCommand(); + final AttachCommand command = AttachCommand(); await expectLater( createTestCommandRunner(command).run(<String>['attach']), throwsA(isInstanceOf<ToolExit>()), @@ -240,7 +240,7 @@ testUsingContext('exits when multiple devices connected', () async { Device aDeviceWithId(String id) { - final MockAndroidDevice device = new MockAndroidDevice(); + final MockAndroidDevice device = MockAndroidDevice(); when(device.name).thenReturn('d$id'); when(device.id).thenReturn(id); when(device.isLocalEmulator).thenAnswer((_) async => false); @@ -248,7 +248,7 @@ return device; } - final AttachCommand command = new AttachCommand(); + final AttachCommand command = AttachCommand(); testDeviceManager.addDevice(aDeviceWithId('xx1')); testDeviceManager.addDevice(aDeviceWithId('yy2')); await expectLater(
diff --git a/packages/flutter_tools/test/commands/config_test.dart b/packages/flutter_tools/test/commands/config_test.dart index d383da4..c93c204 100644 --- a/packages/flutter_tools/test/commands/config_test.dart +++ b/packages/flutter_tools/test/commands/config_test.dart
@@ -19,14 +19,14 @@ MockAndroidSdk mockAndroidSdk; setUp(() { - mockAndroidStudio = new MockAndroidStudio(); - mockAndroidSdk = new MockAndroidSdk(); + mockAndroidStudio = MockAndroidStudio(); + mockAndroidSdk = MockAndroidSdk(); }); group('config', () { testUsingContext('machine flag', () async { final BufferLogger logger = context[Logger]; - final ConfigCommand command = new ConfigCommand(); + final ConfigCommand command = ConfigCommand(); await command.handleMachine(); expect(logger.statusText, isNotEmpty);
diff --git a/packages/flutter_tools/test/commands/create_test.dart b/packages/flutter_tools/test/commands/create_test.dart index 33530b6..ab848f0 100644 --- a/packages/flutter_tools/test/commands/create_test.dart +++ b/packages/flutter_tools/test/commands/create_test.dart
@@ -34,10 +34,10 @@ }); setUp(() { - loggingProcessManager = new LoggingProcessManager(); + loggingProcessManager = LoggingProcessManager(); tempDir = fs.systemTempDirectory.createTempSync('flutter_tools_create_test.'); projectDir = tempDir.childDirectory('flutter_project'); - mockFlutterVersion = new MockFlutterVersion(); + mockFlutterVersion = MockFlutterVersion(); }); tearDown(() { @@ -239,7 +239,7 @@ when(mockFlutterVersion.frameworkRevision).thenReturn(frameworkRevision); when(mockFlutterVersion.channel).thenReturn(frameworkChannel); - final CreateCommand command = new CreateCommand(); + final CreateCommand command = CreateCommand(); final CommandRunner<Null> runner = createTestCommandRunner(command); await runner.run(<String>['create', '--no-pub', '--org', 'com.foo.bar', projectDir.path]); @@ -303,7 +303,7 @@ testUsingContext('can re-gen over existing project', () async { Cache.flutterRoot = '../..'; - final CreateCommand command = new CreateCommand(); + final CreateCommand command = CreateCommand(); final CommandRunner<Null> runner = createTestCommandRunner(command); await runner.run(<String>['create', '--no-pub', projectDir.path]); @@ -394,7 +394,7 @@ testUsingContext('produces sensible error message', () async { Cache.flutterRoot = '../..'; - final CreateCommand command = new CreateCommand(); + final CreateCommand command = CreateCommand(); final CommandRunner<Null> runner = createTestCommandRunner(command); expect( @@ -406,7 +406,7 @@ // Verify that we fail with an error code when the file exists. testUsingContext('fails when file exists', () async { Cache.flutterRoot = '../..'; - final CreateCommand command = new CreateCommand(); + final CreateCommand command = CreateCommand(); final CommandRunner<Null> runner = createTestCommandRunner(command); final File existingFile = fs.file('${projectDir.path.toString()}/bad'); if (!existingFile.existsSync()) @@ -419,7 +419,7 @@ testUsingContext('fails when invalid package name', () async { Cache.flutterRoot = '../..'; - final CreateCommand command = new CreateCommand(); + final CreateCommand command = CreateCommand(); final CommandRunner<Null> runner = createTestCommandRunner(command); expect( runner.run(<String>['create', fs.path.join(projectDir.path, 'invalidName')]), @@ -430,7 +430,7 @@ testUsingContext('invokes pub offline when requested', () async { Cache.flutterRoot = '../..'; - final CreateCommand command = new CreateCommand(); + final CreateCommand command = CreateCommand(); final CommandRunner<Null> runner = createTestCommandRunner(command); await runner.run(<String>['create', '--pub', '--offline', projectDir.path]); @@ -446,7 +446,7 @@ testUsingContext('invokes pub online when offline not requested', () async { Cache.flutterRoot = '../..'; - final CreateCommand command = new CreateCommand(); + final CreateCommand command = CreateCommand(); final CommandRunner<Null> runner = createTestCommandRunner(command); await runner.run(<String>['create', '--pub', projectDir.path]); @@ -465,7 +465,7 @@ Directory dir, List<String> createArgs, List<String> expectedPaths, { List<String> unexpectedPaths = const <String>[], bool plugin = false}) async { Cache.flutterRoot = '../..'; - final CreateCommand command = new CreateCommand(); + final CreateCommand command = CreateCommand(); final CommandRunner<Null> runner = createTestCommandRunner(command); final List<String> args = <String>['create']; args.addAll(createArgs);
diff --git a/packages/flutter_tools/test/commands/daemon_test.dart b/packages/flutter_tools/test/commands/daemon_test.dart index f880e59..15301da 100644 --- a/packages/flutter_tools/test/commands/daemon_test.dart +++ b/packages/flutter_tools/test/commands/daemon_test.dart
@@ -21,7 +21,7 @@ group('daemon', () { setUp(() { - notifyingLogger = new NotifyingLogger(); + notifyingLogger = NotifyingLogger(); }); tearDown(() { @@ -31,9 +31,9 @@ }); testUsingContext('daemon.version command should succeed', () async { - final StreamController<Map<String, dynamic>> commands = new StreamController<Map<String, dynamic>>(); - final StreamController<Map<String, dynamic>> responses = new StreamController<Map<String, dynamic>>(); - daemon = new Daemon( + final StreamController<Map<String, dynamic>> commands = StreamController<Map<String, dynamic>>(); + final StreamController<Map<String, dynamic>> responses = StreamController<Map<String, dynamic>>(); + daemon = Daemon( commands.stream, responses.add, notifyingLogger: notifyingLogger @@ -48,9 +48,9 @@ }); testUsingContext('printError should send daemon.logMessage event', () async { - final StreamController<Map<String, dynamic>> commands = new StreamController<Map<String, dynamic>>(); - final StreamController<Map<String, dynamic>> responses = new StreamController<Map<String, dynamic>>(); - daemon = new Daemon( + final StreamController<Map<String, dynamic>> commands = StreamController<Map<String, dynamic>>(); + final StreamController<Map<String, dynamic>> responses = StreamController<Map<String, dynamic>>(); + daemon = Daemon( commands.stream, responses.add, notifyingLogger: notifyingLogger, @@ -71,12 +71,12 @@ }); testUsingContext('printStatus should log to stdout when logToStdout is enabled', () async { - final StringBuffer buffer = new StringBuffer(); + final StringBuffer buffer = StringBuffer(); await runZoned(() async { - final StreamController<Map<String, dynamic>> commands = new StreamController<Map<String, dynamic>>(); - final StreamController<Map<String, dynamic>> responses = new StreamController<Map<String, dynamic>>(); - daemon = new Daemon( + final StreamController<Map<String, dynamic>> commands = StreamController<Map<String, dynamic>>(); + final StreamController<Map<String, dynamic>> responses = StreamController<Map<String, dynamic>>(); + daemon = Daemon( commands.stream, responses.add, notifyingLogger: notifyingLogger, @@ -84,8 +84,8 @@ ); printStatus('daemon.logMessage test'); // Service the event loop. - await new Future<Null>.value(); - }, zoneSpecification: new ZoneSpecification(print: (Zone self, ZoneDelegate parent, Zone zone, String line) { + await Future<Null>.value(); + }, zoneSpecification: ZoneSpecification(print: (Zone self, ZoneDelegate parent, Zone zone, String line) { buffer.writeln(line); })); @@ -95,9 +95,9 @@ }); testUsingContext('daemon.shutdown command should stop daemon', () async { - final StreamController<Map<String, dynamic>> commands = new StreamController<Map<String, dynamic>>(); - final StreamController<Map<String, dynamic>> responses = new StreamController<Map<String, dynamic>>(); - daemon = new Daemon( + final StreamController<Map<String, dynamic>> commands = StreamController<Map<String, dynamic>>(); + final StreamController<Map<String, dynamic>> responses = StreamController<Map<String, dynamic>>(); + daemon = Daemon( commands.stream, responses.add, notifyingLogger: notifyingLogger @@ -110,12 +110,12 @@ }); testUsingContext('app.restart without an appId should report an error', () async { - final DaemonCommand command = new DaemonCommand(); + final DaemonCommand command = DaemonCommand(); applyMocksToCommand(command); - final StreamController<Map<String, dynamic>> commands = new StreamController<Map<String, dynamic>>(); - final StreamController<Map<String, dynamic>> responses = new StreamController<Map<String, dynamic>>(); - daemon = new Daemon( + final StreamController<Map<String, dynamic>> commands = StreamController<Map<String, dynamic>>(); + final StreamController<Map<String, dynamic>> responses = StreamController<Map<String, dynamic>>(); + daemon = Daemon( commands.stream, responses.add, daemonCommand: command, @@ -131,12 +131,12 @@ }); testUsingContext('ext.flutter.debugPaint via service extension without an appId should report an error', () async { - final DaemonCommand command = new DaemonCommand(); + final DaemonCommand command = DaemonCommand(); applyMocksToCommand(command); - final StreamController<Map<String, dynamic>> commands = new StreamController<Map<String, dynamic>>(); - final StreamController<Map<String, dynamic>> responses = new StreamController<Map<String, dynamic>>(); - daemon = new Daemon( + final StreamController<Map<String, dynamic>> commands = StreamController<Map<String, dynamic>>(); + final StreamController<Map<String, dynamic>> responses = StreamController<Map<String, dynamic>>(); + daemon = Daemon( commands.stream, responses.add, daemonCommand: command, @@ -158,12 +158,12 @@ }); testUsingContext('app.stop without appId should report an error', () async { - final DaemonCommand command = new DaemonCommand(); + final DaemonCommand command = DaemonCommand(); applyMocksToCommand(command); - final StreamController<Map<String, dynamic>> commands = new StreamController<Map<String, dynamic>>(); - final StreamController<Map<String, dynamic>> responses = new StreamController<Map<String, dynamic>>(); - daemon = new Daemon( + final StreamController<Map<String, dynamic>> commands = StreamController<Map<String, dynamic>>(); + final StreamController<Map<String, dynamic>> responses = StreamController<Map<String, dynamic>>(); + daemon = Daemon( commands.stream, responses.add, daemonCommand: command, @@ -179,9 +179,9 @@ }); testUsingContext('daemon should send showMessage on startup if no Android devices are available', () async { - final StreamController<Map<String, dynamic>> commands = new StreamController<Map<String, dynamic>>(); - final StreamController<Map<String, dynamic>> responses = new StreamController<Map<String, dynamic>>(); - daemon = new Daemon( + final StreamController<Map<String, dynamic>> commands = StreamController<Map<String, dynamic>>(); + final StreamController<Map<String, dynamic>> responses = StreamController<Map<String, dynamic>>(); + daemon = Daemon( commands.stream, responses.add, notifyingLogger: notifyingLogger, @@ -195,14 +195,14 @@ expect(response['params'], containsPair('title', 'Unable to list devices')); expect(response['params'], containsPair('message', contains('Unable to discover Android devices'))); }, overrides: <Type, Generator>{ - AndroidWorkflow: () => new MockAndroidWorkflow(canListDevices: false), - IOSWorkflow: () => new MockIOSWorkflow(), + AndroidWorkflow: () => MockAndroidWorkflow(canListDevices: false), + IOSWorkflow: () => MockIOSWorkflow(), }); testUsingContext('device.getDevices should respond with list', () async { - final StreamController<Map<String, dynamic>> commands = new StreamController<Map<String, dynamic>>(); - final StreamController<Map<String, dynamic>> responses = new StreamController<Map<String, dynamic>>(); - daemon = new Daemon( + final StreamController<Map<String, dynamic>> commands = StreamController<Map<String, dynamic>>(); + final StreamController<Map<String, dynamic>> responses = StreamController<Map<String, dynamic>>(); + daemon = Daemon( commands.stream, responses.add, notifyingLogger: notifyingLogger @@ -216,17 +216,17 @@ }); testUsingContext('should send device.added event when device is discovered', () async { - final StreamController<Map<String, dynamic>> commands = new StreamController<Map<String, dynamic>>(); - final StreamController<Map<String, dynamic>> responses = new StreamController<Map<String, dynamic>>(); - daemon = new Daemon( + final StreamController<Map<String, dynamic>> commands = StreamController<Map<String, dynamic>>(); + final StreamController<Map<String, dynamic>> responses = StreamController<Map<String, dynamic>>(); + daemon = Daemon( commands.stream, responses.add, notifyingLogger: notifyingLogger ); - final MockPollingDeviceDiscovery discoverer = new MockPollingDeviceDiscovery(); + final MockPollingDeviceDiscovery discoverer = MockPollingDeviceDiscovery(); daemon.deviceDomain.addDeviceDiscoverer(discoverer); - discoverer.addDevice(new MockAndroidDevice()); + discoverer.addDevice(MockAndroidDevice()); return await responses.stream.skipWhile(_isConnectedEvent).first.then((Map<String, dynamic> response) async { expect(response['event'], 'device.added'); @@ -239,17 +239,17 @@ await commands.close(); }); }, overrides: <Type, Generator>{ - AndroidWorkflow: () => new MockAndroidWorkflow(), - IOSWorkflow: () => new MockIOSWorkflow(), + AndroidWorkflow: () => MockAndroidWorkflow(), + IOSWorkflow: () => MockIOSWorkflow(), }); testUsingContext('emulator.launch without an emulatorId should report an error', () async { - final DaemonCommand command = new DaemonCommand(); + final DaemonCommand command = DaemonCommand(); applyMocksToCommand(command); - final StreamController<Map<String, dynamic>> commands = new StreamController<Map<String, dynamic>>(); - final StreamController<Map<String, dynamic>> responses = new StreamController<Map<String, dynamic>>(); - daemon = new Daemon( + final StreamController<Map<String, dynamic>> commands = StreamController<Map<String, dynamic>>(); + final StreamController<Map<String, dynamic>> responses = StreamController<Map<String, dynamic>>(); + daemon = Daemon( commands.stream, responses.add, daemonCommand: command, @@ -265,9 +265,9 @@ }); testUsingContext('emulator.getEmulators should respond with list', () async { - final StreamController<Map<String, dynamic>> commands = new StreamController<Map<String, dynamic>>(); - final StreamController<Map<String, dynamic>> responses = new StreamController<Map<String, dynamic>>(); - daemon = new Daemon( + final StreamController<Map<String, dynamic>> commands = StreamController<Map<String, dynamic>>(); + final StreamController<Map<String, dynamic>> responses = StreamController<Map<String, dynamic>>(); + daemon = Daemon( commands.stream, responses.add, notifyingLogger: notifyingLogger @@ -288,11 +288,11 @@ '{"code":0,"message":""}' ); expect( - jsonEncodeObject(new OperationResult(1, 'foo')), + jsonEncodeObject(OperationResult(1, 'foo')), '{"code":1,"message":"foo"}' ); expect( - jsonEncodeObject(new OperationResult(0, 'foo', hintMessage: 'my hint', hintId: 'myId')), + jsonEncodeObject(OperationResult(0, 'foo', hintMessage: 'my hint', hintId: 'myId')), '{"code":0,"message":"foo","hintMessage":"my hint","hintId":"myId"}' ); });
diff --git a/packages/flutter_tools/test/commands/devices_test.dart b/packages/flutter_tools/test/commands/devices_test.dart index 14b9087..f3fa126 100644 --- a/packages/flutter_tools/test/commands/devices_test.dart +++ b/packages/flutter_tools/test/commands/devices_test.dart
@@ -23,18 +23,18 @@ }); testUsingContext('returns 0 when called', () async { - final DevicesCommand command = new DevicesCommand(); + final DevicesCommand command = DevicesCommand(); await createTestCommandRunner(command).run(<String>['devices']); }); testUsingContext('no error when no connected devices', () async { - final DevicesCommand command = new DevicesCommand(); + final DevicesCommand command = DevicesCommand(); await createTestCommandRunner(command).run(<String>['devices']); expect(testLogger.statusText, contains('No devices detected')); }, overrides: <Type, Generator>{ AndroidSdk: () => null, - DeviceManager: () => new DeviceManager(), - ProcessManager: () => new MockProcessManager(), + DeviceManager: () => DeviceManager(), + ProcessManager: () => MockProcessManager(), }); }); } @@ -50,7 +50,7 @@ Encoding stdoutEncoding = systemEncoding, Encoding stderrEncoding = systemEncoding, }) async { - return new ProcessResult(0, 0, '', ''); + return ProcessResult(0, 0, '', ''); } @override @@ -63,6 +63,6 @@ Encoding stdoutEncoding = systemEncoding, Encoding stderrEncoding = systemEncoding, }) { - return new ProcessResult(0, 0, '', ''); + return ProcessResult(0, 0, '', ''); } }
diff --git a/packages/flutter_tools/test/commands/doctor_test.dart b/packages/flutter_tools/test/commands/doctor_test.dart index d192d1b..c74a159 100644 --- a/packages/flutter_tools/test/commands/doctor_test.dart +++ b/packages/flutter_tools/test/commands/doctor_test.dart
@@ -16,7 +16,7 @@ group('doctor', () { testUsingContext('intellij validator', () async { const String installPath = '/path/to/intelliJ'; - final ValidationResult result = await new IntelliJValidatorTestTarget('Test', installPath).validate(); + final ValidationResult result = await IntelliJValidatorTestTarget('Test', installPath).validate(); expect(result.type, ValidationType.partial); expect(result.statusInfo, 'version test.test.test'); expect(result.messages, hasLength(4)); @@ -94,14 +94,14 @@ '• No issues found!\n' )); }, overrides: <Type, Generator>{ - DoctorValidatorsProvider: () => new FakeDoctorValidatorsProvider() + DoctorValidatorsProvider: () => FakeDoctorValidatorsProvider() }); }); group('doctor with fake validators', () { testUsingContext('validate non-verbose output format for run without issues', () async { - expect(await new FakeQuietDoctor().diagnose(verbose: false), isTrue); + expect(await FakeQuietDoctor().diagnose(verbose: false), isTrue); expect(testLogger.statusText, equals( 'Doctor summary (to see all details, run flutter doctor -v):\n' '[✓] Passing Validator (with statusInfo)\n' @@ -114,7 +114,7 @@ }); testUsingContext('validate non-verbose output format when only one category fails', () async { - expect(await new FakeSinglePassingDoctor().diagnose(verbose: false), isTrue); + expect(await FakeSinglePassingDoctor().diagnose(verbose: false), isTrue); expect(testLogger.statusText, equals( 'Doctor summary (to see all details, run flutter doctor -v):\n' '[!] Partial Validator with only a Hint\n' @@ -125,7 +125,7 @@ }); testUsingContext('validate non-verbose output format for a passing run', () async { - expect(await new FakePassingDoctor().diagnose(verbose: false), isTrue); + expect(await FakePassingDoctor().diagnose(verbose: false), isTrue); expect(testLogger.statusText, equals( 'Doctor summary (to see all details, run flutter doctor -v):\n' '[✓] Passing Validator (with statusInfo)\n' @@ -141,7 +141,7 @@ }); testUsingContext('validate non-verbose output format', () async { - expect(await new FakeDoctor().diagnose(verbose: false), isFalse); + expect(await FakeDoctor().diagnose(verbose: false), isFalse); expect(testLogger.statusText, equals( 'Doctor summary (to see all details, run flutter doctor -v):\n' '[✓] Passing Validator (with statusInfo)\n' @@ -159,7 +159,7 @@ }); testUsingContext('validate verbose output format', () async { - expect(await new FakeDoctor().diagnose(verbose: true), isFalse); + expect(await FakeDoctor().diagnose(verbose: true), isFalse); expect(testLogger.statusText, equals( '[✓] Passing Validator (with statusInfo)\n' ' • A helpful message\n' @@ -187,7 +187,7 @@ group('doctor with grouped validators', () { testUsingContext('validate diagnose combines validator output', () async { - expect(await new FakeGroupedDoctor().diagnose(), isTrue); + expect(await FakeGroupedDoctor().diagnose(), isTrue); expect(testLogger.statusText, equals( '[✓] Category 1\n' ' • A helpful message\n' @@ -202,7 +202,7 @@ }); testUsingContext('validate summary combines validator output', () async { - expect(await new FakeGroupedDoctor().summaryText, equals( + expect(await FakeGroupedDoctor().summaryText, equals( '[✓] Category 1 is fully installed.\n' '[!] Category 2 is partially installed; more components are available.\n' '\n' @@ -214,52 +214,52 @@ group('doctor merging validator results', () { - final PassingGroupedValidator installed = new PassingGroupedValidator('Category', groupedCategory1); - final PartialGroupedValidator partial = new PartialGroupedValidator('Category', groupedCategory1); - final MissingGroupedValidator missing = new MissingGroupedValidator('Category', groupedCategory1); + final PassingGroupedValidator installed = PassingGroupedValidator('Category', groupedCategory1); + final PartialGroupedValidator partial = PartialGroupedValidator('Category', groupedCategory1); + final MissingGroupedValidator missing = MissingGroupedValidator('Category', groupedCategory1); testUsingContext('validate installed + installed = installed', () async { - expect(await new FakeSmallGroupDoctor(installed, installed).diagnose(), isTrue); + expect(await FakeSmallGroupDoctor(installed, installed).diagnose(), isTrue); expect(testLogger.statusText, startsWith('[✓]')); }); testUsingContext('validate installed + partial = partial', () async { - expect(await new FakeSmallGroupDoctor(installed, partial).diagnose(), isTrue); + expect(await FakeSmallGroupDoctor(installed, partial).diagnose(), isTrue); expect(testLogger.statusText, startsWith('[!]')); }); testUsingContext('validate installed + missing = partial', () async { - expect(await new FakeSmallGroupDoctor(installed, missing).diagnose(), isTrue); + expect(await FakeSmallGroupDoctor(installed, missing).diagnose(), isTrue); expect(testLogger.statusText, startsWith('[!]')); }); testUsingContext('validate partial + installed = partial', () async { - expect(await new FakeSmallGroupDoctor(partial, installed).diagnose(), isTrue); + expect(await FakeSmallGroupDoctor(partial, installed).diagnose(), isTrue); expect(testLogger.statusText, startsWith('[!]')); }); testUsingContext('validate partial + partial = partial', () async { - expect(await new FakeSmallGroupDoctor(partial, partial).diagnose(), isTrue); + expect(await FakeSmallGroupDoctor(partial, partial).diagnose(), isTrue); expect(testLogger.statusText, startsWith('[!]')); }); testUsingContext('validate partial + missing = partial', () async { - expect(await new FakeSmallGroupDoctor(partial, missing).diagnose(), isTrue); + expect(await FakeSmallGroupDoctor(partial, missing).diagnose(), isTrue); expect(testLogger.statusText, startsWith('[!]')); }); testUsingContext('validate missing + installed = partial', () async { - expect(await new FakeSmallGroupDoctor(missing, installed).diagnose(), isTrue); + expect(await FakeSmallGroupDoctor(missing, installed).diagnose(), isTrue); expect(testLogger.statusText, startsWith('[!]')); }); testUsingContext('validate missing + partial = partial', () async { - expect(await new FakeSmallGroupDoctor(missing, partial).diagnose(), isTrue); + expect(await FakeSmallGroupDoctor(missing, partial).diagnose(), isTrue); expect(testLogger.statusText, startsWith('[!]')); }); testUsingContext('validate missing + missing = missing', () async { - expect(await new FakeSmallGroupDoctor(missing, missing).diagnose(), isFalse); + expect(await FakeSmallGroupDoctor(missing, missing).diagnose(), isFalse); expect(testLogger.statusText, startsWith('[✗]')); }); }); @@ -281,9 +281,9 @@ @override Future<ValidationResult> validate() async { final List<ValidationMessage> messages = <ValidationMessage>[]; - messages.add(new ValidationMessage('A helpful message')); - messages.add(new ValidationMessage('A second, somewhat longer helpful message')); - return new ValidationResult(ValidationType.installed, messages, statusInfo: 'with statusInfo'); + messages.add(ValidationMessage('A helpful message')); + messages.add(ValidationMessage('A second, somewhat longer helpful message')); + return ValidationResult(ValidationType.installed, messages, statusInfo: 'with statusInfo'); } } @@ -293,10 +293,10 @@ @override Future<ValidationResult> validate() async { final List<ValidationMessage> messages = <ValidationMessage>[]; - messages.add(new ValidationMessage.error('A useful error message')); - messages.add(new ValidationMessage('A message that is not an error')); - messages.add(new ValidationMessage.hint('A hint message')); - return new ValidationResult(ValidationType.missing, messages); + messages.add(ValidationMessage.error('A useful error message')); + messages.add(ValidationMessage('A message that is not an error')); + messages.add(ValidationMessage.hint('A hint message')); + return ValidationResult(ValidationType.missing, messages); } } @@ -306,10 +306,10 @@ @override Future<ValidationResult> validate() async { final List<ValidationMessage> messages = <ValidationMessage>[]; - messages.add(new ValidationMessage.error('A error message indicating partial installation')); - messages.add(new ValidationMessage.hint('Maybe a hint will help the user')); - messages.add(new ValidationMessage('An extra message with some verbose details')); - return new ValidationResult(ValidationType.partial, messages); + messages.add(ValidationMessage.error('A error message indicating partial installation')); + messages.add(ValidationMessage.hint('Maybe a hint will help the user')); + messages.add(ValidationMessage('An extra message with some verbose details')); + return ValidationResult(ValidationType.partial, messages); } } @@ -319,9 +319,9 @@ @override Future<ValidationResult> validate() async { final List<ValidationMessage> messages = <ValidationMessage>[]; - messages.add(new ValidationMessage.hint('There is a hint here')); - messages.add(new ValidationMessage('But there is no error')); - return new ValidationResult(ValidationType.partial, messages); + messages.add(ValidationMessage.hint('There is a hint here')); + messages.add(ValidationMessage('But there is no error')); + return ValidationResult(ValidationType.partial, messages); } } @@ -333,10 +333,10 @@ List<DoctorValidator> get validators { if (_validators == null) { _validators = <DoctorValidator>[]; - _validators.add(new PassingValidator('Passing Validator')); - _validators.add(new MissingValidator()); - _validators.add(new PartialValidatorWithHintsOnly()); - _validators.add(new PartialValidatorWithErrors()); + _validators.add(PassingValidator('Passing Validator')); + _validators.add(MissingValidator()); + _validators.add(PartialValidatorWithHintsOnly()); + _validators.add(PartialValidatorWithErrors()); } return _validators; } @@ -349,10 +349,10 @@ List<DoctorValidator> get validators { if (_validators == null) { _validators = <DoctorValidator>[]; - _validators.add(new PassingValidator('Passing Validator')); - _validators.add(new PartialValidatorWithHintsOnly()); - _validators.add(new PartialValidatorWithErrors()); - _validators.add(new PassingValidator('Another Passing Validator')); + _validators.add(PassingValidator('Passing Validator')); + _validators.add(PartialValidatorWithHintsOnly()); + _validators.add(PartialValidatorWithErrors()); + _validators.add(PassingValidator('Another Passing Validator')); } return _validators; } @@ -366,7 +366,7 @@ List<DoctorValidator> get validators { if (_validators == null) { _validators = <DoctorValidator>[]; - _validators.add(new PartialValidatorWithHintsOnly()); + _validators.add(PartialValidatorWithHintsOnly()); } return _validators; } @@ -379,10 +379,10 @@ List<DoctorValidator> get validators { if (_validators == null) { _validators = <DoctorValidator>[]; - _validators.add(new PassingValidator('Passing Validator')); - _validators.add(new PassingValidator('Another Passing Validator')); - _validators.add(new PassingValidator('Validators are fun')); - _validators.add(new PassingValidator('Four score and seven validators ago')); + _validators.add(PassingValidator('Passing Validator')); + _validators.add(PassingValidator('Another Passing Validator')); + _validators.add(PassingValidator('Validators are fun')); + _validators.add(PassingValidator('Four score and seven validators ago')); } return _validators; } @@ -394,9 +394,9 @@ @override List<DoctorValidator> get validators { return <DoctorValidator>[ - new PassingValidator('Passing Validator'), - new PassingValidator('Another Passing Validator'), - new PassingValidator('Providing validators is fun') + PassingValidator('Passing Validator'), + PassingValidator('Another Passing Validator'), + PassingValidator('Providing validators is fun') ]; } @@ -414,8 +414,8 @@ @override Future<ValidationResult> validate() async { final List<ValidationMessage> messages = <ValidationMessage>[]; - messages.add(new ValidationMessage('A helpful message')); - return new ValidationResult(ValidationType.installed, messages); + messages.add(ValidationMessage('A helpful message')); + return ValidationResult(ValidationType.installed, messages); } } @@ -426,8 +426,8 @@ @override Future<ValidationResult> validate() async { final List<ValidationMessage> messages = <ValidationMessage>[]; - messages.add(new ValidationMessage.error('A useful error message')); - return new ValidationResult(ValidationType.missing, messages); + messages.add(ValidationMessage.error('A useful error message')); + return ValidationResult(ValidationType.missing, messages); } } @@ -437,8 +437,8 @@ @override Future<ValidationResult> validate() async { final List<ValidationMessage> messages = <ValidationMessage>[]; - messages.add(new ValidationMessage.error('An error message for partial installation')); - return new ValidationResult(ValidationType.partial, messages); + messages.add(ValidationMessage.error('An error message for partial installation')); + return ValidationResult(ValidationType.partial, messages); } } @@ -449,10 +449,10 @@ List<DoctorValidator> get validators { if (_validators == null) { _validators = <DoctorValidator>[]; - _validators.add(new PassingGroupedValidator('Category 1', groupedCategory1)); - _validators.add(new PassingGroupedValidator('Category 1', groupedCategory1)); - _validators.add(new PassingGroupedValidator('Category 2', groupedCategory2)); - _validators.add(new MissingGroupedValidator('Category 2', groupedCategory2)); + _validators.add(PassingGroupedValidator('Category 1', groupedCategory1)); + _validators.add(PassingGroupedValidator('Category 1', groupedCategory1)); + _validators.add(PassingGroupedValidator('Category 2', groupedCategory2)); + _validators.add(MissingGroupedValidator('Category 2', groupedCategory2)); } return _validators; } @@ -474,14 +474,14 @@ static final String validExtensions = fs.path.join('test', 'data', 'vscode', 'extensions'); static final String missingExtensions = fs.path.join('test', 'data', 'vscode', 'notExtensions'); VsCodeValidatorTestTargets._(String installDirectory, String extensionDirectory, {String edition}) - : super(new VsCode.fromDirectory(installDirectory, extensionDirectory, edition: edition)); + : super(VsCode.fromDirectory(installDirectory, extensionDirectory, edition: edition)); static VsCodeValidatorTestTargets get installedWithExtension => - new VsCodeValidatorTestTargets._(validInstall, validExtensions); + VsCodeValidatorTestTargets._(validInstall, validExtensions); static VsCodeValidatorTestTargets get installedWithExtension64bit => - new VsCodeValidatorTestTargets._(validInstall, validExtensions, edition: '64-bit edition'); + VsCodeValidatorTestTargets._(validInstall, validExtensions, edition: '64-bit edition'); static VsCodeValidatorTestTargets get installedWithoutExtension => - new VsCodeValidatorTestTargets._(validInstall, missingExtensions); + VsCodeValidatorTestTargets._(validInstall, missingExtensions); }
diff --git a/packages/flutter_tools/test/commands/drive_test.dart b/packages/flutter_tools/test/commands/drive_test.dart index a9d673d..f154204 100644 --- a/packages/flutter_tools/test/commands/drive_test.dart +++ b/packages/flutter_tools/test/commands/drive_test.dart
@@ -27,7 +27,7 @@ Directory tempDir; void withMockDevice([Device mock]) { - mockDevice = mock ?? new MockDevice(); + mockDevice = mock ?? MockDevice(); targetDeviceFinder = () async => mockDevice; testDeviceManager.addDevice(mockDevice); } @@ -37,9 +37,9 @@ }); setUp(() { - command = new DriveCommand(); + command = DriveCommand(); applyMocksToCommand(command); - fs = new MemoryFileSystem(); + fs = MemoryFileSystem(); tempDir = fs.systemTempDirectory.createTempSync('flutter_drive_test.'); fs.currentDirectory = tempDir; fs.directory('test').createSync(); @@ -167,7 +167,7 @@ final String testFile = fs.path.join(tempDir.path, 'test_driver', 'e2e_test.dart'); appStarter = expectAsync1((DriveCommand command) async { - return new LaunchResult.succeeded(); + return LaunchResult.succeeded(); }); testRunner = expectAsync2((List<String> testArgs, String observatoryUri) async { expect(testArgs, <String>[testFile]); @@ -198,7 +198,7 @@ final String testFile = fs.path.join(tempDir.path, 'test_driver', 'e2e_test.dart'); appStarter = expectAsync1((DriveCommand command) async { - return new LaunchResult.succeeded(); + return LaunchResult.succeeded(); }); testRunner = (List<String> testArgs, String observatoryUri) async { throwToolExit(null, exitCode: 123); @@ -241,7 +241,7 @@ }); void findTargetDeviceOnOperatingSystem(String operatingSystem) { - Platform platform() => new FakePlatform(operatingSystem: operatingSystem); + Platform platform() => FakePlatform(operatingSystem: operatingSystem); testUsingContext('returns null if no devices found', () async { expect(await findTargetDevice(), isNull); @@ -251,7 +251,7 @@ }); testUsingContext('uses existing Android device', () async { - mockDevice = new MockAndroidDevice(); + mockDevice = MockAndroidDevice(); when(mockDevice.name).thenReturn('mock-android-device'); withMockDevice(mockDevice); @@ -274,13 +274,13 @@ group('findTargetDevice on macOS', () { findTargetDeviceOnOperatingSystem('macos'); - Platform macOsPlatform() => new FakePlatform(operatingSystem: 'macos'); + Platform macOsPlatform() => FakePlatform(operatingSystem: 'macos'); testUsingContext('uses existing simulator', () async { withMockDevice(); when(mockDevice.name).thenReturn('mock-simulator'); when(mockDevice.isLocalEmulator) - .thenAnswer((Invocation invocation) => new Future<bool>.value(true)); + .thenAnswer((Invocation invocation) => Future<bool>.value(true)); final Device device = await findTargetDevice(); expect(device.name, 'mock-simulator');
diff --git a/packages/flutter_tools/test/commands/format_test.dart b/packages/flutter_tools/test/commands/format_test.dart index 752e720..526fa38 100644 --- a/packages/flutter_tools/test/commands/format_test.dart +++ b/packages/flutter_tools/test/commands/format_test.dart
@@ -30,7 +30,7 @@ final String original = srcFile.readAsStringSync(); srcFile.writeAsStringSync(original.replaceFirst('main()', 'main( )')); - final FormatCommand command = new FormatCommand(); + final FormatCommand command = FormatCommand(); final CommandRunner<Null> runner = createTestCommandRunner(command); await runner.run(<String>['format', srcFile.path]); @@ -47,7 +47,7 @@ 'main()', 'main( )'); srcFile.writeAsStringSync(nonFormatted); - final FormatCommand command = new FormatCommand(); + final FormatCommand command = FormatCommand(); final CommandRunner<Null> runner = createTestCommandRunner(command); await runner.run(<String>['format', '--dry-run', srcFile.path]); @@ -64,7 +64,7 @@ 'main()', 'main( )'); srcFile.writeAsStringSync(nonFormatted); - final FormatCommand command = new FormatCommand(); + final FormatCommand command = FormatCommand(); final CommandRunner<Null> runner = createTestCommandRunner(command); expect(runner.run(<String>[
diff --git a/packages/flutter_tools/test/commands/fuchsia_reload_test.dart b/packages/flutter_tools/test/commands/fuchsia_reload_test.dart index 8d128cd..1c32964 100644 --- a/packages/flutter_tools/test/commands/fuchsia_reload_test.dart +++ b/packages/flutter_tools/test/commands/fuchsia_reload_test.dart
@@ -17,7 +17,7 @@ group('FuchsiaDeviceCommandRunner', () { testUsingContext('a test', () async { final FuchsiaDeviceCommandRunner commandRunner = - new FuchsiaDeviceCommandRunner('8.8.9.9', + FuchsiaDeviceCommandRunner('8.8.9.9', '~/fuchsia/out/release-x86-64'); final List<String> ports = await commandRunner.run('ls /tmp'); expect(ports, hasLength(3)); @@ -25,7 +25,7 @@ expect(ports[1], equals('5678')); expect(ports[2], equals('5')); }, overrides: <Type, Generator>{ - ProcessManager: () => new MockProcessManager(), + ProcessManager: () => MockProcessManager(), }); }); } @@ -41,6 +41,6 @@ Encoding stdoutEncoding = systemEncoding, Encoding stderrEncoding = systemEncoding, }) async { - return new ProcessResult(0, 0, '1234\n5678\n5', ''); + return ProcessResult(0, 0, '1234\n5678\n5', ''); } }
diff --git a/packages/flutter_tools/test/commands/ide_config_test.dart b/packages/flutter_tools/test/commands/ide_config_test.dart index 79e799f..1e7a0fe 100644 --- a/packages/flutter_tools/test/commands/ide_config_test.dart +++ b/packages/flutter_tools/test/commands/ide_config_test.dart
@@ -83,7 +83,7 @@ List<String> unexpectedPaths = const <String>[], }) async { dir ??= tempDir; - final IdeConfigCommand command = new IdeConfigCommand(); + final IdeConfigCommand command = IdeConfigCommand(); final CommandRunner<Null> runner = createTestCommandRunner(command); final List<String> finalArgs = <String>['--flutter-root=${tempDir.absolute.path}', 'ide-config']; finalArgs.addAll(args);
diff --git a/packages/flutter_tools/test/commands/install_test.dart b/packages/flutter_tools/test/commands/install_test.dart index 07d9eb6..1f56cb0 100644 --- a/packages/flutter_tools/test/commands/install_test.dart +++ b/packages/flutter_tools/test/commands/install_test.dart
@@ -12,10 +12,10 @@ void main() { group('install', () { testUsingContext('returns 0 when Android is connected and ready for an install', () async { - final InstallCommand command = new InstallCommand(); + final InstallCommand command = InstallCommand(); applyMocksToCommand(command); - final MockAndroidDevice device = new MockAndroidDevice(); + final MockAndroidDevice device = MockAndroidDevice(); when(device.isAppInstalled(any)).thenAnswer((_) async => false); when(device.installApp(any)).thenAnswer((_) async => true); testDeviceManager.addDevice(device); @@ -24,10 +24,10 @@ }); testUsingContext('returns 0 when iOS is connected and ready for an install', () async { - final InstallCommand command = new InstallCommand(); + final InstallCommand command = InstallCommand(); applyMocksToCommand(command); - final MockIOSDevice device = new MockIOSDevice(); + final MockIOSDevice device = MockIOSDevice(); when(device.isAppInstalled(any)).thenAnswer((_) async => false); when(device.installApp(any)).thenAnswer((_) async => true); testDeviceManager.addDevice(device);
diff --git a/packages/flutter_tools/test/commands/packages_test.dart b/packages/flutter_tools/test/commands/packages_test.dart index efa71dd..95c7f46 100644 --- a/packages/flutter_tools/test/commands/packages_test.dart +++ b/packages/flutter_tools/test/commands/packages_test.dart
@@ -58,7 +58,7 @@ } Future<Null> runCommandIn(String projectPath, String verb, { List<String> args }) async { - final PackagesCommand command = new PackagesCommand(); + final PackagesCommand command = PackagesCommand(); final CommandRunner<Null> runner = createTestCommandRunner(command); final List<String> commandArgs = <String>['packages', verb]; @@ -233,12 +233,12 @@ MockStdio mockStdio; setUp(() { - mockProcessManager = new MockProcessManager(); - mockStdio = new MockStdio(); + mockProcessManager = MockProcessManager(); + mockStdio = MockStdio(); }); testUsingContext('test without bot', () async { - await createTestCommandRunner(new PackagesCommand()).run(<String>['packages', 'test']); + await createTestCommandRunner(PackagesCommand()).run(<String>['packages', 'test']); final List<String> commands = mockProcessManager.commands; expect(commands, hasLength(3)); expect(commands[0], matches(r'dart-sdk[\\/]bin[\\/]pub')); @@ -251,7 +251,7 @@ }); testUsingContext('test with bot', () async { - await createTestCommandRunner(new PackagesCommand()).run(<String>['packages', 'test']); + await createTestCommandRunner(PackagesCommand()).run(<String>['packages', 'test']); final List<String> commands = mockProcessManager.commands; expect(commands, hasLength(4)); expect(commands[0], matches(r'dart-sdk[\\/]bin[\\/]pub')); @@ -265,7 +265,7 @@ }); testUsingContext('run', () async { - await createTestCommandRunner(new PackagesCommand()).run(<String>['packages', '--verbose', 'pub', 'run', '--foo', 'bar']); + await createTestCommandRunner(PackagesCommand()).run(<String>['packages', '--verbose', 'pub', 'run', '--foo', 'bar']); final List<String> commands = mockProcessManager.commands; expect(commands, hasLength(4)); expect(commands[0], matches(r'dart-sdk[\\/]bin[\\/]pub')); @@ -278,11 +278,11 @@ }); testUsingContext('publish', () async { - final PromptingProcess process = new PromptingProcess(); + final PromptingProcess process = PromptingProcess(); mockProcessManager.processFactory = (List<String> commands) => process; - final Future<Null> runPackages = createTestCommandRunner(new PackagesCommand()).run(<String>['packages', 'pub', 'publish']); + final Future<Null> runPackages = createTestCommandRunner(PackagesCommand()).run(<String>['packages', 'pub', 'publish']); final Future<Null> runPrompt = process.showPrompt('Proceed (y/n)? ', <String>['hello', 'world']); - final Future<Null> simulateUserInput = new Future<Null>(() { + final Future<Null> simulateUserInput = Future<Null>(() { mockStdio.simulateStdin('y'); }); await Future.wait(<Future<Null>>[runPackages, runPrompt, simulateUserInput]);
diff --git a/packages/flutter_tools/test/commands/run_test.dart b/packages/flutter_tools/test/commands/run_test.dart index fde6043..16c4efe 100644 --- a/packages/flutter_tools/test/commands/run_test.dart +++ b/packages/flutter_tools/test/commands/run_test.dart
@@ -12,7 +12,7 @@ void main() { group('run', () { testUsingContext('fails when target not found', () async { - final RunCommand command = new RunCommand(); + final RunCommand command = RunCommand(); applyMocksToCommand(command); try { await createTestCommandRunner(command).run(<String>['run', '-t', 'abc123']);
diff --git a/packages/flutter_tools/test/commands/shell_completion_test.dart b/packages/flutter_tools/test/commands/shell_completion_test.dart index c55dc83..6b1498b 100644 --- a/packages/flutter_tools/test/commands/shell_completion_test.dart +++ b/packages/flutter_tools/test/commands/shell_completion_test.dart
@@ -20,11 +20,11 @@ setUp(() { Cache.disableLocking(); - mockStdio = new MockStdio(); + mockStdio = MockStdio(); }); testUsingContext('generates bash initialization script to stdout', () async { - final ShellCompletionCommand command = new ShellCompletionCommand(); + final ShellCompletionCommand command = ShellCompletionCommand(); await createTestCommandRunner(command).run(<String>['bash-completion']); expect(mockStdio.writtenToStdout.length, equals(1)); expect(mockStdio.writtenToStdout.first, contains('__flutter_completion')); @@ -33,7 +33,7 @@ }); testUsingContext('generates bash initialization script to stdout with arg', () async { - final ShellCompletionCommand command = new ShellCompletionCommand(); + final ShellCompletionCommand command = ShellCompletionCommand(); await createTestCommandRunner(command).run(<String>['bash-completion', '-']); expect(mockStdio.writtenToStdout.length, equals(1)); expect(mockStdio.writtenToStdout.first, contains('__flutter_completion')); @@ -42,7 +42,7 @@ }); testUsingContext('generates bash initialization script to output file', () async { - final ShellCompletionCommand command = new ShellCompletionCommand(); + final ShellCompletionCommand command = ShellCompletionCommand(); const String outputFile = 'bash-setup.sh'; await createTestCommandRunner(command).run( <String>['bash-completion', outputFile], @@ -50,12 +50,12 @@ expect(fs.isFileSync(outputFile), isTrue); expect(fs.file(outputFile).readAsStringSync(), contains('__flutter_completion')); }, overrides: <Type, Generator>{ - FileSystem: () => new MemoryFileSystem(), + FileSystem: () => MemoryFileSystem(), Stdio: () => mockStdio, }); testUsingContext("won't overwrite existing output file ", () async { - final ShellCompletionCommand command = new ShellCompletionCommand(); + final ShellCompletionCommand command = ShellCompletionCommand(); const String outputFile = 'bash-setup.sh'; fs.file(outputFile).createSync(); try { @@ -70,12 +70,12 @@ expect(fs.isFileSync(outputFile), isTrue); expect(fs.file(outputFile).readAsStringSync(), isEmpty); }, overrides: <Type, Generator>{ - FileSystem: () => new MemoryFileSystem(), + FileSystem: () => MemoryFileSystem(), Stdio: () => mockStdio, }); testUsingContext('will overwrite existing output file if given --overwrite', () async { - final ShellCompletionCommand command = new ShellCompletionCommand(); + final ShellCompletionCommand command = ShellCompletionCommand(); const String outputFile = 'bash-setup.sh'; fs.file(outputFile).createSync(); await createTestCommandRunner(command).run( @@ -84,7 +84,7 @@ expect(fs.isFileSync(outputFile), isTrue); expect(fs.file(outputFile).readAsStringSync(), contains('__flutter_completion')); }, overrides: <Type, Generator>{ - FileSystem: () => new MemoryFileSystem(), + FileSystem: () => MemoryFileSystem(), Stdio: () => mockStdio, }); });
diff --git a/packages/flutter_tools/test/commands/test_test.dart b/packages/flutter_tools/test/commands/test_test.dart index 6aa542f..d576023 100644 --- a/packages/flutter_tools/test/commands/test_test.dart +++ b/packages/flutter_tools/test/commands/test_test.dart
@@ -125,7 +125,7 @@ continue; } if (allowSkip) { - if (!new RegExp(expectationLine).hasMatch(outputLine)) { + if (!RegExp(expectationLine).hasMatch(outputLine)) { outputLineNumber += 1; continue; } @@ -167,7 +167,7 @@ while (_testExclusionLock != null) await _testExclusionLock; - final Completer<Null> testExclusionCompleter = new Completer<Null>(); + final Completer<Null> testExclusionCompleter = Completer<Null>(); _testExclusionLock = testExclusionCompleter.future; try { return await Process.run(
diff --git a/packages/flutter_tools/test/compile_test.dart b/packages/flutter_tools/test/compile_test.dart index 3ddb5be..1565f74 100644 --- a/packages/flutter_tools/test/compile_test.dart +++ b/packages/flutter_tools/test/compile_test.dart
@@ -22,27 +22,27 @@ MockStdIn mockFrontendServerStdIn; MockStream mockFrontendServerStdErr; setUp(() { - mockProcessManager = new MockProcessManager(); - mockFrontendServer = new MockProcess(); - mockFrontendServerStdIn = new MockStdIn(); - mockFrontendServerStdErr = new MockStream(); + mockProcessManager = MockProcessManager(); + mockFrontendServer = MockProcess(); + mockFrontendServerStdIn = MockStdIn(); + mockFrontendServerStdErr = MockStream(); when(mockFrontendServer.stderr) .thenAnswer((Invocation invocation) => mockFrontendServerStdErr); - final StreamController<String> stdErrStreamController = new StreamController<String>(); + final StreamController<String> stdErrStreamController = StreamController<String>(); when(mockFrontendServerStdErr.transform<String>(any)).thenAnswer((_) => stdErrStreamController.stream); when(mockFrontendServer.stdin).thenReturn(mockFrontendServerStdIn); when(mockProcessManager.canRun(any)).thenReturn(true); when(mockProcessManager.start(any)).thenAnswer( - (Invocation invocation) => new Future<Process>.value(mockFrontendServer)); + (Invocation invocation) => Future<Process>.value(mockFrontendServer)); when(mockFrontendServer.exitCode).thenAnswer((_) async => 0); }); testUsingContext('single dart successful compilation', () async { final BufferLogger logger = context[Logger]; when(mockFrontendServer.stdout) - .thenAnswer((Invocation invocation) => new Stream<List<int>>.fromFuture( - new Future<List<int>>.value(utf8.encode( + .thenAnswer((Invocation invocation) => Stream<List<int>>.fromFuture( + Future<List<int>>.value(utf8.encode( 'result abc\nline1\nline2\nabc /path/to/main.dart.dill 0' )) )); @@ -60,8 +60,8 @@ final BufferLogger logger = context[Logger]; when(mockFrontendServer.stdout) - .thenAnswer((Invocation invocation) => new Stream<List<int>>.fromFuture( - new Future<List<int>>.value(utf8.encode( + .thenAnswer((Invocation invocation) => Stream<List<int>>.fromFuture( + Future<List<int>>.value(utf8.encode( 'result abc\nline1\nline2\nabc' )) )); @@ -82,8 +82,8 @@ final BufferLogger logger = context[Logger]; when(mockFrontendServer.stdout) - .thenAnswer((Invocation invocation) => new Stream<List<int>>.fromFuture( - new Future<List<int>>.value(utf8.encode( + .thenAnswer((Invocation invocation) => Stream<List<int>>.fromFuture( + Future<List<int>>.value(utf8.encode( 'result abc\nline1\nline2\nabc' )) )); @@ -108,22 +108,22 @@ StreamController<String> stdErrStreamController; setUp(() { - generator = new ResidentCompiler('sdkroot'); - mockProcessManager = new MockProcessManager(); - mockFrontendServer = new MockProcess(); - mockFrontendServerStdIn = new MockStdIn(); - mockFrontendServerStdErr = new MockStream(); + generator = ResidentCompiler('sdkroot'); + mockProcessManager = MockProcessManager(); + mockFrontendServer = MockProcess(); + mockFrontendServerStdIn = MockStdIn(); + mockFrontendServerStdErr = MockStream(); when(mockFrontendServer.stdin).thenReturn(mockFrontendServerStdIn); when(mockFrontendServer.stderr) .thenAnswer((Invocation invocation) => mockFrontendServerStdErr); - stdErrStreamController = new StreamController<String>(); + stdErrStreamController = StreamController<String>(); when(mockFrontendServerStdErr.transform<String>(any)) .thenAnswer((Invocation invocation) => stdErrStreamController.stream); when(mockProcessManager.canRun(any)).thenReturn(true); when(mockProcessManager.start(any)).thenAnswer( - (Invocation invocation) => new Future<Process>.value(mockFrontendServer) + (Invocation invocation) => Future<Process>.value(mockFrontendServer) ); }); @@ -135,8 +135,8 @@ final BufferLogger logger = context[Logger]; when(mockFrontendServer.stdout) - .thenAnswer((Invocation invocation) => new Stream<List<int>>.fromFuture( - new Future<List<int>>.value(utf8.encode( + .thenAnswer((Invocation invocation) => Stream<List<int>>.fromFuture( + Future<List<int>>.value(utf8.encode( 'result abc\nline1\nline2\nabc /path/to/main.dart.dill 0' )) )); @@ -168,7 +168,7 @@ testUsingContext('compile and recompile', () async { final BufferLogger logger = context[Logger]; - final StreamController<List<int>> streamController = new StreamController<List<int>>(); + final StreamController<List<int>> streamController = StreamController<List<int>>(); when(mockFrontendServer.stdout) .thenAnswer((Invocation invocation) => streamController.stream); streamController.add(utf8.encode('result abc\nline0\nline1\nabc /path/to/main.dart.dill 0\n')); @@ -191,7 +191,7 @@ testUsingContext('compile and recompile twice', () async { final BufferLogger logger = context[Logger]; - final StreamController<List<int>> streamController = new StreamController<List<int>>(); + final StreamController<List<int>> streamController = StreamController<List<int>>(); when(mockFrontendServer.stdout) .thenAnswer((Invocation invocation) => streamController.stream); streamController.add(utf8.encode( @@ -227,23 +227,23 @@ StreamController<String> stdErrStreamController; setUp(() { - generator = new ResidentCompiler('sdkroot'); - mockProcessManager = new MockProcessManager(); - mockFrontendServer = new MockProcess(); - mockFrontendServerStdIn = new MockStdIn(); - mockFrontendServerStdErr = new MockStream(); + generator = ResidentCompiler('sdkroot'); + mockProcessManager = MockProcessManager(); + mockFrontendServer = MockProcess(); + mockFrontendServerStdIn = MockStdIn(); + mockFrontendServerStdErr = MockStream(); when(mockFrontendServer.stdin).thenReturn(mockFrontendServerStdIn); when(mockFrontendServer.stderr) .thenAnswer((Invocation invocation) => mockFrontendServerStdErr); - stdErrStreamController = new StreamController<String>(); + stdErrStreamController = StreamController<String>(); when(mockFrontendServerStdErr.transform<String>(any)) .thenAnswer((Invocation invocation) => stdErrStreamController.stream); when(mockProcessManager.canRun(any)).thenReturn(true); when(mockProcessManager.start(any)).thenAnswer( (Invocation invocation) => - new Future<Process>.value(mockFrontendServer) + Future<Process>.value(mockFrontendServer) ); }); @@ -261,18 +261,18 @@ final BufferLogger logger = context[Logger]; final Completer<List<int>> compileResponseCompleter = - new Completer<List<int>>(); + Completer<List<int>>(); final Completer<List<int>> compileExpressionResponseCompleter = - new Completer<List<int>>(); + Completer<List<int>>(); when(mockFrontendServer.stdout) .thenAnswer((Invocation invocation) => - new Stream<List<int>>.fromFutures( + Stream<List<int>>.fromFutures( <Future<List<int>>>[ compileResponseCompleter.future, compileExpressionResponseCompleter.future])); - compileResponseCompleter.complete(new Future<List<int>>.value(utf8.encode( + compileResponseCompleter.complete(Future<List<int>>.value(utf8.encode( 'result abc\nline1\nline2\nabc /path/to/main.dart.dill 0\n' ))); @@ -287,7 +287,7 @@ expect(output.outputFilename, equals('/path/to/main.dart.dill')); compileExpressionResponseCompleter.complete( - new Future<List<int>>.value(utf8.encode( + Future<List<int>>.value(utf8.encode( 'result def\nline1\nline2\ndef /path/to/main.dart.dill.incremental 0\n' ))); generator.compileExpression( @@ -307,13 +307,13 @@ testUsingContext('compile expressions without awaiting', () async { final BufferLogger logger = context[Logger]; - final Completer<List<int>> compileResponseCompleter = new Completer<List<int>>(); - final Completer<List<int>> compileExpressionResponseCompleter1 = new Completer<List<int>>(); - final Completer<List<int>> compileExpressionResponseCompleter2 = new Completer<List<int>>(); + final Completer<List<int>> compileResponseCompleter = Completer<List<int>>(); + final Completer<List<int>> compileExpressionResponseCompleter1 = Completer<List<int>>(); + final Completer<List<int>> compileExpressionResponseCompleter2 = Completer<List<int>>(); when(mockFrontendServer.stdout) .thenAnswer((Invocation invocation) => - new Stream<List<int>>.fromFutures( + Stream<List<int>>.fromFutures( <Future<List<int>>>[ compileResponseCompleter.future, compileExpressionResponseCompleter1.future, @@ -328,20 +328,20 @@ equals('compiler message: line1\ncompiler message: line2\n')); expect(outputCompile.outputFilename, equals('/path/to/main.dart.dill')); - compileExpressionResponseCompleter1.complete(new Future<List<int>>.value(utf8.encode( + compileExpressionResponseCompleter1.complete(Future<List<int>>.value(utf8.encode( 'result def\nline1\nline2\ndef /path/to/main.dart.dill.incremental 0\n' ))); }); // The test manages timing via completers. - final Completer<bool> lastExpressionCompleted = new Completer<bool>(); + final Completer<bool> lastExpressionCompleted = Completer<bool>(); generator.compileExpression('0+1', null, null, null, null, false).then( // ignore: unawaited_futures (CompilerOutput outputExpression) { expect(outputExpression, isNotNull); expect(outputExpression.outputFilename, equals('/path/to/main.dart.dill.incremental')); expect(outputExpression.errorCount, 0); - compileExpressionResponseCompleter2.complete(new Future<List<int>>.value(utf8.encode( + compileExpressionResponseCompleter2.complete(Future<List<int>>.value(utf8.encode( 'result def\nline1\nline2\ndef /path/to/main.dart.dill.incremental 0\n' ))); }); @@ -356,7 +356,7 @@ lastExpressionCompleted.complete(true); }); - compileResponseCompleter.complete(new Future<List<int>>.value(utf8.encode( + compileResponseCompleter.complete(Future<List<int>>.value(utf8.encode( 'result abc\nline1\nline2\nabc /path/to/main.dart.dill 0\n' ))); @@ -378,7 +378,7 @@ final CompilerOutput output = await generator.recompile(null /* mainPath */, <String>['/path/to/main.dart']); expect(output.outputFilename, equals('/path/to/main.dart.dill')); final String commands = mockFrontendServerStdIn.getAndClear(); - final RegExp re = new RegExp('^recompile (.*)\\n/path/to/main.dart\\n(.*)\\n\$'); + final RegExp re = RegExp('^recompile (.*)\\n/path/to/main.dart\\n(.*)\\n\$'); expect(commands, matches(re)); final Match match = re.firstMatch(commands); expect(match[1] == match[2], isTrue); @@ -389,7 +389,7 @@ class MockProcess extends Mock implements Process {} class MockStream extends Mock implements Stream<List<int>> {} class MockStdIn extends Mock implements IOSink { - final StringBuffer _stdInWrites = new StringBuffer(); + final StringBuffer _stdInWrites = StringBuffer(); String getAndClear() { final String result = _stdInWrites.toString();
diff --git a/packages/flutter_tools/test/config_test.dart b/packages/flutter_tools/test/config_test.dart index 30edb71..63e1d71 100644 --- a/packages/flutter_tools/test/config_test.dart +++ b/packages/flutter_tools/test/config_test.dart
@@ -14,7 +14,7 @@ setUp(() { tempDir = fs.systemTempDirectory.createTempSync('flutter_config_test.'); final File file = fs.file(fs.path.join(tempDir.path, '.settings')); - config = new Config(file); + config = Config(file); }); tearDown(() {
diff --git a/packages/flutter_tools/test/crash_reporting_test.dart b/packages/flutter_tools/test/crash_reporting_test.dart index d7a7c4f..2eab591 100644 --- a/packages/flutter_tools/test/crash_reporting_test.dart +++ b/packages/flutter_tools/test/crash_reporting_test.dart
@@ -30,7 +30,7 @@ }); setUp(() async { - tools.crashFileSystem = new MemoryFileSystem(); + tools.crashFileSystem = MemoryFileSystem(); setExitFunctionForTests((_) { }); }); @@ -44,18 +44,18 @@ Uri uri; Map<String, String> fields; - CrashReportSender.initializeWith(new MockClient((Request request) async { + CrashReportSender.initializeWith(MockClient((Request request) async { method = request.method; uri = request.url; // A very ad-hoc multipart request parser. Good enough for this test. String boundary = request.headers['Content-Type']; boundary = boundary.substring(boundary.indexOf('boundary=') + 9); - fields = new Map<String, String>.fromIterable( + fields = Map<String, String>.fromIterable( utf8.decode(request.bodyBytes) .split('--$boundary') .map<List<String>>((String part) { - final Match nameMatch = new RegExp(r'name="(.*)"').firstMatch(part); + final Match nameMatch = RegExp(r'name="(.*)"').firstMatch(part); if (nameMatch == null) return null; final String name = nameMatch[1]; @@ -73,7 +73,7 @@ } ); - return new Response( + return Response( 'test-report-id', 200 ); @@ -81,7 +81,7 @@ final int exitCode = await tools.run( <String>['crash'], - <FlutterCommand>[new _CrashCommand()], + <FlutterCommand>[_CrashCommand()], reportCrashes: true, flutterVersion: 'test-version', ); @@ -90,7 +90,7 @@ // Verify that we sent the crash report. expect(method, 'POST'); - expect(uri, new Uri( + expect(uri, Uri( scheme: 'https', host: 'clients2.google.com', port: 443, @@ -124,14 +124,14 @@ testUsingContext('can override base URL', () async { Uri uri; - CrashReportSender.initializeWith(new MockClient((Request request) async { + CrashReportSender.initializeWith(MockClient((Request request) async { uri = request.url; - return new Response('test-report-id', 200); + return Response('test-report-id', 200); })); final int exitCode = await tools.run( <String>['crash'], - <FlutterCommand>[new _CrashCommand()], + <FlutterCommand>[_CrashCommand()], reportCrashes: true, flutterVersion: 'test-version', ); @@ -140,7 +140,7 @@ // Verify that we sent the crash report. expect(uri, isNotNull); - expect(uri, new Uri( + expect(uri, Uri( scheme: 'https', host: 'localhost', port: 12345, @@ -151,12 +151,12 @@ }, )); }, overrides: <Type, Generator> { - Platform: () => new FakePlatform( + Platform: () => FakePlatform( operatingSystem: 'linux', environment: <String, String>{ 'FLUTTER_CRASH_SERVER_BASE_URL': 'https://localhost:12345/fake_server', }, - script: new Uri(scheme: 'data'), + script: Uri(scheme: 'data'), ), Stdio: () => const _NoStderr(), }); @@ -175,7 +175,7 @@ @override Future<Null> runCommand() async { void fn1() { - throw new StateError('Test bad state error'); + throw StateError('Test bad state error'); } void fn2() { @@ -204,7 +204,7 @@ Encoding get encoding => utf8; @override - set encoding(_) => throw new UnsupportedError(''); + set encoding(_) => throw UnsupportedError(''); @override void add(_) {}
diff --git a/packages/flutter_tools/test/dart/pub_get_test.dart b/packages/flutter_tools/test/dart/pub_get_test.dart index 3bbbdf0c..373ef17 100644 --- a/packages/flutter_tools/test/dart/pub_get_test.dart +++ b/packages/flutter_tools/test/dart/pub_get_test.dart
@@ -29,7 +29,7 @@ final MockProcessManager processMock = context[ProcessManager]; - new FakeAsync().run((FakeAsync time) { + FakeAsync().run((FakeAsync time) { expect(processMock.lastPubEnvironment, isNull); expect(testLogger.statusText, ''); pubGet(context: PubContext.flutterTests, checkLastModified: false).then((Null value) { @@ -85,9 +85,9 @@ expect(testLogger.errorText, isEmpty); expect(error, isNull); }, overrides: <Type, Generator>{ - ProcessManager: () => new MockProcessManager(69), - FileSystem: () => new MockFileSystem(), - Platform: () => new FakePlatform( + ProcessManager: () => MockProcessManager(69), + FileSystem: () => MockFileSystem(), + Platform: () => FakePlatform( environment: <String, String>{}, ), }); @@ -98,7 +98,7 @@ final MockProcessManager processMock = context[ProcessManager]; final MockFileSystem fsMock = context[FileSystem]; - new FakeAsync().run((FakeAsync time) { + FakeAsync().run((FakeAsync time) { MockDirectory.findCache = true; expect(processMock.lastPubEnvironment, isNull); expect(processMock.lastPubCache, isNull); @@ -112,9 +112,9 @@ expect(error, isNull); }); }, overrides: <Type, Generator>{ - ProcessManager: () => new MockProcessManager(69), - FileSystem: () => new MockFileSystem(), - Platform: () => new FakePlatform( + ProcessManager: () => MockProcessManager(69), + FileSystem: () => MockFileSystem(), + Platform: () => FakePlatform( environment: <String, String>{}, ), }); @@ -124,7 +124,7 @@ final MockProcessManager processMock = context[ProcessManager]; - new FakeAsync().run((FakeAsync time) { + FakeAsync().run((FakeAsync time) { MockDirectory.findCache = true; expect(processMock.lastPubEnvironment, isNull); expect(processMock.lastPubCache, isNull); @@ -138,9 +138,9 @@ expect(error, isNull); }); }, overrides: <Type, Generator>{ - ProcessManager: () => new MockProcessManager(69), - FileSystem: () => new MockFileSystem(), - Platform: () => new FakePlatform( + ProcessManager: () => MockProcessManager(69), + FileSystem: () => MockFileSystem(), + Platform: () => FakePlatform( environment: <String, String>{'PUB_CACHE': 'custom/pub-cache/path'}, ), }); @@ -167,7 +167,7 @@ }) { lastPubEnvironment = environment['PUB_ENVIRONMENT']; lastPubCache = environment['PUB_CACHE']; - return new Future<Process>.value(new MockProcess(fakeExitCode)); + return Future<Process>.value(MockProcess(fakeExitCode)); } @override @@ -180,13 +180,13 @@ final int fakeExitCode; @override - Stream<List<int>> get stdout => new MockStream<List<int>>(); + Stream<List<int>> get stdout => MockStream<List<int>>(); @override - Stream<List<int>> get stderr => new MockStream<List<int>>(); + Stream<List<int>> get stderr => MockStream<List<int>>(); @override - Future<int> get exitCode => new Future<int>.value(fakeExitCode); + Future<int> get exitCode => Future<int>.value(fakeExitCode); @override dynamic noSuchMethod(Invocation invocation) => null; @@ -194,14 +194,14 @@ class MockStream<T> implements Stream<T> { @override - Stream<S> transform<S>(StreamTransformer<T, S> streamTransformer) => new MockStream<S>(); + Stream<S> transform<S>(StreamTransformer<T, S> streamTransformer) => MockStream<S>(); @override - Stream<T> where(bool test(T event)) => new MockStream<T>(); + Stream<T> where(bool test(T event)) => MockStream<T>(); @override StreamSubscription<T> listen(void onData(T event), {Function onError, void onDone(), bool cancelOnError}) { - return new MockStreamSubscription<T>(); + return MockStreamSubscription<T>(); } @override @@ -210,7 +210,7 @@ class MockStreamSubscription<T> implements StreamSubscription<T> { @override - Future<E> asFuture<E>([E futureValue]) => new Future<E>.value(); + Future<E> asFuture<E>([E futureValue]) => Future<E>.value(); @override Future<Null> cancel() => null; @@ -221,30 +221,30 @@ class MockFileSystem extends ForwardingFileSystem { - MockFileSystem() : super(new MemoryFileSystem()); + MockFileSystem() : super(MemoryFileSystem()); @override File file(dynamic path) { - return new MockFile(); + return MockFile(); } @override Directory directory(dynamic path) { - return new MockDirectory(path); + return MockDirectory(path); } } class MockFile implements File { @override Future<RandomAccessFile> open({FileMode mode = FileMode.read}) async { - return new MockRandomAccessFile(); + return MockRandomAccessFile(); } @override bool existsSync() => true; @override - DateTime lastModifiedSync() => new DateTime(0); + DateTime lastModifiedSync() => DateTime(0); @override dynamic noSuchMethod(Invocation invocation) => null;
diff --git a/packages/flutter_tools/test/dart_dependencies_test.dart b/packages/flutter_tools/test/dart_dependencies_test.dart index 0a56c7a..dbfdc26 100644 --- a/packages/flutter_tools/test/dart_dependencies_test.dart +++ b/packages/flutter_tools/test/dart_dependencies_test.dart
@@ -24,7 +24,7 @@ final String mainPath = fs.path.join(testPath, 'main.dart'); final String packagesPath = fs.path.join(testPath, '.packages'); final DartDependencySetBuilder builder = - new DartDependencySetBuilder(mainPath, packagesPath); + DartDependencySetBuilder(mainPath, packagesPath); final Set<String> dependencies = builder.build(); expect(dependencies.contains(canonicalizePath(mainPath)), isTrue); expect(dependencies.contains(canonicalizePath(fs.path.join(testPath, 'foo.dart'))), isTrue); @@ -35,7 +35,7 @@ final String mainPath = fs.path.join(testPath, 'main.dart'); final String packagesPath = fs.path.join(testPath, '.packages'); final DartDependencySetBuilder builder = - new DartDependencySetBuilder(mainPath, packagesPath); + DartDependencySetBuilder(mainPath, packagesPath); try { builder.build(); fail('expect an exception to be thrown.'); @@ -49,7 +49,7 @@ final String mainPath = fs.path.join(testPath, 'main.dart'); final String packagesPath = fs.path.join(testPath, '.packages'); final DartDependencySetBuilder builder = - new DartDependencySetBuilder(mainPath, packagesPath); + DartDependencySetBuilder(mainPath, packagesPath); try { builder.build(); fail('expect an exception to be thrown.'); @@ -63,7 +63,7 @@ final String mainPath = fs.path.join(testPath, 'main.dart'); final String packagesPath = fs.path.join(testPath, '.packages'); final DartDependencySetBuilder builder = - new DartDependencySetBuilder(mainPath, packagesPath); + DartDependencySetBuilder(mainPath, packagesPath); try { builder.build(); fail('expect an exception to be thrown.'); @@ -77,7 +77,7 @@ final String testPath = fs.path.join(dataPath, 'asci_casing'); final String mainPath = fs.path.join(testPath, 'main.dart'); final String packagesPath = fs.path.join(testPath, '.packages'); - final DartDependencySetBuilder builder = new DartDependencySetBuilder(mainPath, packagesPath); + final DartDependencySetBuilder builder = DartDependencySetBuilder(mainPath, packagesPath); final Set<String> deps = builder.build(); expect(deps, contains(endsWith('This_Import_Has_fuNNy_casING.dart'))); }); @@ -87,7 +87,7 @@ final String mainPath = fs.path.join(testPath, 'main.dart'); final String packagesPath = fs.path.join(testPath, '.packages'); final DartDependencySetBuilder builder = - new DartDependencySetBuilder(mainPath, packagesPath); + DartDependencySetBuilder(mainPath, packagesPath); try { builder.build(); fail('expect an exception to be thrown.');
diff --git a/packages/flutter_tools/test/dependency_checker_test.dart b/packages/flutter_tools/test/dependency_checker_test.dart index 1fdbc7c..a815ff2 100644 --- a/packages/flutter_tools/test/dependency_checker_test.dart +++ b/packages/flutter_tools/test/dependency_checker_test.dart
@@ -30,7 +30,7 @@ }); setUp(() { - testFileSystem = new MemoryFileSystem(); + testFileSystem = MemoryFileSystem(); }); testUsingContext('good', () { @@ -40,12 +40,12 @@ final String barPath = fs.path.join(testPath, 'lib', 'bar.dart'); final String packagesPath = fs.path.join(testPath, '.packages'); final DartDependencySetBuilder builder = - new DartDependencySetBuilder(mainPath, packagesPath); + DartDependencySetBuilder(mainPath, packagesPath); final DependencyChecker dependencyChecker = - new DependencyChecker(builder, null); + DependencyChecker(builder, null); // Set file modification time on all dependencies to be in the past. - final DateTime baseTime = new DateTime.now(); + final DateTime baseTime = DateTime.now(); updateFileModificationTime(packagesPath, baseTime, -10); updateFileModificationTime(mainPath, baseTime, -10); updateFileModificationTime(fooPath, baseTime, -10); @@ -72,11 +72,11 @@ final String packagesPath = fs.path.join(testPath, '.packages'); final DartDependencySetBuilder builder = - new DartDependencySetBuilder(mainPath, packagesPath); + DartDependencySetBuilder(mainPath, packagesPath); final DependencyChecker dependencyChecker = - new DependencyChecker(builder, null); + DependencyChecker(builder, null); - final DateTime baseTime = new DateTime.now(); + final DateTime baseTime = DateTime.now(); // Set file modification time on all dependencies to be in the past. updateFileModificationTime(packagesPath, baseTime, -10); @@ -102,7 +102,7 @@ fs.currentDirectory = tempDir; // Doesn't matter what commands we run. Arbitrarily list devices here. - await createTestCommandRunner(new DevicesCommand()).run(<String>['devices']); + await createTestCommandRunner(DevicesCommand()).run(<String>['devices']); expect(testLogger.errorText, contains('.packages')); tryToDelete(tempDir); }, overrides: <Type, Generator>{
diff --git a/packages/flutter_tools/test/devfs_test.dart b/packages/flutter_tools/test/devfs_test.dart index 52ade17..c834d02 100644 --- a/packages/flutter_tools/test/devfs_test.dart +++ b/packages/flutter_tools/test/devfs_test.dart
@@ -29,14 +29,14 @@ final AssetBundle assetBundle = AssetBundleFactory.defaultInstance.createBundle(); setUpAll(() { - fs = new MemoryFileSystem(); + fs = MemoryFileSystem(); filePath = fs.path.join('lib', 'foo.txt'); filePath2 = fs.path.join('foo', 'bar.txt'); }); group('DevFSContent', () { test('bytes', () { - final DevFSByteContent content = new DevFSByteContent(<int>[4, 5, 6]); + final DevFSByteContent content = DevFSByteContent(<int>[4, 5, 6]); expect(content.bytes, orderedEquals(<int>[4, 5, 6])); expect(content.isModified, isTrue); expect(content.isModified, isFalse); @@ -46,7 +46,7 @@ expect(content.isModified, isFalse); }); test('string', () { - final DevFSStringContent content = new DevFSStringContent('some string'); + final DevFSStringContent content = DevFSStringContent('some string'); expect(content.string, 'some string'); expect(content.bytes, orderedEquals(utf8.encode('some string'))); expect(content.isModified, isTrue); @@ -65,8 +65,8 @@ }); group('devfs local', () { - final MockDevFSOperations devFSOperations = new MockDevFSOperations(); - final MockResidentCompiler residentCompiler = new MockResidentCompiler(); + final MockDevFSOperations devFSOperations = MockDevFSOperations(); + final MockResidentCompiler residentCompiler = MockResidentCompiler(); setUpAll(() { tempDir = _newTempDir(fs); @@ -84,7 +84,7 @@ // simulate package await _createPackage(fs, 'somepkg', 'somefile.txt'); - devFS = new DevFS.operations(devFSOperations, 'test', tempDir); + devFS = DevFS.operations(devFSOperations, 'test', tempDir); await devFS.create(); devFSOperations.expectMessages(<String>['create test']); expect(devFS.assetPathsToEvict, isEmpty); @@ -136,7 +136,7 @@ final File file = fs.file(fs.path.join(basePath, filePath)); // Set the last modified time to 5 seconds in the past. - updateFileModificationTime(file.path, new DateTime.now(), -5); + updateFileModificationTime(file.path, DateTime.now(), -5); bytes = await devFS.update( mainPath: 'lib/foo.txt', generator: residentCompiler, @@ -201,7 +201,7 @@ const String packageName = 'doubleslashpkg'; await _createPackage(fs, packageName, 'somefile.txt', doubleSlash: true); - final Set<String> fileFilter = new Set<String>(); + final Set<String> fileFilter = Set<String>(); final List<Uri> pkgUris = <Uri>[fs.path.toUri(basePath)]..addAll(_packages.values); for (Uri pkgUri in pkgUris) { if (!pkgUri.isAbsolute) { @@ -229,7 +229,7 @@ }); testUsingContext('add an asset bundle', () async { - assetBundle.entries['a.txt'] = new DevFSStringContent('abc'); + assetBundle.entries['a.txt'] = DevFSStringContent('abc'); final int bytes = await devFS.update( mainPath: 'lib/foo.txt', bundle: assetBundle, @@ -249,7 +249,7 @@ }); testUsingContext('add a file to the asset bundle - bundleDirty', () async { - assetBundle.entries['b.txt'] = new DevFSStringContent('abcd'); + assetBundle.entries['b.txt'] = DevFSStringContent('abcd'); final int bytes = await devFS.update( mainPath: 'lib/foo.txt', bundle: assetBundle, @@ -272,7 +272,7 @@ }); testUsingContext('add a file to the asset bundle', () async { - assetBundle.entries['c.txt'] = new DevFSStringContent('12'); + assetBundle.entries['c.txt'] = DevFSStringContent('12'); final int bytes = await devFS.update( mainPath: 'lib/foo.txt', bundle: assetBundle, @@ -344,12 +344,12 @@ group('devfs remote', () { MockVMService vmService; - final MockResidentCompiler residentCompiler = new MockResidentCompiler(); + final MockResidentCompiler residentCompiler = MockResidentCompiler(); setUpAll(() async { tempDir = _newTempDir(fs); basePath = tempDir.path; - vmService = new MockVMService(); + vmService = MockVMService(); await vmService.setUp(); }); tearDownAll(() async { @@ -366,7 +366,7 @@ // simulate package await _createPackage(fs, 'somepkg', 'somefile.txt'); - devFS = new DevFS(vmService, 'test', tempDir); + devFS = DevFS(vmService, 'test', tempDir); await devFS.create(); vmService.expectMessages(<String>['create test']); expect(devFS.assetPathsToEvict, isEmpty); @@ -403,7 +403,7 @@ // simulate package await _createPackage(fs, 'somepkg', 'somefile.txt'); - devFS = new DevFS(vmService, 'test', tempDir); + devFS = DevFS(vmService, 'test', tempDir); await devFS.create(); vmService.expectMessages(<String>['create test']); expect(devFS.assetPathsToEvict, isEmpty); @@ -429,7 +429,7 @@ MockVM _vm; MockVMService() { - _vm = new MockVM(this); + _vm = MockVM(this); } @override @@ -480,7 +480,7 @@ Future<Map<String, dynamic>> createDevFS(String fsName) async { _service.messages.add('create $fsName'); if (_devFSExists) { - throw new rpc.RpcException(kFileSystemAlreadyExists, 'File system already exists'); + throw rpc.RpcException(kFileSystemAlreadyExists, 'File system already exists'); } _devFSExists = true; return <String, dynamic>{'uri': '$_baseUri'}; @@ -534,7 +534,7 @@ await pkgFile.parent.create(recursive: true); pkgFile.writeAsBytesSync(<int>[11, 12, 13]); _packages[pkgName] = fs.path.toUri(pkgFile.parent.path); - final StringBuffer sb = new StringBuffer(); + final StringBuffer sb = StringBuffer(); _packages.forEach((String pkgName, Uri pkgUri) { sb.writeln('$pkgName:$pkgUri'); });
diff --git a/packages/flutter_tools/test/device_test.dart b/packages/flutter_tools/test/device_test.dart index 94cf23c..286ee49 100644 --- a/packages/flutter_tools/test/device_test.dart +++ b/packages/flutter_tools/test/device_test.dart
@@ -13,17 +13,17 @@ group('DeviceManager', () { testUsingContext('getDevices', () async { // Test that DeviceManager.getDevices() doesn't throw. - final DeviceManager deviceManager = new DeviceManager(); + final DeviceManager deviceManager = DeviceManager(); final List<Device> devices = await deviceManager.getDevices().toList(); expect(devices, isList); }); testUsingContext('getDeviceById', () async { - final _MockDevice device1 = new _MockDevice('Nexus 5', '0553790d0a4e726f'); - final _MockDevice device2 = new _MockDevice('Nexus 5X', '01abfc49119c410e'); - final _MockDevice device3 = new _MockDevice('iPod touch', '82564b38861a9a5'); + final _MockDevice device1 = _MockDevice('Nexus 5', '0553790d0a4e726f'); + final _MockDevice device2 = _MockDevice('Nexus 5X', '01abfc49119c410e'); + final _MockDevice device3 = _MockDevice('iPod touch', '82564b38861a9a5'); final List<Device> devices = <Device>[device1, device2, device3]; - final DeviceManager deviceManager = new TestDeviceManager(devices); + final DeviceManager deviceManager = TestDeviceManager(devices); Future<Null> expectDevice(String id, List<Device> expected) async { expect(await deviceManager.getDevicesById(id).toList(), expected); @@ -45,7 +45,7 @@ @override Stream<Device> getAllConnectedDevices() { - return new Stream<Device>.fromIterable(allDevices); + return Stream<Device>.fromIterable(allDevices); } }
diff --git a/packages/flutter_tools/test/emulator_test.dart b/packages/flutter_tools/test/emulator_test.dart index 64f04e2..01c7d4c 100644 --- a/packages/flutter_tools/test/emulator_test.dart +++ b/packages/flutter_tools/test/emulator_test.dart
@@ -26,10 +26,10 @@ MockXcode mockXcode; setUp(() { - mockProcessManager = new MockProcessManager(); - mockConfig = new MockConfig(); - mockSdk = new MockAndroidSdk(); - mockXcode = new MockXcode(); + mockProcessManager = MockProcessManager(); + mockConfig = MockConfig(); + mockSdk = MockAndroidSdk(); + mockXcode = MockXcode(); when(mockSdk.avdManagerPath).thenReturn('avdmanager'); when(mockSdk.emulatorPath).thenReturn('emulator'); @@ -45,18 +45,18 @@ testUsingContext('getEmulatorsById', () async { final _MockEmulator emulator1 = - new _MockEmulator('Nexus_5', 'Nexus 5', 'Google', ''); + _MockEmulator('Nexus_5', 'Nexus 5', 'Google', ''); final _MockEmulator emulator2 = - new _MockEmulator('Nexus_5X_API_27_x86', 'Nexus 5X', 'Google', ''); + _MockEmulator('Nexus_5X_API_27_x86', 'Nexus 5X', 'Google', ''); final _MockEmulator emulator3 = - new _MockEmulator('iOS Simulator', 'iOS Simulator', 'Apple', ''); + _MockEmulator('iOS Simulator', 'iOS Simulator', 'Apple', ''); final List<Emulator> emulators = <Emulator>[ emulator1, emulator2, emulator3 ]; final TestEmulatorManager testEmulatorManager = - new TestEmulatorManager(emulators); + TestEmulatorManager(emulators); Future<Null> expectEmulator(String id, List<Emulator> expected) async { expect(await testEmulatorManager.getEmulatorsMatching(id), expected); @@ -136,11 +136,11 @@ if (args.length >= 3 && args[0] == 'open' && args[1] == '-a' && args[2] == '/fake/simulator.app') { didAttemptToRunSimulator = true; } - return new ProcessResult(101, 0, '', ''); + return ProcessResult(101, 0, '', ''); }); }); testUsingContext('runs correct launch commands', () async { - final Emulator emulator = new IOSEmulator('ios'); + final Emulator emulator = IOSEmulator('ios'); await emulator.launch(); expect(didAttemptToRunSimulator, equals(true)); }, overrides: <Type, Generator>{ @@ -158,7 +158,7 @@ @override Future<List<Emulator>> getAllAvailableEmulators() { - return new Future<List<Emulator>>.value(allEmulators); + return Future<List<Emulator>>.value(allEmulators); } } @@ -177,7 +177,7 @@ @override Future<void> launch() { - throw new UnimplementedError('Not implemented in Mock'); + throw UnimplementedError('Not implemented in Mock'); } } @@ -210,29 +210,29 @@ final List<String> args = command.sublist(1); switch (command[0]) { case '/usr/bin/xcode-select': - throw new ProcessException(program, args); + throw ProcessException(program, args); break; case 'emulator': return _handleEmulator(args); case 'avdmanager': return _handleAvdManager(args); } - throw new StateError('Unexpected process call: $command'); + throw StateError('Unexpected process call: $command'); } ProcessResult _handleEmulator(List<String> args) { if (_equality.equals(args, <String>['-list-avds'])) { - return new ProcessResult(101, 0, '${_existingAvds.join('\n')}\n', ''); + return ProcessResult(101, 0, '${_existingAvds.join('\n')}\n', ''); } - throw new ProcessException('emulator', args); + throw ProcessException('emulator', args); } ProcessResult _handleAvdManager(List<String> args) { if (_equality.equals(args, <String>['list', 'device', '-c'])) { - return new ProcessResult(101, 0, 'test\ntest2\npixel\npixel-xl\n', ''); + return ProcessResult(101, 0, 'test\ntest2\npixel\npixel-xl\n', ''); } if (_equality.equals(args, <String>['create', 'avd', '-n', 'temp'])) { - return new ProcessResult(101, 1, '', mockCreateFailureOutput); + return ProcessResult(101, 1, '', mockCreateFailureOutput); } if (args.length == 8 && _equality.equals(args, @@ -244,7 +244,7 @@ final String name = args[3]; // Error if this AVD already existed if (_existingAvds.contains(name)) { - return new ProcessResult( + return ProcessResult( 101, 1, '', @@ -252,10 +252,10 @@ 'Use --force if you want to replace it.'); } else { _existingAvds.add(name); - return new ProcessResult(101, 0, '', ''); + return ProcessResult(101, 0, '', ''); } } - throw new ProcessException('emulator', args); + throw ProcessException('emulator', args); } }
diff --git a/packages/flutter_tools/test/flutter_manifest_test.dart b/packages/flutter_tools/test/flutter_manifest_test.dart index 2c29651..794ee95 100644 --- a/packages/flutter_tools/test/flutter_manifest_test.dart +++ b/packages/flutter_tools/test/flutter_manifest_test.dart
@@ -534,13 +534,13 @@ }); testUsingContextAndFs('Validate manifest on Posix FS', - new MemoryFileSystem(style: FileSystemStyle.posix), () { + MemoryFileSystem(style: FileSystemStyle.posix), () { assertSchemaIsReadable(); } ); testUsingContextAndFs('Validate manifest on Windows FS', - new MemoryFileSystem(style: FileSystemStyle.windows), () { + MemoryFileSystem(style: FileSystemStyle.windows), () { assertSchemaIsReadable(); } );
diff --git a/packages/flutter_tools/test/forbidden_imports_test.dart b/packages/flutter_tools/test/forbidden_imports_test.dart index 16efccb..cf3b387 100644 --- a/packages/flutter_tools/test/forbidden_imports_test.dart +++ b/packages/flutter_tools/test/forbidden_imports_test.dart
@@ -21,7 +21,7 @@ .map(_asFile); for (File file in files) { for (String line in file.readAsLinesSync()) { - if (line.startsWith(new RegExp(r'import.*dart:io')) && + if (line.startsWith(RegExp(r'import.*dart:io')) && !line.contains('ignore: dart_io_import')) { final String relativePath = fs.path.relative(file.path, from:flutterTools); fail("$relativePath imports 'dart:io'; import 'lib/src/base/io.dart' instead"); @@ -39,7 +39,7 @@ .map(_asFile); for (File file in files) { for (String line in file.readAsLinesSync()) { - if (line.startsWith(new RegExp(r'import.*package:path/path.dart'))) { + if (line.startsWith(RegExp(r'import.*package:path/path.dart'))) { final String relativePath = fs.path.relative(file.path, from:flutterTools); fail("$relativePath imports 'package:path/path.dart'; use 'fs.path' instead"); }
diff --git a/packages/flutter_tools/test/hot_test.dart b/packages/flutter_tools/test/hot_test.dart index d074ff1..9d92cd2 100644 --- a/packages/flutter_tools/test/hot_test.dart +++ b/packages/flutter_tools/test/hot_test.dart
@@ -93,35 +93,35 @@ }); group('hotRestart', () { - final MockResidentCompiler residentCompiler = new MockResidentCompiler(); + final MockResidentCompiler residentCompiler = MockResidentCompiler(); MockLocalEngineArtifacts mockArtifacts; setUp(() { - mockArtifacts = new MockLocalEngineArtifacts(); + mockArtifacts = MockLocalEngineArtifacts(); when(mockArtifacts.getArtifactPath(Artifact.flutterPatchedSdkPath)).thenReturn('some/path'); }); testUsingContext('no setup', () async { - final List<FlutterDevice> devices = <FlutterDevice>[new FlutterDevice(new MockDevice(), generator: residentCompiler, trackWidgetCreation: false)]; - expect((await new HotRunner(devices).restart(fullRestart: true)).isOk, true); + final List<FlutterDevice> devices = <FlutterDevice>[FlutterDevice(MockDevice(), generator: residentCompiler, trackWidgetCreation: false)]; + expect((await HotRunner(devices).restart(fullRestart: true)).isOk, true); }, overrides: <Type, Generator>{ Artifacts: () => mockArtifacts, }); testUsingContext('setup function succeeds', () async { - final List<FlutterDevice> devices = <FlutterDevice>[new FlutterDevice(new MockDevice(), generator: residentCompiler, trackWidgetCreation: false)]; - expect((await new HotRunner(devices).restart(fullRestart: true)).isOk, true); + final List<FlutterDevice> devices = <FlutterDevice>[FlutterDevice(MockDevice(), generator: residentCompiler, trackWidgetCreation: false)]; + expect((await HotRunner(devices).restart(fullRestart: true)).isOk, true); }, overrides: <Type, Generator>{ Artifacts: () => mockArtifacts, - HotRunnerConfig: () => new TestHotRunnerConfig(successfulSetup: true), + HotRunnerConfig: () => TestHotRunnerConfig(successfulSetup: true), }); testUsingContext('setup function fails', () async { - final List<FlutterDevice> devices = <FlutterDevice>[new FlutterDevice(new MockDevice(), generator: residentCompiler, trackWidgetCreation: false)]; - expect((await new HotRunner(devices).restart(fullRestart: true)).isOk, false); + final List<FlutterDevice> devices = <FlutterDevice>[FlutterDevice(MockDevice(), generator: residentCompiler, trackWidgetCreation: false)]; + expect((await HotRunner(devices).restart(fullRestart: true)).isOk, false); }, overrides: <Type, Generator>{ Artifacts: () => mockArtifacts, - HotRunnerConfig: () => new TestHotRunnerConfig(successfulSetup: false), + HotRunnerConfig: () => TestHotRunnerConfig(successfulSetup: false), }); }); }
diff --git a/packages/flutter_tools/test/integration/expression_evaluation_test.dart b/packages/flutter_tools/test/integration/expression_evaluation_test.dart index c7401fc..3648669 100644 --- a/packages/flutter_tools/test/integration/expression_evaluation_test.dart +++ b/packages/flutter_tools/test/integration/expression_evaluation_test.dart
@@ -17,13 +17,13 @@ void main() { group('expression evaluation', () { Directory tempDir; - final BasicProject _project = new BasicProject(); + final BasicProject _project = BasicProject(); FlutterTestDriver _flutter; setUp(() async { tempDir = fs.systemTempDirectory.createTempSync('flutter_expression_test.'); await _project.setUpIn(tempDir); - _flutter = new FlutterTestDriver(tempDir); + _flutter = FlutterTestDriver(tempDir); }); tearDown(() async { @@ -58,11 +58,11 @@ Future<void> evaluateComplexExpressions() async { final VMInstanceRef res = await _flutter.evaluateExpression('new DateTime.now().year'); - expect(res is VMIntInstanceRef && res.value == new DateTime.now().year, isTrue); + expect(res is VMIntInstanceRef && res.value == DateTime.now().year, isTrue); } Future<void> evaluateComplexReturningExpressions() async { - final DateTime now = new DateTime.now(); + final DateTime now = DateTime.now(); final VMInstanceRef resp = await _flutter.evaluateExpression('new DateTime.now()'); expect(resp.klass.name, equals('DateTime')); // Ensure we got a reasonable approximation. The more accurate we try to
diff --git a/packages/flutter_tools/test/integration/flutter_attach_test.dart b/packages/flutter_tools/test/integration/flutter_attach_test.dart index b31d5f8..61452b7 100644 --- a/packages/flutter_tools/test/integration/flutter_attach_test.dart +++ b/packages/flutter_tools/test/integration/flutter_attach_test.dart
@@ -11,14 +11,14 @@ void main() { FlutterTestDriver _flutterRun, _flutterAttach; - final BasicProject _project = new BasicProject(); + final BasicProject _project = BasicProject(); Directory tempDir; setUp(() async { tempDir = fs.systemTempDirectory.createTempSync('flutter_attach_test.'); await _project.setUpIn(tempDir); - _flutterRun = new FlutterTestDriver(tempDir, logPrefix: 'RUN'); - _flutterAttach = new FlutterTestDriver(tempDir, logPrefix: 'ATTACH'); + _flutterRun = FlutterTestDriver(tempDir, logPrefix: 'RUN'); + _flutterAttach = FlutterTestDriver(tempDir, logPrefix: 'ATTACH'); }); tearDown(() async { @@ -44,7 +44,7 @@ await _flutterRun.run(withDebugger: true); await _flutterAttach.attach(_flutterRun.vmServicePort); await _flutterAttach.quit(); - _flutterAttach = new FlutterTestDriver(tempDir, logPrefix: 'ATTACH-2'); + _flutterAttach = FlutterTestDriver(tempDir, logPrefix: 'ATTACH-2'); await _flutterAttach.attach(_flutterRun.vmServicePort); await _flutterAttach.hotReload(); });
diff --git a/packages/flutter_tools/test/integration/flutter_run_test.dart b/packages/flutter_tools/test/integration/flutter_run_test.dart index 8374eeb..7cbc97b 100644 --- a/packages/flutter_tools/test/integration/flutter_run_test.dart +++ b/packages/flutter_tools/test/integration/flutter_run_test.dart
@@ -13,7 +13,7 @@ void main() { group('flutter_run', () { Directory tempDir; - final BasicProject _project = new BasicProject(); + final BasicProject _project = BasicProject(); setUp(() async { tempDir = fs.systemTempDirectory.createTempSync('flutter_run_integration_test.');
diff --git a/packages/flutter_tools/test/integration/hot_reload_test.dart b/packages/flutter_tools/test/integration/hot_reload_test.dart index 28330c1..97eb158 100644 --- a/packages/flutter_tools/test/integration/hot_reload_test.dart +++ b/packages/flutter_tools/test/integration/hot_reload_test.dart
@@ -15,13 +15,13 @@ void main() { group('hot', () { Directory tempDir; - final BasicProject _project = new BasicProject(); + final BasicProject _project = BasicProject(); FlutterTestDriver _flutter; setUp(() async { tempDir = fs.systemTempDirectory.createTempSync('flutter_hot_reload_test_app.'); await _project.setUpIn(tempDir); - _flutter = new FlutterTestDriver(tempDir); + _flutter = FlutterTestDriver(tempDir); }); tearDown(() async { @@ -46,7 +46,7 @@ // Hit breakpoint using a file:// URI. final VMIsolate isolate = await _flutter.breakAt( - new Uri.file(_project.breakpointFile).toString(), + Uri.file(_project.breakpointFile).toString(), _project.breakpointLine); expect(isolate.pauseEvent, isInstanceOf<VMPauseBreakpointEvent>());
diff --git a/packages/flutter_tools/test/integration/lifetime_test.dart b/packages/flutter_tools/test/integration/lifetime_test.dart index 471f59e..76aa644 100644 --- a/packages/flutter_tools/test/integration/lifetime_test.dart +++ b/packages/flutter_tools/test/integration/lifetime_test.dart
@@ -18,14 +18,14 @@ void main() { group('flutter run', () { - final BasicProject _project = new BasicProject(); + final BasicProject _project = BasicProject(); FlutterTestDriver _flutter; Directory tempDir; setUp(() async { tempDir = fs.systemTempDirectory.createTempSync('flutter_lifetime_test.'); await _project.setUpIn(tempDir); - _flutter = new FlutterTestDriver(tempDir); + _flutter = FlutterTestDriver(tempDir); }); tearDown(() async { @@ -35,13 +35,13 @@ test('does not terminate when a debugger is attached', () async { await _flutter.run(withDebugger: true); - await new Future<void>.delayed(requiredLifespan); + await Future<void>.delayed(requiredLifespan); expect(_flutter.hasExited, equals(false)); }); test('does not terminate when a debugger is attached and pause-on-exceptions', () async { await _flutter.run(withDebugger: true, pauseOnExceptions: true); - await new Future<void>.delayed(requiredLifespan); + await Future<void>.delayed(requiredLifespan); expect(_flutter.hasExited, equals(false)); }); }, timeout: const Timeout.factor(6));
diff --git a/packages/flutter_tools/test/integration/test_data/test_project.dart b/packages/flutter_tools/test/integration/test_data/test_project.dart index 1b73c45..ae9b739 100644 --- a/packages/flutter_tools/test/integration/test_data/test_project.dart +++ b/packages/flutter_tools/test/integration/test_data/test_project.dart
@@ -29,7 +29,7 @@ int lineContaining(String contents, String search) { final int index = contents.split('\n').indexWhere((String l) => l.contains(search)); if (index == -1) - throw new Exception("Did not find '$search' inside the file"); + throw Exception("Did not find '$search' inside the file"); return index; } }
diff --git a/packages/flutter_tools/test/integration/test_driver.dart b/packages/flutter_tools/test/integration/test_driver.dart index fb350f4..e70eb15 100644 --- a/packages/flutter_tools/test/integration/test_driver.dart +++ b/packages/flutter_tools/test/integration/test_driver.dart
@@ -30,10 +30,10 @@ final String _logPrefix; Process _proc; int _procPid; - final StreamController<String> _stdout = new StreamController<String>.broadcast(); - final StreamController<String> _stderr = new StreamController<String>.broadcast(); - final StreamController<String> _allMessages = new StreamController<String>.broadcast(); - final StringBuffer _errorBuffer = new StringBuffer(); + final StreamController<String> _stdout = StreamController<String>.broadcast(); + final StreamController<String> _stderr = StreamController<String>.broadcast(); + final StreamController<String> _allMessages = StreamController<String>.broadcast(); + final StringBuffer _errorBuffer = StringBuffer(); String _lastResponse; String _currentRunningAppId; Uri _vmServiceWsUri; @@ -125,13 +125,13 @@ _vmServiceWsUri = Uri.parse(wsUriString); _vmServicePort = debugPort['params']['port']; // Proxy the stream/sink for the VM Client so we can debugPrint it. - final StreamChannel<String> channel = new IOWebSocketChannel.connect(_vmServiceWsUri) + final StreamChannel<String> channel = IOWebSocketChannel.connect(_vmServiceWsUri) .cast<String>() .changeStream((Stream<String> stream) => stream.map(_debugPrint)) .changeSink((StreamSink<String> sink) => - new StreamController<String>() + StreamController<String>() ..stream.listen((String s) => sink.add(_debugPrint(s)))); - vmService = new VMServiceClient(channel); + vmService = VMServiceClient(channel); // Because we start paused, resume so the app is in a "running" state as // expected by tests. Tests will reload/restart as required if they need @@ -153,7 +153,7 @@ Future<void> _restart({bool fullRestart = false, bool pause = false}) async { if (_currentRunningAppId == null) - throw new Exception('App has not started yet'); + throw Exception('App has not started yet'); final dynamic hotReloadResp = await _sendRequest( 'app.restart', @@ -291,7 +291,7 @@ final VMIsolate isolate = await vm.isolates.first.load(); final VMStack stack = await isolate.getStack(); if (stack.frames.isEmpty) { - throw new Exception('Stack is empty'); + throw Exception('Stack is empty'); } return stack.frames.first; } @@ -308,7 +308,7 @@ Duration timeout, bool ignoreAppStopEvent = false, }) async { - final Completer<Map<String, dynamic>> response = new Completer<Map<String, dynamic>>(); + final Completer<Map<String, dynamic>> response = Completer<Map<String, dynamic>>(); StreamSubscription<String> sub; sub = _stdout.stream.listen((String line) async { final dynamic json = _parseFlutterResponse(line); @@ -321,7 +321,7 @@ response.complete(json); } else if (!ignoreAppStopEvent && json['event'] == 'app.stop') { await sub.cancel(); - final StringBuffer error = new StringBuffer(); + final StringBuffer error = StringBuffer(); error.write('Received app.stop event while waiting for '); error.write('${event != null ? '$event event' : 'response to request $id.'}.\n\n'); if (json['params'] != null && json['params']['error'] != null) { @@ -345,10 +345,10 @@ Future<T> _timeoutWithMessages<T>(Future<T> Function() f, {Duration timeout, String message}) { // Capture output to a buffer so if we don't get the response we want we can show // the output that did arrive in the timeout error. - final StringBuffer messages = new StringBuffer(); - final DateTime start = new DateTime.now(); + final StringBuffer messages = StringBuffer(); + final DateTime start = DateTime.now(); void logMessage(String m) { - final int ms = new DateTime.now().difference(start).inMilliseconds; + final int ms = DateTime.now().difference(start).inMilliseconds; messages.writeln('[+ ${ms.toString().padLeft(5)}] $m'); } final StreamSubscription<String> sub = _allMessages.stream.listen(logMessage);
diff --git a/packages/flutter_tools/test/integration/test_utils.dart b/packages/flutter_tools/test/integration/test_utils.dart index 8f8a9d8..b75543a 100644 --- a/packages/flutter_tools/test/integration/test_utils.dart +++ b/packages/flutter_tools/test/integration/test_utils.dart
@@ -39,10 +39,10 @@ 'get' ]; final Process process = await processManager.start(command, workingDirectory: folder); - final StringBuffer errorOutput = new StringBuffer(); + final StringBuffer errorOutput = StringBuffer(); process.stderr.transform(utf8.decoder).listen(errorOutput.write); final int exitCode = await process.exitCode; if (exitCode != 0) - throw new Exception( + throw Exception( 'flutter packages get failed: ${errorOutput.toString()}'); }
diff --git a/packages/flutter_tools/test/intellij/intellij_test.dart b/packages/flutter_tools/test/intellij/intellij_test.dart index 2236616..2da197f 100644 --- a/packages/flutter_tools/test/intellij/intellij_test.dart +++ b/packages/flutter_tools/test/intellij/intellij_test.dart
@@ -23,13 +23,13 @@ } setUp(() { - fs = new MemoryFileSystem(); + fs = MemoryFileSystem(); }); group('IntelliJ', () { group('plugins', () { testUsingContext('found', () async { - final IntelliJPlugins plugins = new IntelliJPlugins(_kPluginsPath); + final IntelliJPlugins plugins = IntelliJPlugins(_kPluginsPath); final Archive dartJarArchive = buildSingleFileArchive('META-INF/plugin.xml', r''' @@ -40,7 +40,7 @@ '''); writeFileCreatingDirectories( fs.path.join(_kPluginsPath, 'Dart', 'lib', 'Dart.jar'), - new ZipEncoder().encode(dartJarArchive)); + ZipEncoder().encode(dartJarArchive)); final Archive flutterJarArchive = buildSingleFileArchive('META-INF/plugin.xml', r''' @@ -51,7 +51,7 @@ '''); writeFileCreatingDirectories( fs.path.join(_kPluginsPath, 'flutter-intellij.jar'), - new ZipEncoder().encode(flutterJarArchive)); + ZipEncoder().encode(flutterJarArchive)); final List<ValidationMessage> messages = <ValidationMessage>[]; plugins.validatePackage(messages, <String>['Dart'], 'Dart'); @@ -72,7 +72,7 @@ }); testUsingContext('not found', () async { - final IntelliJPlugins plugins = new IntelliJPlugins(_kPluginsPath); + final IntelliJPlugins plugins = IntelliJPlugins(_kPluginsPath); final List<ValidationMessage> messages = <ValidationMessage>[]; plugins.validatePackage(messages, <String>['Dart'], 'Dart'); @@ -97,10 +97,10 @@ const String _kPluginsPath = '/data/intellij/plugins'; Archive buildSingleFileArchive(String path, String content) { - final Archive archive = new Archive(); + final Archive archive = Archive(); final List<int> bytes = utf8.encode(content); - archive.addFile(new ArchiveFile(path, bytes.length, bytes)); + archive.addFile(ArchiveFile(path, bytes.length, bytes)); return archive; }
diff --git a/packages/flutter_tools/test/ios/cocoapods_test.dart b/packages/flutter_tools/test/ios/cocoapods_test.dart index e732615..a39c8d2 100644 --- a/packages/flutter_tools/test/ios/cocoapods_test.dart +++ b/packages/flutter_tools/test/ios/cocoapods_test.dart
@@ -42,12 +42,12 @@ setUp(() async { Cache.flutterRoot = 'flutter'; - fs = new MemoryFileSystem(); - mockProcessManager = new MockProcessManager(); - mockXcodeProjectInterpreter = new MockXcodeProjectInterpreter(); + fs = MemoryFileSystem(); + mockProcessManager = MockProcessManager(); + mockXcodeProjectInterpreter = MockXcodeProjectInterpreter(); projectUnderTest = await FlutterProject.fromDirectory(fs.directory('project')); projectUnderTest.ios.directory.childDirectory('Runner.xcodeproj').createSync(recursive: true); - cocoaPodsUnderTest = new CocoaPods(); + cocoaPodsUnderTest = CocoaPods(); pretendPodVersionIs('1.5.0'); fs.file(fs.path.join( Cache.flutterRoot, 'packages', 'flutter_tools', 'templates', 'cocoapods', 'Podfile-objc' @@ -399,7 +399,7 @@ projectUnderTest.ios.podManifestLock ..createSync(recursive: true) ..writeAsStringSync('Existing lock file.'); - await new Future<void>.delayed(const Duration(milliseconds: 10)); + await Future<void>.delayed(const Duration(milliseconds: 10)); projectUnderTest.ios.podfile ..writeAsStringSync('Updated Podfile'); await cocoaPodsUnderTest.processPods( @@ -488,5 +488,5 @@ class MockProcessManager extends Mock implements ProcessManager {} class MockXcodeProjectInterpreter extends Mock implements XcodeProjectInterpreter {} -ProcessResult exitsWithError([String stdout = '']) => new ProcessResult(1, 1, stdout, ''); -ProcessResult exitsHappy([String stdout = '']) => new ProcessResult(1, 0, stdout, ''); +ProcessResult exitsWithError([String stdout = '']) => ProcessResult(1, 1, stdout, ''); +ProcessResult exitsHappy([String stdout = '']) => ProcessResult(1, 0, stdout, '');
diff --git a/packages/flutter_tools/test/ios/code_signing_test.dart b/packages/flutter_tools/test/ios/code_signing_test.dart index 38b6b09..be540de 100644 --- a/packages/flutter_tools/test/ios/code_signing_test.dart +++ b/packages/flutter_tools/test/ios/code_signing_test.dart
@@ -28,14 +28,14 @@ AnsiTerminal testTerminal; setUp(() { - mockProcessManager = new MockProcessManager(); - mockConfig = new MockConfig(); - mockIosProject = new MockIosProject(); + mockProcessManager = MockProcessManager(); + mockConfig = MockConfig(); + mockIosProject = MockIosProject(); when(mockIosProject.buildSettings).thenReturn(<String, String>{ 'For our purposes': 'a non-empty build settings map is valid', }); - testTerminal = new TestTerminal(); - app = new BuildableIOSApp(mockIosProject); + testTerminal = TestTerminal(); + app = BuildableIOSApp(mockIosProject); }); testUsingContext('No auto-sign if Xcode project settings are not available', () async { @@ -99,7 +99,7 @@ argThat(contains('find-identity')), environment: anyNamed('environment'), workingDirectory: anyNamed('workingDirectory'), - )).thenReturn(new ProcessResult( + )).thenReturn(ProcessResult( 1, // pid 0, // exitCode ''' @@ -111,27 +111,27 @@ <String>['security', 'find-certificate', '-c', '1111AAAA11', '-p'], environment: anyNamed('environment'), workingDirectory: anyNamed('workingDirectory'), - )).thenReturn(new ProcessResult( + )).thenReturn(ProcessResult( 1, // pid 0, // exitCode 'This is a mock certificate', '', )); - final MockProcess mockProcess = new MockProcess(); - final MockStdIn mockStdIn = new MockStdIn(); - final MockStream mockStdErr = new MockStream(); + final MockProcess mockProcess = MockProcess(); + final MockStdIn mockStdIn = MockStdIn(); + final MockStream mockStdErr = MockStream(); when(mockProcessManager.start( argThat(contains('openssl')), environment: anyNamed('environment'), workingDirectory: anyNamed('workingDirectory'), - )).thenAnswer((Invocation invocation) => new Future<Process>.value(mockProcess)); + )).thenAnswer((Invocation invocation) => Future<Process>.value(mockProcess)); when(mockProcess.stdin).thenReturn(mockStdIn); when(mockProcess.stdout) - .thenAnswer((Invocation invocation) => new Stream<List<int>>.fromFuture( - new Future<List<int>>.value(utf8.encode( + .thenAnswer((Invocation invocation) => Stream<List<int>>.fromFuture( + Future<List<int>>.value(utf8.encode( 'subject= /CN=iPhone Developer: Profile 1 (1111AAAA11)/OU=3333CCCC33/O=My Team/C=US' )) )); @@ -158,7 +158,7 @@ argThat(contains('find-identity')), environment: anyNamed('environment'), workingDirectory: anyNamed('workingDirectory'), - )).thenReturn(new ProcessResult( + )).thenReturn(ProcessResult( 1, // pid 0, // exitCode ''' @@ -170,27 +170,27 @@ <String>['security', 'find-certificate', '-c', '1111AAAA11', '-p'], environment: anyNamed('environment'), workingDirectory: anyNamed('workingDirectory'), - )).thenReturn(new ProcessResult( + )).thenReturn(ProcessResult( 1, // pid 0, // exitCode 'This is a mock certificate', '', )); - final MockProcess mockProcess = new MockProcess(); - final MockStdIn mockStdIn = new MockStdIn(); - final MockStream mockStdErr = new MockStream(); + final MockProcess mockProcess = MockProcess(); + final MockStdIn mockStdIn = MockStdIn(); + final MockStream mockStdErr = MockStream(); when(mockProcessManager.start( argThat(contains('openssl')), environment: anyNamed('environment'), workingDirectory: anyNamed('workingDirectory'), - )).thenAnswer((Invocation invocation) => new Future<Process>.value(mockProcess)); + )).thenAnswer((Invocation invocation) => Future<Process>.value(mockProcess)); when(mockProcess.stdin).thenReturn(mockStdIn); when(mockProcess.stdout) - .thenAnswer((Invocation invocation) => new Stream<List<int>>.fromFuture( - new Future<List<int>>.value(utf8.encode( + .thenAnswer((Invocation invocation) => Stream<List<int>>.fromFuture( + Future<List<int>>.value(utf8.encode( 'subject= /CN=iPhone Developer: Google Development (1111AAAA11)/OU=3333CCCC33/O=My Team/C=US' )) )); @@ -221,7 +221,7 @@ argThat(contains('find-identity')), environment: anyNamed('environment'), workingDirectory: anyNamed('workingDirectory'), - )).thenReturn(new ProcessResult( + )).thenReturn(ProcessResult( 1, // pid 0, // exitCode ''' @@ -232,37 +232,37 @@ '' )); mockTerminalStdInStream = - new Stream<String>.fromFuture(new Future<String>.value('3')); + Stream<String>.fromFuture(Future<String>.value('3')); when(mockProcessManager.runSync( <String>['security', 'find-certificate', '-c', '3333CCCC33', '-p'], environment: anyNamed('environment'), workingDirectory: anyNamed('workingDirectory'), - )).thenReturn(new ProcessResult( + )).thenReturn(ProcessResult( 1, // pid 0, // exitCode 'This is a mock certificate', '', )); - final MockProcess mockOpenSslProcess = new MockProcess(); - final MockStdIn mockOpenSslStdIn = new MockStdIn(); - final MockStream mockOpenSslStdErr = new MockStream(); + final MockProcess mockOpenSslProcess = MockProcess(); + final MockStdIn mockOpenSslStdIn = MockStdIn(); + final MockStream mockOpenSslStdErr = MockStream(); when(mockProcessManager.start( argThat(contains('openssl')), environment: anyNamed('environment'), workingDirectory: anyNamed('workingDirectory'), - )).thenAnswer((Invocation invocation) => new Future<Process>.value(mockOpenSslProcess)); + )).thenAnswer((Invocation invocation) => Future<Process>.value(mockOpenSslProcess)); when(mockOpenSslProcess.stdin).thenReturn(mockOpenSslStdIn); when(mockOpenSslProcess.stdout) - .thenAnswer((Invocation invocation) => new Stream<List<int>>.fromFuture( - new Future<List<int>>.value(utf8.encode( + .thenAnswer((Invocation invocation) => Stream<List<int>>.fromFuture( + Future<List<int>>.value(utf8.encode( 'subject= /CN=iPhone Developer: Profile 3 (3333CCCC33)/OU=4444DDDD44/O=My Team/C=US' )) )); when(mockOpenSslProcess.stderr).thenAnswer((Invocation invocation) => mockOpenSslStdErr); - when(mockOpenSslProcess.exitCode).thenAnswer((_) => new Future<int>.value(0)); + when(mockOpenSslProcess.exitCode).thenAnswer((_) => Future<int>.value(0)); final Map<String, String> signingConfigs = await getCodeSigningIdentityDevelopmentTeam(iosApp: app); @@ -295,7 +295,7 @@ argThat(contains('find-identity')), environment: anyNamed('environment'), workingDirectory: anyNamed('workingDirectory'), - )).thenReturn(new ProcessResult( + )).thenReturn(ProcessResult( 1, // pid 0, // exitCode ''' @@ -306,37 +306,37 @@ '' )); mockTerminalStdInStream = - new Stream<String>.fromFuture(new Future<String>.error(new Exception('Cannot read from StdIn'))); + Stream<String>.fromFuture(Future<String>.error(Exception('Cannot read from StdIn'))); when(mockProcessManager.runSync( <String>['security', 'find-certificate', '-c', '1111AAAA11', '-p'], environment: anyNamed('environment'), workingDirectory: anyNamed('workingDirectory'), - )).thenReturn(new ProcessResult( + )).thenReturn(ProcessResult( 1, // pid 0, // exitCode 'This is a mock certificate', '', )); - final MockProcess mockOpenSslProcess = new MockProcess(); - final MockStdIn mockOpenSslStdIn = new MockStdIn(); - final MockStream mockOpenSslStdErr = new MockStream(); + final MockProcess mockOpenSslProcess = MockProcess(); + final MockStdIn mockOpenSslStdIn = MockStdIn(); + final MockStream mockOpenSslStdErr = MockStream(); when(mockProcessManager.start( argThat(contains('openssl')), environment: anyNamed('environment'), workingDirectory: anyNamed('workingDirectory'), - )).thenAnswer((Invocation invocation) => new Future<Process>.value(mockOpenSslProcess)); + )).thenAnswer((Invocation invocation) => Future<Process>.value(mockOpenSslProcess)); when(mockOpenSslProcess.stdin).thenReturn(mockOpenSslStdIn); when(mockOpenSslProcess.stdout) - .thenAnswer((Invocation invocation) => new Stream<List<int>>.fromFuture( - new Future<List<int>>.value(utf8.encode( + .thenAnswer((Invocation invocation) => Stream<List<int>>.fromFuture( + Future<List<int>>.value(utf8.encode( 'subject= /CN=iPhone Developer: Profile 1 (1111AAAA11)/OU=5555EEEE55/O=My Team/C=US' )), )); when(mockOpenSslProcess.stderr).thenAnswer((Invocation invocation) => mockOpenSslStdErr); - when(mockOpenSslProcess.exitCode).thenAnswer((_) => new Future<int>.value(0)); + when(mockOpenSslProcess.exitCode).thenAnswer((_) => Future<int>.value(0)); final Map<String, String> signingConfigs = await getCodeSigningIdentityDevelopmentTeam(iosApp: app, usesTerminalUi: false); @@ -363,7 +363,7 @@ argThat(contains('find-identity')), environment: anyNamed('environment'), workingDirectory: anyNamed('workingDirectory'), - )).thenReturn(new ProcessResult( + )).thenReturn(ProcessResult( 1, // pid 0, // exitCode ''' @@ -377,32 +377,32 @@ <String>['security', 'find-certificate', '-c', '3333CCCC33', '-p'], environment: anyNamed('environment'), workingDirectory: anyNamed('workingDirectory'), - )).thenReturn(new ProcessResult( + )).thenReturn(ProcessResult( 1, // pid 0, // exitCode 'This is a mock certificate', '', )); - final MockProcess mockOpenSslProcess = new MockProcess(); - final MockStdIn mockOpenSslStdIn = new MockStdIn(); - final MockStream mockOpenSslStdErr = new MockStream(); + final MockProcess mockOpenSslProcess = MockProcess(); + final MockStdIn mockOpenSslStdIn = MockStdIn(); + final MockStream mockOpenSslStdErr = MockStream(); when(mockProcessManager.start( argThat(contains('openssl')), environment: anyNamed('environment'), workingDirectory: anyNamed('workingDirectory'), - )).thenAnswer((Invocation invocation) => new Future<Process>.value(mockOpenSslProcess)); + )).thenAnswer((Invocation invocation) => Future<Process>.value(mockOpenSslProcess)); when(mockOpenSslProcess.stdin).thenReturn(mockOpenSslStdIn); when(mockOpenSslProcess.stdout) - .thenAnswer((Invocation invocation) => new Stream<List<int>>.fromFuture( - new Future<List<int>>.value(utf8.encode( + .thenAnswer((Invocation invocation) => Stream<List<int>>.fromFuture( + Future<List<int>>.value(utf8.encode( 'subject= /CN=iPhone Developer: Profile 3 (3333CCCC33)/OU=4444DDDD44/O=My Team/C=US' )) )); when(mockOpenSslProcess.stderr).thenAnswer((Invocation invocation) => mockOpenSslStdErr); - when(mockOpenSslProcess.exitCode).thenAnswer((_) => new Future<int>.value(0)); + when(mockOpenSslProcess.exitCode).thenAnswer((_) => Future<int>.value(0)); when<String>(mockConfig.getValue('ios-signing-cert')).thenReturn('iPhone Developer: Profile 3 (3333CCCC33)'); final Map<String, String> signingConfigs = await getCodeSigningIdentityDevelopmentTeam(iosApp: app); @@ -433,7 +433,7 @@ argThat(contains('find-identity')), environment: anyNamed('environment'), workingDirectory: anyNamed('workingDirectory'), - )).thenReturn(new ProcessResult( + )).thenReturn(ProcessResult( 1, // pid 0, // exitCode ''' @@ -444,12 +444,12 @@ '' )); mockTerminalStdInStream = - new Stream<String>.fromFuture(new Future<String>.value('3')); + Stream<String>.fromFuture(Future<String>.value('3')); when(mockProcessManager.runSync( <String>['security', 'find-certificate', '-c', '3333CCCC33', '-p'], environment: anyNamed('environment'), workingDirectory: anyNamed('workingDirectory'), - )).thenReturn(new ProcessResult( + )).thenReturn(ProcessResult( 1, // pid 0, // exitCode 'This is a mock certificate', @@ -457,25 +457,25 @@ )); - final MockProcess mockOpenSslProcess = new MockProcess(); - final MockStdIn mockOpenSslStdIn = new MockStdIn(); - final MockStream mockOpenSslStdErr = new MockStream(); + final MockProcess mockOpenSslProcess = MockProcess(); + final MockStdIn mockOpenSslStdIn = MockStdIn(); + final MockStream mockOpenSslStdErr = MockStream(); when(mockProcessManager.start( argThat(contains('openssl')), environment: anyNamed('environment'), workingDirectory: anyNamed('workingDirectory'), - )).thenAnswer((Invocation invocation) => new Future<Process>.value(mockOpenSslProcess)); + )).thenAnswer((Invocation invocation) => Future<Process>.value(mockOpenSslProcess)); when(mockOpenSslProcess.stdin).thenReturn(mockOpenSslStdIn); when(mockOpenSslProcess.stdout) - .thenAnswer((Invocation invocation) => new Stream<List<int>>.fromFuture( - new Future<List<int>>.value(utf8.encode( + .thenAnswer((Invocation invocation) => Stream<List<int>>.fromFuture( + Future<List<int>>.value(utf8.encode( 'subject= /CN=iPhone Developer: Profile 3 (3333CCCC33)/OU=4444DDDD44/O=My Team/C=US' )) )); when(mockOpenSslProcess.stderr).thenAnswer((Invocation invocation) => mockOpenSslStdErr); - when(mockOpenSslProcess.exitCode).thenAnswer((_) => new Future<int>.value(0)); + when(mockOpenSslProcess.exitCode).thenAnswer((_) => Future<int>.value(0)); when<String>(mockConfig.getValue('ios-signing-cert')).thenReturn('iPhone Developer: Invalid Profile'); final Map<String, String> signingConfigs = await getCodeSigningIdentityDevelopmentTeam(iosApp: app); @@ -499,14 +499,14 @@ }); } -final ProcessResult exitsHappy = new ProcessResult( +final ProcessResult exitsHappy = ProcessResult( 1, // pid 0, // exitCode '', // stdout '', // stderr ); -final ProcessResult exitsFail = new ProcessResult( +final ProcessResult exitsFail = ProcessResult( 2, // pid 1, // exitCode '', // stdout
diff --git a/packages/flutter_tools/test/ios/devices_test.dart b/packages/flutter_tools/test/ios/devices_test.dart index b2a1291..39518a6 100644 --- a/packages/flutter_tools/test/ios/devices_test.dart +++ b/packages/flutter_tools/test/ios/devices_test.dart
@@ -26,14 +26,14 @@ class MockProcess extends Mock implements Process {} void main() { - final FakePlatform osx = new FakePlatform.fromPlatform(const LocalPlatform()); + final FakePlatform osx = FakePlatform.fromPlatform(const LocalPlatform()); osx.operatingSystem = 'macos'; group('getAttachedDevices', () { MockIMobileDevice mockIMobileDevice; setUp(() { - mockIMobileDevice = new MockIMobileDevice(); + mockIMobileDevice = MockIMobileDevice(); }); testUsingContext('return no devices if Xcode is not installed', () async { @@ -46,7 +46,7 @@ testUsingContext('returns no devices if none are attached', () async { when(iMobileDevice.isInstalled).thenReturn(true); when(iMobileDevice.getAvailableDeviceIDs()) - .thenAnswer((Invocation invocation) => new Future<String>.value('')); + .thenAnswer((Invocation invocation) => Future<String>.value('')); final List<IOSDevice> devices = await IOSDevice.getAttachedDevices(); expect(devices, isEmpty); }, overrides: <Type, Generator>{ @@ -56,18 +56,18 @@ testUsingContext('returns attached devices', () async { when(iMobileDevice.isInstalled).thenReturn(true); when(iMobileDevice.getAvailableDeviceIDs()) - .thenAnswer((Invocation invocation) => new Future<String>.value(''' + .thenAnswer((Invocation invocation) => Future<String>.value(''' 98206e7a4afd4aedaff06e687594e089dede3c44 f577a7903cc54959be2e34bc4f7f80b7009efcf4 ''')); when(iMobileDevice.getInfoForDevice('98206e7a4afd4aedaff06e687594e089dede3c44', 'DeviceName')) - .thenAnswer((_) => new Future<String>.value('La tele me regarde')); + .thenAnswer((_) => Future<String>.value('La tele me regarde')); when(iMobileDevice.getInfoForDevice('98206e7a4afd4aedaff06e687594e089dede3c44', 'ProductVersion')) - .thenAnswer((_) => new Future<String>.value('10.3.2')); + .thenAnswer((_) => Future<String>.value('10.3.2')); when(iMobileDevice.getInfoForDevice('f577a7903cc54959be2e34bc4f7f80b7009efcf4', 'DeviceName')) - .thenAnswer((_) => new Future<String>.value('Puits sans fond')); + .thenAnswer((_) => Future<String>.value('Puits sans fond')); when(iMobileDevice.getInfoForDevice('f577a7903cc54959be2e34bc4f7f80b7009efcf4', 'ProductVersion')) - .thenAnswer((_) => new Future<String>.value('11.0')); + .thenAnswer((_) => Future<String>.value('11.0')); final List<IOSDevice> devices = await IOSDevice.getAttachedDevices(); expect(devices, hasLength(2)); expect(devices[0].id, '98206e7a4afd4aedaff06e687594e089dede3c44'); @@ -95,15 +95,15 @@ MockIosProject mockIosProject; setUp(() { - mockIMobileDevice = new MockIMobileDevice(); - mockIosProject = new MockIosProject(); + mockIMobileDevice = MockIMobileDevice(); + mockIosProject = MockIosProject(); }); testUsingContext('suppresses non-Flutter lines from output', () async { when(mockIMobileDevice.startLogger()).thenAnswer((Invocation invocation) { - final Process mockProcess = new MockProcess(); + final Process mockProcess = MockProcess(); when(mockProcess.stdout).thenAnswer((Invocation invocation) => - new Stream<List<int>>.fromIterable(<List<int>>[''' + Stream<List<int>>.fromIterable(<List<int>>[''' Runner(Flutter)[297] <Notice>: A is for ari Runner(libsystem_asl.dylib)[297] <Notice>: libMobileGestalt MobileGestaltSupport.m:153: pid 123 (Runner) does not have sandbox access for frZQaeyWLUvLjeuEK43hmg and IS NOT appropriately entitled Runner(libsystem_asl.dylib)[297] <Notice>: libMobileGestalt MobileGestalt.c:550: no access to InverseDeviceID (see <rdar://problem/11744455>) @@ -114,13 +114,13 @@ .thenAnswer((Invocation invocation) => const Stream<List<int>>.empty()); // Delay return of exitCode until after stdout stream data, since it terminates the logger. when(mockProcess.exitCode) - .thenAnswer((Invocation invocation) => new Future<int>.delayed(Duration.zero, () => 0)); - return new Future<Process>.value(mockProcess); + .thenAnswer((Invocation invocation) => Future<int>.delayed(Duration.zero, () => 0)); + return Future<Process>.value(mockProcess); }); - final IOSDevice device = new IOSDevice('123456'); + final IOSDevice device = IOSDevice('123456'); final DeviceLogReader logReader = device.getLogReader( - app: new BuildableIOSApp(mockIosProject), + app: BuildableIOSApp(mockIosProject), ); final List<String> lines = await logReader.logLines.toList(); @@ -131,9 +131,9 @@ testUsingContext('includes multi-line Flutter logs in the output', () async { when(mockIMobileDevice.startLogger()).thenAnswer((Invocation invocation) { - final Process mockProcess = new MockProcess(); + final Process mockProcess = MockProcess(); when(mockProcess.stdout).thenAnswer((Invocation invocation) => - new Stream<List<int>>.fromIterable(<List<int>>[''' + Stream<List<int>>.fromIterable(<List<int>>[''' Runner(Flutter)[297] <Notice>: This is a multi-line message, with another Flutter message following it. Runner(Flutter)[297] <Notice>: This is a multi-line message, @@ -144,13 +144,13 @@ .thenAnswer((Invocation invocation) => const Stream<List<int>>.empty()); // Delay return of exitCode until after stdout stream data, since it terminates the logger. when(mockProcess.exitCode) - .thenAnswer((Invocation invocation) => new Future<int>.delayed(Duration.zero, () => 0)); - return new Future<Process>.value(mockProcess); + .thenAnswer((Invocation invocation) => Future<int>.delayed(Duration.zero, () => 0)); + return Future<Process>.value(mockProcess); }); - final IOSDevice device = new IOSDevice('123456'); + final IOSDevice device = IOSDevice('123456'); final DeviceLogReader logReader = device.getLogReader( - app: new BuildableIOSApp(mockIosProject), + app: BuildableIOSApp(mockIosProject), ); final List<String> lines = await logReader.logLines.toList();
diff --git a/packages/flutter_tools/test/ios/ios_workflow_test.dart b/packages/flutter_tools/test/ios/ios_workflow_test.dart index 981d4a7..a4cacf7 100644 --- a/packages/flutter_tools/test/ios/ios_workflow_test.dart +++ b/packages/flutter_tools/test/ios/ios_workflow_test.dart
@@ -27,11 +27,11 @@ FileSystem fs; setUp(() { - iMobileDevice = new MockIMobileDevice(); - xcode = new MockXcode(); - processManager = new MockProcessManager(); - cocoaPods = new MockCocoaPods(); - fs = new MemoryFileSystem(); + iMobileDevice = MockIMobileDevice(); + xcode = MockXcode(); + processManager = MockProcessManager(); + cocoaPods = MockCocoaPods(); + fs = MemoryFileSystem(); when(cocoaPods.evaluateCocoaPodsInstallation) .thenAnswer((_) async => CocoaPodsStatus.recommended); @@ -42,7 +42,7 @@ testUsingContext('Emit missing status when nothing is installed', () async { when(xcode.isInstalled).thenReturn(false); when(xcode.xcodeSelectPath).thenReturn(null); - final IOSWorkflowTestTarget workflow = new IOSWorkflowTestTarget( + final IOSWorkflowTestTarget workflow = IOSWorkflowTestTarget( hasHomebrew: false, hasIosDeploy: false, ); @@ -57,7 +57,7 @@ testUsingContext('Emits partial status when Xcode is not installed', () async { when(xcode.isInstalled).thenReturn(false); when(xcode.xcodeSelectPath).thenReturn(null); - final IOSWorkflowTestTarget workflow = new IOSWorkflowTestTarget(); + final IOSWorkflowTestTarget workflow = IOSWorkflowTestTarget(); final ValidationResult result = await workflow.validate(); expect(result.type, ValidationType.partial); }, overrides: <Type, Generator>{ @@ -69,7 +69,7 @@ testUsingContext('Emits partial status when Xcode is partially installed', () async { when(xcode.isInstalled).thenReturn(false); when(xcode.xcodeSelectPath).thenReturn('/Library/Developer/CommandLineTools'); - final IOSWorkflowTestTarget workflow = new IOSWorkflowTestTarget(); + final IOSWorkflowTestTarget workflow = IOSWorkflowTestTarget(); final ValidationResult result = await workflow.validate(); expect(result.type, ValidationType.partial); }, overrides: <Type, Generator>{ @@ -85,7 +85,7 @@ when(xcode.isInstalledAndMeetsVersionCheck).thenReturn(false); when(xcode.eulaSigned).thenReturn(true); when(xcode.isSimctlInstalled).thenReturn(true); - final IOSWorkflowTestTarget workflow = new IOSWorkflowTestTarget(); + final IOSWorkflowTestTarget workflow = IOSWorkflowTestTarget(); final ValidationResult result = await workflow.validate(); expect(result.type, ValidationType.partial); }, overrides: <Type, Generator>{ @@ -101,7 +101,7 @@ when(xcode.isInstalledAndMeetsVersionCheck).thenReturn(true); when(xcode.eulaSigned).thenReturn(false); when(xcode.isSimctlInstalled).thenReturn(true); - final IOSWorkflowTestTarget workflow = new IOSWorkflowTestTarget(); + final IOSWorkflowTestTarget workflow = IOSWorkflowTestTarget(); final ValidationResult result = await workflow.validate(); expect(result.type, ValidationType.partial); }, overrides: <Type, Generator>{ @@ -117,7 +117,7 @@ when(xcode.isInstalledAndMeetsVersionCheck).thenReturn(true); when(xcode.eulaSigned).thenReturn(true); when(xcode.isSimctlInstalled).thenReturn(true); - final IOSWorkflowTestTarget workflow = new IOSWorkflowTestTarget(hasHomebrew: false); + final IOSWorkflowTestTarget workflow = IOSWorkflowTestTarget(hasHomebrew: false); final ValidationResult result = await workflow.validate(); expect(result.type, ValidationType.partial); }, overrides: <Type, Generator>{ @@ -133,11 +133,11 @@ when(xcode.isInstalledAndMeetsVersionCheck).thenReturn(true); when(xcode.eulaSigned).thenReturn(true); when(xcode.isSimctlInstalled).thenReturn(true); - final IOSWorkflowTestTarget workflow = new IOSWorkflowTestTarget(); + final IOSWorkflowTestTarget workflow = IOSWorkflowTestTarget(); final ValidationResult result = await workflow.validate(); expect(result.type, ValidationType.partial); }, overrides: <Type, Generator>{ - IMobileDevice: () => new MockIMobileDevice(isInstalled: false, isWorking: false), + IMobileDevice: () => MockIMobileDevice(isInstalled: false, isWorking: false), Xcode: () => xcode, CocoaPods: () => cocoaPods, }); @@ -149,11 +149,11 @@ when(xcode.isInstalledAndMeetsVersionCheck).thenReturn(true); when(xcode.eulaSigned).thenReturn(true); when(xcode.isSimctlInstalled).thenReturn(true); - final IOSWorkflowTestTarget workflow = new IOSWorkflowTestTarget(); + final IOSWorkflowTestTarget workflow = IOSWorkflowTestTarget(); final ValidationResult result = await workflow.validate(); expect(result.type, ValidationType.partial); }, overrides: <Type, Generator>{ - IMobileDevice: () => new MockIMobileDevice(isWorking: false), + IMobileDevice: () => MockIMobileDevice(isWorking: false), Xcode: () => xcode, CocoaPods: () => cocoaPods, }); @@ -165,7 +165,7 @@ when(xcode.isInstalledAndMeetsVersionCheck).thenReturn(true); when(xcode.isSimctlInstalled).thenReturn(true); when(xcode.eulaSigned).thenReturn(true); - final IOSWorkflowTestTarget workflow = new IOSWorkflowTestTarget(hasIosDeploy: false); + final IOSWorkflowTestTarget workflow = IOSWorkflowTestTarget(hasIosDeploy: false); final ValidationResult result = await workflow.validate(); expect(result.type, ValidationType.partial); }, overrides: <Type, Generator>{ @@ -181,7 +181,7 @@ when(xcode.isInstalledAndMeetsVersionCheck).thenReturn(true); when(xcode.eulaSigned).thenReturn(true); when(xcode.isSimctlInstalled).thenReturn(true); - final IOSWorkflowTestTarget workflow = new IOSWorkflowTestTarget(iosDeployVersionText: '1.8.0'); + final IOSWorkflowTestTarget workflow = IOSWorkflowTestTarget(iosDeployVersionText: '1.8.0'); final ValidationResult result = await workflow.validate(); expect(result.type, ValidationType.partial); }, overrides: <Type, Generator>{ @@ -199,7 +199,7 @@ when(cocoaPods.evaluateCocoaPodsInstallation) .thenAnswer((_) async => CocoaPodsStatus.notInstalled); when(xcode.isSimctlInstalled).thenReturn(true); - final IOSWorkflowTestTarget workflow = new IOSWorkflowTestTarget(); + final IOSWorkflowTestTarget workflow = IOSWorkflowTestTarget(); final ValidationResult result = await workflow.validate(); expect(result.type, ValidationType.partial); }, overrides: <Type, Generator>{ @@ -217,7 +217,7 @@ when(cocoaPods.evaluateCocoaPodsInstallation) .thenAnswer((_) async => CocoaPodsStatus.belowRecommendedVersion); when(xcode.isSimctlInstalled).thenReturn(true); - final IOSWorkflowTestTarget workflow = new IOSWorkflowTestTarget(); + final IOSWorkflowTestTarget workflow = IOSWorkflowTestTarget(); final ValidationResult result = await workflow.validate(); expect(result.type, ValidationType.partial); }, overrides: <Type, Generator>{ @@ -235,7 +235,7 @@ when(cocoaPods.isCocoaPodsInitialized).thenAnswer((_) async => false); when(xcode.isSimctlInstalled).thenReturn(true); - final ValidationResult result = await new IOSWorkflowTestTarget().validate(); + final ValidationResult result = await IOSWorkflowTestTarget().validate(); expect(result.type, ValidationType.partial); }, overrides: <Type, Generator>{ FileSystem: () => fs, @@ -252,7 +252,7 @@ when(xcode.isInstalledAndMeetsVersionCheck).thenReturn(true); when(xcode.eulaSigned).thenReturn(true); when(xcode.isSimctlInstalled).thenReturn(false); - final IOSWorkflowTestTarget workflow = new IOSWorkflowTestTarget(); + final IOSWorkflowTestTarget workflow = IOSWorkflowTestTarget(); final ValidationResult result = await workflow.validate(); expect(result.type, ValidationType.partial); }, overrides: <Type, Generator>{ @@ -272,7 +272,7 @@ ensureDirectoryExists(fs.path.join(homeDirPath, '.cocoapods', 'repos', 'master', 'README.md')); - final ValidationResult result = await new IOSWorkflowTestTarget().validate(); + final ValidationResult result = await IOSWorkflowTestTarget().validate(); expect(result.type, ValidationType.installed); }, overrides: <Type, Generator>{ FileSystem: () => fs, @@ -284,7 +284,7 @@ }); } -final ProcessResult exitsHappy = new ProcessResult( +final ProcessResult exitsHappy = ProcessResult( 1, // pid 0, // exitCode '', // stdout @@ -295,7 +295,7 @@ MockIMobileDevice({ this.isInstalled = true, bool isWorking = true, - }) : isWorking = new Future<bool>.value(isWorking); + }) : isWorking = Future<bool>.value(isWorking); @override final bool isInstalled; @@ -314,9 +314,9 @@ bool hasIosDeploy = true, String iosDeployVersionText = '1.9.2', bool hasIDeviceInstaller = true, - }) : hasIosDeploy = new Future<bool>.value(hasIosDeploy), - iosDeployVersionText = new Future<String>.value(iosDeployVersionText), - hasIDeviceInstaller = new Future<bool>.value(hasIDeviceInstaller); + }) : hasIosDeploy = Future<bool>.value(hasIosDeploy), + iosDeployVersionText = Future<String>.value(iosDeployVersionText), + hasIDeviceInstaller = Future<bool>.value(hasIDeviceInstaller); @override final bool hasHomebrew;
diff --git a/packages/flutter_tools/test/ios/mac_test.dart b/packages/flutter_tools/test/ios/mac_test.dart index c30631e..8e3ccc3 100644 --- a/packages/flutter_tools/test/ios/mac_test.dart +++ b/packages/flutter_tools/test/ios/mac_test.dart
@@ -22,12 +22,12 @@ void main() { group('IMobileDevice', () { - final FakePlatform osx = new FakePlatform.fromPlatform(const LocalPlatform()) + final FakePlatform osx = FakePlatform.fromPlatform(const LocalPlatform()) ..operatingSystem = 'macos'; MockProcessManager mockProcessManager; setUp(() { - mockProcessManager = new MockProcessManager(); + mockProcessManager = MockProcessManager(); }); testUsingContext('getAvailableDeviceIDs throws ToolExit when libimobiledevice is not installed', () async { @@ -40,7 +40,7 @@ testUsingContext('getAvailableDeviceIDs throws ToolExit when idevice_id returns non-zero', () async { when(mockProcessManager.run(<String>['idevice_id', '-l'])) - .thenAnswer((_) => new Future<ProcessResult>.value(new ProcessResult(1, 1, '', 'Sad today'))); + .thenAnswer((_) => Future<ProcessResult>.value(ProcessResult(1, 1, '', 'Sad today'))); expect(() async => await iMobileDevice.getAvailableDeviceIDs(), throwsToolExit()); }, overrides: <Type, Generator>{ ProcessManager: () => mockProcessManager, @@ -48,7 +48,7 @@ testUsingContext('getAvailableDeviceIDs returns idevice_id output when installed', () async { when(mockProcessManager.run(<String>['idevice_id', '-l'])) - .thenAnswer((_) => new Future<ProcessResult>.value(new ProcessResult(1, 0, 'foo', ''))); + .thenAnswer((_) => Future<ProcessResult>.value(ProcessResult(1, 0, 'foo', ''))); expect(await iMobileDevice.getAvailableDeviceIDs(), 'foo'); }, overrides: <Type, Generator>{ ProcessManager: () => mockProcessManager, @@ -60,8 +60,8 @@ MockFile mockOutputFile; setUp(() { - mockProcessManager = new MockProcessManager(); - mockOutputFile = new MockFile(); + mockProcessManager = MockProcessManager(); + mockOutputFile = MockFile(); }); testUsingContext('error if idevicescreenshot is not installed', () async { @@ -71,7 +71,7 @@ when(mockProcessManager.run(<String>['idevicescreenshot', outputPath], environment: null, workingDirectory: null - )).thenAnswer((_) => new Future<ProcessResult>.value(new ProcessResult(4, 1, '', ''))); + )).thenAnswer((_) => Future<ProcessResult>.value(ProcessResult(4, 1, '', ''))); expect(() async => await iMobileDevice.takeScreenshot(mockOutputFile), throwsA(anything)); }, overrides: <Type, Generator>{ @@ -82,7 +82,7 @@ testUsingContext('idevicescreenshot captures and returns screenshot', () async { when(mockOutputFile.path).thenReturn(outputPath); when(mockProcessManager.run(any, environment: null, workingDirectory: null)).thenAnswer( - (Invocation invocation) => new Future<ProcessResult>.value(new ProcessResult(4, 0, '', ''))); + (Invocation invocation) => Future<ProcessResult>.value(ProcessResult(4, 0, '', ''))); await iMobileDevice.takeScreenshot(mockOutputFile); verify(mockProcessManager.run(<String>['idevicescreenshot', outputPath], @@ -101,9 +101,9 @@ MockXcodeProjectInterpreter mockXcodeProjectInterpreter; setUp(() { - mockProcessManager = new MockProcessManager(); - mockXcodeProjectInterpreter = new MockXcodeProjectInterpreter(); - xcode = new Xcode(); + mockProcessManager = MockProcessManager(); + mockXcodeProjectInterpreter = MockXcodeProjectInterpreter(); + xcode = Xcode(); }); testUsingContext('xcodeSelectPath returns null when xcode-select is not installed', () { @@ -117,7 +117,7 @@ testUsingContext('xcodeSelectPath returns path when xcode-select is installed', () { const String xcodePath = '/Applications/Xcode8.0.app/Contents/Developer'; when(mockProcessManager.runSync(<String>['/usr/bin/xcode-select', '--print-path'])) - .thenReturn(new ProcessResult(1, 0, xcodePath, '')); + .thenReturn(ProcessResult(1, 0, xcodePath, '')); expect(xcode.xcodeSelectPath, xcodePath); }, overrides: <Type, Generator>{ ProcessManager: () => mockProcessManager, @@ -176,7 +176,7 @@ testUsingContext('eulaSigned is false when clang output indicates EULA not yet accepted', () { when(mockProcessManager.runSync(<String>['/usr/bin/xcrun', 'clang'])) - .thenReturn(new ProcessResult(1, 1, '', 'Xcode EULA has not been accepted.\nLaunch Xcode and accept the license.')); + .thenReturn(ProcessResult(1, 1, '', 'Xcode EULA has not been accepted.\nLaunch Xcode and accept the license.')); expect(xcode.eulaSigned, isFalse); }, overrides: <Type, Generator>{ ProcessManager: () => mockProcessManager, @@ -184,7 +184,7 @@ testUsingContext('eulaSigned is true when clang output indicates EULA has been accepted', () { when(mockProcessManager.runSync(<String>['/usr/bin/xcrun', 'clang'])) - .thenReturn(new ProcessResult(1, 1, '', 'clang: error: no input files')); + .thenReturn(ProcessResult(1, 1, '', 'clang: error: no input files')); expect(xcode.eulaSigned, isTrue); }, overrides: <Type, Generator>{ ProcessManager: () => mockProcessManager, @@ -201,7 +201,7 @@ }); testUsingContext('No provisioning profile shows message', () async { - final XcodeBuildResult buildResult = new XcodeBuildResult( + final XcodeBuildResult buildResult = XcodeBuildResult( success: false, stdout: ''' Launching lib/main.dart on iPhone in debug mode... @@ -258,7 +258,7 @@ Could not build the precompiled application for the device. Error launching application on iPhone.''', - xcodeBuildExecution: new XcodeBuildExecution( + xcodeBuildExecution: XcodeBuildExecution( buildCommands: <String>['xcrun', 'xcodebuild', 'blah'], appDirectory: '/blah/blah', buildForPhysicalDevice: true, @@ -274,7 +274,7 @@ }); testUsingContext('No development team shows message', () async { - final XcodeBuildResult buildResult = new XcodeBuildResult( + final XcodeBuildResult buildResult = XcodeBuildResult( success: false, stdout: ''' Running "flutter packages get" in flutter_gallery... 0.6s @@ -339,7 +339,7 @@ Code signing is required for product type 'Application' in SDK 'iOS 10.3' Could not build the precompiled application for the device.''', - xcodeBuildExecution: new XcodeBuildExecution( + xcodeBuildExecution: XcodeBuildExecution( buildCommands: <String>['xcrun', 'xcodebuild', 'blah'], appDirectory: '/blah/blah', buildForPhysicalDevice: true,
diff --git a/packages/flutter_tools/test/ios/simulators_test.dart b/packages/flutter_tools/test/ios/simulators_test.dart index 5517e35..24507b5 100644 --- a/packages/flutter_tools/test/ios/simulators_test.dart +++ b/packages/flutter_tools/test/ios/simulators_test.dart
@@ -25,14 +25,14 @@ FakePlatform osx; setUp(() { - osx = new FakePlatform.fromPlatform(const LocalPlatform()); + osx = FakePlatform.fromPlatform(const LocalPlatform()); osx.operatingSystem = 'macos'; }); group('logFilePath', () { testUsingContext('defaults to rooted from HOME', () { osx.environment['HOME'] = '/foo/bar'; - expect(new IOSSimulator('123').logFilePath, '/foo/bar/Library/Logs/CoreSimulator/123/system.log'); + expect(IOSSimulator('123').logFilePath, '/foo/bar/Library/Logs/CoreSimulator/123/system.log'); }, overrides: <Type, Generator>{ Platform: () => osx, }, testOn: 'posix'); @@ -40,7 +40,7 @@ testUsingContext('respects IOS_SIMULATOR_LOG_FILE_PATH', () { osx.environment['HOME'] = '/foo/bar'; osx.environment['IOS_SIMULATOR_LOG_FILE_PATH'] = '/baz/qux/%{id}/system.log'; - expect(new IOSSimulator('456').logFilePath, '/baz/qux/456/system.log'); + expect(IOSSimulator('456').logFilePath, '/baz/qux/456/system.log'); }, overrides: <Type, Generator>{ Platform: () => osx, }); @@ -98,13 +98,13 @@ group('sdkMajorVersion', () { // This new version string appears in SimulatorApp-850 CoreSimulator-518.16 beta. test('can be parsed from iOS-11-3', () async { - final IOSSimulator device = new IOSSimulator('x', name: 'iPhone SE', category: 'com.apple.CoreSimulator.SimRuntime.iOS-11-3'); + final IOSSimulator device = IOSSimulator('x', name: 'iPhone SE', category: 'com.apple.CoreSimulator.SimRuntime.iOS-11-3'); expect(await device.sdkMajorVersion, 11); }); test('can be parsed from iOS 11.2', () async { - final IOSSimulator device = new IOSSimulator('x', name: 'iPhone SE', category: 'iOS 11.2'); + final IOSSimulator device = IOSSimulator('x', name: 'iPhone SE', category: 'iOS 11.2'); expect(await device.sdkMajorVersion, 11); }); @@ -112,55 +112,55 @@ group('IOSSimulator.isSupported', () { testUsingContext('Apple TV is unsupported', () { - expect(new IOSSimulator('x', name: 'Apple TV').isSupported(), false); + expect(IOSSimulator('x', name: 'Apple TV').isSupported(), false); }, overrides: <Type, Generator>{ Platform: () => osx, }); testUsingContext('Apple Watch is unsupported', () { - expect(new IOSSimulator('x', name: 'Apple Watch').isSupported(), false); + expect(IOSSimulator('x', name: 'Apple Watch').isSupported(), false); }, overrides: <Type, Generator>{ Platform: () => osx, }); testUsingContext('iPad 2 is supported', () { - expect(new IOSSimulator('x', name: 'iPad 2').isSupported(), true); + expect(IOSSimulator('x', name: 'iPad 2').isSupported(), true); }, overrides: <Type, Generator>{ Platform: () => osx, }); testUsingContext('iPad Retina is supported', () { - expect(new IOSSimulator('x', name: 'iPad Retina').isSupported(), true); + expect(IOSSimulator('x', name: 'iPad Retina').isSupported(), true); }, overrides: <Type, Generator>{ Platform: () => osx, }); testUsingContext('iPhone 5 is supported', () { - expect(new IOSSimulator('x', name: 'iPhone 5').isSupported(), true); + expect(IOSSimulator('x', name: 'iPhone 5').isSupported(), true); }, overrides: <Type, Generator>{ Platform: () => osx, }); testUsingContext('iPhone 5s is supported', () { - expect(new IOSSimulator('x', name: 'iPhone 5s').isSupported(), true); + expect(IOSSimulator('x', name: 'iPhone 5s').isSupported(), true); }, overrides: <Type, Generator>{ Platform: () => osx, }); testUsingContext('iPhone SE is supported', () { - expect(new IOSSimulator('x', name: 'iPhone SE').isSupported(), true); + expect(IOSSimulator('x', name: 'iPhone SE').isSupported(), true); }, overrides: <Type, Generator>{ Platform: () => osx, }); testUsingContext('iPhone 7 Plus is supported', () { - expect(new IOSSimulator('x', name: 'iPhone 7 Plus').isSupported(), true); + expect(IOSSimulator('x', name: 'iPhone 7 Plus').isSupported(), true); }, overrides: <Type, Generator>{ Platform: () => osx, }); testUsingContext('iPhone X is supported', () { - expect(new IOSSimulator('x', name: 'iPhone X').isSupported(), true); + expect(IOSSimulator('x', name: 'iPhone X').isSupported(), true); }, overrides: <Type, Generator>{ Platform: () => osx, }); @@ -172,16 +172,16 @@ IOSSimulator deviceUnderTest; setUp(() { - mockXcode = new MockXcode(); - mockProcessManager = new MockProcessManager(); + mockXcode = MockXcode(); + mockProcessManager = MockProcessManager(); // Let everything else return exit code 0 so process.dart doesn't crash. when( mockProcessManager.run(any, environment: null, workingDirectory: null) ).thenAnswer((Invocation invocation) => - new Future<ProcessResult>.value(new ProcessResult(2, 0, '', '')) + Future<ProcessResult>.value(ProcessResult(2, 0, '', '')) ); // Doesn't matter what the device is. - deviceUnderTest = new IOSSimulator('x', name: 'iPhone SE'); + deviceUnderTest = IOSSimulator('x', name: 'iPhone SE'); }); testUsingContext( @@ -200,7 +200,7 @@ when(mockXcode.majorVersion).thenReturn(8); when(mockXcode.minorVersion).thenReturn(2); expect(deviceUnderTest.supportsScreenshot, true); - final MockFile mockFile = new MockFile(); + final MockFile mockFile = MockFile(); when(mockFile.path).thenReturn(fs.path.join('some', 'path', 'to', 'screenshot.png')); await deviceUnderTest.takeScreenshot(mockFile); verify(mockProcessManager.run( @@ -219,7 +219,7 @@ overrides: <Type, Generator>{ ProcessManager: () => mockProcessManager, // Test a real one. Screenshot doesn't require instance states. - SimControl: () => new SimControl(), + SimControl: () => SimControl(), Xcode: () => mockXcode, } ); @@ -229,13 +229,13 @@ MockProcessManager mockProcessManager; setUp(() { - mockProcessManager = new MockProcessManager(); + mockProcessManager = MockProcessManager(); when(mockProcessManager.start(any, environment: null, workingDirectory: null)) - .thenAnswer((Invocation invocation) => new Future<Process>.value(new MockProcess())); + .thenAnswer((Invocation invocation) => Future<Process>.value(MockProcess())); }); testUsingContext('uses tail on iOS versions prior to iOS 11', () async { - final IOSSimulator device = new IOSSimulator('x', name: 'iPhone SE', category: 'iOS 9.3'); + final IOSSimulator device = IOSSimulator('x', name: 'iPhone SE', category: 'iOS 9.3'); await launchDeviceLogTool(device); expect( verify(mockProcessManager.start(captureAny, environment: null, workingDirectory: null)).captured.single, @@ -247,7 +247,7 @@ }); testUsingContext('uses /usr/bin/log on iOS 11 and above', () async { - final IOSSimulator device = new IOSSimulator('x', name: 'iPhone SE', category: 'iOS 11.0'); + final IOSSimulator device = IOSSimulator('x', name: 'iPhone SE', category: 'iOS 11.0'); await launchDeviceLogTool(device); expect( verify(mockProcessManager.start(captureAny, environment: null, workingDirectory: null)).captured.single, @@ -263,13 +263,13 @@ MockProcessManager mockProcessManager; setUp(() { - mockProcessManager = new MockProcessManager(); + mockProcessManager = MockProcessManager(); when(mockProcessManager.start(any, environment: null, workingDirectory: null)) - .thenAnswer((Invocation invocation) => new Future<Process>.value(new MockProcess())); + .thenAnswer((Invocation invocation) => Future<Process>.value(MockProcess())); }); testUsingContext('uses tail on iOS versions prior to iOS 11', () async { - final IOSSimulator device = new IOSSimulator('x', name: 'iPhone SE', category: 'iOS 9.3'); + final IOSSimulator device = IOSSimulator('x', name: 'iPhone SE', category: 'iOS 9.3'); await launchSystemLogTool(device); expect( verify(mockProcessManager.start(captureAny, environment: null, workingDirectory: null)).captured.single, @@ -281,7 +281,7 @@ }); testUsingContext('uses /usr/bin/log on iOS 11 and above', () async { - final IOSSimulator device = new IOSSimulator('x', name: 'iPhone SE', category: 'iOS 11.0'); + final IOSSimulator device = IOSSimulator('x', name: 'iPhone SE', category: 'iOS 11.0'); await launchSystemLogTool(device); verifyNever(mockProcessManager.start(any, environment: null, workingDirectory: null)); }, @@ -295,16 +295,16 @@ MockIosProject mockIosProject; setUp(() { - mockProcessManager = new MockProcessManager(); - mockIosProject = new MockIosProject(); + mockProcessManager = MockProcessManager(); + mockIosProject = MockIosProject(); }); testUsingContext('simulator can output `)`', () async { when(mockProcessManager.start(any, environment: null, workingDirectory: null)) .thenAnswer((Invocation invocation) { - final Process mockProcess = new MockProcess(); + final Process mockProcess = MockProcess(); when(mockProcess.stdout).thenAnswer((Invocation invocation) => - new Stream<List<int>>.fromIterable(<List<int>>[''' + Stream<List<int>>.fromIterable(<List<int>>[''' 2017-09-13 15:26:57.228948-0700 localhost Runner[37195]: (Flutter) Observatory listening on http://127.0.0.1:57701/ 2017-09-13 15:26:57.228948-0700 localhost Runner[37195]: (Flutter) )))))))))) 2017-09-13 15:26:57.228948-0700 localhost Runner[37195]: (Flutter) #0 Object.noSuchMethod (dart:core-patch/dart:core/object_patch.dart:46)''' @@ -313,13 +313,13 @@ .thenAnswer((Invocation invocation) => const Stream<List<int>>.empty()); // Delay return of exitCode until after stdout stream data, since it terminates the logger. when(mockProcess.exitCode) - .thenAnswer((Invocation invocation) => new Future<int>.delayed(Duration.zero, () => 0)); - return new Future<Process>.value(mockProcess); + .thenAnswer((Invocation invocation) => Future<int>.delayed(Duration.zero, () => 0)); + return Future<Process>.value(mockProcess); }); - final IOSSimulator device = new IOSSimulator('123456', category: 'iOS 11.0'); + final IOSSimulator device = IOSSimulator('123456', category: 'iOS 11.0'); final DeviceLogReader logReader = device.getLogReader( - app: new BuildableIOSApp(mockIosProject), + app: BuildableIOSApp(mockIosProject), ); final List<String> lines = await logReader.logLines.toList(); @@ -370,11 +370,11 @@ SimControl simControl; setUp(() { - mockProcessManager = new MockProcessManager(); + mockProcessManager = MockProcessManager(); when(mockProcessManager.runSync(any)) - .thenReturn(new ProcessResult(mockPid, 0, validSimControlOutput, '')); + .thenReturn(ProcessResult(mockPid, 0, validSimControlOutput, '')); - simControl = new SimControl(); + simControl = SimControl(); }); testUsingContext('getDevices succeeds', () {
diff --git a/packages/flutter_tools/test/ios/xcodeproj_test.dart b/packages/flutter_tools/test/ios/xcodeproj_test.dart index 204fe44..d80fbc1 100644 --- a/packages/flutter_tools/test/ios/xcodeproj_test.dart +++ b/packages/flutter_tools/test/ios/xcodeproj_test.dart
@@ -29,10 +29,10 @@ FileSystem fs; setUp(() { - mockProcessManager = new MockProcessManager(); - xcodeProjectInterpreter = new XcodeProjectInterpreter(); + mockProcessManager = MockProcessManager(); + xcodeProjectInterpreter = XcodeProjectInterpreter(); macOS = fakePlatform('macos'); - fs = new MemoryFileSystem(); + fs = MemoryFileSystem(); fs.file(xcodebuild).createSync(recursive: true); }); @@ -52,7 +52,7 @@ testUsingOsxContext('versionText returns null when xcodebuild is not fully installed', () { when(mockProcessManager.runSync(<String>[xcodebuild, '-version'])).thenReturn( - new ProcessResult( + ProcessResult( 0, 1, "xcode-select: error: tool 'xcodebuild' requires Xcode, " @@ -66,43 +66,43 @@ testUsingOsxContext('versionText returns formatted version text', () { when(mockProcessManager.runSync(<String>[xcodebuild, '-version'])) - .thenReturn(new ProcessResult(1, 0, 'Xcode 8.3.3\nBuild version 8E3004b', '')); + .thenReturn(ProcessResult(1, 0, 'Xcode 8.3.3\nBuild version 8E3004b', '')); expect(xcodeProjectInterpreter.versionText, 'Xcode 8.3.3, Build version 8E3004b'); }); testUsingOsxContext('versionText handles Xcode version string with unexpected format', () { when(mockProcessManager.runSync(<String>[xcodebuild, '-version'])) - .thenReturn(new ProcessResult(1, 0, 'Xcode Ultra5000\nBuild version 8E3004b', '')); + .thenReturn(ProcessResult(1, 0, 'Xcode Ultra5000\nBuild version 8E3004b', '')); expect(xcodeProjectInterpreter.versionText, 'Xcode Ultra5000, Build version 8E3004b'); }); testUsingOsxContext('majorVersion returns major version', () { when(mockProcessManager.runSync(<String>[xcodebuild, '-version'])) - .thenReturn(new ProcessResult(1, 0, 'Xcode 8.3.3\nBuild version 8E3004b', '')); + .thenReturn(ProcessResult(1, 0, 'Xcode 8.3.3\nBuild version 8E3004b', '')); expect(xcodeProjectInterpreter.majorVersion, 8); }); testUsingOsxContext('majorVersion is null when version has unexpected format', () { when(mockProcessManager.runSync(<String>[xcodebuild, '-version'])) - .thenReturn(new ProcessResult(1, 0, 'Xcode Ultra5000\nBuild version 8E3004b', '')); + .thenReturn(ProcessResult(1, 0, 'Xcode Ultra5000\nBuild version 8E3004b', '')); expect(xcodeProjectInterpreter.majorVersion, isNull); }); testUsingOsxContext('minorVersion returns minor version', () { when(mockProcessManager.runSync(<String>[xcodebuild, '-version'])) - .thenReturn(new ProcessResult(1, 0, 'Xcode 8.3.3\nBuild version 8E3004b', '')); + .thenReturn(ProcessResult(1, 0, 'Xcode 8.3.3\nBuild version 8E3004b', '')); expect(xcodeProjectInterpreter.minorVersion, 3); }); testUsingOsxContext('minorVersion returns 0 when minor version is unspecified', () { when(mockProcessManager.runSync(<String>[xcodebuild, '-version'])) - .thenReturn(new ProcessResult(1, 0, 'Xcode 8\nBuild version 8E3004b', '')); + .thenReturn(ProcessResult(1, 0, 'Xcode 8\nBuild version 8E3004b', '')); expect(xcodeProjectInterpreter.minorVersion, 0); }); testUsingOsxContext('minorVersion is null when version has unexpected format', () { when(mockProcessManager.runSync(<String>[xcodebuild, '-version'])) - .thenReturn(new ProcessResult(1, 0, 'Xcode Ultra5000\nBuild version 8E3004b', '')); + .thenReturn(ProcessResult(1, 0, 'Xcode Ultra5000\nBuild version 8E3004b', '')); expect(xcodeProjectInterpreter.minorVersion, isNull); }); @@ -120,7 +120,7 @@ testUsingOsxContext('isInstalled is false when Xcode is not fully installed', () { when(mockProcessManager.runSync(<String>[xcodebuild, '-version'])).thenReturn( - new ProcessResult( + ProcessResult( 0, 1, "xcode-select: error: tool 'xcodebuild' requires Xcode, " @@ -134,13 +134,13 @@ testUsingOsxContext('isInstalled is false when version has unexpected format', () { when(mockProcessManager.runSync(<String>[xcodebuild, '-version'])) - .thenReturn(new ProcessResult(1, 0, 'Xcode Ultra5000\nBuild version 8E3004b', '')); + .thenReturn(ProcessResult(1, 0, 'Xcode Ultra5000\nBuild version 8E3004b', '')); expect(xcodeProjectInterpreter.isInstalled, isFalse); }); testUsingOsxContext('isInstalled is true when version has expected format', () { when(mockProcessManager.runSync(<String>[xcodebuild, '-version'])) - .thenReturn(new ProcessResult(1, 0, 'Xcode 8.3.3\nBuild version 8E3004b', '')); + .thenReturn(ProcessResult(1, 0, 'Xcode 8.3.3\nBuild version 8E3004b', '')); expect(xcodeProjectInterpreter.isInstalled, isTrue); }); }); @@ -161,7 +161,7 @@ Runner '''; - final XcodeProjectInfo info = new XcodeProjectInfo.fromXcodeBuildOutput(output); + final XcodeProjectInfo info = XcodeProjectInfo.fromXcodeBuildOutput(output); expect(info.targets, <String>['Runner']); expect(info.schemes, <String>['Runner']); expect(info.buildConfigurations, <String>['Debug', 'Release']); @@ -185,7 +185,7 @@ Paid '''; - final XcodeProjectInfo info = new XcodeProjectInfo.fromXcodeBuildOutput(output); + final XcodeProjectInfo info = XcodeProjectInfo.fromXcodeBuildOutput(output); expect(info.targets, <String>['Runner']); expect(info.schemes, <String>['Free', 'Paid']); expect(info.buildConfigurations, <String>['Debug (Free)', 'Debug (Paid)', 'Release (Free)', 'Release (Paid)']); @@ -211,20 +211,20 @@ expect(XcodeProjectInfo.expectedBuildConfigurationFor(const BuildInfo(BuildMode.release, 'Hello'), 'Hello'), 'Release-Hello'); }); test('scheme for default project is Runner', () { - final XcodeProjectInfo info = new XcodeProjectInfo(<String>['Runner'], <String>['Debug', 'Release'], <String>['Runner']); + final XcodeProjectInfo info = XcodeProjectInfo(<String>['Runner'], <String>['Debug', 'Release'], <String>['Runner']); expect(info.schemeFor(BuildInfo.debug), 'Runner'); expect(info.schemeFor(BuildInfo.profile), 'Runner'); expect(info.schemeFor(BuildInfo.release), 'Runner'); expect(info.schemeFor(const BuildInfo(BuildMode.debug, 'unknown')), isNull); }); test('build configuration for default project is matched against BuildMode', () { - final XcodeProjectInfo info = new XcodeProjectInfo(<String>['Runner'], <String>['Debug', 'Release'], <String>['Runner']); + final XcodeProjectInfo info = XcodeProjectInfo(<String>['Runner'], <String>['Debug', 'Release'], <String>['Runner']); expect(info.buildConfigurationFor(BuildInfo.debug, 'Runner'), 'Debug'); expect(info.buildConfigurationFor(BuildInfo.profile, 'Runner'), 'Release'); expect(info.buildConfigurationFor(BuildInfo.release, 'Runner'), 'Release'); }); test('scheme for project with custom schemes is matched against flavor', () { - final XcodeProjectInfo info = new XcodeProjectInfo( + final XcodeProjectInfo info = XcodeProjectInfo( <String>['Runner'], <String>['Debug (Free)', 'Debug (Paid)', 'Release (Free)', 'Release (Paid)'], <String>['Free', 'Paid'], @@ -236,7 +236,7 @@ expect(info.schemeFor(const BuildInfo(BuildMode.debug, 'unknown')), isNull); }); test('build configuration for project with custom schemes is matched against BuildMode and flavor', () { - final XcodeProjectInfo info = new XcodeProjectInfo( + final XcodeProjectInfo info = XcodeProjectInfo( <String>['Runner'], <String>['debug (free)', 'Debug paid', 'release - Free', 'Release-Paid'], <String>['Free', 'Paid'], @@ -247,7 +247,7 @@ expect(info.buildConfigurationFor(const BuildInfo(BuildMode.release, 'paid'), 'Paid'), 'Release-Paid'); }); test('build configuration for project with inconsistent naming is null', () { - final XcodeProjectInfo info = new XcodeProjectInfo( + final XcodeProjectInfo info = XcodeProjectInfo( <String>['Runner'], <String>['Debug-F', 'Dbg Paid', 'Rel Free', 'Release Full'], <String>['Free', 'Paid'], @@ -265,9 +265,9 @@ FileSystem fs; setUp(() { - fs = new MemoryFileSystem(); - mockArtifacts = new MockLocalEngineArtifacts(); - mockProcessManager = new MockProcessManager(); + fs = MemoryFileSystem(); + mockArtifacts = MockLocalEngineArtifacts(); + mockProcessManager = MockProcessManager(); macOS = fakePlatform('macos'); fs.file(xcodebuild).createSync(recursive: true); }); @@ -515,7 +515,7 @@ } Platform fakePlatform(String name) { - return new FakePlatform.fromPlatform(const LocalPlatform())..operatingSystem = name; + return FakePlatform.fromPlatform(const LocalPlatform())..operatingSystem = name; } class MockLocalEngineArtifacts extends Mock implements LocalEngineArtifacts {}
diff --git a/packages/flutter_tools/test/project_test.dart b/packages/flutter_tools/test/project_test.dart index 5ab8100..aa737b0 100644 --- a/packages/flutter_tools/test/project_test.dart +++ b/packages/flutter_tools/test/project_test.dart
@@ -137,7 +137,7 @@ group('ensure ready for platform-specific tooling', () { testInMemory('does nothing, if project is not created', () async { - final FlutterProject project = new FlutterProject( + final FlutterProject project = FlutterProject( fs.directory('not_created'), FlutterManifest.empty(), FlutterManifest.empty(), @@ -229,9 +229,9 @@ MockIOSWorkflow mockIOSWorkflow; MockXcodeProjectInterpreter mockXcodeProjectInterpreter; setUp(() { - fs = new MemoryFileSystem(); - mockIOSWorkflow = new MockIOSWorkflow(); - mockXcodeProjectInterpreter = new MockXcodeProjectInterpreter(); + fs = MemoryFileSystem(); + mockIOSWorkflow = MockIOSWorkflow(); + mockXcodeProjectInterpreter = MockXcodeProjectInterpreter(); }); void testWithMocks(String description, Future<Null> testMethod()) { @@ -367,12 +367,12 @@ /// is in memory. void testInMemory(String description, Future<Null> testMethod()) { Cache.flutterRoot = getFlutterRoot(); - final FileSystem testFileSystem = new MemoryFileSystem( + final FileSystem testFileSystem = MemoryFileSystem( style: platform.isWindows ? FileSystemStyle.windows : FileSystemStyle.posix, ); // Transfer needed parts of the Flutter installation folder // to the in-memory file system used during testing. - transfer(new Cache().getArtifactDirectory('gradle_wrapper'), testFileSystem); + transfer(Cache().getArtifactDirectory('gradle_wrapper'), testFileSystem); transfer(fs.directory(Cache.flutterRoot) .childDirectory('packages') .childDirectory('flutter_tools') @@ -386,7 +386,7 @@ testMethod, overrides: <Type, Generator>{ FileSystem: () => testFileSystem, - Cache: () => new Cache(), + Cache: () => Cache(), }, ); }
diff --git a/packages/flutter_tools/test/protocol_discovery_test.dart b/packages/flutter_tools/test/protocol_discovery_test.dart index 1b84b11..0f4fb42 100644 --- a/packages/flutter_tools/test/protocol_discovery_test.dart +++ b/packages/flutter_tools/test/protocol_discovery_test.dart
@@ -35,8 +35,8 @@ /// /// See also: [runZoned] void initialize() { - logReader = new MockDeviceLogReader(); - discoverer = new ProtocolDiscovery.observatory(logReader); + logReader = MockDeviceLogReader(); + discoverer = ProtocolDiscovery.observatory(logReader); } tearDown(() { @@ -124,10 +124,10 @@ group('port forwarding', () { testUsingContext('default port', () async { - final MockDeviceLogReader logReader = new MockDeviceLogReader(); - final ProtocolDiscovery discoverer = new ProtocolDiscovery.observatory( + final MockDeviceLogReader logReader = MockDeviceLogReader(); + final ProtocolDiscovery discoverer = ProtocolDiscovery.observatory( logReader, - portForwarder: new MockPortForwarder(99), + portForwarder: MockPortForwarder(99), ); // Get next port future. @@ -142,10 +142,10 @@ }); testUsingContext('specified port', () async { - final MockDeviceLogReader logReader = new MockDeviceLogReader(); - final ProtocolDiscovery discoverer = new ProtocolDiscovery.observatory( + final MockDeviceLogReader logReader = MockDeviceLogReader(); + final ProtocolDiscovery discoverer = ProtocolDiscovery.observatory( logReader, - portForwarder: new MockPortForwarder(99), + portForwarder: MockPortForwarder(99), hostPort: 1243, ); @@ -161,10 +161,10 @@ }); testUsingContext('specified port zero', () async { - final MockDeviceLogReader logReader = new MockDeviceLogReader(); - final ProtocolDiscovery discoverer = new ProtocolDiscovery.observatory( + final MockDeviceLogReader logReader = MockDeviceLogReader(); + final ProtocolDiscovery discoverer = ProtocolDiscovery.observatory( logReader, - portForwarder: new MockPortForwarder(99), + portForwarder: MockPortForwarder(99), hostPort: 0, ); @@ -180,10 +180,10 @@ }); testUsingContext('ipv6', () async { - final MockDeviceLogReader logReader = new MockDeviceLogReader(); - final ProtocolDiscovery discoverer = new ProtocolDiscovery.observatory( + final MockDeviceLogReader logReader = MockDeviceLogReader(); + final ProtocolDiscovery discoverer = ProtocolDiscovery.observatory( logReader, - portForwarder: new MockPortForwarder(99), + portForwarder: MockPortForwarder(99), hostPort: 54777, ipv6: true, ); @@ -200,10 +200,10 @@ }); testUsingContext('ipv6 with Ascii Escape code', () async { - final MockDeviceLogReader logReader = new MockDeviceLogReader(); - final ProtocolDiscovery discoverer = new ProtocolDiscovery.observatory( + final MockDeviceLogReader logReader = MockDeviceLogReader(); + final ProtocolDiscovery discoverer = ProtocolDiscovery.observatory( logReader, - portForwarder: new MockPortForwarder(99), + portForwarder: MockPortForwarder(99), hostPort: 54777, ipv6: true, );
diff --git a/packages/flutter_tools/test/resident_runner_test.dart b/packages/flutter_tools/test/resident_runner_test.dart index 55eeab1..fd50df4 100644 --- a/packages/flutter_tools/test/resident_runner_test.dart +++ b/packages/flutter_tools/test/resident_runner_test.dart
@@ -46,8 +46,8 @@ TestRunner createTestRunner() { // TODO(jacobr): make these tests run with `trackWidgetCreation: true` as // well as the default flags. - return new TestRunner( - <FlutterDevice>[new FlutterDevice(new MockDevice(), trackWidgetCreation: false)], + return TestRunner( + <FlutterDevice>[FlutterDevice(MockDevice(), trackWidgetCreation: false)], ); }
diff --git a/packages/flutter_tools/test/runner/flutter_command_runner_test.dart b/packages/flutter_tools/test/runner/flutter_command_runner_test.dart index 827692a..bda0f61 100644 --- a/packages/flutter_tools/test/runner/flutter_command_runner_test.dart +++ b/packages/flutter_tools/test/runner/flutter_command_runner_test.dart
@@ -30,16 +30,16 @@ }); setUp(() { - fs = new MemoryFileSystem(); + fs = MemoryFileSystem(); fs.directory(_kFlutterRoot).createSync(recursive: true); fs.directory(_kProjectRoot).createSync(recursive: true); fs.currentDirectory = _kProjectRoot; - platform = new FakePlatform(environment: <String, String>{ + platform = FakePlatform(environment: <String, String>{ 'FLUTTER_ROOT': _kFlutterRoot, }); - runner = createTestCommandRunner(new DummyFlutterCommand()); + runner = createTestCommandRunner(DummyFlutterCommand()); }); group('run', () {
diff --git a/packages/flutter_tools/test/runner/flutter_command_test.dart b/packages/flutter_tools/test/runner/flutter_command_test.dart index f5c5b08..29ab6df 100644 --- a/packages/flutter_tools/test/runner/flutter_command_test.dart +++ b/packages/flutter_tools/test/runner/flutter_command_test.dart
@@ -24,17 +24,17 @@ List<int> mockTimes; setUp(() { - cache = new MockCache(); - clock = new MockClock(); - usage = new MockUsage(); + cache = MockCache(); + clock = MockClock(); + usage = MockUsage(); when(usage.isFirstRun).thenReturn(false); when(clock.now()).thenAnswer( - (Invocation _) => new DateTime.fromMillisecondsSinceEpoch(mockTimes.removeAt(0)) + (Invocation _) => DateTime.fromMillisecondsSinceEpoch(mockTimes.removeAt(0)) ); }); testUsingContext('honors shouldUpdateCache false', () async { - final DummyFlutterCommand flutterCommand = new DummyFlutterCommand(shouldUpdateCache: false); + final DummyFlutterCommand flutterCommand = DummyFlutterCommand(shouldUpdateCache: false); await flutterCommand.run(); verifyZeroInteractions(cache); }, @@ -43,7 +43,7 @@ }); testUsingContext('honors shouldUpdateCache true', () async { - final DummyFlutterCommand flutterCommand = new DummyFlutterCommand(shouldUpdateCache: true); + final DummyFlutterCommand flutterCommand = DummyFlutterCommand(shouldUpdateCache: true); await flutterCommand.run(); verify(cache.updateAll()).called(1); }, @@ -55,7 +55,7 @@ // Crash if called a third time which is unexpected. mockTimes = <int>[1000, 2000]; - final DummyFlutterCommand flutterCommand = new DummyFlutterCommand(); + final DummyFlutterCommand flutterCommand = DummyFlutterCommand(); await flutterCommand.run(); verify(clock.now()).called(2); @@ -76,7 +76,7 @@ mockTimes = <int>[1000, 2000]; final DummyFlutterCommand flutterCommand = - new DummyFlutterCommand(noUsagePath: true); + DummyFlutterCommand(noUsagePath: true); await flutterCommand.run(); verify(clock.now()).called(2); verifyNever(usage.sendTiming( @@ -92,14 +92,14 @@ // Crash if called a third time which is unexpected. mockTimes = <int>[1000, 2000]; - final FlutterCommandResult commandResult = new FlutterCommandResult( + final FlutterCommandResult commandResult = FlutterCommandResult( ExitStatus.success, // nulls should be cleaned up. timingLabelParts: <String> ['blah1', 'blah2', null, 'blah3'], - endTimeOverride: new DateTime.fromMillisecondsSinceEpoch(1500) + endTimeOverride: DateTime.fromMillisecondsSinceEpoch(1500) ); - final DummyFlutterCommand flutterCommand = new DummyFlutterCommand( + final DummyFlutterCommand flutterCommand = DummyFlutterCommand( commandFunction: () async => commandResult ); await flutterCommand.run(); @@ -125,7 +125,7 @@ // Crash if called a third time which is unexpected. mockTimes = <int>[1000, 2000]; - final DummyFlutterCommand flutterCommand = new DummyFlutterCommand( + final DummyFlutterCommand flutterCommand = DummyFlutterCommand( commandFunction: () async { throwToolExit('fail'); return null; // unreachable
diff --git a/packages/flutter_tools/test/src/common.dart b/packages/flutter_tools/test/src/common.dart index b932cf8..2424667 100644 --- a/packages/flutter_tools/test/src/common.dart +++ b/packages/flutter_tools/test/src/common.dart
@@ -20,7 +20,7 @@ /// A matcher that compares the type of the actual value to the type argument T. // TODO(ianh): Remove this once https://github.com/dart-lang/matcher/issues/98 is fixed -Matcher isInstanceOf<T>() => new test_package.TypeMatcher<T>(); // ignore: prefer_const_constructors, https://github.com/dart-lang/sdk/issues/32544 +Matcher isInstanceOf<T>() => test_package.TypeMatcher<T>(); // ignore: prefer_const_constructors, https://github.com/dart-lang/sdk/issues/32544 void tryToDelete(Directory directory) { // This should not be necessary, but it turns out that @@ -42,7 +42,7 @@ if (platform.environment.containsKey('FLUTTER_ROOT')) return platform.environment['FLUTTER_ROOT']; - Error invalidScript() => new StateError('Invalid script: ${platform.script}'); + Error invalidScript() => StateError('Invalid script: ${platform.script}'); Uri scriptUri; switch (platform.script.scheme) { @@ -50,7 +50,7 @@ scriptUri = platform.script; break; case 'data': - final RegExp flutterTools = new RegExp(r'(file://[^"]*[/\\]flutter_tools[/\\][^"]+\.dart)', multiLine: true); + final RegExp flutterTools = RegExp(r'(file://[^"]*[/\\]flutter_tools[/\\][^"]+\.dart)', multiLine: true); final Match match = flutterTools.firstMatch(Uri.decodeFull(platform.script.path)); if (match == null) throw invalidScript(); @@ -69,7 +69,7 @@ } CommandRunner<Null> createTestCommandRunner([FlutterCommand command]) { - final FlutterCommandRunner runner = new FlutterCommandRunner(); + final FlutterCommandRunner runner = FlutterCommandRunner(); if (command != null) runner.addCommand(command); return runner; @@ -79,7 +79,7 @@ void updateFileModificationTime(String path, DateTime baseTime, int seconds) { - final DateTime modificationTime = baseTime.add(new Duration(seconds: seconds)); + final DateTime modificationTime = baseTime.add(Duration(seconds: seconds)); fs.file(path).setLastModifiedSync(modificationTime); } @@ -112,7 +112,7 @@ Future<String> createProject(Directory temp, {List<String> arguments}) async { arguments ??= <String>['--no-pub']; final String projectPath = fs.path.join(temp.path, 'flutter_project'); - final CreateCommand command = new CreateCommand(); + final CreateCommand command = CreateCommand(); final CommandRunner<Null> runner = createTestCommandRunner(command); await runner.run(<String>['create']..addAll(arguments)..add(projectPath)); return projectPath;
diff --git a/packages/flutter_tools/test/src/context.dart b/packages/flutter_tools/test/src/context.dart index bc37d0e..0885212 100644 --- a/packages/flutter_tools/test/src/context.dart +++ b/packages/flutter_tools/test/src/context.dart
@@ -58,7 +58,7 @@ final File settingsFile = fs.file( fs.path.join(configDir.path, '.flutter_settings') ); - return new Config(settingsFile); + return Config(settingsFile); } test(description, () async { @@ -67,20 +67,20 @@ name: 'mocks', overrides: <Type, Generator>{ Config: () => buildConfig(fs), - DeviceManager: () => new MockDeviceManager(), - Doctor: () => new MockDoctor(), - FlutterVersion: () => new MockFlutterVersion(), - HttpClient: () => new MockHttpClient(), + DeviceManager: () => MockDeviceManager(), + Doctor: () => MockDoctor(), + FlutterVersion: () => MockFlutterVersion(), + HttpClient: () => MockHttpClient(), IOSSimulatorUtils: () { - final MockIOSSimulatorUtils mock = new MockIOSSimulatorUtils(); + final MockIOSSimulatorUtils mock = MockIOSSimulatorUtils(); when(mock.getAttachedDevices()).thenReturn(<IOSSimulator>[]); return mock; }, - Logger: () => new BufferLogger(), - OperatingSystemUtils: () => new MockOperatingSystemUtils(), - SimControl: () => new MockSimControl(), - Usage: () => new MockUsage(), - XcodeProjectInterpreter: () => new MockXcodeProjectInterpreter(), + Logger: () => BufferLogger(), + OperatingSystemUtils: () => MockOperatingSystemUtils(), + SimControl: () => MockSimControl(), + Usage: () => MockUsage(), + XcodeProjectInterpreter: () => MockXcodeProjectInterpreter(), }, body: () { final String flutterRoot = getFlutterRoot(); @@ -154,11 +154,11 @@ } @override - Stream<Device> getAllConnectedDevices() => new Stream<Device>.fromIterable(devices); + Stream<Device> getAllConnectedDevices() => Stream<Device>.fromIterable(devices); @override Stream<Device> getDevicesById(String deviceId) { - return new Stream<Device>.fromIterable( + return Stream<Device>.fromIterable( devices.where((Device device) => device.id == deviceId)); } @@ -200,7 +200,7 @@ final List<DoctorValidator> superValidators = super.validators; return superValidators.map((DoctorValidator v) { if (v is AndroidValidator) { - return new MockAndroidWorkflowValidator(); + return MockAndroidWorkflowValidator(); } return v; }).toList(); @@ -261,7 +261,7 @@ Stream<Map<String, dynamic>> get onSend => null; @override - Future<Null> ensureAnalyticsSent() => new Future<Null>.value(); + Future<Null> ensureAnalyticsSent() => Future<Null>.value(); @override void printWelcome() { } @@ -287,7 +287,7 @@ @override XcodeProjectInfo getInfo(String projectPath) { - return new XcodeProjectInfo( + return XcodeProjectInfo( <String>['Runner'], <String>['Debug', 'Release'], <String>['Runner'],
diff --git a/packages/flutter_tools/test/src/mocks.dart b/packages/flutter_tools/test/src/mocks.dart index b87a343..1aab448 100644 --- a/packages/flutter_tools/test/src/mocks.dart +++ b/packages/flutter_tools/test/src/mocks.dart
@@ -26,12 +26,12 @@ class MockApplicationPackageStore extends ApplicationPackageStore { MockApplicationPackageStore() : super( - android: new AndroidApk( + android: AndroidApk( id: 'io.flutter.android.mock', file: fs.file('/mock/path/to/android/SkyShell.apk'), launchActivity: 'io.flutter.android.mock.MockActivity' ), - iOS: new BuildableIOSApp(new MockIosProject()) + iOS: BuildableIOSApp(MockIosProject()) ); } @@ -113,7 +113,7 @@ /// A ProcessManager that starts Processes by delegating to a ProcessFactory. class MockProcessManager implements ProcessManager { - ProcessFactory processFactory = (List<String> commands) => new MockProcess(); + ProcessFactory processFactory = (List<String> commands) => MockProcess(); bool succeed = true; List<String> commands; @@ -132,11 +132,11 @@ if (!succeed) { final String executable = command[0]; final List<String> arguments = command.length > 1 ? command.sublist(1) : <String>[]; - throw new ProcessException(executable, arguments); + throw ProcessException(executable, arguments); } commands = command; - return new Future<Process>.value(processFactory(command)); + return Future<Process>.value(processFactory(command)); } @override @@ -151,8 +151,8 @@ Stream<List<int>> stdin, this.stdout = const Stream<List<int>>.empty(), this.stderr = const Stream<List<int>>.empty(), - }) : exitCode = exitCode ?? new Future<int>.value(0), - stdin = stdin ?? new MemoryIOSink(); + }) : exitCode = exitCode ?? Future<int>.value(0), + stdin = stdin ?? MemoryIOSink(); @override final int pid; @@ -185,8 +185,8 @@ await _stdoutController.close(); } - final StreamController<List<int>> _stdoutController = new StreamController<List<int>>(); - final CompleterIOSink _stdin = new CompleterIOSink(); + final StreamController<List<int>> _stdoutController = StreamController<List<int>>(); + final CompleterIOSink _stdin = CompleterIOSink(); @override Stream<List<int>> get stdout => _stdoutController.stream; @@ -209,7 +209,7 @@ /// An IOSink that completes a future with the first line written to it. class CompleterIOSink extends MemoryIOSink { - final Completer<List<int>> _completer = new Completer<List<int>>(); + final Completer<List<int>> _completer = Completer<List<int>>(); Future<List<int>> get future => _completer.future; @@ -235,7 +235,7 @@ @override Future<Null> addStream(Stream<List<int>> stream) { - final Completer<Null> completer = new Completer<Null>(); + final Completer<Null> completer = Completer<Null>(); stream.listen((List<int> data) { add(data); }).onDone(() => completer.complete(null)); @@ -271,7 +271,7 @@ @override void addError(dynamic error, [StackTrace stackTrace]) { - throw new UnimplementedError(); + throw UnimplementedError(); } @override @@ -286,8 +286,8 @@ /// A Stdio that collects stdout and supports simulated stdin. class MockStdio extends Stdio { - final MemoryIOSink _stdout = new MemoryIOSink(); - final StreamController<List<int>> _stdin = new StreamController<List<int>>(); + final MemoryIOSink _stdout = MemoryIOSink(); + final StreamController<List<int>> _stdin = StreamController<List<int>>(); @override IOSink get stdout => _stdout; @@ -304,8 +304,8 @@ class MockPollingDeviceDiscovery extends PollingDeviceDiscovery { final List<Device> _devices = <Device>[]; - final StreamController<Device> _onAddedController = new StreamController<Device>.broadcast(); - final StreamController<Device> _onRemovedController = new StreamController<Device>.broadcast(); + final StreamController<Device> _onAddedController = StreamController<Device>.broadcast(); + final StreamController<Device> _onRemovedController = StreamController<Device>.broadcast(); MockPollingDeviceDiscovery() : super('mock'); @@ -370,7 +370,7 @@ @override String get name => 'MockLogReader'; - final StreamController<String> _linesController = new StreamController<String>.broadcast(); + final StreamController<String> _linesController = StreamController<String>.broadcast(); @override Stream<String> get logLines => _linesController.stream; @@ -384,7 +384,7 @@ void applyMocksToCommand(FlutterCommand command) { command - ..applicationPackages = new MockApplicationPackageStore(); + ..applicationPackages = MockApplicationPackageStore(); } /// Common functionality for tracking mock interaction @@ -392,7 +392,7 @@ final List<String> messages = <String>[]; void expectMessages(List<String> expectedMessages) { - final List<String> actualMessages = new List<String>.from(messages); + final List<String> actualMessages = List<String>.from(messages); messages.clear(); expect(actualMessages, unorderedEquals(expectedMessages)); } @@ -461,6 +461,6 @@ Future<CompilerOutput> recompile(String mainPath, List<String> invalidatedFiles, {String outputPath, String packagesFilePath}) async { fs.file(outputPath).createSync(recursive: true); fs.file(outputPath).writeAsStringSync('compiled_kernel_output'); - return new CompilerOutput(outputPath, 0); + return CompilerOutput(outputPath, 0); } }
diff --git a/packages/flutter_tools/test/stop_test.dart b/packages/flutter_tools/test/stop_test.dart index e74e42a..b30813d 100644 --- a/packages/flutter_tools/test/stop_test.dart +++ b/packages/flutter_tools/test/stop_test.dart
@@ -19,19 +19,19 @@ }); testUsingContext('returns 0 when Android is connected and ready to be stopped', () async { - final StopCommand command = new StopCommand(); + final StopCommand command = StopCommand(); applyMocksToCommand(command); - final MockAndroidDevice device = new MockAndroidDevice(); - when(device.stopApp(any)).thenAnswer((Invocation invocation) => new Future<bool>.value(true)); + final MockAndroidDevice device = MockAndroidDevice(); + when(device.stopApp(any)).thenAnswer((Invocation invocation) => Future<bool>.value(true)); testDeviceManager.addDevice(device); await createTestCommandRunner(command).run(<String>['stop']); }); testUsingContext('returns 0 when iOS is connected and ready to be stopped', () async { - final StopCommand command = new StopCommand(); + final StopCommand command = StopCommand(); applyMocksToCommand(command); - final MockIOSDevice device = new MockIOSDevice(); - when(device.stopApp(any)).thenAnswer((Invocation invocation) => new Future<bool>.value(true)); + final MockIOSDevice device = MockIOSDevice(); + when(device.stopApp(any)).thenAnswer((Invocation invocation) => Future<bool>.value(true)); testDeviceManager.addDevice(device); await createTestCommandRunner(command).run(<String>['stop']);
diff --git a/packages/flutter_tools/test/tester/flutter_tester_test.dart b/packages/flutter_tools/test/tester/flutter_tester_test.dart index 3ca867d..5b7aa26 100644 --- a/packages/flutter_tools/test/tester/flutter_tester_test.dart +++ b/packages/flutter_tools/test/tester/flutter_tester_test.dart
@@ -24,7 +24,7 @@ MemoryFileSystem fs; setUp(() { - fs = new MemoryFileSystem(); + fs = MemoryFileSystem(); }); group('FlutterTesterApp', () { @@ -33,7 +33,7 @@ await fs.directory(projectPath).create(recursive: true); fs.currentDirectory = projectPath; - final FlutterTesterApp app = new FlutterTesterApp.fromCurrentDirectory(); + final FlutterTesterApp app = FlutterTesterApp.fromCurrentDirectory(); expect(app.name, 'my_project'); expect(app.packagesFile.path, fs.path.join(projectPath, '.packages')); }, overrides: <Type, Generator>{ @@ -47,7 +47,7 @@ }); testUsingContext('no device', () async { - final FlutterTesterDevices discoverer = new FlutterTesterDevices(); + final FlutterTesterDevices discoverer = FlutterTesterDevices(); final List<Device> devices = await discoverer.devices; expect(devices, isEmpty); @@ -55,7 +55,7 @@ testUsingContext('has device', () async { FlutterTesterDevices.showFlutterTesterDevice = true; - final FlutterTesterDevices discoverer = new FlutterTesterDevices(); + final FlutterTesterDevices discoverer = FlutterTesterDevices(); final List<Device> devices = await discoverer.devices; expect(devices, hasLength(1)); @@ -71,7 +71,7 @@ List<String> logLines; setUp(() { - device = new FlutterTesterDevice('flutter-tester'); + device = FlutterTesterDevice('flutter-tester'); logLines = <String>[]; device.getLogReader().logLines.listen(logLines.add); @@ -105,9 +105,9 @@ MockProcess mockProcess; final Map<Type, Generator> startOverrides = <Type, Generator>{ - Platform: () => new FakePlatform(operatingSystem: 'linux'), + Platform: () => FakePlatform(operatingSystem: 'linux'), FileSystem: () => fs, - Cache: () => new Cache(rootOverride: fs.directory(flutterRoot)), + Cache: () => Cache(rootOverride: fs.directory(flutterRoot)), ProcessManager: () => mockProcessManager, KernelCompiler: () => mockKernelCompiler, Artifacts: () => mockArtifacts, @@ -125,22 +125,22 @@ projectPath = fs.path.join('home', 'me', 'hello'); mainPath = fs.path.join(projectPath, 'lin', 'main.dart'); - mockProcessManager = new MockProcessManager(); + mockProcessManager = MockProcessManager(); mockProcessManager.processFactory = (List<String> commands) => mockProcess; - mockArtifacts = new MockArtifacts(); + mockArtifacts = MockArtifacts(); final String artifactPath = fs.path.join(flutterRoot, 'artifact'); fs.file(artifactPath).createSync(recursive: true); when(mockArtifacts.getArtifactPath(any)).thenReturn(artifactPath); - mockKernelCompiler = new MockKernelCompiler(); + mockKernelCompiler = MockKernelCompiler(); }); testUsingContext('not debug', () async { final LaunchResult result = await device.startApp(null, mainPath: mainPath, - debuggingOptions: new DebuggingOptions.disabled(const BuildInfo(BuildMode.release, null))); + debuggingOptions: DebuggingOptions.disabled(const BuildInfo(BuildMode.release, null))); expect(result.started, isFalse); }, overrides: startOverrides); @@ -149,14 +149,14 @@ expect(() async { await device.startApp(null, mainPath: mainPath, - debuggingOptions: new DebuggingOptions.disabled(const BuildInfo(BuildMode.debug, null))); + debuggingOptions: DebuggingOptions.disabled(const BuildInfo(BuildMode.debug, null))); }, throwsToolExit()); }, overrides: startOverrides); testUsingContext('start', () async { final Uri observatoryUri = Uri.parse('http://127.0.0.1:6666/'); - mockProcess = new MockProcess( - stdout: new Stream<List<int>>.fromIterable(<List<int>>[ + mockProcess = MockProcess( + stdout: Stream<List<int>>.fromIterable(<List<int>>[ ''' Observatory listening on $observatoryUri Hello! @@ -177,12 +177,12 @@ packagesPath: anyNamed('packagesPath'), )).thenAnswer((_) async { fs.file('$mainPath.dill').createSync(recursive: true); - return new CompilerOutput('$mainPath.dill', 0); + return CompilerOutput('$mainPath.dill', 0); }); final LaunchResult result = await device.startApp(null, mainPath: mainPath, - debuggingOptions: new DebuggingOptions.enabled(const BuildInfo(BuildMode.debug, null))); + debuggingOptions: DebuggingOptions.enabled(const BuildInfo(BuildMode.debug, null))); expect(result.started, isTrue); expect(result.observatoryUri, observatoryUri);
diff --git a/packages/flutter_tools/test/trace_test.dart b/packages/flutter_tools/test/trace_test.dart index d824934..f8cbcc4 100644 --- a/packages/flutter_tools/test/trace_test.dart +++ b/packages/flutter_tools/test/trace_test.dart
@@ -12,7 +12,7 @@ void main() { group('trace', () { testUsingContext('returns 1 when no Android device is connected', () async { - final TraceCommand command = new TraceCommand(); + final TraceCommand command = TraceCommand(); applyMocksToCommand(command); try { await createTestCommandRunner(command).run(<String>['trace']);
diff --git a/packages/flutter_tools/test/utils_test.dart b/packages/flutter_tools/test/utils_test.dart index a638dec..513a75d 100644 --- a/packages/flutter_tools/test/utils_test.dart +++ b/packages/flutter_tools/test/utils_test.dart
@@ -12,7 +12,7 @@ void main() { group('SettingsFile', () { test('parse', () { - final SettingsFile file = new SettingsFile.parse(''' + final SettingsFile file = SettingsFile.parse(''' # ignore comment foo=bar baz=qux @@ -26,7 +26,7 @@ group('uuid', () { // xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx test('simple', () { - final Uuid uuid = new Uuid(); + final Uuid uuid = Uuid(); final String result = uuid.generateV4(); expect(result.length, 36); expect(result[8], '-'); @@ -36,7 +36,7 @@ }); test('can parse', () { - final Uuid uuid = new Uuid(); + final Uuid uuid = Uuid(); final String result = uuid.generateV4(); expect(int.parse(result.substring(0, 8), radix: 16), isNotNull); expect(int.parse(result.substring(9, 13), radix: 16), isNotNull); @@ -46,7 +46,7 @@ }); test('special bits', () { - final Uuid uuid = new Uuid(); + final Uuid uuid = Uuid(); String result = uuid.generateV4(); expect(result[14], '4'); expect(result[19].toLowerCase(), isIn('89ab')); @@ -59,23 +59,23 @@ }); test('is pretty random', () { - final Set<String> set = new Set<String>(); + final Set<String> set = Set<String>(); - Uuid uuid = new Uuid(); + Uuid uuid = Uuid(); for (int i = 0; i < 64; i++) { final String val = uuid.generateV4(); expect(set, isNot(contains(val))); set.add(val); } - uuid = new Uuid(); + uuid = Uuid(); for (int i = 0; i < 64; i++) { final String val = uuid.generateV4(); expect(set, isNot(contains(val))); set.add(val); } - uuid = new Uuid(); + uuid = Uuid(); for (int i = 0; i < 64; i++) { final String val = uuid.generateV4(); expect(set, isNot(contains(val))); @@ -87,35 +87,35 @@ group('Version', () { test('can parse and compare', () { expect(Version.unknown.toString(), equals('unknown')); - expect(new Version(null, null, null).toString(), equals('0')); + expect(Version(null, null, null).toString(), equals('0')); - final Version v1 = new Version.parse('1'); + final Version v1 = Version.parse('1'); expect(v1.major, equals(1)); expect(v1.minor, equals(0)); expect(v1.patch, equals(0)); expect(v1, greaterThan(Version.unknown)); - final Version v2 = new Version.parse('1.2'); + final Version v2 = Version.parse('1.2'); expect(v2.major, equals(1)); expect(v2.minor, equals(2)); expect(v2.patch, equals(0)); - final Version v3 = new Version.parse('1.2.3'); + final Version v3 = Version.parse('1.2.3'); expect(v3.major, equals(1)); expect(v3.minor, equals(2)); expect(v3.patch, equals(3)); - final Version v4 = new Version.parse('1.12'); + final Version v4 = Version.parse('1.12'); expect(v4, greaterThan(v2)); expect(v3, greaterThan(v2)); expect(v2, greaterThan(v1)); - final Version v5 = new Version(1, 2, 0, text: 'foo'); + final Version v5 = Version(1, 2, 0, text: 'foo'); expect(v5, equals(v2)); - expect(new Version.parse('Preview2.2'), isNull); + expect(Version.parse('Preview2.2'), isNull); }); }); @@ -130,40 +130,40 @@ test('fires at start', () async { bool called = false; - poller = new Poller(() async { + poller = Poller(() async { called = true; }, const Duration(seconds: 1)); expect(called, false); - await new Future<Null>.delayed(kShortDelay); + await Future<Null>.delayed(kShortDelay); expect(called, true); }); test('runs periodically', () async { // Ensure we get the first (no-delay) callback, and one of the periodic callbacks. int callCount = 0; - poller = new Poller(() async { + poller = Poller(() async { callCount++; - }, new Duration(milliseconds: kShortDelay.inMilliseconds ~/ 2)); + }, Duration(milliseconds: kShortDelay.inMilliseconds ~/ 2)); expect(callCount, 0); - await new Future<Null>.delayed(kShortDelay); + await Future<Null>.delayed(kShortDelay); expect(callCount, greaterThanOrEqualTo(2)); }); test('no quicker then the periodic delay', () async { // Make sure that the poller polls at delay + the time it took to run the callback. - final Completer<Duration> completer = new Completer<Duration>(); + final Completer<Duration> completer = Completer<Duration>(); DateTime firstTime; - poller = new Poller(() async { + poller = Poller(() async { if (firstTime == null) - firstTime = new DateTime.now(); + firstTime = DateTime.now(); else - completer.complete(new DateTime.now().difference(firstTime)); + completer.complete(DateTime.now().difference(firstTime)); // introduce a delay - await new Future<Null>.delayed(kShortDelay); + await Future<Null>.delayed(kShortDelay); }, kShortDelay); final Duration duration = await completer.future; - expect(duration, greaterThanOrEqualTo(new Duration(milliseconds: kShortDelay.inMilliseconds * 2))); + expect(duration, greaterThanOrEqualTo(Duration(milliseconds: kShortDelay.inMilliseconds * 2))); }); });
diff --git a/packages/flutter_tools/test/version_test.dart b/packages/flutter_tools/test/version_test.dart index 6060d5f..bd2cbcd 100644 --- a/packages/flutter_tools/test/version_test.dart +++ b/packages/flutter_tools/test/version_test.dart
@@ -18,7 +18,7 @@ import 'src/common.dart'; import 'src/context.dart'; -final Clock _testClock = new Clock.fixed(new DateTime(2015, 1, 1)); +final Clock _testClock = Clock.fixed(DateTime(2015, 1, 1)); final DateTime _upToDateVersion = _testClock.agoBy(FlutterVersion.kVersionAgeConsideredUpToDate ~/ 2); final DateTime _outOfDateVersion = _testClock.agoBy(FlutterVersion.kVersionAgeConsideredUpToDate * 2); final DateTime _stampUpToDate = _testClock.agoBy(FlutterVersion.kCheckAgeConsideredUpToDate ~/ 2); @@ -29,8 +29,8 @@ MockCache mockCache; setUp(() { - mockProcessManager = new MockProcessManager(); - mockCache = new MockCache(); + mockProcessManager = MockProcessManager(); + mockCache = MockCache(); }); group('$FlutterVersion', () { @@ -51,7 +51,7 @@ await FlutterVersion.instance.checkFlutterVersionFreshness(); _expectVersionMessage(''); }, overrides: <Type, Generator>{ - FlutterVersion: () => new FlutterVersion(_testClock), + FlutterVersion: () => FlutterVersion(_testClock), ProcessManager: () => mockProcessManager, Cache: () => mockCache, }); @@ -61,7 +61,7 @@ mockProcessManager, mockCache, localCommitDate: _outOfDateVersion, - stamp: new VersionCheckStamp( + stamp: VersionCheckStamp( lastTimeVersionWasChecked: _stampOutOfDate, lastKnownRemoteVersion: _outOfDateVersion, ), @@ -74,7 +74,7 @@ await version.checkFlutterVersionFreshness(); _expectVersionMessage(''); }, overrides: <Type, Generator>{ - FlutterVersion: () => new FlutterVersion(_testClock), + FlutterVersion: () => FlutterVersion(_testClock), ProcessManager: () => mockProcessManager, Cache: () => mockCache, }); @@ -84,7 +84,7 @@ mockProcessManager, mockCache, localCommitDate: _outOfDateVersion, - stamp: new VersionCheckStamp( + stamp: VersionCheckStamp( lastTimeVersionWasChecked: _stampUpToDate, lastKnownRemoteVersion: _upToDateVersion, ), @@ -95,7 +95,7 @@ await version.checkFlutterVersionFreshness(); _expectVersionMessage(FlutterVersion.newVersionAvailableMessage()); }, overrides: <Type, Generator>{ - FlutterVersion: () => new FlutterVersion(_testClock), + FlutterVersion: () => FlutterVersion(_testClock), ProcessManager: () => mockProcessManager, Cache: () => mockCache, }); @@ -105,7 +105,7 @@ mockProcessManager, mockCache, localCommitDate: _outOfDateVersion, - stamp: new VersionCheckStamp( + stamp: VersionCheckStamp( lastTimeVersionWasChecked: _stampUpToDate, lastKnownRemoteVersion: _upToDateVersion, ), @@ -120,7 +120,7 @@ await version.checkFlutterVersionFreshness(); _expectVersionMessage(''); }, overrides: <Type, Generator>{ - FlutterVersion: () => new FlutterVersion(_testClock), + FlutterVersion: () => FlutterVersion(_testClock), ProcessManager: () => mockProcessManager, Cache: () => mockCache, }); @@ -149,7 +149,7 @@ await version.checkFlutterVersionFreshness(); _expectVersionMessage(''); }, overrides: <Type, Generator>{ - FlutterVersion: () => new FlutterVersion(_testClock), + FlutterVersion: () => FlutterVersion(_testClock), ProcessManager: () => mockProcessManager, Cache: () => mockCache, }); @@ -159,7 +159,7 @@ mockProcessManager, mockCache, localCommitDate: _outOfDateVersion, - stamp: new VersionCheckStamp( + stamp: VersionCheckStamp( lastTimeVersionWasChecked: _stampOutOfDate, lastKnownRemoteVersion: _testClock.ago(days: 2), ), @@ -172,7 +172,7 @@ await version.checkFlutterVersionFreshness(); _expectVersionMessage(FlutterVersion.newVersionAvailableMessage()); }, overrides: <Type, Generator>{ - FlutterVersion: () => new FlutterVersion(_testClock), + FlutterVersion: () => FlutterVersion(_testClock), ProcessManager: () => mockProcessManager, Cache: () => mockCache, }); @@ -191,7 +191,7 @@ await version.checkFlutterVersionFreshness(); _expectVersionMessage(''); }, overrides: <Type, Generator>{ - FlutterVersion: () => new FlutterVersion(_testClock), + FlutterVersion: () => FlutterVersion(_testClock), ProcessManager: () => mockProcessManager, Cache: () => mockCache, }); @@ -210,7 +210,7 @@ await version.checkFlutterVersionFreshness(); _expectVersionMessage(FlutterVersion.versionOutOfDateMessage(_testClock.now().difference(_outOfDateVersion))); }, overrides: <Type, Generator>{ - FlutterVersion: () => new FlutterVersion(_testClock), + FlutterVersion: () => FlutterVersion(_testClock), ProcessManager: () => mockProcessManager, Cache: () => mockCache, }); @@ -229,7 +229,7 @@ when(mockProcessManager.runSync( <String>['git', 'merge-base', '--is-ancestor', 'abcdef', '123456'], workingDirectory: anyNamed('workingDirectory'), - )).thenReturn(new ProcessResult(1, 0, '', '')); + )).thenReturn(ProcessResult(1, 0, '', '')); expect( version.checkRevisionAncestry( @@ -245,7 +245,7 @@ )); }, overrides: <Type, Generator>{ - FlutterVersion: () => new FlutterVersion(_testClock), + FlutterVersion: () => FlutterVersion(_testClock), ProcessManager: () => mockProcessManager, }); }); @@ -261,7 +261,7 @@ fakeData(mockProcessManager, mockCache); _expectDefault(await VersionCheckStamp.load()); }, overrides: <Type, Generator>{ - FlutterVersion: () => new FlutterVersion(_testClock), + FlutterVersion: () => FlutterVersion(_testClock), ProcessManager: () => mockProcessManager, Cache: () => mockCache, }); @@ -270,7 +270,7 @@ fakeData(mockProcessManager, mockCache, stampJson: '<'); _expectDefault(await VersionCheckStamp.load()); }, overrides: <Type, Generator>{ - FlutterVersion: () => new FlutterVersion(_testClock), + FlutterVersion: () => FlutterVersion(_testClock), ProcessManager: () => mockProcessManager, Cache: () => mockCache, }); @@ -279,7 +279,7 @@ fakeData(mockProcessManager, mockCache, stampJson: '[]'); _expectDefault(await VersionCheckStamp.load()); }, overrides: <Type, Generator>{ - FlutterVersion: () => new FlutterVersion(_testClock), + FlutterVersion: () => FlutterVersion(_testClock), ProcessManager: () => mockProcessManager, Cache: () => mockCache, }); @@ -298,7 +298,7 @@ expect(stamp.lastTimeVersionWasChecked, _testClock.ago(days: 2)); expect(stamp.lastTimeWarningWasPrinted, _testClock.now()); }, overrides: <Type, Generator>{ - FlutterVersion: () => new FlutterVersion(_testClock), + FlutterVersion: () => FlutterVersion(_testClock), ProcessManager: () => mockProcessManager, Cache: () => mockCache, }); @@ -308,7 +308,7 @@ _expectDefault(await VersionCheckStamp.load()); - final VersionCheckStamp stamp = new VersionCheckStamp( + final VersionCheckStamp stamp = VersionCheckStamp( lastKnownRemoteVersion: _testClock.ago(days: 1), lastTimeVersionWasChecked: _testClock.ago(days: 2), lastTimeWarningWasPrinted: _testClock.now(), @@ -320,7 +320,7 @@ expect(storedStamp.lastTimeVersionWasChecked, _testClock.ago(days: 2)); expect(storedStamp.lastTimeWarningWasPrinted, _testClock.now()); }, overrides: <Type, Generator>{ - FlutterVersion: () => new FlutterVersion(_testClock), + FlutterVersion: () => FlutterVersion(_testClock), ProcessManager: () => mockProcessManager, Cache: () => mockCache, }); @@ -330,7 +330,7 @@ _expectDefault(await VersionCheckStamp.load()); - final VersionCheckStamp stamp = new VersionCheckStamp( + final VersionCheckStamp stamp = VersionCheckStamp( lastKnownRemoteVersion: _testClock.ago(days: 10), lastTimeVersionWasChecked: _testClock.ago(days: 9), lastTimeWarningWasPrinted: _testClock.ago(days: 8), @@ -346,7 +346,7 @@ expect(storedStamp.lastTimeVersionWasChecked, _testClock.ago(days: 2)); expect(storedStamp.lastTimeWarningWasPrinted, _testClock.now()); }, overrides: <Type, Generator>{ - FlutterVersion: () => new FlutterVersion(_testClock), + FlutterVersion: () => FlutterVersion(_testClock), ProcessManager: () => mockProcessManager, Cache: () => mockCache, }); @@ -371,11 +371,11 @@ bool expectServerPing = false, }) { ProcessResult success(String standardOutput) { - return new ProcessResult(1, 0, standardOutput, ''); + return ProcessResult(1, 0, standardOutput, ''); } ProcessResult failure(int exitCode) { - return new ProcessResult(1, exitCode, '', 'error'); + return ProcessResult(1, exitCode, '', 'error'); } when(cache.getStampFor(any)).thenAnswer((Invocation invocation) { @@ -398,7 +398,7 @@ return null; } - throw new StateError('Unexpected call to Cache.setStampFor(${invocation.positionalArguments}, ${invocation.namedArguments})'); + throw StateError('Unexpected call to Cache.setStampFor(${invocation.positionalArguments}, ${invocation.namedArguments})'); }); final Answering<ProcessResult> syncAnswer = (Invocation invocation) { @@ -426,7 +426,7 @@ return success(remoteCommitDate.toString()); } - throw new StateError('Unexpected call to ProcessManager.run(${invocation.positionalArguments}, ${invocation.namedArguments})'); + throw StateError('Unexpected call to ProcessManager.run(${invocation.positionalArguments}, ${invocation.namedArguments})'); }; when(pm.runSync(any, workingDirectory: anyNamed('workingDirectory'))).thenAnswer(syncAnswer); @@ -438,27 +438,27 @@ <String>['git', 'rev-parse', '--abbrev-ref', '--symbolic', '@{u}'], workingDirectory: anyNamed('workingDirectory'), environment: anyNamed('environment'), - )).thenReturn(new ProcessResult(101, 0, 'master', '')); + )).thenReturn(ProcessResult(101, 0, 'master', '')); when(pm.runSync( <String>['git', 'rev-parse', '--abbrev-ref', 'HEAD'], workingDirectory: anyNamed('workingDirectory'), environment: anyNamed('environment'), - )).thenReturn(new ProcessResult(102, 0, 'branch', '')); + )).thenReturn(ProcessResult(102, 0, 'branch', '')); when(pm.runSync( <String>['git', 'log', '-n', '1', '--pretty=format:%H'], workingDirectory: anyNamed('workingDirectory'), environment: anyNamed('environment'), - )).thenReturn(new ProcessResult(103, 0, '1234abcd', '')); + )).thenReturn(ProcessResult(103, 0, '1234abcd', '')); when(pm.runSync( <String>['git', 'log', '-n', '1', '--pretty=format:%ar'], workingDirectory: anyNamed('workingDirectory'), environment: anyNamed('environment'), - )).thenReturn(new ProcessResult(104, 0, '1 second ago', '')); + )).thenReturn(ProcessResult(104, 0, '1 second ago', '')); when(pm.runSync( <String>['git', 'describe', '--match', 'v*.*.*', '--first-parent', '--long', '--tags'], workingDirectory: anyNamed('workingDirectory'), environment: anyNamed('environment'), - )).thenReturn(new ProcessResult(105, 0, 'v0.1.2-3-1234abcd', '')); + )).thenReturn(ProcessResult(105, 0, 'v0.1.2-3-1234abcd', '')); } class MockProcessManager extends Mock implements ProcessManager {}