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

Side by Side Diff: pkg/analysis_server/test/integration/integration_tests.dart

Issue 2812483002: Add integration tests for edit.getAssists and edit.getFixes. (Closed)
Patch Set: Created 3 years, 8 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 unified diff | Download patch
OLDNEW
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.integration.analysis; 5 library test.integration.analysis;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:collection'; 8 import 'dart:collection';
9 import 'dart:convert'; 9 import 'dart:convert';
10 import 'dart:io'; 10 import 'dart:io';
(...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after
452 } 452 }
453 453
454 /** 454 /**
455 * Instances of the class [Server] manage a connection to a server process, and 455 * Instances of the class [Server] manage a connection to a server process, and
456 * facilitate communication to and from the server. 456 * facilitate communication to and from the server.
457 */ 457 */
458 class Server { 458 class Server {
459 /** 459 /**
460 * Server process object, or null if server hasn't been started yet. 460 * Server process object, or null if server hasn't been started yet.
461 */ 461 */
462 Process _process = null; 462 Process _process;
463 463
464 /** 464 /**
465 * Commands that have been sent to the server but not yet acknowledged, and 465 * Commands that have been sent to the server but not yet acknowledged, and
466 * the [Completer] objects which should be completed when acknowledgement is 466 * the [Completer] objects which should be completed when acknowledgement is
467 * received. 467 * received.
468 */ 468 */
469 final Map<String, Completer> _pendingCommands = <String, Completer>{}; 469 final Map<String, Completer> _pendingCommands = <String, Completer>{};
470 470
471 /** 471 /**
472 * Number which should be used to compute the 'id' to send in the next command 472 * Number which should be used to compute the 'id' to send in the next command
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
647 _recordStdio('SEND: $line'); 647 _recordStdio('SEND: $line');
648 _process.stdin.add(UTF8.encoder.convert("$line\n")); 648 _process.stdin.add(UTF8.encoder.convert("$line\n"));
649 return completer.future; 649 return completer.future;
650 } 650 }
651 651
652 /** 652 /**
653 * Start the server. If [profileServer] is `true`, the server will be started 653 * Start the server. If [profileServer] is `true`, the server will be started
654 * with "--observe" and "--pause-isolates-on-exit", allowing the observatory 654 * with "--observe" and "--pause-isolates-on-exit", allowing the observatory
655 * to be used. 655 * to be used.
656 */ 656 */
657 Future start( 657 Future start({
658 {bool checked: true, 658 bool checked: true,
659 int diagnosticPort, 659 int diagnosticPort,
660 bool enableNewAnalysisDriver: false, 660 bool enableNewAnalysisDriver: false,
661 bool profileServer: false, 661 bool profileServer: false,
662 String sdkPath, 662 String sdkPath,
663 int servicesPort, 663 int servicesPort,
664 bool useAnalysisHighlight2: false}) { 664 bool useAnalysisHighlight2: false,
665 }) async {
665 if (_process != null) { 666 if (_process != null) {
666 throw new Exception('Process already started'); 667 throw new Exception('Process already started');
667 } 668 }
668 _time.start(); 669 _time.start();
669 String dartBinary = Platform.executable; 670 String dartBinary = Platform.executable;
670 String rootDir = 671 String rootDir =
671 findRoot(Platform.script.toFilePath(windows: Platform.isWindows)); 672 findRoot(Platform.script.toFilePath(windows: Platform.isWindows));
672 String serverPath = normalize(join(rootDir, 'bin', 'server.dart')); 673 String serverPath = normalize(join(rootDir, 'bin', 'server.dart'));
673 List<String> arguments = []; 674 List<String> arguments = [];
674 // 675 //
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
710 if (useAnalysisHighlight2) { 711 if (useAnalysisHighlight2) {
711 arguments.add('--useAnalysisHighlight2'); 712 arguments.add('--useAnalysisHighlight2');
712 } 713 }
713 if (!enableNewAnalysisDriver) { 714 if (!enableNewAnalysisDriver) {
714 arguments.add('--disable-new-analysis-driver'); 715 arguments.add('--disable-new-analysis-driver');
715 } 716 }
716 // print('Launching $serverPath'); 717 // print('Launching $serverPath');
717 // print('$dartBinary ${arguments.join(' ')}'); 718 // print('$dartBinary ${arguments.join(' ')}');
718 // TODO(devoncarew): We could experiment with instead launching the analysis 719 // TODO(devoncarew): We could experiment with instead launching the analysis
719 // server in a separate isolate. This would make it easier to debug the 720 // server in a separate isolate. This would make it easier to debug the
720 // integration tests, and would like speed the tests up as well. 721 // integration tests, and would likely speed the tests up as well.
721 return Process.start(dartBinary, arguments).then((Process process) { 722 _process = await Process.start(dartBinary, arguments);
722 _process = process; 723 _process.exitCode.then((int code) {
723 process.exitCode.then((int code) { 724 if (code != 0) {
724 if (code != 0) { 725 _badDataFromServer('server terminated with exit code $code');
725 _badDataFromServer('server terminated with exit code $code'); 726 }
726 }
727 });
728 }); 727 });
729 } 728 }
730 729
731 /** 730 /**
732 * Deal with bad data received from the server. 731 * Deal with bad data received from the server.
733 */ 732 */
734 void _badDataFromServer(String details, {bool silent: false}) { 733 void _badDataFromServer(String details, {bool silent: false}) {
735 if (!silent) { 734 if (!silent) {
736 _recordStdio('BAD DATA FROM SERVER: $details'); 735 _recordStdio('BAD DATA FROM SERVER: $details');
737 } 736 }
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
990 void populateMismatches(item, List<MismatchDescriber> mismatches); 989 void populateMismatches(item, List<MismatchDescriber> mismatches);
991 990
992 /** 991 /**
993 * Create a [MismatchDescriber] describing a mismatch with a simple string. 992 * Create a [MismatchDescriber] describing a mismatch with a simple string.
994 */ 993 */
995 MismatchDescriber simpleDescription(String description) => 994 MismatchDescriber simpleDescription(String description) =>
996 (Description mismatchDescription) { 995 (Description mismatchDescription) {
997 mismatchDescription.add(description); 996 mismatchDescription.add(description);
998 }; 997 };
999 } 998 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/test/integration/edit/test_all.dart ('k') | pkg/analysis_server/test/timing/timing_framework.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698