Unverified Commit 25c10d6a authored by Jenn Magder's avatar Jenn Magder Committed by GitHub

Replace testUsingContext with testWithoutContext in a few places (#82498)

parent c533ab65
...@@ -22,7 +22,7 @@ import 'package:meta/meta.dart'; ...@@ -22,7 +22,7 @@ import 'package:meta/meta.dart';
import 'package:test/fake.dart'; import 'package:test/fake.dart';
import '../src/common.dart'; import '../src/common.dart';
import '../src/context.dart'; import '../src/fake_process_manager.dart';
void main() { void main() {
group('Basic info', () { group('Basic info', () {
...@@ -244,7 +244,7 @@ void main() { ...@@ -244,7 +244,7 @@ void main() {
expect(portForwarder.forwardedPorts.isEmpty, true); expect(portForwarder.forwardedPorts.isEmpty, true);
}); });
testUsingContext('createDevFSWriter returns a LocalDevFSWriter', () { testWithoutContext('createDevFSWriter returns a LocalDevFSWriter', () {
final FakeDesktopDevice device = setUpDesktopDevice(); final FakeDesktopDevice device = setUpDesktopDevice();
expect(device.createDevFSWriter(null, ''), isA<LocalDevFSWriter>()); expect(device.createDevFSWriter(null, ''), isA<LocalDevFSWriter>());
......
...@@ -2,24 +2,21 @@ ...@@ -2,24 +2,21 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// @dart = 2.8
import 'dart:io' as io; // ignore: dart_io_import import 'dart:io' as io; // ignore: dart_io_import
import 'package:flutter_tools/src/base/io.dart'; import 'package:flutter_tools/src/base/io.dart';
import 'package:flutter_tools/src/device_port_forwarder.dart'; import 'package:flutter_tools/src/device_port_forwarder.dart';
import 'package:test/fake.dart'; import 'package:test/fake.dart';
import '../src/common.dart'; import '../src/common.dart';
import '../src/context.dart';
void main() { void main() {
testUsingContext('dispose does not throw exception if no process is present', () { testWithoutContext('dispose does not throw exception if no process is present', () {
final ForwardedPort forwardedPort = ForwardedPort(123, 456); final ForwardedPort forwardedPort = ForwardedPort(123, 456);
expect(forwardedPort.context, isNull); expect(forwardedPort.context, isNull);
forwardedPort.dispose(); forwardedPort.dispose();
}); });
testUsingContext('dispose kills process if process was available', () { testWithoutContext('dispose kills process if process was available', () {
final FakeProcess process = FakeProcess(); final FakeProcess process = FakeProcess();
final ForwardedPort forwardedPort = ForwardedPort.withContext(123, 456, process); final ForwardedPort forwardedPort = ForwardedPort.withContext(123, 456, process);
forwardedPort.dispose(); forwardedPort.dispose();
......
...@@ -20,7 +20,7 @@ import 'package:flutter_tools/src/project.dart'; ...@@ -20,7 +20,7 @@ import 'package:flutter_tools/src/project.dart';
import 'package:test/fake.dart'; import 'package:test/fake.dart';
import '../../src/common.dart'; import '../../src/common.dart';
import '../../src/context.dart'; import '../../src/fake_process_manager.dart';
import '../../src/fakes.dart'; import '../../src/fakes.dart';
final FakePlatform macOS = FakePlatform( final FakePlatform macOS = FakePlatform(
...@@ -196,7 +196,7 @@ void main() { ...@@ -196,7 +196,7 @@ void main() {
expect(await device.targetPlatformDisplayName, 'darwin-arm64'); expect(await device.targetPlatformDisplayName, 'darwin-arm64');
}); });
testUsingContext('isSupportedForProject is false with no host app', () async { testWithoutContext('isSupportedForProject is false with no host app', () async {
final FileSystem fileSystem = MemoryFileSystem.test(); final FileSystem fileSystem = MemoryFileSystem.test();
final MacOSDevice device = MacOSDevice( final MacOSDevice device = MacOSDevice(
fileSystem: fileSystem, fileSystem: fileSystem,
...@@ -211,7 +211,7 @@ void main() { ...@@ -211,7 +211,7 @@ void main() {
expect(device.isSupportedForProject(flutterProject), false); expect(device.isSupportedForProject(flutterProject), false);
}); });
testUsingContext('executablePathForDevice uses the correct package executable', () async { testWithoutContext('executablePathForDevice uses the correct package executable', () async {
final FakeMacOSApp package = FakeMacOSApp(); final FakeMacOSApp package = FakeMacOSApp();
final MacOSDevice device = MacOSDevice( final MacOSDevice device = MacOSDevice(
fileSystem: MemoryFileSystem.test(), fileSystem: MemoryFileSystem.test(),
......
...@@ -9,7 +9,6 @@ import 'package:file_testing/file_testing.dart'; ...@@ -9,7 +9,6 @@ import 'package:file_testing/file_testing.dart';
import 'package:flutter_tools/src/base/io.dart'; import 'package:flutter_tools/src/base/io.dart';
import '../src/common.dart'; import '../src/common.dart';
import '../src/context.dart';
import 'test_utils.dart'; import 'test_utils.dart';
const String apkDebugMessage = 'A summary of your APK analysis can be found at: '; const String apkDebugMessage = 'A summary of your APK analysis can be found at: ';
...@@ -17,7 +16,7 @@ const String iosDebugMessage = 'A summary of your iOS bundle analysis can be fou ...@@ -17,7 +16,7 @@ const String iosDebugMessage = 'A summary of your iOS bundle analysis can be fou
const String runDevToolsMessage = 'flutter pub global activate devtools; flutter pub global run devtools '; const String runDevToolsMessage = 'flutter pub global activate devtools; flutter pub global run devtools ';
void main() { void main() {
testUsingContext('--analyze-size flag produces expected output on hello_world for Android', () async { testWithoutContext('--analyze-size flag produces expected output on hello_world for Android', () async {
final String workingDirectory = fileSystem.path.join(getFlutterRoot(), 'examples', 'hello_world'); final String workingDirectory = fileSystem.path.join(getFlutterRoot(), 'examples', 'hello_world');
final String flutterBin = fileSystem.path.join(getFlutterRoot(), 'bin', 'flutter'); final String flutterBin = fileSystem.path.join(getFlutterRoot(), 'bin', 'flutter');
final ProcessResult result = await processManager.run(<String>[ final ProcessResult result = await processManager.run(<String>[
......
...@@ -11,7 +11,6 @@ import 'package:flutter_tools/src/base/process.dart'; ...@@ -11,7 +11,6 @@ import 'package:flutter_tools/src/base/process.dart';
import 'package:flutter_tools/src/base/terminal.dart'; import 'package:flutter_tools/src/base/terminal.dart';
import '../src/common.dart'; import '../src/common.dart';
import '../src/context.dart';
import 'test_utils.dart'; import 'test_utils.dart';
const String _kInitialVersion = 'v1.9.1'; const String _kInitialVersion = 'v1.9.1';
...@@ -46,7 +45,7 @@ void main() { ...@@ -46,7 +45,7 @@ void main() {
} }
}); });
testUsingContext('Can upgrade and downgrade a Flutter checkout', () async { testWithoutContext('Can upgrade and downgrade a Flutter checkout', () async {
final Directory testDirectory = parentDirectory.childDirectory('flutter'); final Directory testDirectory = parentDirectory.childDirectory('flutter');
testDirectory.createSync(recursive: true); testDirectory.createSync(recursive: true);
......
...@@ -8,7 +8,6 @@ import 'package:file/file.dart'; ...@@ -8,7 +8,6 @@ import 'package:file/file.dart';
import 'package:file_testing/file_testing.dart'; import 'package:file_testing/file_testing.dart';
import '../src/common.dart'; import '../src/common.dart';
import '../src/context.dart';
import 'test_utils.dart'; import 'test_utils.dart';
void main() { void main() {
...@@ -22,7 +21,7 @@ void main() { ...@@ -22,7 +21,7 @@ void main() {
tryToDelete(tempDir); tryToDelete(tempDir);
}); });
testUsingContext('flutter app that depends on a non-Android plugin can still build for Android', () { testWithoutContext('flutter app that depends on a non-Android plugin can still build for Android', () {
final String flutterRoot = getFlutterRoot(); final String flutterRoot = getFlutterRoot();
final String flutterBin = fileSystem.path.join( final String flutterBin = fileSystem.path.join(
flutterRoot, flutterRoot,
......
...@@ -11,7 +11,6 @@ import 'package:flutter_tools/src/base/io.dart'; ...@@ -11,7 +11,6 @@ import 'package:flutter_tools/src/base/io.dart';
import 'package:flutter_tools/src/convert.dart'; import 'package:flutter_tools/src/convert.dart';
import '../src/common.dart'; import '../src/common.dart';
import '../src/context.dart';
import 'test_data/basic_project.dart'; import 'test_data/basic_project.dart';
import 'test_utils.dart'; import 'test_utils.dart';
...@@ -56,7 +55,7 @@ void main() { ...@@ -56,7 +55,7 @@ void main() {
tryToDelete(tempDir); tryToDelete(tempDir);
}); });
testUsingContext('flutter run --observatory-port', () async { testWithoutContext('flutter run --observatory-port', () async {
final String flutterBin = fileSystem.path.join(getFlutterRoot(), 'bin', 'flutter'); final String flutterBin = fileSystem.path.join(getFlutterRoot(), 'bin', 'flutter');
final int port = await getFreePort(); final int port = await getFreePort();
// If only --observatory-port is provided, --observatory-port will be used by DDS // If only --observatory-port is provided, --observatory-port will be used by DDS
...@@ -74,7 +73,7 @@ void main() { ...@@ -74,7 +73,7 @@ void main() {
await process.exitCode; await process.exitCode;
}); });
testUsingContext('flutter run --dds-port --observatory-port', () async { testWithoutContext('flutter run --dds-port --observatory-port', () async {
final String flutterBin = fileSystem.path.join(getFlutterRoot(), 'bin', 'flutter'); final String flutterBin = fileSystem.path.join(getFlutterRoot(), 'bin', 'flutter');
final int observatoryPort = await getFreePort(); final int observatoryPort = await getFreePort();
int ddsPort = await getFreePort(); int ddsPort = await getFreePort();
...@@ -97,7 +96,7 @@ void main() { ...@@ -97,7 +96,7 @@ void main() {
await process.exitCode; await process.exitCode;
}); });
testUsingContext('flutter run --dds-port', () async { testWithoutContext('flutter run --dds-port', () async {
final String flutterBin = fileSystem.path.join(getFlutterRoot(), 'bin', 'flutter'); final String flutterBin = fileSystem.path.join(getFlutterRoot(), 'bin', 'flutter');
final int ddsPort = await getFreePort(); final int ddsPort = await getFreePort();
// If only --dds-port is provided, --dds-port will be used by DDS and the VM service // If only --dds-port is provided, --dds-port will be used by DDS and the VM service
......
...@@ -7,7 +7,6 @@ ...@@ -7,7 +7,6 @@
import 'package:flutter_tools/src/base/io.dart'; import 'package:flutter_tools/src/base/io.dart';
import '../src/common.dart'; import '../src/common.dart';
import '../src/context.dart';
import 'test_utils.dart'; import 'test_utils.dart';
final String toolBackend = fileSystem.path.join(getFlutterRoot(), 'packages', 'flutter_tools', 'bin', 'tool_backend.dart'); final String toolBackend = fileSystem.path.join(getFlutterRoot(), 'packages', 'flutter_tools', 'bin', 'tool_backend.dart');
...@@ -15,7 +14,7 @@ final String examplePath = fileSystem.path.join(getFlutterRoot(), 'examples', 'h ...@@ -15,7 +14,7 @@ final String examplePath = fileSystem.path.join(getFlutterRoot(), 'examples', 'h
final String dart = fileSystem.path.join(getFlutterRoot(), 'bin', platform.isWindows ? 'dart.bat' : 'dart'); final String dart = fileSystem.path.join(getFlutterRoot(), 'bin', platform.isWindows ? 'dart.bat' : 'dart');
void main() { void main() {
testUsingContext('tool_backend.dart exits if PROJECT_DIR is not set', () async { testWithoutContext('tool_backend.dart exits if PROJECT_DIR is not set', () async {
final ProcessResult result = await processManager.run(<String>[ final ProcessResult result = await processManager.run(<String>[
dart, dart,
toolBackend, toolBackend,
...@@ -27,7 +26,7 @@ void main() { ...@@ -27,7 +26,7 @@ void main() {
expect(result.stderr, contains('PROJECT_DIR environment variable must be set to the location of Flutter project to be built.')); expect(result.stderr, contains('PROJECT_DIR environment variable must be set to the location of Flutter project to be built.'));
}); });
testUsingContext('tool_backend.dart exits if FLUTTER_ROOT is not set', () async { testWithoutContext('tool_backend.dart exits if FLUTTER_ROOT is not set', () async {
// Removing parent environment means that batch script cannot be run. // Removing parent environment means that batch script cannot be run.
final String dart = fileSystem.path.join(getFlutterRoot(), 'bin', 'cache', 'dart-sdk', 'bin', platform.isWindows ? 'dart.exe' : 'dart'); final String dart = fileSystem.path.join(getFlutterRoot(), 'bin', 'cache', 'dart-sdk', 'bin', platform.isWindows ? 'dart.exe' : 'dart');
...@@ -44,7 +43,7 @@ void main() { ...@@ -44,7 +43,7 @@ void main() {
expect(result.stderr, contains('FLUTTER_ROOT environment variable must be set to the location of the Flutter SDK.')); expect(result.stderr, contains('FLUTTER_ROOT environment variable must be set to the location of the Flutter SDK.'));
}); });
testUsingContext('tool_backend.dart exits if local engine does not match build mode', () async { testWithoutContext('tool_backend.dart exits if local engine does not match build mode', () async {
final ProcessResult result = await processManager.run(<String>[ final ProcessResult result = await processManager.run(<String>[
dart, dart,
toolBackend, toolBackend,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment