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

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

Issue 2212813003: Clean up use of resource provider in cli (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 4 years, 4 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/lib/src/driver.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/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();
}
}
« no previous file with comments | « pkg/analyzer_cli/lib/src/driver.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698