| 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.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'; |
| 11 | 11 |
| 12 import 'package:analysis_server/plugin/protocol/protocol.dart'; | 12 import 'package:analysis_server/plugin/protocol/protocol.dart'; |
| 13 import 'package:analysis_server/src/constants.dart'; | 13 import 'package:analysis_server/src/constants.dart'; |
| 14 import 'package:analysis_server/src/server/driver.dart' as analysisServer; | |
| 15 import 'package:path/path.dart'; | 14 import 'package:path/path.dart'; |
| 16 import 'package:unittest/unittest.dart'; | 15 import 'package:unittest/unittest.dart'; |
| 17 | 16 |
| 18 import 'integration_test_methods.dart'; | 17 import 'integration_test_methods.dart'; |
| 19 import 'protocol_matchers.dart'; | 18 import 'protocol_matchers.dart'; |
| 20 | 19 |
| 21 const Matcher isBool = const isInstanceOf<bool>('bool'); | 20 const Matcher isBool = const isInstanceOf<bool>('bool'); |
| 22 | 21 |
| 23 const Matcher isInt = const isInstanceOf<int>('int'); | 22 const Matcher isInt = const isInstanceOf<int>('int'); |
| 24 | 23 |
| (...skipping 565 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 590 /** | 589 /** |
| 591 * Start the server. If [debugServer] is `true`, the server will be started | 590 * Start the server. If [debugServer] is `true`, the server will be started |
| 592 * with "--debug", allowing a debugger to be attached. If [profileServer] is | 591 * with "--debug", allowing a debugger to be attached. If [profileServer] is |
| 593 * `true`, the server will be started with "--observe" and | 592 * `true`, the server will be started with "--observe" and |
| 594 * "--pause-isolates-on-exit", allowing the observatory to be used. | 593 * "--pause-isolates-on-exit", allowing the observatory to be used. |
| 595 */ | 594 */ |
| 596 Future start( | 595 Future start( |
| 597 {bool debugServer: false, | 596 {bool debugServer: false, |
| 598 int diagnosticPort, | 597 int diagnosticPort, |
| 599 bool profileServer: false, | 598 bool profileServer: false, |
| 600 bool newTaskModel: true, | |
| 601 bool useAnalysisHighlight2: false}) { | 599 bool useAnalysisHighlight2: false}) { |
| 602 if (_process != null) { | 600 if (_process != null) { |
| 603 throw new Exception('Process already started'); | 601 throw new Exception('Process already started'); |
| 604 } | 602 } |
| 605 _time.start(); | 603 _time.start(); |
| 606 String dartBinary = Platform.executable; | 604 String dartBinary = Platform.executable; |
| 607 String rootDir = | 605 String rootDir = |
| 608 findRoot(Platform.script.toFilePath(windows: Platform.isWindows)); | 606 findRoot(Platform.script.toFilePath(windows: Platform.isWindows)); |
| 609 String serverPath = normalize(join(rootDir, 'bin', 'server.dart')); | 607 String serverPath = normalize(join(rootDir, 'bin', 'server.dart')); |
| 610 List<String> arguments = []; | 608 List<String> arguments = []; |
| 611 if (debugServer) { | 609 if (debugServer) { |
| 612 arguments.add('--debug'); | 610 arguments.add('--debug'); |
| 613 } | 611 } |
| 614 if (profileServer) { | 612 if (profileServer) { |
| 615 arguments.add('--observe'); | 613 arguments.add('--observe'); |
| 616 arguments.add('--pause-isolates-on-exit'); | 614 arguments.add('--pause-isolates-on-exit'); |
| 617 } | 615 } |
| 618 if (Platform.packageRoot.isNotEmpty) { | 616 if (Platform.packageRoot.isNotEmpty) { |
| 619 arguments.add('--package-root=${Platform.packageRoot}'); | 617 arguments.add('--package-root=${Platform.packageRoot}'); |
| 620 } | 618 } |
| 621 arguments.add('--checked'); | 619 arguments.add('--checked'); |
| 622 arguments.add(serverPath); | 620 arguments.add(serverPath); |
| 623 if (diagnosticPort != null) { | 621 if (diagnosticPort != null) { |
| 624 arguments.add('--port'); | 622 arguments.add('--port'); |
| 625 arguments.add(diagnosticPort.toString()); | 623 arguments.add(diagnosticPort.toString()); |
| 626 } | 624 } |
| 627 if (useAnalysisHighlight2) { | 625 if (useAnalysisHighlight2) { |
| 628 arguments.add('--useAnalysisHighlight2'); | 626 arguments.add('--useAnalysisHighlight2'); |
| 629 } | 627 } |
| 630 if (!newTaskModel) { | |
| 631 arguments.add('--${analysisServer.Driver.DISABLE_NEW_TASK_MODEL}'); | |
| 632 } | |
| 633 // print('Launching $serverPath'); | 628 // print('Launching $serverPath'); |
| 634 // print('$dartBinary ${arguments.join(' ')}'); | 629 // print('$dartBinary ${arguments.join(' ')}'); |
| 635 return Process.start(dartBinary, arguments).then((Process process) { | 630 return Process.start(dartBinary, arguments).then((Process process) { |
| 636 _process = process; | 631 _process = process; |
| 637 process.exitCode.then((int code) { | 632 process.exitCode.then((int code) { |
| 638 _recordStdio('TERMINATED WITH EXIT CODE $code'); | 633 _recordStdio('TERMINATED WITH EXIT CODE $code'); |
| 639 if (code != 0) { | 634 if (code != 0) { |
| 640 _badDataFromServer(); | 635 _badDataFromServer(); |
| 641 } | 636 } |
| 642 }); | 637 }); |
| (...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 888 void populateMismatches(item, List<MismatchDescriber> mismatches); | 883 void populateMismatches(item, List<MismatchDescriber> mismatches); |
| 889 | 884 |
| 890 /** | 885 /** |
| 891 * Create a [MismatchDescriber] describing a mismatch with a simple string. | 886 * Create a [MismatchDescriber] describing a mismatch with a simple string. |
| 892 */ | 887 */ |
| 893 MismatchDescriber simpleDescription(String description) => | 888 MismatchDescriber simpleDescription(String description) => |
| 894 (Description mismatchDescription) { | 889 (Description mismatchDescription) { |
| 895 mismatchDescription.add(description); | 890 mismatchDescription.add(description); |
| 896 }; | 891 }; |
| 897 } | 892 } |
| OLD | NEW |