[dart:io] Rename IoOverrides -> IOOverrides

fixes #31063

Change-Id: Ib49ae77903805a5c027ab870898954bb43901fda
Reviewed-on: https://dart-review.googlesource.com/13120
Reviewed-by: Kevin Moore <kevmoo@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Zach Anderson <zra@google.com>
This commit is contained in:
Zachary Anderson 2017-10-11 20:31:00 +00:00 committed by commit-bot@chromium.org
parent 50c540296a
commit 346e1edf7e
7 changed files with 26 additions and 26 deletions

View file

@ -34,7 +34,7 @@
String describing the version of the operating system.
* Added `RawZLibFilter` for low-level access to compression and
decompression routines.
* Added `IoOverrides` and `HttpOverrides` to aid in writing tests that wish to
* Added `IOOverrides` and `HttpOverrides` to aid in writing tests that wish to
mock varios `dart:io` objects.
* `dart:core`

View file

@ -127,7 +127,7 @@ abstract class Directory implements FileSystemEntity {
* current working directory.
*/
factory Directory(String path) {
final IoOverrides overrides = IoOverrides.current;
final IOOverrides overrides = IOOverrides.current;
if (overrides == null) {
return new _Directory(path);
}
@ -146,7 +146,7 @@ abstract class Directory implements FileSystemEntity {
* directory.
*/
static Directory get current {
final IoOverrides overrides = IoOverrides.current;
final IOOverrides overrides = IOOverrides.current;
if (overrides == null) {
return _Directory.current;
}
@ -181,7 +181,7 @@ abstract class Directory implements FileSystemEntity {
* are working with the file system, can lead to unexpected results.
*/
static void set current(path) {
final IoOverrides overrides = IoOverrides.current;
final IOOverrides overrides = IOOverrides.current;
if (overrides == null) {
_Directory.current = path;
return;
@ -222,7 +222,7 @@ abstract class Directory implements FileSystemEntity {
* and may be set by an environment variable.
*/
static Directory get systemTemp {
final IoOverrides overrides = IoOverrides.current;
final IOOverrides overrides = IOOverrides.current;
if (overrides == null) {
return _Directory.systemTemp;
}

View file

@ -220,7 +220,7 @@ abstract class File implements FileSystemEntity {
* current working directory.
*/
factory File(String path) {
final IoOverrides overrides = IoOverrides.current;
final IOOverrides overrides = IOOverrides.current;
if (overrides == null) {
return new _File(path);
}

View file

@ -109,7 +109,7 @@ class FileStat {
* FileSystemEntityType.NOT_FOUND and the other fields invalid.
*/
static FileStat statSync(String path) {
final IoOverrides overrides = IoOverrides.current;
final IOOverrides overrides = IOOverrides.current;
if (overrides == null) {
return _statSyncInternal(path);
}
@ -141,7 +141,7 @@ class FileStat {
* the other fields invalid.
*/
static Future<FileStat> stat(String path) {
final IoOverrides overrides = IoOverrides.current;
final IOOverrides overrides = IOOverrides.current;
if (overrides == null) {
return _stat(path);
}
@ -484,7 +484,7 @@ abstract class FileSystemEntity {
Stream<FileSystemEvent> watch(
{int events: FileSystemEvent.ALL, bool recursive: false}) {
final String trimmedPath = _trimTrailingPathSeparators(path);
final IoOverrides overrides = IoOverrides.current;
final IOOverrides overrides = IOOverrides.current;
if (overrides == null) {
return _FileSystemWatcher._watch(trimmedPath, events, recursive);
}
@ -520,7 +520,7 @@ abstract class FileSystemEntity {
* to an object that does not exist.
*/
static Future<bool> identical(String path1, String path2) {
IoOverrides overrides = IoOverrides.current;
IOOverrides overrides = IOOverrides.current;
if (overrides == null) {
return _identical(path1, path2);
}
@ -586,7 +586,7 @@ abstract class FileSystemEntity {
* exist.
*/
static bool identicalSync(String path1, String path2) {
IoOverrides overrides = IoOverrides.current;
IOOverrides overrides = IOOverrides.current;
if (overrides == null) {
return _identicalSync(path1, path2);
}
@ -599,7 +599,7 @@ abstract class FileSystemEntity {
* OS X 10.6 and below is not supported.
*/
static bool get isWatchSupported {
final IoOverrides overrides = IoOverrides.current;
final IOOverrides overrides = IOOverrides.current;
if (overrides == null) {
return _FileSystemWatcher.isSupported;
}
@ -737,7 +737,7 @@ abstract class FileSystemEntity {
}
static FileSystemEntityType _getTypeSync(String path, bool followLinks) {
IoOverrides overrides = IoOverrides.current;
IOOverrides overrides = IOOverrides.current;
if (overrides == null) {
return _getTypeSyncHelper(path, followLinks);
}
@ -756,7 +756,7 @@ abstract class FileSystemEntity {
}
static Future<FileSystemEntityType> _getType(String path, bool followLinks) {
IoOverrides overrides = IoOverrides.current;
IOOverrides overrides = IOOverrides.current;
if (overrides == null) {
return _getTypeRequest(path, followLinks);
}

View file

@ -13,7 +13,7 @@ abstract class Link implements FileSystemEntity {
* Creates a Link object.
*/
factory Link(String path) {
final IoOverrides overrides = IoOverrides.current;
final IOOverrides overrides = IOOverrides.current;
if (overrides == null) {
return new _Link(path);
}

View file

@ -23,7 +23,7 @@ const _asyncRunZoned = runZoned;
/// }
///
/// main() {
/// IoOverrides.runZoned(() {
/// IOOverrides.runZoned(() {
/// ...
/// // Operations will use MyDirectory instead of dart:io's Directory
/// // implementation whenever Directory is used.
@ -31,14 +31,14 @@ const _asyncRunZoned = runZoned;
/// }, createDirectory: (String path) => new MyDirectory(path));
/// }
/// ```
abstract class IoOverrides {
static IoOverrides get current {
abstract class IOOverrides {
static IOOverrides get current {
return Zone.current[_ioOverridesToken];
}
/// Runs [body] in a fresh [Zone] using the provided overrides.
///
/// See the documentation on the corresponding methods of IoOverrides for
/// See the documentation on the corresponding methods of IOOverrides for
/// information about what the optional arguments do.
static R runZoned<R>(R body(),
{
@ -71,7 +71,7 @@ abstract class IoOverrides {
// Optional Zone parameters
ZoneSpecification zoneSpecification,
Function onError}) {
IoOverrides overrides = new _IoOverridesScope(
IOOverrides overrides = new _IOOverridesScope(
// Directory
createDirectory,
getCurrentDirectory,
@ -107,8 +107,8 @@ abstract class IoOverrides {
/// Runs [body] in a fresh [Zone] using the overrides found in [overrides].
///
/// Note that [overrides] should be an instance of a class that extends
/// [IoOverrides].
static R runWithIoOverrides<R>(R body(), IoOverrides overrides,
/// [IOOverrides].
static R runWithIOOverrides<R>(R body(), IOOverrides overrides,
{ZoneSpecification zoneSpecification, Function onError}) {
return _asyncRunZoned<R>(body,
zoneValues: {_ioOverridesToken: overrides},
@ -230,8 +230,8 @@ abstract class IoOverrides {
Link createLink(String path) => new _Link(path);
}
class _IoOverridesScope extends IoOverrides {
final IoOverrides _previous = IoOverrides.current;
class _IOOverridesScope extends IOOverrides {
final IOOverrides _previous = IOOverrides.current;
// Directory
Directory Function(String) _createDirectory;
@ -259,7 +259,7 @@ class _IoOverridesScope extends IoOverrides {
// Link
Link Function(String) _createLink;
_IoOverridesScope(
_IOOverridesScope(
// Directory
this._createDirectory,
this._getCurrentDirectory,

View file

@ -158,7 +158,7 @@ class LinkMock extends FileSystemEntity implements Link {
}
Future<Null> ioOverridesRunTest() async {
Future<Null> f = IoOverrides.runZoned(
Future<Null> f = IOOverrides.runZoned(
() async {
Expect.isTrue(new Directory("directory") is DirectoryMock);
Expect.isTrue(Directory.current is DirectoryMock);