| 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 import 'dart:io'; | 8 import 'dart:io'; |
| 9 | 9 |
| 10 import 'package:analysis_server/src/protocol.dart'; | 10 import 'package:analysis_server/src/protocol.dart'; |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 } | 76 } |
| 77 '''; | 77 '''; |
| 78 cursorOffset = originalContent.indexOf('c;') + 1; | 78 cursorOffset = originalContent.indexOf('c;') + 1; |
| 79 writeFile(mainFilePath, originalContent); | 79 writeFile(mainFilePath, originalContent); |
| 80 }); | 80 }); |
| 81 } | 81 } |
| 82 | 82 |
| 83 @override | 83 @override |
| 84 Future perform() { | 84 Future perform() { |
| 85 sendAnalysisUpdateContent({ | 85 sendAnalysisUpdateContent({ |
| 86 mainFilePath: new ChangeContentOverlay( | 86 mainFilePath: |
| 87 [new SourceEdit(cursorOffset, 0, '.')]) | 87 new ChangeContentOverlay([new SourceEdit(cursorOffset, 0, '.')]) |
| 88 }); | 88 }); |
| 89 sendCompletionGetSuggestions(mainFilePath, cursorOffset + 1); | 89 sendCompletionGetSuggestions(mainFilePath, cursorOffset + 1); |
| 90 return completionReceived.future; | 90 return completionReceived.future; |
| 91 } | 91 } |
| 92 | 92 |
| 93 @override | 93 @override |
| 94 Future setUp() { | 94 Future setUp() { |
| 95 completionReceived = new Completer(); | 95 completionReceived = new Completer(); |
| 96 onCompletionResults.listen((_) { | 96 onCompletionResults.listen((_) { |
| 97 // We only care about the time to the first response. | 97 // We only care about the time to the first response. |
| 98 if (!completionReceived.isCompleted) { | 98 if (!completionReceived.isCompleted) { |
| 99 completionReceived.complete(); | 99 completionReceived.complete(); |
| 100 } | 100 } |
| 101 }); | 101 }); |
| 102 sendAnalysisSetAnalysisRoots([dirname(mainFilePath)], []); | 102 sendAnalysisSetAnalysisRoots([dirname(mainFilePath)], []); |
| 103 sendAnalysisUpdateContent({ | 103 sendAnalysisUpdateContent( |
| 104 mainFilePath: new AddContentOverlay(originalContent) | 104 {mainFilePath: new AddContentOverlay(originalContent)}); |
| 105 }); | |
| 106 return new Future.value(); | 105 return new Future.value(); |
| 107 } | 106 } |
| 108 | 107 |
| 109 @override | 108 @override |
| 110 Future tearDown() { | 109 Future tearDown() { |
| 111 sendAnalysisSetAnalysisRoots([], []); | 110 sendAnalysisSetAnalysisRoots([], []); |
| 112 return new Future.value(); | 111 return new Future.value(); |
| 113 } | 112 } |
| 114 } | 113 } |
| OLD | NEW |