| OLD | NEW |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 library server.performance; | 5 library server.performance; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 | 8 |
| 9 import 'package:analysis_server/src/protocol.dart'; | 9 import 'package:analysis_server/src/protocol.dart'; |
| 10 import 'package:unittest/unittest.dart'; | 10 import 'package:unittest/unittest.dart'; |
| 11 | 11 |
| 12 import '../../test/integration/integration_tests.dart'; | 12 import '../../test/integration/integration_tests.dart'; |
| 13 | 13 |
| 14 /** | 14 /** |
| 15 * Base class for analysis server performance tests. | 15 * Base class for analysis server performance tests. |
| 16 */ | 16 */ |
| 17 abstract class AbstractAnalysisServerPerformanceTest | 17 abstract class AbstractAnalysisServerPerformanceTest |
| 18 extends AbstractAnalysisServerIntegrationTest { | 18 extends AbstractAnalysisServerIntegrationTest { |
| 19 /** | 19 /** |
| 20 * Stopwatch for timing results; | 20 * Stopwatch for timing results; |
| 21 */ | 21 */ |
| 22 Stopwatch stopwatch = new Stopwatch(); | 22 Stopwatch stopwatch = new Stopwatch(); |
| 23 | 23 |
| 24 /** | 24 /** |
| 25 * Send the server an 'analysis.setAnalysisRoots' command directing it to | 25 * Send the server an 'analysis.setAnalysisRoots' command directing it to |
| 26 * analyze [sourceDirectory]. | 26 * analyze [sourceDirectory]. |
| 27 */ | 27 */ |
| 28 Future setAnalysisRoot() { | 28 Future setAnalysisRoot() => |
| 29 return sendAnalysisSetAnalysisRoots([sourceDirectory.path], []); | 29 sendAnalysisSetAnalysisRoots([sourceDirectory.path], []); |
| 30 } | |
| 31 | 30 |
| 32 /** | 31 /** |
| 33 * Enable [SERVER_STATUS] notifications so that [analysisFinished] | 32 * Enable [SERVER_STATUS] notifications so that [analysisFinished] |
| 34 * can be used. | 33 * can be used. |
| 35 */ | 34 */ |
| 36 Future subscribeToStatusNotifications() { | 35 Future subscribeToStatusNotifications() { |
| 37 List<Future> futures = <Future>[]; | 36 List<Future> futures = <Future>[]; |
| 38 futures.add(sendServerSetSubscriptions([ServerService.STATUS])); | 37 futures.add(sendServerSetSubscriptions([ServerService.STATUS])); |
| 39 return Future.wait(futures); | 38 return Future.wait(futures); |
| 40 } | 39 } |
| (...skipping 21 matching lines...) Expand all Loading... |
| 62 skipShutdown = true; | 61 skipShutdown = true; |
| 63 }); | 62 }); |
| 64 return serverConnected.future; | 63 return serverConnected.future; |
| 65 }); | 64 }); |
| 66 } | 65 } |
| 67 | 66 |
| 68 /** | 67 /** |
| 69 * After every test, the server is stopped. | 68 * After every test, the server is stopped. |
| 70 */ | 69 */ |
| 71 @override | 70 @override |
| 72 Future tearDown() { | 71 Future tearDown() => shutdownIfNeeded(); |
| 73 return shutdownIfNeeded(); | |
| 74 } | |
| 75 } | 72 } |
| OLD | NEW |