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

Side by Side Diff: pkg/analysis_server/test/domain_analysis_test.dart

Issue 787763004: Hooks for instrumentation (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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 test.domain.analysis; 5 library test.domain.analysis;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 8
9 import 'package:analysis_server/src/analysis_server.dart'; 9 import 'package:analysis_server/src/analysis_server.dart';
10 import 'package:analysis_server/src/constants.dart'; 10 import 'package:analysis_server/src/constants.dart';
11 import 'package:analysis_server/src/domain_analysis.dart'; 11 import 'package:analysis_server/src/domain_analysis.dart';
12 import 'package:analysis_server/src/protocol.dart'; 12 import 'package:analysis_server/src/protocol.dart';
13 import 'package:analyzer/file_system/memory_file_system.dart'; 13 import 'package:analyzer/file_system/memory_file_system.dart';
14 import 'package:analyzer/instrumentation/instrumentation.dart';
14 import 'package:path/path.dart'; 15 import 'package:path/path.dart';
15 import 'package:unittest/unittest.dart'; 16 import 'package:unittest/unittest.dart';
16 17
17 import 'analysis_abstract.dart'; 18 import 'analysis_abstract.dart';
18 import 'mock_sdk.dart'; 19 import 'mock_sdk.dart';
19 import 'mocks.dart'; 20 import 'mocks.dart';
20 import 'reflective_tests.dart'; 21 import 'reflective_tests.dart';
21 22
22 23
23 main() { 24 main() {
24 groupSep = ' | '; 25 groupSep = ' | ';
25 26
26 runReflectiveTests(AnalysisDomainTest); 27 runReflectiveTests(AnalysisDomainTest);
27 28
28 MockServerChannel serverChannel; 29 MockServerChannel serverChannel;
29 MemoryResourceProvider resourceProvider; 30 MemoryResourceProvider resourceProvider;
30 AnalysisServer server; 31 AnalysisServer server;
31 AnalysisDomainHandler handler; 32 AnalysisDomainHandler handler;
32 33
33 setUp(() { 34 setUp(() {
34 serverChannel = new MockServerChannel(); 35 serverChannel = new MockServerChannel();
35 resourceProvider = new MemoryResourceProvider(); 36 resourceProvider = new MemoryResourceProvider();
36 server = new AnalysisServer( 37 server = new AnalysisServer(
37 serverChannel, 38 serverChannel,
38 resourceProvider, 39 resourceProvider,
39 new MockPackageMapProvider(), 40 new MockPackageMapProvider(),
40 null, 41 null,
41 new AnalysisServerOptions(), 42 new AnalysisServerOptions(),
42 new MockSdk()); 43 new MockSdk(),
44 new NullInstrumentationServer());
43 handler = new AnalysisDomainHandler(server); 45 handler = new AnalysisDomainHandler(server);
44 }); 46 });
45 47
46 group('updateContent', testUpdateContent); 48 group('updateContent', testUpdateContent);
47 group('setSubscriptions', test_setSubscriptions); 49 group('setSubscriptions', test_setSubscriptions);
48 50
49 group('AnalysisDomainHandler', () { 51 group('AnalysisDomainHandler', () {
50 group('setAnalysisRoots', () { 52 group('setAnalysisRoots', () {
51 Response testSetAnalysisRoots(List<String> included, 53 Response testSetAnalysisRoots(List<String> included,
52 List<String> excluded) { 54 List<String> excluded) {
(...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after
454 456
455 AnalysisTestHelper() { 457 AnalysisTestHelper() {
456 serverChannel = new MockServerChannel(); 458 serverChannel = new MockServerChannel();
457 resourceProvider = new MemoryResourceProvider(); 459 resourceProvider = new MemoryResourceProvider();
458 server = new AnalysisServer( 460 server = new AnalysisServer(
459 serverChannel, 461 serverChannel,
460 resourceProvider, 462 resourceProvider,
461 new MockPackageMapProvider(), 463 new MockPackageMapProvider(),
462 null, 464 null,
463 new AnalysisServerOptions(), 465 new AnalysisServerOptions(),
464 new MockSdk()); 466 new MockSdk(),
467 new NullInstrumentationServer());
465 handler = new AnalysisDomainHandler(server); 468 handler = new AnalysisDomainHandler(server);
466 // listen for notifications 469 // listen for notifications
467 Stream<Notification> notificationStream = 470 Stream<Notification> notificationStream =
468 serverChannel.notificationController.stream; 471 serverChannel.notificationController.stream;
469 notificationStream.listen((Notification notification) { 472 notificationStream.listen((Notification notification) {
470 if (notification.event == ANALYSIS_ERRORS) { 473 if (notification.event == ANALYSIS_ERRORS) {
471 var decoded = new AnalysisErrorsParams.fromNotification(notification); 474 var decoded = new AnalysisErrorsParams.fromNotification(notification);
472 filesErrors[decoded.file] = decoded.errors; 475 filesErrors[decoded.file] = decoded.errors;
473 } 476 }
474 if (notification.event == ANALYSIS_HIGHLIGHTS) { 477 if (notification.event == ANALYSIS_HIGHLIGHTS) {
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
637 return waitForServerOperationsPerformed(server); 640 return waitForServerOperationsPerformed(server);
638 } 641 }
639 642
640 static String _getCodeString(code) { 643 static String _getCodeString(code) {
641 if (code is List<String>) { 644 if (code is List<String>) {
642 code = code.join('\n'); 645 code = code.join('\n');
643 } 646 }
644 return code as String; 647 return code as String;
645 } 648 }
646 } 649 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/test/analysis_server_test.dart ('k') | pkg/analysis_server/test/domain_completion_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698