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

Side by Side Diff: pkg/analysis_server/test/analysis/reanalyze_test.dart

Issue 2960073002: Generate constants in server as we do in plugin (Closed)
Patch Set: improve names Created 3 years, 5 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 unified diff | Download patch
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 import 'dart:async'; 5 import 'dart:async';
6 6
7 import 'package:analysis_server/protocol/protocol.dart'; 7 import 'package:analysis_server/protocol/protocol.dart';
8 import 'package:analysis_server/protocol/protocol_constants.dart';
8 import 'package:analysis_server/protocol/protocol_generated.dart'; 9 import 'package:analysis_server/protocol/protocol_generated.dart';
9 import 'package:analysis_server/src/constants.dart';
10 import 'package:analyzer_plugin/protocol/protocol_common.dart'; 10 import 'package:analyzer_plugin/protocol/protocol_common.dart';
11 import 'package:test/test.dart'; 11 import 'package:test/test.dart';
12 import 'package:test_reflective_loader/test_reflective_loader.dart'; 12 import 'package:test_reflective_loader/test_reflective_loader.dart';
13 13
14 import '../analysis_abstract.dart'; 14 import '../analysis_abstract.dart';
15 15
16 main() { 16 main() {
17 defineReflectiveSuite(() { 17 defineReflectiveSuite(() {
18 defineReflectiveTests(ReanalyzeTest); 18 defineReflectiveTests(ReanalyzeTest);
19 }); 19 });
20 } 20 }
21 21
22 @reflectiveTest 22 @reflectiveTest
23 class ReanalyzeTest extends AbstractAnalysisTest { 23 class ReanalyzeTest extends AbstractAnalysisTest {
24 Map<String, List<AnalysisError>> filesErrors = {}; 24 Map<String, List<AnalysisError>> filesErrors = {};
25 25
26 Completer _resultsAvailable = new Completer(); 26 Completer _resultsAvailable = new Completer();
27 27
28 @override 28 @override
29 void processNotification(Notification notification) { 29 void processNotification(Notification notification) {
30 if (notification.event == ANALYSIS_ERRORS) { 30 if (notification.event == ANALYSIS_NOTIFICATION_ERRORS) {
31 var decoded = new AnalysisErrorsParams.fromNotification(notification); 31 var decoded = new AnalysisErrorsParams.fromNotification(notification);
32 filesErrors[decoded.file] = decoded.errors; 32 filesErrors[decoded.file] = decoded.errors;
33 _resultsAvailable.complete(null); 33 _resultsAvailable.complete(null);
34 } 34 }
35 } 35 }
36 36
37 test_reanalyze() { 37 test_reanalyze() {
38 createProject(); 38 createProject();
39 Map drivers = server.driverMap; 39 Map drivers = server.driverMap;
40 expect(drivers, hasLength(1)); 40 expect(drivers, hasLength(1));
41 Request request = new Request("0", ANALYSIS_REANALYZE); 41 Request request = new Request("0", ANALYSIS_REQUEST_REANALYZE);
42 handleSuccessfulRequest(request); 42 handleSuccessfulRequest(request);
43 drivers = server.driverMap; 43 drivers = server.driverMap;
44 expect(drivers, hasLength(1)); 44 expect(drivers, hasLength(1));
45 } 45 }
46 46
47 test_reanalyze_with_overlay() async { 47 test_reanalyze_with_overlay() async {
48 createProject(); 48 createProject();
49 resourceProvider.newFolder(testFolder); 49 resourceProvider.newFolder(testFolder);
50 resourceProvider.newFile(testFile, 'main() {}'); 50 resourceProvider.newFile(testFile, 'main() {}');
51 // Update the content with an overlay that contains a syntax error. 51 // Update the content with an overlay that contains a syntax error.
(...skipping 16 matching lines...) Expand all
68 // Verify that the syntax error is present (this indicates that the 68 // Verify that the syntax error is present (this indicates that the
69 // content introduced by the call to updateContent is still in effect). 69 // content introduced by the call to updateContent is still in effect).
70 { 70 {
71 List<AnalysisError> errors = filesErrors[testFile]; 71 List<AnalysisError> errors = filesErrors[testFile];
72 expect(errors, hasLength(1)); 72 expect(errors, hasLength(1));
73 } 73 }
74 } 74 }
75 75
76 test_sentToPlugins() async { 76 test_sentToPlugins() async {
77 createProject(); 77 createProject();
78 Request request = new Request("0", ANALYSIS_REANALYZE); 78 Request request = new Request("0", ANALYSIS_REQUEST_REANALYZE);
79 handleSuccessfulRequest(request); 79 handleSuccessfulRequest(request);
80 // verify 80 // verify
81 expect(pluginManager.broadcastedRequest, isNotNull); 81 expect(pluginManager.broadcastedRequest, isNotNull);
82 } 82 }
83 } 83 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698