mirror of
https://github.com/flutter/flutter.git
synced 2025-06-03 00:51:18 +00:00

* Update project.pbxproj files to say Flutter rather than Chromium Also, the templates now have an empty organization so that we don't cause people to give their apps a Flutter copyright. * Update the copyright notice checker to require a standard notice on all files * Update copyrights on Dart files. (This was a mechanical commit.) * Fix weird license headers on Dart files that deviate from our conventions; relicense Shrine. Some were already marked "The Flutter Authors", not clear why. Their dates have been normalized. Some were missing the blank line after the license. Some were randomly different in trivial ways for no apparent reason (e.g. missing the trailing period). * Clean up the copyrights in non-Dart files. (Manual edits.) Also, make sure templates don't have copyrights. * Fix some more ORGANIZATIONNAMEs
86 lines
3.5 KiB
Dart
86 lines
3.5 KiB
Dart
// Copyright 2014 The Flutter Authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
// found in the LICENSE file.
|
|
|
|
import 'package:file/memory.dart';
|
|
import 'package:flutter_tools/src/base/file_system.dart';
|
|
import 'package:flutter_tools/src/base/platform.dart';
|
|
import 'package:flutter_tools/src/build_info.dart';
|
|
import 'package:flutter_tools/src/linux/application_package.dart';
|
|
import 'package:flutter_tools/src/linux/linux_device.dart';
|
|
import 'package:flutter_tools/src/device.dart';
|
|
import 'package:flutter_tools/src/project.dart';
|
|
import 'package:mockito/mockito.dart';
|
|
|
|
import '../../src/common.dart';
|
|
import '../../src/context.dart';
|
|
|
|
void main() {
|
|
final LinuxDevice device = LinuxDevice();
|
|
final MockPlatform notLinux = MockPlatform();
|
|
|
|
when(notLinux.isLinux).thenReturn(false);
|
|
|
|
testUsingContext('LinuxDevice defaults', () async {
|
|
final PrebuiltLinuxApp linuxApp = PrebuiltLinuxApp(executable: 'foo');
|
|
expect(await device.targetPlatform, TargetPlatform.linux_x64);
|
|
expect(device.name, 'Linux');
|
|
expect(await device.installApp(linuxApp), true);
|
|
expect(await device.uninstallApp(linuxApp), true);
|
|
expect(await device.isLatestBuildInstalled(linuxApp), true);
|
|
expect(await device.isAppInstalled(linuxApp), true);
|
|
expect(await device.stopApp(linuxApp), true);
|
|
expect(device.category, Category.desktop);
|
|
});
|
|
|
|
testUsingContext('LinuxDevice: no devices listed if platform unsupported', () async {
|
|
expect(await LinuxDevices().devices, <Device>[]);
|
|
}, overrides: <Type, Generator>{
|
|
Platform: () => notLinux,
|
|
});
|
|
|
|
testUsingContext('LinuxDevice.isSupportedForProject is true with editable host app', () async {
|
|
fs.file('pubspec.yaml').createSync();
|
|
fs.file('.packages').createSync();
|
|
fs.directory('linux').createSync();
|
|
final FlutterProject flutterProject = FlutterProject.current();
|
|
|
|
expect(LinuxDevice().isSupportedForProject(flutterProject), true);
|
|
}, overrides: <Type, Generator>{
|
|
FileSystem: () => MemoryFileSystem(),
|
|
ProcessManager: () => FakeProcessManager.any(),
|
|
});
|
|
|
|
testUsingContext('LinuxDevice.isSupportedForProject is false with no host app', () async {
|
|
fs.file('pubspec.yaml').createSync();
|
|
fs.file('.packages').createSync();
|
|
final FlutterProject flutterProject = FlutterProject.current();
|
|
|
|
expect(LinuxDevice().isSupportedForProject(flutterProject), false);
|
|
}, overrides: <Type, Generator>{
|
|
FileSystem: () => MemoryFileSystem(),
|
|
ProcessManager: () => FakeProcessManager.any(),
|
|
});
|
|
|
|
testUsingContext('LinuxDevice.executablePathForDevice uses the correct package executable', () async {
|
|
final MockLinuxApp mockApp = MockLinuxApp();
|
|
const String debugPath = 'debug/executable';
|
|
const String profilePath = 'profile/executable';
|
|
const String releasePath = 'release/executable';
|
|
when(mockApp.executable(BuildMode.debug)).thenReturn(debugPath);
|
|
when(mockApp.executable(BuildMode.profile)).thenReturn(profilePath);
|
|
when(mockApp.executable(BuildMode.release)).thenReturn(releasePath);
|
|
|
|
expect(LinuxDevice().executablePathForDevice(mockApp, BuildMode.debug), debugPath);
|
|
expect(LinuxDevice().executablePathForDevice(mockApp, BuildMode.profile), profilePath);
|
|
expect(LinuxDevice().executablePathForDevice(mockApp, BuildMode.release), releasePath);
|
|
}, overrides: <Type, Generator>{
|
|
FileSystem: () => MemoryFileSystem(),
|
|
ProcessManager: () => FakeProcessManager.any(),
|
|
});
|
|
}
|
|
|
|
class MockPlatform extends Mock implements Platform {}
|
|
|
|
class MockLinuxApp extends Mock implements LinuxApp {}
|