| 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.completion.domain; | 5 library test.integration.completion.domain; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 | 8 |
| 9 import 'package:analysis_server/src/constants.dart'; | |
| 10 import 'package:analysis_testing/reflective_tests.dart'; | 9 import 'package:analysis_testing/reflective_tests.dart'; |
| 11 import 'package:unittest/unittest.dart'; | 10 import 'package:unittest/unittest.dart'; |
| 12 | 11 |
| 13 import 'integration_tests.dart'; | 12 import 'integration_tests.dart'; |
| 14 | 13 |
| 15 @ReflectiveTestCase() | 14 @ReflectiveTestCase() |
| 16 class CompletionDomainIntegrationTest extends | 15 class CompletionDomainIntegrationTest extends |
| 17 AbstractAnalysisServerIntegrationTest { | 16 AbstractAnalysisServerIntegrationTest { |
| 18 fail_test_getSuggestions_string_var() { | 17 fail_test_getSuggestions_string_var() { |
| 19 // See dartbug.com/20188 | 18 // See dartbug.com/20188 |
| 20 String pathname = sourcePath('test.dart'); | 19 String pathname = sourcePath('test.dart'); |
| 21 String text = | 20 String text = r''' |
| 22 r''' | |
| 23 var test = ''; | 21 var test = ''; |
| 24 main() { | 22 main() { |
| 25 test. | 23 test. |
| 26 } | 24 } |
| 27 '''; | 25 '''; |
| 28 writeFile(pathname, text); | 26 writeFile(pathname, text); |
| 29 standardAnalysisRoot(); | 27 standardAnalysisRoot(); |
| 30 | 28 |
| 31 return analysisFinished.then((_) { | 29 return analysisFinished.then((_) { |
| 32 return server.send(COMPLETION_GET_SUGGESTIONS, { | 30 return sendCompletionGetSuggestions(pathname, text.indexOf('test.') + |
| 33 'file': pathname, | 31 'test.'.length).then((result) { |
| 34 'offset': text.indexOf('test.') + 'test.'.length | |
| 35 }).then((result) { | |
| 36 // Since the feature doesn't work yet, just pause for a second to | 32 // Since the feature doesn't work yet, just pause for a second to |
| 37 // collect the output of the analysis server, and then stop the test. | 33 // collect the output of the analysis server, and then stop the test. |
| 38 // TODO(paulberry): finish writing the integration test once the feature | 34 // TODO(paulberry): finish writing the integration test once the feature |
| 39 // it more complete. | 35 // it more complete. |
| 40 return new Future.delayed(new Duration(seconds: 1), () { | 36 return new Future.delayed(new Duration(seconds: 1), () { |
| 41 fail('test not completed yet'); | 37 fail('test not completed yet'); |
| 42 }); | 38 }); |
| 43 }); | 39 }); |
| 44 }); | 40 }); |
| 45 } | 41 } |
| 46 | 42 |
| 47 test_placeholder() { | 43 test_placeholder() { |
| 48 // The unit test framework freaks out if there are no tests, so this is a | 44 // The unit test framework freaks out if there are no tests, so this is a |
| 49 // placeholder until we have a passing test. | 45 // placeholder until we have a passing test. |
| 50 // TODO(paulberry): remove this. | 46 // TODO(paulberry): remove this. |
| 51 } | 47 } |
| 52 } | 48 } |
| 53 | 49 |
| 54 main() { | 50 main() { |
| 55 runReflectiveTests(CompletionDomainIntegrationTest); | 51 runReflectiveTests(CompletionDomainIntegrationTest); |
| 56 } | 52 } |
| OLD | NEW |