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

Unified Diff: pkg/analysis_server/test/domain_context_test.dart

Issue 214933002: Clean-up and progress on analysis server (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 9 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/analysis_server/lib/src/protocol.dart ('k') | pkg/analysis_server/test/mocks.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analysis_server/test/domain_context_test.dart
diff --git a/pkg/analysis_server/test/domain_context_test.dart b/pkg/analysis_server/test/domain_context_test.dart
index 953f8eb64764855f4bb3999d6282c748fa0dc192..1b0e4b16c585de73cf774a793fd781aec4267d01 100644
--- a/pkg/analysis_server/test/domain_context_test.dart
+++ b/pkg/analysis_server/test/domain_context_test.dart
@@ -5,6 +5,8 @@
library test.domain.context;
import 'package:analyzer/src/generated/engine.dart';
+import 'package:analyzer/src/generated/source.dart';
+import 'package:analyzer/src/generated/source_io.dart';
import 'package:analysis_server/src/analysis_server.dart';
import 'package:analysis_server/src/domain_context.dart';
import 'package:analysis_server/src/domain_server.dart';
@@ -17,6 +19,7 @@ import 'mocks.dart';
main() {
group('ContextDomainHandlerTest', () {
test('applyChanges', ContextDomainHandlerTest.applyChanges);
+ test('createChangeSet', ContextDomainHandlerTest.createChangeSet);
test('setOptions', ContextDomainHandlerTest.setOptions);
test('setPrioritySources_empty', ContextDomainHandlerTest.setPrioritySources_empty);
test('setPrioritySources_nonEmpty', ContextDomainHandlerTest.setPrioritySources_nonEmpty);
@@ -32,9 +35,11 @@ class ContextDomainHandlerTest {
Request request = new Request('0', ContextDomainHandler.APPLY_CHANGES_NAME);
request.setParameter(ContextDomainHandler.CONTEXT_ID_PARAM, contextId);
- // TODO (danrubel) convert ChangeSet to Map
-// request.setParameter(ContextDomainHandler.CHANGES_PARAM, changeSet);
- request.setParameter(ContextDomainHandler.CHANGES_PARAM, new Map());
+ request.setParameter(ContextDomainHandler.CHANGES_PARAM, {
+ ContextDomainHandler.ADDED_PARAM : ['ffile:/one.dart'],
+ ContextDomainHandler.MODIFIED_PARAM : ['ffile:/two.dart'],
+ ContextDomainHandler.REMOVED_PARAM : ['ffile:/three.dart']
+ });
Response response = handler.handleRequest(request);
expect(response.toJson(), equals({
Response.ID: '0',
@@ -42,6 +47,21 @@ class ContextDomainHandlerTest {
}));
}
+ static void createChangeSet() {
+ AnalysisServer server = new AnalysisServer(new MockServerChannel());
+ Request request = new Request('0', ContextDomainHandler.APPLY_CHANGES_NAME);
+ ContextDomainHandler handler = new ContextDomainHandler(server);
+ SourceFactory sourceFactory = new SourceFactory([new FileUriResolver()]);
+ ChangeSet changeSet = handler.createChangeSet(request, sourceFactory, {
+ ContextDomainHandler.ADDED_PARAM : ['ffile:/one.dart'],
+ ContextDomainHandler.MODIFIED_PARAM : [],
+ ContextDomainHandler.REMOVED_PARAM : ['ffile:/two.dart', 'ffile:/three.dart']
+ });
+ expect(changeSet.addedSources, hasLength(equals(1)));
+ expect(changeSet.changedSources, hasLength(equals(0)));
+ expect(changeSet.removedSources, hasLength(equals(2)));
+ }
+
static void setOptions() {
AnalysisServer server = new AnalysisServer(new MockServerChannel());
String contextId = _createContext(server);
« no previous file with comments | « pkg/analysis_server/lib/src/protocol.dart ('k') | pkg/analysis_server/test/mocks.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698