Skip to content

Create abstraction layer for dart:io's Process commands#7100

Merged
tvolkert merged 4 commits intoflutter:masterfrom
tvolkert:os-abstraction-layer
Nov 30, 2016
Merged

Create abstraction layer for dart:io's Process commands#7100
tvolkert merged 4 commits intoflutter:masterfrom
tvolkert:os-abstraction-layer

Conversation

@tvolkert
Copy link
Contributor

With this change, they're run via instance methods on an object
obtained through the context. This will allow us to substitute
that object in tests with replay/record versions to allow us to
mock out the os-layer in tests.

With this change, they're run via instance methods on an object
obtained through the context. This will allow us to substitute
that object in tests with replay/record versions to allow us to
mock out the os-layer in tests.
@tvolkert
Copy link
Contributor Author

@johnmccutchan

context.putIfAbsent(IOSSimulatorUtils, () => new IOSSimulatorUtils());
context.putIfAbsent(SimControl, () => new SimControl());
context.putIfAbsent(Usage, () => new Usage());
context.putIfAbsent(ProcessManager, () => new ProcessManager());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You need to add the same putIfAbsent into test/src/context.dart

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@johnmccutchan
Copy link
Contributor

LGTM after figuring out travis failures

@eseidelGoogle
Copy link
Contributor

@danrubel

Copy link
Contributor

@danrubel danrubel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM with suggestion for you to address as you see fit.

);
}

ProcessResult runSync(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would prefer if we only used the run method throughout flutter tools and deleted this runSync method.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like it, but it'd be a pretty invasive change, so let's do it in a different change.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Filed #7102

@tvolkert
Copy link
Contributor Author

I had to change around how context overrides are applied in the tests in order to fix the Travis failures. PTAL.

@johnmccutchan
Copy link
Contributor

I like the new test overrides interface. LGTM.

@tvolkert tvolkert merged commit 60b19b2 into flutter:master Nov 30, 2016
@tvolkert tvolkert deleted the os-abstraction-layer branch November 30, 2016 16:42
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 14, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants