| OLD | NEW |
| 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 library analyzer_cli.test.built_mode; | 5 library analyzer_cli.test.built_mode; |
| 6 | 6 |
| 7 import 'dart:async'; |
| 8 |
| 7 import 'package:analyzer/file_system/memory_file_system.dart'; | 9 import 'package:analyzer/file_system/memory_file_system.dart'; |
| 8 import 'package:analyzer_cli/src/build_mode.dart'; | 10 import 'package:analyzer_cli/src/build_mode.dart'; |
| 9 import 'package:analyzer_cli/src/driver.dart'; | 11 import 'package:analyzer_cli/src/driver.dart'; |
| 10 import 'package:analyzer_cli/src/options.dart'; | 12 import 'package:analyzer_cli/src/options.dart'; |
| 11 import 'package:bazel_worker/bazel_worker.dart'; | 13 import 'package:bazel_worker/bazel_worker.dart'; |
| 12 import 'package:bazel_worker/testing.dart'; | 14 import 'package:bazel_worker/testing.dart'; |
| 13 import 'package:protobuf/protobuf.dart'; | 15 import 'package:protobuf/protobuf.dart'; |
| 14 import 'package:test/test.dart'; | 16 import 'package:test/test.dart'; |
| 15 import 'package:test_reflective_loader/test_reflective_loader.dart'; | 17 import 'package:test_reflective_loader/test_reflective_loader.dart'; |
| 16 | 18 |
| 17 main() { | 19 main() { |
| 18 defineReflectiveTests(WorkerLoopTest); | 20 defineReflectiveTests(WorkerLoopTest); |
| 19 } | 21 } |
| 20 | 22 |
| 21 typedef void _TestWorkerLoopAnalyze(CommandLineOptions options); | 23 typedef void _TestWorkerLoopAnalyze(CommandLineOptions options); |
| 22 | 24 |
| 23 /** | 25 /** |
| 24 * [AnalyzerWorkerLoop] for testing. | 26 * [AnalyzerWorkerLoop] for testing. |
| 25 */ | 27 */ |
| 26 class TestAnalyzerWorkerLoop extends AnalyzerWorkerLoop { | 28 class TestAnalyzerWorkerLoop extends AnalyzerWorkerLoop { |
| 27 final _TestWorkerLoopAnalyze _analyze; | 29 final _TestWorkerLoopAnalyze _analyze; |
| 28 | 30 |
| 29 TestAnalyzerWorkerLoop(AsyncWorkerConnection connection, [this._analyze]) | 31 TestAnalyzerWorkerLoop(AsyncWorkerConnection connection, [this._analyze]) |
| 30 : super(new MemoryResourceProvider(), connection); | 32 : super(new MemoryResourceProvider(), connection); |
| 31 | 33 |
| 32 @override | 34 @override |
| 33 void analyze(CommandLineOptions options) { | 35 Future<Null> analyze(CommandLineOptions options) async { |
| 34 if (_analyze != null) { | 36 if (_analyze != null) { |
| 35 _analyze(options); | 37 _analyze(options); |
| 36 } | 38 } |
| 37 } | 39 } |
| 38 } | 40 } |
| 39 | 41 |
| 40 @reflectiveTest | 42 @reflectiveTest |
| 41 class WorkerLoopTest { | 43 class WorkerLoopTest { |
| 42 final TestStdinAsync stdinStream = new TestStdinAsync(); | 44 final TestStdinAsync stdinStream = new TestStdinAsync(); |
| 43 final TestStdoutStream stdoutStream = new TestStdoutStream(); | 45 final TestStdoutStream stdoutStream = new TestStdoutStream(); |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 List<int> _serializeProto(GeneratedMessage message) { | 135 List<int> _serializeProto(GeneratedMessage message) { |
| 134 var buffer = message.writeToBuffer(); | 136 var buffer = message.writeToBuffer(); |
| 135 | 137 |
| 136 var writer = new CodedBufferWriter(); | 138 var writer = new CodedBufferWriter(); |
| 137 writer.writeInt32NoTag(buffer.length); | 139 writer.writeInt32NoTag(buffer.length); |
| 138 writer.writeRawBytes(buffer); | 140 writer.writeRawBytes(buffer); |
| 139 | 141 |
| 140 return writer.toBuffer(); | 142 return writer.toBuffer(); |
| 141 } | 143 } |
| 142 } | 144 } |
| OLD | NEW |