common.dart 1.05 KB
Newer Older
1 2 3 4
// 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.

5 6
import 'dart:io' show Platform;

7
import 'package:file/file.dart';
8 9
import 'package:file/local.dart';
import 'package:file/memory.dart';
10 11 12 13

/// The file system implementation used by this library.
///
/// See [useMemoryFileSystemForTesting] and [restoreFileSystem].
14
FileSystem fs = const LocalFileSystem();
15 16 17 18 19 20 21 22 23

/// Overrides the file system so it can be tested without hitting the hard
/// drive.
void useMemoryFileSystemForTesting() {
  fs = new MemoryFileSystem();
}

/// Restores the file system to the default local file system implementation.
void restoreFileSystem() {
24
  fs = const LocalFileSystem();
25
}
26

27
/// Flutter Driver test output directory.
28 29 30 31 32
///
/// Tests should write any output files to this directory. Defaults to the path
/// set in the FLUTTER_TEST_OUTPUTS_DIR environment variable, or `build` if
/// unset.
String get testOutputsDirectory => Platform.environment['FLUTTER_TEST_OUTPUTS_DIR'] ?? 'build';