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

Side by Side Diff: pkg/analysis_server/test/edit/fixes_test.dart

Issue 477323005: Use generated classes to create requests in analysis server unit tests. (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
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.edit.fixes; 5 library test.edit.fixes;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 8
9 import 'package:analysis_server/src/constants.dart'; 9 import 'package:analysis_server/src/constants.dart';
10 import 'package:analysis_server/src/edit/edit_domain.dart'; 10 import 'package:analysis_server/src/edit/edit_domain.dart';
11 import 'package:analysis_server/src/protocol.dart'; 11 import 'package:analysis_server/src/protocol.dart';
12 import 'package:analysis_server/src/protocol2.dart';
12 import 'package:analysis_testing/reflective_tests.dart'; 13 import 'package:analysis_testing/reflective_tests.dart';
13 import 'package:unittest/unittest.dart' hide ERROR; 14 import 'package:unittest/unittest.dart' hide ERROR;
14 15
15 import '../analysis_abstract.dart'; 16 import '../analysis_abstract.dart';
16 17
17 18
18 main() { 19 main() {
19 groupSep = ' | '; 20 groupSep = ' | ';
20 runReflectiveTests(FixesTest); 21 runReflectiveTests(FixesTest);
21 } 22 }
22 23
23 24
24 @ReflectiveTestCase() 25 @ReflectiveTestCase()
25 class FixesTest extends AbstractAnalysisTest { 26 class FixesTest extends AbstractAnalysisTest {
26 @override 27 @override
27 void setUp() { 28 void setUp() {
28 super.setUp(); 29 super.setUp();
29 createProject(); 30 createProject();
30 handler = new EditDomainHandler(server); 31 handler = new EditDomainHandler(server);
31 } 32 }
32 33
33 Future test_hasFixes() { 34 Future test_hasFixes() {
34 addTestFile(''' 35 addTestFile('''
35 main() { 36 main() {
36 print(42) 37 print(42)
37 } 38 }
38 '''); 39 ''');
39 return waitForTasksFinished().then((_) { 40 return waitForTasksFinished().then((_) {
40 Request request = new Request('0', EDIT_GET_FIXES); 41 Request request = new EditGetFixesParams(testFile,
41 request.setParameter(FILE, testFile); 42 findOffset('print')).toRequest('0');
42 request.setParameter(OFFSET, findOffset('print'));
43 Response response = handleSuccessfulRequest(request); 43 Response response = handleSuccessfulRequest(request);
44 List<Map<String, Object>> errorFixesJsonList = response.getResult(FIXES); 44 List<Map<String, Object>> errorFixesJsonList = response.getResult(FIXES);
45 expect(errorFixesJsonList, hasLength(1)); 45 expect(errorFixesJsonList, hasLength(1));
46 { 46 {
47 Map<String, Object> fixes = errorFixesJsonList[0]; 47 Map<String, Object> fixes = errorFixesJsonList[0];
48 Map<String, Object> error = fixes[ERROR]; 48 Map<String, Object> error = fixes[ERROR];
49 expect(error[SEVERITY], 'ERROR'); 49 expect(error[SEVERITY], 'ERROR');
50 expect(error[TYPE], 'SYNTACTIC_ERROR'); 50 expect(error[TYPE], 'SYNTACTIC_ERROR');
51 expect(fixes[FIXES], hasLength(1)); 51 expect(fixes[FIXES], hasLength(1));
52 } 52 }
53 }); 53 });
54 } 54 }
55 } 55 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/test/edit/edit_domain_test.dart ('k') | pkg/analysis_server/test/edit/refactoring_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698