| Index: pkg/analyzer_cli/test/build_mode_test.dart
|
| diff --git a/pkg/analyzer_cli/test/build_mode_test.dart b/pkg/analyzer_cli/test/build_mode_test.dart
|
| index 9c88a0f4e63d0513a51215b64ebde2effd8a1571..5e16d9532e2eddcd82605040511f9d6342828db8 100644
|
| --- a/pkg/analyzer_cli/test/build_mode_test.dart
|
| +++ b/pkg/analyzer_cli/test/build_mode_test.dart
|
| @@ -4,6 +4,7 @@
|
|
|
| library analyzer_cli.test.built_mode;
|
|
|
| +import 'package:analyzer/file_system/memory_file_system.dart';
|
| import 'package:analyzer_cli/src/build_mode.dart';
|
| import 'package:analyzer_cli/src/driver.dart';
|
| import 'package:analyzer_cli/src/options.dart';
|
| @@ -17,6 +18,25 @@ main() {
|
| defineReflectiveTests(WorkerLoopTest);
|
| }
|
|
|
| +typedef void _TestWorkerLoopAnalyze(CommandLineOptions options);
|
| +
|
| +/**
|
| + * [AnalyzerWorkerLoop] for testing.
|
| + */
|
| +class TestAnalyzerWorkerLoop extends AnalyzerWorkerLoop {
|
| + final _TestWorkerLoopAnalyze _analyze;
|
| +
|
| + TestAnalyzerWorkerLoop(SyncWorkerConnection connection, [this._analyze])
|
| + : super(new MemoryResourceProvider(), connection);
|
| +
|
| + @override
|
| + void analyze(CommandLineOptions options) {
|
| + if (_analyze != null) {
|
| + _analyze(options);
|
| + }
|
| + }
|
| +}
|
| +
|
| @reflectiveTest
|
| class WorkerLoopTest {
|
| final TestStdinSync stdinStream = new TestStdinSync();
|
| @@ -30,16 +50,6 @@ class WorkerLoopTest {
|
|
|
| void setUp() {}
|
|
|
| - List<int> _serializeProto(GeneratedMessage message) {
|
| - var buffer = message.writeToBuffer();
|
| -
|
| - var writer = new CodedBufferWriter();
|
| - writer.writeInt32NoTag(buffer.length);
|
| - writer.writeRawBytes(buffer);
|
| -
|
| - return writer.toBuffer();
|
| - }
|
| -
|
| test_run() {
|
| var request = new WorkRequest();
|
| request.arguments.addAll([
|
| @@ -119,23 +129,14 @@ class WorkerLoopTest {
|
| stdinStream.close();
|
| new TestAnalyzerWorkerLoop(connection).run();
|
| }
|
| -}
|
| -
|
| -typedef void _TestWorkerLoopAnalyze(CommandLineOptions options);
|
|
|
| -/**
|
| - * [AnalyzerWorkerLoop] for testing.
|
| - */
|
| -class TestAnalyzerWorkerLoop extends AnalyzerWorkerLoop {
|
| - final _TestWorkerLoopAnalyze _analyze;
|
| + List<int> _serializeProto(GeneratedMessage message) {
|
| + var buffer = message.writeToBuffer();
|
|
|
| - TestAnalyzerWorkerLoop(SyncWorkerConnection connection, [this._analyze])
|
| - : super(connection);
|
| + var writer = new CodedBufferWriter();
|
| + writer.writeInt32NoTag(buffer.length);
|
| + writer.writeRawBytes(buffer);
|
|
|
| - @override
|
| - void analyze(CommandLineOptions options) {
|
| - if (_analyze != null) {
|
| - _analyze(options);
|
| - }
|
| + return writer.toBuffer();
|
| }
|
| }
|
|
|