| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 test.timing.simple; | 5 library test.timing.simple; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 | 8 |
| 9 import 'package:analysis_server/src/protocol.dart'; |
| 9 import 'package:path/path.dart'; | 10 import 'package:path/path.dart'; |
| 10 | 11 |
| 11 import '../timing_framework.dart'; | 12 import '../timing_framework.dart'; |
| 12 | 13 |
| 13 /** | 14 /** |
| 14 * Perform the timing test, printing the minimum, average and maximum times, as | 15 * Perform the timing test, printing the minimum, average and maximum times, as |
| 15 * well as the standard deviation to the output. | 16 * well as the standard deviation to the output. |
| 16 */ | 17 */ |
| 17 void main(List<String> args) { | 18 void main(List<String> args) { |
| 18 SimpleTest test = new SimpleTest(); | 19 SimpleTest test = new SimpleTest(); |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 Future setUp() { | 80 Future setUp() { |
| 80 completionReceived = new Completer(); | 81 completionReceived = new Completer(); |
| 81 onCompletionResults.listen((_) { | 82 onCompletionResults.listen((_) { |
| 82 // We only care about the time to the first response. | 83 // We only care about the time to the first response. |
| 83 if (!completionReceived.isCompleted) { | 84 if (!completionReceived.isCompleted) { |
| 84 completionReceived.complete(); | 85 completionReceived.complete(); |
| 85 } | 86 } |
| 86 }); | 87 }); |
| 87 sendAnalysisSetAnalysisRoots([dirname(mainFilePath)], []); | 88 sendAnalysisSetAnalysisRoots([dirname(mainFilePath)], []); |
| 88 sendAnalysisUpdateContent({ | 89 sendAnalysisUpdateContent({ |
| 89 mainFilePath: { | 90 mainFilePath: new AddContentOverlay(originalContent) |
| 90 'type': 'add', | |
| 91 'content': originalContent | |
| 92 } | |
| 93 }); | 91 }); |
| 94 return new Future.value(); | 92 return new Future.value(); |
| 95 } | 93 } |
| 96 | 94 |
| 97 @override | 95 @override |
| 98 Future perform() { | 96 Future perform() { |
| 99 sendAnalysisUpdateContent({ | 97 sendAnalysisUpdateContent({ |
| 100 mainFilePath: { | 98 mainFilePath: new ChangeContentOverlay( |
| 101 'type': 'change', | 99 [new SourceEdit(cursorOffset, 0, '.')]) |
| 102 'edits': [{ | |
| 103 'offset': cursorOffset, | |
| 104 'length': 0, | |
| 105 'replacement': '.' | |
| 106 }] | |
| 107 } | |
| 108 }); | 100 }); |
| 109 sendCompletionGetSuggestions(mainFilePath, cursorOffset + 1); | 101 sendCompletionGetSuggestions(mainFilePath, cursorOffset + 1); |
| 110 return completionReceived.future; | 102 return completionReceived.future; |
| 111 } | 103 } |
| 112 | 104 |
| 113 @override | 105 @override |
| 114 Future tearDown() { | 106 Future tearDown() { |
| 115 sendAnalysisSetAnalysisRoots([], []); | 107 sendAnalysisSetAnalysisRoots([], []); |
| 116 return new Future.value(); | 108 return new Future.value(); |
| 117 } | 109 } |
| 118 } | 110 } |
| OLD | NEW |