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

Side by Side Diff: pkg/analysis_server/test/services/refactoring/abstract_refactoring.dart

Issue 492243002: Introduce convenience methods into generated analysis server classes. (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.services.refactoring; 5 library test.services.refactoring;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 8
9 import 'package:analysis_server/src/protocol2.dart';
9 import 'package:analysis_server/src/services/correction/change.dart'; 10 import 'package:analysis_server/src/services/correction/change.dart';
10 import 'package:analysis_server/src/services/correction/status.dart'; 11 import 'package:analysis_server/src/services/correction/status.dart';
11 import 'package:analysis_server/src/services/index/index.dart'; 12 import 'package:analysis_server/src/services/index/index.dart';
12 import 'package:analysis_server/src/services/index/local_memory_index.dart'; 13 import 'package:analysis_server/src/services/index/local_memory_index.dart';
13 import 'package:analysis_server/src/services/refactoring/refactoring.dart'; 14 import 'package:analysis_server/src/services/refactoring/refactoring.dart';
14 import 'package:analysis_server/src/services/search/search_engine_internal.dart' ; 15 import 'package:analysis_server/src/services/search/search_engine_internal.dart' ;
15 import 'package:analysis_testing/abstract_single_unit.dart'; 16 import 'package:analysis_testing/abstract_single_unit.dart';
16 import 'package:analyzer/src/generated/ast.dart'; 17 import 'package:analyzer/src/generated/ast.dart';
17 import 'package:analyzer/src/generated/source.dart'; 18 import 'package:analyzer/src/generated/source.dart';
18 import 'package:unittest/unittest.dart'; 19 import 'package:unittest/unittest.dart';
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 92
92 /** 93 /**
93 * Asserts that [refactoringChange] contains a [FileEdit] for [testFile], and 94 * Asserts that [refactoringChange] contains a [FileEdit] for [testFile], and
94 * it results the [expectedCode]. 95 * it results the [expectedCode].
95 */ 96 */
96 void assertTestChangeResult(String expectedCode) { 97 void assertTestChangeResult(String expectedCode) {
97 // prepare FileEdit 98 // prepare FileEdit
98 FileEdit fileEdit = refactoringChange.getFileEdit(testFile); 99 FileEdit fileEdit = refactoringChange.getFileEdit(testFile);
99 expect(fileEdit, isNotNull); 100 expect(fileEdit, isNotNull);
100 // validate resulting code 101 // validate resulting code
101 String actualCode = applySequence(testCode, fileEdit.edits); 102 String actualCode = SourceEdit.applySequence(testCode, fileEdit.edits);
102 expect(actualCode, expectedCode); 103 expect(actualCode, expectedCode);
103 } 104 }
104 105
105 void indexTestUnit(String code) { 106 void indexTestUnit(String code) {
106 resolveTestUnit(code); 107 resolveTestUnit(code);
107 index.indexUnit(context, testUnit); 108 index.indexUnit(context, testUnit);
108 } 109 }
109 110
110 void indexUnit(String file, String code) { 111 void indexUnit(String file, String code) {
111 Source source = addSource(file, code); 112 Source source = addSource(file, code);
112 CompilationUnit unit = resolveLibraryUnit(source); 113 CompilationUnit unit = resolveLibraryUnit(source);
113 index.indexUnit(context, unit); 114 index.indexUnit(context, unit);
114 } 115 }
115 116
116 void setUp() { 117 void setUp() {
117 super.setUp(); 118 super.setUp();
118 index = createLocalMemoryIndex(); 119 index = createLocalMemoryIndex();
119 searchEngine = new SearchEngineImpl(index); 120 searchEngine = new SearchEngineImpl(index);
120 } 121 }
121 } 122 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698