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

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

Issue 453603003: Code generate integration test streams for notifications. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | pkg/analysis_server/test/integration/integration_tests.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 // This file has been automatically generated. Please do not edit it manually. 5 // This file has been automatically generated. Please do not edit it manually.
6 // To regenerate the file, use the script 6 // To regenerate the file, use the script
7 // "pkg/analysis_server/spec/generate_files". 7 // "pkg/analysis_server/spec/generate_files".
8 8
9 /** 9 /**
10 * Convenience methods for running integration tests 10 * Convenience methods for running integration tests
11 */ 11 */
12 library test.integration.methods; 12 library test.integration.methods;
13 13
14 import 'dart:async'; 14 import 'dart:async';
15 15
16 import 'package:unittest/unittest.dart'; 16 import 'package:unittest/unittest.dart';
17 17
18 import 'integration_tests.dart'; 18 import 'integration_tests.dart';
19 import 'protocol_matchers.dart'; 19 import 'protocol_matchers.dart';
20 20
21 21
22 /** 22 /**
23 * Convenience methods for running integration tests 23 * Convenience methods for running integration tests
24 */ 24 */
25 abstract class InttestMixin { 25 abstract class InttestMixin {
Brian Wilkerson 2014/08/11 16:47:09 I know it's outside the scope of this CL, but what
Paul Berry 2014/08/11 17:34:43 Sure, will do.
26 Server get server; 26 Server get server;
27 27
28 /** 28 /**
29 * Return the version number of the analysis server. 29 * Return the version number of the analysis server.
30 * 30 *
31 * Returns 31 * Returns
32 * 32 *
33 * version ( String ) 33 * version ( String )
34 * 34 *
35 * The version number of the analysis server. 35 * The version number of the analysis server.
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 return server.send("server.setSubscriptions", params) 84 return server.send("server.setSubscriptions", params)
85 .then((result) { 85 .then((result) {
86 if (checkTypes) { 86 if (checkTypes) {
87 expect(result, isServerSetSubscriptionsResult); 87 expect(result, isServerSetSubscriptionsResult);
88 } 88 }
89 return result; 89 return result;
90 }); 90 });
91 } 91 }
92 92
93 /** 93 /**
94 * Reports that the server is running. This notification is issued once after
95 * the server has started running but before any requests are processed to
96 * let the client know that it started correctly.
97 *
98 * It is not possible to subscribe to or unsubscribe from this notification.
99 */
100 Stream onServerConnected;
101
102 /**
103 * Stream controller for [onServerConnected].
104 */
105 StreamController _onServerConnected;
106
107 /**
108 * Reports that an unexpected error has occurred while executing the server.
109 * This notification is not used for problems with specific requests (which
110 * are returned as part of the response) but is used for exceptions that
111 * occur while performing other tasks, such as analysis or preparing
112 * notifications.
113 *
114 * It is not possible to subscribe to or unsubscribe from this notification.
115 *
116 * Parameters
117 *
118 * fatal ( bool )
119 *
120 * True if the error is a fatal error, meaning that the server will
121 * shutdown automatically after sending this notification.
122 *
123 * message ( String )
124 *
125 * The error message indicating what kind of error was encountered.
126 *
127 * stackTrace ( String )
128 *
129 * The stack trace associated with the generation of the error, used for
130 * debugging the server.
131 */
132 Stream onServerError;
133
134 /**
135 * Stream controller for [onServerError].
136 */
137 StreamController _onServerError;
138
139 /**
140 * Reports the current status of the server. Parameters are omitted if there
141 * has been no change in the status represented by that parameter.
142 *
143 * This notification is not subscribed to by default. Clients can subscribe
144 * by including the value "STATUS" in the list of services passed in a
145 * server.setSubscriptions request.
146 *
147 * Parameters
148 *
149 * analysis ( optional AnalysisStatus )
150 *
151 * The current status of analysis, including whether analysis is being
152 * performed and if so what is being analyzed.
153 */
154 Stream onServerStatus;
155
156 /**
157 * Stream controller for [onServerStatus].
158 */
159 StreamController _onServerStatus;
160
161 /**
94 * Return the errors associated with the given file. If the errors for the 162 * Return the errors associated with the given file. If the errors for the
95 * given file have not yet been computed, or the most recently computed 163 * given file have not yet been computed, or the most recently computed
96 * errors for the given file are out of date, then the response for this 164 * errors for the given file are out of date, then the response for this
97 * request will be delayed until they have been computed. If some or all of 165 * request will be delayed until they have been computed. If some or all of
98 * the errors for the file cannot be computed, then the subset of the errors 166 * the errors for the file cannot be computed, then the subset of the errors
99 * that can be computed will be returned and the response will contain an 167 * that can be computed will be returned and the response will contain an
100 * error to indicate why the errors could not be computed. 168 * error to indicate why the errors could not be computed.
101 * 169 *
102 * This request is intended to be used by clients that cannot asynchronously 170 * This request is intended to be used by clients that cannot asynchronously
103 * apply updated error information. Clients that can apply error information 171 * apply updated error information. Clients that can apply error information
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after
377 return server.send("analysis.updateOptions", params) 445 return server.send("analysis.updateOptions", params)
378 .then((result) { 446 .then((result) {
379 if (checkTypes) { 447 if (checkTypes) {
380 expect(result, isAnalysisUpdateOptionsResult); 448 expect(result, isAnalysisUpdateOptionsResult);
381 } 449 }
382 return result; 450 return result;
383 }); 451 });
384 } 452 }
385 453
386 /** 454 /**
455 * Reports the errors associated with a given file. The set of errors
456 * included in the notification is always a complete list that supersedes any
457 * previously reported errors.
458 *
459 * It is only possible to unsubscribe from this notification by using the
460 * command-line flag --no-error-notification.
461 *
462 * Parameters
463 *
464 * file ( FilePath )
465 *
466 * The file containing the errors.
467 *
468 * errors ( List<AnalysisError> )
469 *
470 * The errors contained in the file.
471 */
472 Stream onAnalysisErrors;
473
474 /**
475 * Stream controller for [onAnalysisErrors].
476 */
477 StreamController _onAnalysisErrors;
478
479 /**
480 * Reports that any analysis results that were previously associated with the
481 * given files should be considered to be invalid because those files are no
482 * longer being analyzed, either because the analysis root that contained it
483 * is no longer being analyzed or because the file no longer exists.
484 *
485 * If a file is included in this notification and at some later time a
486 * notification with results for the file is received, clients should assume
487 * that the file is once again being analyzed and the information should be
488 * processed.
489 *
490 * It is not possible to subscribe to or unsubscribe from this notification.
491 *
492 * Parameters
493 *
494 * files ( List<FilePath> )
495 *
496 * The files that are no longer being analyzed.
497 */
498 Stream onAnalysisFlushResults;
499
500 /**
501 * Stream controller for [onAnalysisFlushResults].
502 */
503 StreamController _onAnalysisFlushResults;
504
505 /**
506 * Reports the folding regions associated with a given file. Folding regions
507 * can be nested, but will not be overlapping. Nesting occurs when a foldable
508 * element, such as a method, is nested inside another foldable element such
509 * as a class.
510 *
511 * This notification is not subscribed to by default. Clients can subscribe
512 * by including the value "FOLDING" in the list of services passed in an
513 * analysis.setSubscriptions request.
514 *
515 * Parameters
516 *
517 * file ( FilePath )
518 *
519 * The file containing the folding regions.
520 *
521 * regions ( List<FoldingRegion> )
522 *
523 * The folding regions contained in the file.
524 */
525 Stream onAnalysisFolding;
526
527 /**
528 * Stream controller for [onAnalysisFolding].
529 */
530 StreamController _onAnalysisFolding;
531
532 /**
533 * Reports the highlight regions associated with a given file.
534 *
535 * This notification is not subscribed to by default. Clients can subscribe
536 * by including the value "HIGHLIGHTS" in the list of services passed in an
537 * analysis.setSubscriptions request.
538 *
539 * Parameters
540 *
541 * file ( FilePath )
542 *
543 * The file containing the highlight regions.
544 *
545 * regions ( List<HighlightRegion> )
546 *
547 * The highlight regions contained in the file. Each highlight region
548 * represents a particular syntactic or semantic meaning associated with
549 * some range. Note that the highlight regions that are returned can
550 * overlap other highlight regions if there is more than one meaning
551 * associated with a particular region.
552 */
553 Stream onAnalysisHighlights;
554
555 /**
556 * Stream controller for [onAnalysisHighlights].
557 */
558 StreamController _onAnalysisHighlights;
559
560 /**
561 * Reports the navigation targets associated with a given file.
562 *
563 * This notification is not subscribed to by default. Clients can subscribe
564 * by including the value "NAVIGATION" in the list of services passed in an
565 * analysis.setSubscriptions request.
566 *
567 * Parameters
568 *
569 * file ( FilePath )
570 *
571 * The file containing the navigation regions.
572 *
573 * regions ( List<NavigationRegion> )
574 *
575 * The navigation regions contained in the file. Each navigation region
576 * represents a list of targets associated with some range. The lists will
577 * usually contain a single target, but can contain more in the case of a
578 * part that is included in multiple libraries or in Dart code that is
579 * compiled against multiple versions of a package. Note that the
580 * navigation regions that are returned do not overlap other navigation
581 * regions.
582 */
583 Stream onAnalysisNavigation;
584
585 /**
586 * Stream controller for [onAnalysisNavigation].
587 */
588 StreamController _onAnalysisNavigation;
589
590 /**
591 * Reports the occurrences of references to elements within a single file.
592 *
593 * This notification is not subscribed to by default. Clients can subscribe
594 * by including the value "OCCURRENCES" in the list of services passed in an
595 * analysis.setSubscriptions request.
596 *
597 * Parameters
598 *
599 * file ( FilePath )
600 *
601 * The file in which the references occur.
602 *
603 * occurrences ( List<Occurrences> )
604 *
605 * The occurrences of references to elements within the file.
606 */
607 Stream onAnalysisOccurrences;
608
609 /**
610 * Stream controller for [onAnalysisOccurrences].
611 */
612 StreamController _onAnalysisOccurrences;
613
614 /**
615 * Reports the outline associated with a single file.
616 *
617 * This notification is not subscribed to by default. Clients can subscribe
618 * by including the value "OUTLINE" in the list of services passed in an
619 * analysis.setSubscriptions request.
620 *
621 * Parameters
622 *
623 * file ( FilePath )
624 *
625 * The file with which the outline is associated.
626 *
627 * outline ( Outline )
628 *
629 * The outline associated with the file.
630 */
631 Stream onAnalysisOutline;
632
633 /**
634 * Stream controller for [onAnalysisOutline].
635 */
636 StreamController _onAnalysisOutline;
637
638 /**
639 * Reports the overridding members in a file. This notification currently
640 * includes only members that override a member from a superclass. In
641 * particular, it does not include members that override members from
642 * interfaces.
643 *
644 * This notification is not subscribed to by default. Clients can subscribe
645 * by including the value "OVERRIDES" in the list of services passed in an
646 * analysis.setSubscriptions request.
647 *
648 * Parameters
649 *
650 * file ( FilePath )
651 *
652 * The file with which the overrides are associated.
653 *
654 * overrides ( List<Override> )
655 *
656 * The overrides associated with the file.
657 */
658 Stream onAnalysisOverrides;
659
660 /**
661 * Stream controller for [onAnalysisOverrides].
662 */
663 StreamController _onAnalysisOverrides;
664
665 /**
387 * Request that completion suggestions for the given offset in the given file 666 * Request that completion suggestions for the given offset in the given file
388 * be returned. 667 * be returned.
389 * 668 *
390 * Parameters 669 * Parameters
391 * 670 *
392 * file ( FilePath ) 671 * file ( FilePath )
393 * 672 *
394 * The file containing the point at which suggestions are to be made. 673 * The file containing the point at which suggestions are to be made.
395 * 674 *
396 * offset ( int ) 675 * offset ( int )
(...skipping 16 matching lines...) Expand all
413 return server.send("completion.getSuggestions", params) 692 return server.send("completion.getSuggestions", params)
414 .then((result) { 693 .then((result) {
415 if (checkTypes) { 694 if (checkTypes) {
416 expect(result, isCompletionGetSuggestionsResult); 695 expect(result, isCompletionGetSuggestionsResult);
417 } 696 }
418 return result; 697 return result;
419 }); 698 });
420 } 699 }
421 700
422 /** 701 /**
702 * Reports the completion suggestions that should be presented to the user.
703 * The set of suggestions included in the notification is always a complete
704 * list that supersedes any previously reported suggestions.
705 *
706 * Parameters
707 *
708 * id ( CompletionId )
709 *
710 * The id associated with the completion.
711 *
712 * replacementOffset ( int )
713 *
714 * The offset of the start of the text to be replaced. This will be
715 * different than the offset used to request the completion suggestions if
716 * there was a portion of an identifier before the original offset. In
717 * particular, the replacementOffset will be the offset of the beginning of
718 * said identifier.
719 *
720 * replacementLength ( int )
721 *
722 * The length of the text to be replaced if the remainder of the identifier
723 * containing the cursor is to be replaced when the suggestion is applied
724 * (that is, the number of characters in the existing identifier).
725 *
726 * results ( List<CompletionSuggestion> )
727 *
728 * The completion suggestions being reported.
729 *
730 * last ( bool )
731 *
732 * True if this is that last set of results that will be returned for the
733 * indicated completion.
734 */
735 Stream onCompletionResults;
736
737 /**
738 * Stream controller for [onCompletionResults].
739 */
740 StreamController _onCompletionResults;
741
742 /**
423 * Perform a search for references to the element defined or referenced at 743 * Perform a search for references to the element defined or referenced at
424 * the given offset in the given file. 744 * the given offset in the given file.
425 * 745 *
426 * An identifier is returned immediately, and individual results will be 746 * An identifier is returned immediately, and individual results will be
427 * returned via the search.results notification as they become available. 747 * returned via the search.results notification as they become available.
428 * 748 *
429 * Parameters 749 * Parameters
430 * 750 *
431 * file ( FilePath ) 751 * file ( FilePath )
432 * 752 *
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
615 return server.send("search.getTypeHierarchy", params) 935 return server.send("search.getTypeHierarchy", params)
616 .then((result) { 936 .then((result) {
617 if (checkTypes) { 937 if (checkTypes) {
618 expect(result, isSearchGetTypeHierarchyResult); 938 expect(result, isSearchGetTypeHierarchyResult);
619 } 939 }
620 return result; 940 return result;
621 }); 941 });
622 } 942 }
623 943
624 /** 944 /**
945 * Reports some or all of the results of performing a requested search.
946 * Unlike other notifications, this notification contains search results that
947 * should be added to any previously received search results associated with
948 * the same search id.
949 *
950 * Parameters
951 *
952 * id ( SearchId )
953 *
954 * The id associated with the search.
955 *
956 * results ( List<SearchResult> )
957 *
958 * The search results being reported.
959 *
960 * last ( bool )
961 *
962 * True if this is that last set of results that will be returned for the
963 * indicated search.
964 */
965 Stream onSearchResults;
966
967 /**
968 * Stream controller for [onSearchResults].
969 */
970 StreamController _onSearchResults;
971
972 /**
625 * Return the set of assists that are available at the given location. An 973 * Return the set of assists that are available at the given location. An
626 * assist is distinguished from a refactoring primarily by the fact that it 974 * assist is distinguished from a refactoring primarily by the fact that it
627 * affects a single file and does not require user input in order to be 975 * affects a single file and does not require user input in order to be
628 * performed. 976 * performed.
629 * 977 *
630 * Parameters 978 * Parameters
631 * 979 *
632 * file ( FilePath ) 980 * file ( FilePath )
633 * 981 *
634 * The file containing the code for which assists are being requested. 982 * The file containing the code for which assists are being requested.
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after
957 expect(params, isDebugSetSubscriptionsParams); 1305 expect(params, isDebugSetSubscriptionsParams);
958 } 1306 }
959 return server.send("debug.setSubscriptions", params) 1307 return server.send("debug.setSubscriptions", params)
960 .then((result) { 1308 .then((result) {
961 if (checkTypes) { 1309 if (checkTypes) {
962 expect(result, isDebugSetSubscriptionsResult); 1310 expect(result, isDebugSetSubscriptionsResult);
963 } 1311 }
964 return result; 1312 return result;
965 }); 1313 });
966 } 1314 }
1315
1316 /**
1317 * Reports information needed to allow applications within the given context
1318 * to be launched.
1319 *
1320 * This notification is not subscribed to by default. Clients can subscribe
1321 * by including the value "LAUNCH_DATA" in the list of services passed in a
1322 * debug.setSubscriptions request.
1323 *
1324 * Parameters
1325 *
1326 * executables ( List<ExecutableFile> )
1327 *
1328 * A list of the files that are executable in the given context. This list
1329 * replaces any previous list provided for the given context.
1330 *
1331 * dartToHtml ( Map<FilePath, List<FilePath>> )
1332 *
1333 * A mapping from the paths of Dart files that are referenced by HTML files
1334 * to a list of the HTML files that reference the Dart files.
1335 *
1336 * htmlToDart ( Map<FilePath, List<FilePath>> )
1337 *
1338 * A mapping from the paths of HTML files that reference Dart files to a
1339 * list of the Dart files they reference.
1340 */
1341 Stream onDebugLaunchData;
1342
1343 /**
1344 * Stream controller for [onDebugLaunchData].
1345 */
1346 StreamController _onDebugLaunchData;
1347
1348 /**
1349 * Initialize the fields in InttestMixin, and ensure that notifications will
1350 * be handled.
1351 */
1352 void initializeInttestMixin() {
1353 _onServerConnected = new StreamController(sync: true);
1354 onServerConnected = _onServerConnected.stream.asBroadcastStream();
1355 _onServerError = new StreamController(sync: true);
1356 onServerError = _onServerError.stream.asBroadcastStream();
1357 _onServerStatus = new StreamController(sync: true);
1358 onServerStatus = _onServerStatus.stream.asBroadcastStream();
1359 _onAnalysisErrors = new StreamController(sync: true);
1360 onAnalysisErrors = _onAnalysisErrors.stream.asBroadcastStream();
1361 _onAnalysisFlushResults = new StreamController(sync: true);
1362 onAnalysisFlushResults = _onAnalysisFlushResults.stream.asBroadcastStream();
1363 _onAnalysisFolding = new StreamController(sync: true);
1364 onAnalysisFolding = _onAnalysisFolding.stream.asBroadcastStream();
1365 _onAnalysisHighlights = new StreamController(sync: true);
1366 onAnalysisHighlights = _onAnalysisHighlights.stream.asBroadcastStream();
1367 _onAnalysisNavigation = new StreamController(sync: true);
1368 onAnalysisNavigation = _onAnalysisNavigation.stream.asBroadcastStream();
1369 _onAnalysisOccurrences = new StreamController(sync: true);
1370 onAnalysisOccurrences = _onAnalysisOccurrences.stream.asBroadcastStream();
1371 _onAnalysisOutline = new StreamController(sync: true);
1372 onAnalysisOutline = _onAnalysisOutline.stream.asBroadcastStream();
1373 _onAnalysisOverrides = new StreamController(sync: true);
1374 onAnalysisOverrides = _onAnalysisOverrides.stream.asBroadcastStream();
1375 _onCompletionResults = new StreamController(sync: true);
1376 onCompletionResults = _onCompletionResults.stream.asBroadcastStream();
1377 _onSearchResults = new StreamController(sync: true);
1378 onSearchResults = _onSearchResults.stream.asBroadcastStream();
1379 _onDebugLaunchData = new StreamController(sync: true);
1380 onDebugLaunchData = _onDebugLaunchData.stream.asBroadcastStream();
1381 }
1382
1383 /**
1384 * Dispatch the notification named [event], and containing parameters
1385 * [params], to the appropriate stream.
1386 */
1387 void dispatchNotification(String event, params) {
1388 switch (event) {
1389 case "server.connected":
1390 expect(params, isServerConnectedParams);
1391 _onServerConnected.add(params);
1392 break;
1393 case "server.error":
1394 expect(params, isServerErrorParams);
1395 _onServerError.add(params);
1396 break;
1397 case "server.status":
1398 expect(params, isServerStatusParams);
1399 _onServerStatus.add(params);
1400 break;
1401 case "analysis.errors":
1402 expect(params, isAnalysisErrorsParams);
1403 _onAnalysisErrors.add(params);
1404 break;
1405 case "analysis.flushResults":
1406 expect(params, isAnalysisFlushResultsParams);
1407 _onAnalysisFlushResults.add(params);
1408 break;
1409 case "analysis.folding":
1410 expect(params, isAnalysisFoldingParams);
1411 _onAnalysisFolding.add(params);
1412 break;
1413 case "analysis.highlights":
1414 expect(params, isAnalysisHighlightsParams);
1415 _onAnalysisHighlights.add(params);
1416 break;
1417 case "analysis.navigation":
1418 expect(params, isAnalysisNavigationParams);
1419 _onAnalysisNavigation.add(params);
1420 break;
1421 case "analysis.occurrences":
1422 expect(params, isAnalysisOccurrencesParams);
1423 _onAnalysisOccurrences.add(params);
1424 break;
1425 case "analysis.outline":
1426 expect(params, isAnalysisOutlineParams);
1427 _onAnalysisOutline.add(params);
1428 break;
1429 case "analysis.overrides":
1430 expect(params, isAnalysisOverridesParams);
1431 _onAnalysisOverrides.add(params);
1432 break;
1433 case "completion.results":
1434 expect(params, isCompletionResultsParams);
1435 _onCompletionResults.add(params);
1436 break;
1437 case "search.results":
1438 expect(params, isSearchResultsParams);
1439 _onSearchResults.add(params);
1440 break;
1441 case "debug.launchData":
1442 expect(params, isDebugLaunchDataParams);
1443 _onDebugLaunchData.add(params);
1444 break;
1445 default:
1446 fail('Unexpected notification: $event');
1447 break;
1448 }
1449 }
967 } 1450 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analysis_server/test/integration/integration_tests.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698