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

Unified Diff: pkg/analysis_server/benchmark/perf/completion_timing_tests.dart

Issue 1419503002: refactor timing tests to not use the test framework (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: remove unused code Created 5 years, 2 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/benchmark/perf/completion_timing_tests.dart
diff --git a/pkg/analysis_server/benchmark/perf/completion_timing_tests.dart b/pkg/analysis_server/benchmark/perf/completion_timing_tests.dart
index 6ff587a18f5793aad94a49d45176b3fe10f36af6..f28ccf4e5e87e8087cf74ed7854ad107f9a3543a 100644
--- a/pkg/analysis_server/benchmark/perf/completion_timing_tests.dart
+++ b/pkg/analysis_server/benchmark/perf/completion_timing_tests.dart
@@ -8,7 +8,6 @@ import 'dart:async';
import 'dart:io';
import 'package:args/args.dart';
-import 'package:test_reflective_loader/test_reflective_loader.dart';
import 'package:unittest/unittest.dart';
import '../../test/utils.dart';
@@ -29,11 +28,9 @@ main(List<String> arguments) {
}
source = args[SOURCE_OPTION];
priorityFile = args[PRIORITY_FILE_OPTION];
- offset = args[COMPLETION_OFFSET];
+ offset = int.parse(args[COMPLETION_OFFSET]);
- unittestConfiguration.timeout = new Duration(minutes: 20);
-
- defineReflectiveTests(CompletionTimingTest);
+ Future.wait([new CompletionTimingTest().test_timing()]);
}
const PRIORITY_FILE_OPTION = 'priority';
@@ -49,17 +46,17 @@ ArgParser _createArgParser() => new ArgParser()
..addOption(PRIORITY_FILE_OPTION, help: 'full path to a priority file')
..addOption(COMPLETION_OFFSET, help: 'offset in file for code completions');
-@reflectiveTest
-class CompletionTimingTest extends AbstractAnalysisServerPerformanceTest {
+/**
+ * CompletionTimingTest measures the time taken for the analysis server to respond with
+ * completion suggestions for a given file and offset. The time measured starts when
+ * the analysis root is set and is done when the completion suggestions are received
+ * from the server. The test does not wait for analysis to be complete before asking for
+ * completions.
+ */
+class CompletionTimingTest extends AbstractTimingTest {
List<Duration> timings = <Duration>[];
- @override
- Future setUp() => super.setUp().then((_) {
- sourceDirectory = new Directory(source);
- subscribeToStatusNotifications();
- });
-
- Future test_timing() {
+ Future test_timing() async {
// debugStdio();
expect(priorityFile, isNotNull,
@@ -67,6 +64,7 @@ class CompletionTimingTest extends AbstractAnalysisServerPerformanceTest {
expect(offset, isNotNull,
reason: 'An offset must be specified for completion testing.');
+ await init(source);
stopwatch.start();
onCompletionResults.listen((_) {
@@ -77,10 +75,10 @@ class CompletionTimingTest extends AbstractAnalysisServerPerformanceTest {
sendAnalysisSetPriorityFiles([priorityFile]);
sendCompletionGetSuggestions(priorityFile, offset);
- return analysisFinished.then((_) {
- print('analysis completed in ${stopwatch.elapsed}');
- timings.forEach((timing) => print('notification at : ${timings}'));
- stopwatch.reset();
- });
+ await analysisFinished;
+
+ print('analysis completed in ${stopwatch.elapsed}');
+ print('completion received at : ${timings}');
+ await shutdown();
}
}

Powered by Google App Engine
This is Rietveld 408576698