Chromium Code Reviews| Index: pkg/analysis_server/test/stress/replay/operation.dart |
| diff --git a/pkg/analysis_server/test/stress/replay/operation.dart b/pkg/analysis_server/test/stress/replay/operation.dart |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..bd28a0c212784e82949c2b7a282ebcebc52c0c2d |
| --- /dev/null |
| +++ b/pkg/analysis_server/test/stress/replay/operation.dart |
| @@ -0,0 +1,57 @@ |
| +// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file |
| +// for details. All rights reserved. Use of this source code is governed by a |
| +// BSD-style license that can be found in the LICENSE file. |
| + |
| +/** |
| + * Operations to be performed during the simulation. |
| + */ |
| +library analysis_server.test.stress.replay.replay; |
|
scheglov
2015/11/20 22:52:18
library analysis_server.test.stress.replay.operati
|
| + |
| +import '../utilities/server.dart'; |
| +import 'package:analysis_server/plugin/protocol/protocol.dart'; |
|
scheglov
2015/11/20 22:52:18
Sort?
|
| + |
| +/** |
| + * An operation to be performed during the simulation. |
| + */ |
| +abstract class ServerOperation { |
| + /** |
| + * Perform this operation by communicating with the given [server]. |
| + */ |
| + void perform(Server server); |
| +} |
| + |
| +/** |
| + * An operation that will send an 'analysis.updateContent' request. |
| + */ |
| +class AnalysisUpdateContent extends ServerOperation { |
| + /** |
| + * The path of the file whose content is being updated. |
| + */ |
| + String filePath; |
| + |
| + /** |
| + * The overlay used to update the content. |
| + */ |
| + dynamic overlay; |
| + |
| + /** |
| + * Initialize an operation to send an 'analysis.updateContent' request with |
| + * the given [filePath] and [overlay] as parameters. |
| + */ |
| + AnalysisUpdateContent(this.filePath, this.overlay); |
| + |
| + @override |
| + void perform(Server server) { |
| + server.sendAnalysisUpdateContent({filePath: overlay}); |
| +// if (overlay is ChangeContentOverlay) { |
| +// List<SourceEdit> edits = (overlay as ChangeContentOverlay).edits; |
| +// if (edits.length == 1) { |
| +// SourceEdit edit = edits[0]; |
| +// if (edit.replacement.endsWith('.')) { |
| +// int offset = edit.offset + edit.replacement.length - 1; |
| +// server.sendCompletionGetSuggestions(filePath, offset); |
| +// } |
| +// } |
| +// } |
| + } |
| +} |