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

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

Issue 308003009: Add ServerOperation and queue. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Tweaks for review comments Created 6 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
« no previous file with comments | « pkg/analysis_server/test/domain_analysis_test.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
deleted file mode 100644
index bd123a0eb289de57e0d9af8f7a4cba006618a096..0000000000000000000000000000000000000000
--- a/pkg/analysis_server/test/domain_context_test.dart
+++ /dev/null
@@ -1,154 +0,0 @@
-// Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-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/constants.dart';
-import 'package:analysis_server/src/domain_context.dart';
-import 'package:analysis_server/src/protocol.dart';
-import 'package:analysis_server/src/resource.dart';
-import 'package:unittest/unittest.dart';
-
-import 'mocks.dart';
-
-main() {
- group('ContextDomainHandlerTest', () {
- // TODO(scheglov) remove or move to the 'analysis' domain
-// test('applyChanges', ContextDomainHandlerTest.applyChanges);
- test('createChangeSet', ContextDomainHandlerTest.createChangeSet);
- test('createChangeSet_onlyAdded', ContextDomainHandlerTest.createChangeSet_onlyAdded);
- // TODO(scheglov) remove or move to the 'analysis' domain
-// test('setOptions', ContextDomainHandlerTest.setOptions);
-// test('setPrioritySources_empty', ContextDomainHandlerTest.setPrioritySources_empty);
-// test('setPrioritySources_nonEmpty', ContextDomainHandlerTest.setPrioritySources_nonEmpty);
- });
-}
-
-class ContextDomainHandlerTest {
- static int contextIdCounter = 0;
-
- // TODO(scheglov) remove or move to the 'analysis' domain
-// static void applyChanges() {
-// AnalysisServer server = new AnalysisServer(new MockServerChannel());
-// String contextId = _createContext(server);
-// ChangeSet changeSet = new ChangeSet();
-// ContextDomainHandler handler = new ContextDomainHandler(server);
-//
-// Request request = new Request('0', ContextDomainHandler.APPLY_CHANGES_NAME);
-// request.setParameter(ContextDomainHandler.CONTEXT_ID_PARAM, contextId);
-// request.setParameter(ContextDomainHandler.SOURCES_PARAM, []);
-// request.setParameter(ContextDomainHandler.CHANGES_PARAM, {
-// ContextDomainHandler.ADDED_PARAM : ['ffile:/one.dart'],
-// ContextDomainHandler.MODIFIED_PARAM : ['ffile:/two.dart'],
-// ContextDomainHandler.REMOVED_PARAM : ['ffile:/three.dart']
-// });
-// expect(server.contextWorkQueue, isEmpty);
-// Response response = handler.handleRequest(request);
-// expect(server.contextWorkQueue, hasLength(1));
-// expect(response.toJson(), equals({
-// Response.ID: '0'
-// }));
-// }
-
- static void createChangeSet() {
- AnalysisServer server = new AnalysisServer(
- new MockServerChannel(),
- PhysicalResourceProvider.INSTANCE);
- Request request = new Request('0', APPLY_CHANGES_NAME);
- ContextDomainHandler handler = new ContextDomainHandler(server);
- SourceFactory sourceFactory = new SourceFactory([new FileUriResolver()]);
- ChangeSet changeSet = handler.createChangeSet(request, sourceFactory,
- new RequestDatum(request, CHANGES_PARAM, {
- ADDED: ['ffile:/one.dart'],
- MODIFIED_PARAM: [],
- REMOVED: ['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 createChangeSet_onlyAdded() {
- AnalysisServer server = new AnalysisServer(
- new MockServerChannel(),
- PhysicalResourceProvider.INSTANCE);
- Request request = new Request('0', APPLY_CHANGES_NAME);
- ContextDomainHandler handler = new ContextDomainHandler(server);
- SourceFactory sourceFactory = new SourceFactory([new FileUriResolver()]);
- ChangeSet changeSet = handler.createChangeSet(request, sourceFactory,
- new RequestDatum(request, CHANGES_PARAM, {
- ADDED: ['ffile:/one.dart'],
- }));
- expect(changeSet.addedSources, hasLength(equals(1)));
- expect(changeSet.changedSources, hasLength(equals(0)));
- expect(changeSet.removedSources, hasLength(equals(0)));
- }
-
- // TODO(scheglov) remove or move to the 'analysis' domain
-// static void setOptions() {
-// AnalysisServer server = new AnalysisServer(new MockServerChannel());
-// String contextId = _createContext(server);
-// Map<String, Object> options = new Map<String, Object>();
-// ContextDomainHandler handler = new ContextDomainHandler(server);
-//
-// Request request = new Request('0', ContextDomainHandler.SET_OPTIONS_NAME);
-// request.setParameter(ContextDomainHandler.CONTEXT_ID_PARAM, contextId);
-// request.setParameter(ContextDomainHandler.OPTIONS_PARAM, options);
-// Response response = handler.handleRequest(request);
-// expect(response.toJson(), equals({
-// Response.ID: '0'
-// }));
-// }
-
- // TODO(scheglov) remove or move to the 'analysis' domain
-// static void setPrioritySources_empty() {
-// AnalysisServer server = new AnalysisServer(new MockServerChannel());
-// String contextId = _createContext(server);
-// List<String> sources = new List<String>();
-// ContextDomainHandler handler = new ContextDomainHandler(server);
-//
-// Request request = new Request('0', ContextDomainHandler.SET_PRIORITY_SOURCES_NAME);
-// request.setParameter(ContextDomainHandler.CONTEXT_ID_PARAM, contextId);
-// request.setParameter(ContextDomainHandler.SOURCES_PARAM, sources);
-// Response response = handler.handleRequest(request);
-// expect(response.toJson(), equals({
-// Response.ID: '0'
-// }));
-// }
-
- // TODO(scheglov) remove or move to the 'analysis' domain
-// static void setPrioritySources_nonEmpty() {
-// AnalysisServer server = new AnalysisServer(new MockServerChannel());
-// String contextId = _createContext(server);
-// List<String> sources = new List<String>();
-// sources.add("foo.dart");
-// ContextDomainHandler handler = new ContextDomainHandler(server);
-//
-// Request request = new Request('0', ContextDomainHandler.SET_PRIORITY_SOURCES_NAME);
-// request.setParameter(ContextDomainHandler.CONTEXT_ID_PARAM, contextId);
-// request.setParameter(ContextDomainHandler.SOURCES_PARAM, sources);
-// Response response = handler.handleRequest(request);
-// expect(response.toJson(), equals({
-// Response.ID: '0'
-// }));
-// }
-
- // TODO(scheglov) remove or move to the 'analysis' domain
-// static String _createContext(AnalysisServer server) {
-// String contextId = "context${contextIdCounter++}";
-// ServerDomainHandler handler = new ServerDomainHandler(server);
-// Request request = new Request('0', ServerDomainHandler.CREATE_CONTEXT_METHOD);
-// request.setParameter(ServerDomainHandler.SDK_DIRECTORY_PARAM, sdkPath);
-// request.setParameter(AnalysisServer.CONTEXT_ID_PARAM, contextId);
-// Response response = handler.handleRequest(request);
-// if (response.error != null) {
-// fail('Unexpected error: ${response.error.toJson()}');
-// }
-// return contextId;
-// }
-}
« no previous file with comments | « pkg/analysis_server/test/domain_analysis_test.dart ('k') | pkg/analysis_server/test/mocks.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698