flutter/packages/flutter_tools/test/toolchain_test.dart
Todd Volkert 8bb270342e Update flutter_tools to use package:file throughout (#7385)
This removes direct file access from within flutter_tools
in favor of using `package:file` via a `FileSystem` that's
accessed via the `ApplicationContext`.

This lays the groundwork for us to be able to easily swap
out the underlying file system when running Flutter tools,
which will be used to provide a record/replay file system,
analogous to what we have for process invocations.
2017-01-06 16:51:44 -08:00

47 lines
1.6 KiB
Dart

// Copyright 2016 The Chromium 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:flutter_tools/src/base/file_system.dart';
import 'package:flutter_tools/src/build_info.dart';
import 'package:flutter_tools/src/cache.dart';
import 'package:flutter_tools/src/toolchain.dart';
import 'package:test/test.dart';
import 'src/context.dart';
void main() {
group('ToolConfiguration', () {
Directory tempDir;
tempDir = fs.systemTempDirectory.createTempSync('flutter_temp');
testUsingContext('using cache', () {
ToolConfiguration toolConfig = new ToolConfiguration();
expect(
toolConfig.getEngineArtifactsDirectory(TargetPlatform.android_arm, BuildMode.debug).path,
endsWith('cache/artifacts/engine/android-arm')
);
expect(
toolConfig.getEngineArtifactsDirectory(TargetPlatform.android_arm, BuildMode.release).path,
endsWith('cache/artifacts/engine/android-arm-release')
);
expect(tempDir, isNotNull);
tempDir.deleteSync(recursive: true);
}, overrides: <Type, Generator> {
Cache: () => new Cache(rootOverride: tempDir),
});
testUsingContext('using enginePath', () {
ToolConfiguration toolConfig = new ToolConfiguration();
toolConfig.engineSrcPath = 'engine';
toolConfig.engineBuildPath = 'engine/out/android_debug';
expect(
toolConfig.getEngineArtifactsDirectory(TargetPlatform.android_arm, BuildMode.debug).path,
'engine/out/android_debug'
);
});
});
}