Files
sdk/pkg/analysis_server/test/integration/server/set_subscriptions_test.dart
T
paulberry@google.com a5e47c8eb2 Change integration test send...() methods to use structured objects.
This is less error prone than using raw JSON, and requires less effort
when writing integration tests.

R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org//621383002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@40904 260f80e4-7a28-3924-810f-c04153c831b5
2014-10-03 18:52:47 +00:00

57 lines
1.6 KiB
Dart

// 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.integration.server.set.subscriptions;
import 'dart:async';
import 'package:analysis_server/src/protocol.dart';
import 'package:unittest/unittest.dart';
import '../../reflective_tests.dart';
import '../integration_tests.dart';
@ReflectiveTestCase()
class Test extends AbstractAnalysisServerIntegrationTest {
test_setSubscriptions() {
bool statusReceived = false;
Completer analysisBegun = new Completer();
onServerStatus.listen((_) {
statusReceived = true;
});
onAnalysisErrors.listen((_) {
if (!analysisBegun.isCompleted) {
analysisBegun.complete();
}
});
return sendServerSetSubscriptions([]).then((_) {
String pathname = sourcePath('test.dart');
writeFile(pathname, '''
main() {
var x;
}''');
standardAnalysisSetup(subscribeStatus: false);
// Analysis should begin, but no server.status notification should be
// received.
return analysisBegun.future.then((_) {
expect(statusReceived, isFalse);
return sendServerSetSubscriptions([ServerService.STATUS]).then((_) {
// Tickle test.dart just in case analysis has already completed.
writeFile(pathname, '''
main() {
var y;
}''');
// Analysis should eventually complete, and we should be notified
// about it.
return analysisFinished;
});
});
});
}
}
main() {
runReflectiveTests(Test);
}