Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(758)

Unified Diff: pkg/analyzer_cli/test/utils.dart

Issue 1868663002: Update worker mode to use the bazel protos directly instead of json (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: s/setInputBytes/addInputBytes Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/analyzer_cli/test/message_grouper_test.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer_cli/test/utils.dart
diff --git a/pkg/analyzer_cli/test/utils.dart b/pkg/analyzer_cli/test/utils.dart
index 07dbe4baaa23e97b719d164bb27d08044f37d0a4..ce71009b635c16834d3417305b85e4aa36ecd1c8 100644
--- a/pkg/analyzer_cli/test/utils.dart
+++ b/pkg/analyzer_cli/test/utils.dart
@@ -4,6 +4,7 @@
library analyzer_cli.test.utils;
+import 'dart:collection';
import 'dart:io';
import 'dart:mirrors';
@@ -11,6 +12,7 @@ import 'package:analyzer/analyzer.dart';
import 'package:analyzer/src/generated/java_io.dart';
import 'package:path/path.dart' as pathos;
import 'package:path/path.dart' as path;
+import 'package:typed_mock/typed_mock.dart';
import 'package:unittest/unittest.dart';
/// Gets the test directory in a way that works with
@@ -63,3 +65,37 @@ dynamic withTempDir(fn(String path)) {
}
class _TestUtils {}
+
+/**
+ * A [Stdin] mock.
+ */
+class TestStdinStream extends TypedMock implements Stdin {
+ final pendingBytes = new Queue<int>();
+
+ // Adds all the input bytes to this stream.
+ void addInputBytes(List<int> bytes) {
+ pendingBytes.addAll(bytes);
+ }
+
+ @override
+ int readByteSync() {
+ if (pendingBytes.isEmpty) {
+ return -1;
+ } else {
+ return pendingBytes.removeFirst();
+ }
+ }
+}
+
+/**
+ * A [Stdout] mock.
+ */
+class TestStdoutStream extends TypedMock implements Stdout {
+ final writes = <List<int>>[];
+
+ @override
+ void add(List<int> bytes) {
+ super.add(bytes);
+ writes.add(bytes);
+ }
+}
« no previous file with comments | « pkg/analyzer_cli/test/message_grouper_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698