Make some pkg tests less timing-dependent.

Testing should not depend on how long it takes to get a response from the
analysis server.

Depending on how long an analysis step takes, these tests will randomly fail
e.g. when run in -mdebug mode, or with other VM flags that change (i.e. slow-down)
timing (--trace-compiler, --optimization-counter-threshold=5"

There are probably more problematic places like this. I just fixed the ones that
I saw failing when running with --optimization-counter-threshold=5.

BUG=#26556
R=scheglov@google.com

Review URL: https://codereview.chromium.org/2016993004 .
This commit is contained in:
Florian Schneider 2016-05-30 12:14:16 +02:00
parent e5597652f8
commit 2a6847de41
2 changed files with 2 additions and 5 deletions

View file

@ -338,12 +338,12 @@ import "../foo/foo.dart";
subscriptions[service] = <String>[bar.path].toSet();
}
server.setAnalysisSubscriptions(subscriptions);
await pumpEventQueue(1000);
await server.onAnalysisComplete;
expect(server.statusAnalyzing, isFalse);
channel.notificationsReceived.clear();
server.updateContent(
'0', {bar.path: new AddContentOverlay('library bar; void f() {}')});
await pumpEventQueue(1000);
await server.onAnalysisComplete;
expect(server.statusAnalyzing, isFalse);
expect(channel.notificationsReceived, isNotEmpty);
Set<String> notificationTypesReceived = new Set<String>();

View file

@ -249,9 +249,6 @@ class MockServerChannel implements ServerCommunicationChannel {
Future<Response> waitForResponse(Request request) {
String id = request.id;
pumpEventQueue().then((_) {
responseController.addError(new NoResponseException(request));
});
return new Future<Response>(() =>
responseController.stream.firstWhere((response) => response.id == id));
}