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

Unified Diff: pkg/analysis_server/test/analysis/update_content_test.dart

Issue 904093002: Discard pending notifications on the same source change. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 10 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/analysis/update_content_test.dart
diff --git a/pkg/analysis_server/test/analysis/update_content_test.dart b/pkg/analysis_server/test/analysis/update_content_test.dart
index f4d5bca234e2d638635c5ed6f76691d98e73ca83..5b780a7e436d826f4217b33544ddb527ca68dd00 100644
--- a/pkg/analysis_server/test/analysis/update_content_test.dart
+++ b/pkg/analysis_server/test/analysis/update_content_test.dart
@@ -21,6 +21,8 @@ main() {
@reflectiveTest
class UpdateContentTest extends AbstractAnalysisTest {
Map<String, List<AnalysisError>> filesErrors = {};
+ int serverErrorCount = 0;
+ int navigationCount = 0;
@override
void processNotification(Notification notification) {
@@ -28,6 +30,37 @@ class UpdateContentTest extends AbstractAnalysisTest {
var decoded = new AnalysisErrorsParams.fromNotification(notification);
filesErrors[decoded.file] = decoded.errors;
}
+ if (notification.event == ANALYSIS_NAVIGATION) {
+ navigationCount++;
+ }
+ if (notification.event == SERVER_ERROR) {
+ serverErrorCount++;
+ }
+ }
+
+ test_discardNotifications_onSourceChange() async {
+ createProject();
+ addTestFile('');
+ await server.onAnalysisComplete;
+ server.setAnalysisSubscriptions({
+ AnalysisService.NAVIGATION: [testFile].toSet()
+ });
+ // update file, analyze, but don't sent notifications
+ navigationCount = 0;
+ server.updateContent('1', {
+ testFile: new AddContentOverlay('foo() {}')
+ });
+ server.test_performAllAnalysisOperations();
+ expect(serverErrorCount, 0);
+ expect(navigationCount, 0);
+ // replace the file contents,
+ // should discard any pending notification operations
+ server.updateContent('2', {
+ testFile: new AddContentOverlay('bar() {}')
+ });
+ await server.onAnalysisComplete;
+ expect(serverErrorCount, 0);
+ expect(navigationCount, 1);
}
test_illegal_ChangeContentOverlay() {

Powered by Google App Engine
This is Rietveld 408576698