blob: e4d289f1912d74990d5839f3fc909c9d6b6bb9c6 [file] [log] [blame]
import 'package:fxutils/fxutils.dart';
import 'package:path/path.dart' as p;
/// Convenience class for tests which returns values vaguely of the same
/// structure as real values, but never suitable for any actual work. This can
/// only safely be used by tests making sure they *would* do work correctly,
/// without having to repeatedly instantiate the same fakes over and over.
class FakeFxEnv extends IFxEnv {
final String _cwd;
final String _fuchsiaDir;
final EnvReader _envReader;
String fuchsiaDir = '/root/fuchsia',
String cwd = '/cwd',
EnvReader envReader,
}) : _envReader = envReader,
_fuchsiaDir = fuchsiaDir,
_cwd = cwd;
static final FakeFxEnv shared = FakeFxEnv();
String get cwd => _cwd;
String get fuchsiaArch => 'x86';
String get fuchsiaDir => _fuchsiaDir;
String get hostOutDir => p.join(fuchsiaDir, 'out/default/host_$fuchsiaArch');
String get outputDir => p.join(fuchsiaDir, 'out/default');
String get sshKey => p.join(fuchsiaDir, 'out/default/.ssh/pkey');
String get zirconBuildRoot => outputDir;
String get zirconToolsDir => p.join(zirconBuildRoot, 'tools');
String getEnv(String variableName, [String defaultValue]) =>
_envReader.getEnv(variableName, defaultValue);