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

Unified Diff: pkg/analysis_server/test/src/plugin/request_converter_test.dart

Issue 2879273002: Make server use the common protocol classes (Closed)
Patch Set: Created 3 years, 7 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
Index: pkg/analysis_server/test/src/plugin/request_converter_test.dart
diff --git a/pkg/analysis_server/test/src/plugin/request_converter_test.dart b/pkg/analysis_server/test/src/plugin/request_converter_test.dart
index 377dc13b14540e001e80eb57893598d9696010fe..f306b92a480a641c1adc5a7e05bcce989e81db99 100644
--- a/pkg/analysis_server/test/src/plugin/request_converter_test.dart
+++ b/pkg/analysis_server/test/src/plugin/request_converter_test.dart
@@ -5,7 +5,7 @@
import 'package:analysis_server/protocol/protocol_generated.dart' as server;
import 'package:analysis_server/src/plugin/request_converter.dart';
import 'package:analysis_server/src/protocol/protocol_internal.dart' as server;
-import 'package:analyzer_plugin/protocol/protocol_common.dart' as plugin;
+import 'package:analyzer_plugin/protocol/protocol_common.dart';
import 'package:analyzer_plugin/protocol/protocol_generated.dart' as plugin;
import 'package:test/test.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';
@@ -67,8 +67,8 @@ class RequestConverterTest extends ProtocolTestUtilities {
void test_convertAnalysisUpdateContentParams() {
Map<String, dynamic> serverFiles = <String, dynamic>{
- 'file1': new server.AddContentOverlay('content1'),
- 'file2': new server.AddContentOverlay('content2'),
+ 'file1': new AddContentOverlay('content1'),
+ 'file2': new AddContentOverlay('content2'),
};
plugin.AnalysisUpdateContentParams result =
converter.convertAnalysisUpdateContentParams(
@@ -76,54 +76,7 @@ class RequestConverterTest extends ProtocolTestUtilities {
expect(result, isNotNull);
Map<String, dynamic> pluginFiles = result.files;
expect(pluginFiles, hasLength(2));
- expect(pluginFiles['file1'], new isInstanceOf<plugin.AddContentOverlay>());
- expect(pluginFiles['file2'], new isInstanceOf<plugin.AddContentOverlay>());
- }
-
- void test_convertFileOverlay_add() {
- String content = 'content';
- plugin.AddContentOverlay result =
- converter.convertFileOverlay(new server.AddContentOverlay(content));
- expect(result, isNotNull);
- expect(result.content, content);
- }
-
- void test_convertFileOverlay_change() {
- List<server.SourceEdit> serverEdits = <server.SourceEdit>[
- new server.SourceEdit(10, 5, 'a'),
- new server.SourceEdit(20, 6, 'b'),
- new server.SourceEdit(30, 7, 'c'),
- ];
- plugin.ChangeContentOverlay result = converter
- .convertFileOverlay(new server.ChangeContentOverlay(serverEdits));
- expect(result, isNotNull);
- List<plugin.SourceEdit> pluginEdits = result.edits;
- int editCount = serverEdits.length;
- expect(pluginEdits, hasLength(editCount));
- for (int i = 0; i < editCount; i++) {
- server.SourceEdit serverEdit = serverEdits[i];
- plugin.SourceEdit pluginEdit = pluginEdits[i];
- expect(pluginEdit.offset, serverEdit.offset);
- expect(pluginEdit.length, serverEdit.length);
- expect(pluginEdit.replacement, serverEdit.replacement);
- }
- }
-
- void test_convertFileOverlay_remove() {
- plugin.RemoveContentOverlay result =
- converter.convertFileOverlay(new server.RemoveContentOverlay());
- expect(result, isNotNull);
- }
-
- void test_convertSourceEdit() {
- int offset = 5;
- int length = 3;
- String replacement = 'x';
- plugin.SourceEdit result = converter
- .convertSourceEdit(new server.SourceEdit(offset, length, replacement));
- expect(result, isNotNull);
- expect(result.offset, offset);
- expect(result.length, length);
- expect(result.replacement, replacement);
+ expect(pluginFiles['file1'], new isInstanceOf<AddContentOverlay>());
+ expect(pluginFiles['file2'], new isInstanceOf<AddContentOverlay>());
}
}

Powered by Google App Engine
This is Rietveld 408576698