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

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

Issue 1083223003: Fix additional cases where analysis server might send null, violating protocol. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 8 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.refactoring; 5 library test.edit.refactoring;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 8
9 import 'package:analysis_server/src/edit/edit_domain.dart'; 9 import 'package:analysis_server/src/edit/edit_domain.dart';
10 import 'package:analysis_server/src/plugin/server_plugin.dart'; 10 import 'package:analysis_server/src/plugin/server_plugin.dart';
(...skipping 973 matching lines...) Expand 10 before | Expand all | Expand 10 after
984 Future<Response> _sendInlineRequest(String search) { 984 Future<Response> _sendInlineRequest(String search) {
985 Request request = new EditGetRefactoringParams( 985 Request request = new EditGetRefactoringParams(
986 RefactoringKind.INLINE_METHOD, testFile, findOffset(search), 0, false, 986 RefactoringKind.INLINE_METHOD, testFile, findOffset(search), 0, false,
987 options: options).toRequest('0'); 987 options: options).toRequest('0');
988 return serverChannel.sendRequest(request); 988 return serverChannel.sendRequest(request);
989 } 989 }
990 } 990 }
991 991
992 @reflectiveTest 992 @reflectiveTest
993 class MoveFileTest extends _AbstractGetRefactoring_Test { 993 class MoveFileTest extends _AbstractGetRefactoring_Test {
994 MoveFileOptions options = new MoveFileOptions(null); 994 void _setOptions(String newFile) {
995 options = new MoveFileOptions(newFile);
996 }
997 MoveFileOptions options;
scheglov 2015/04/16 15:01:10 Sort?
Paul Berry 2015/04/16 15:42:21 Done.
995 998
996 test_OK() { 999 test_OK() {
997 resourceProvider.newFile('/project/bin/lib.dart', ''); 1000 resourceProvider.newFile('/project/bin/lib.dart', '');
998 addTestFile(''' 1001 addTestFile('''
999 import 'dart:math'; 1002 import 'dart:math';
1000 import 'lib.dart'; 1003 import 'lib.dart';
1001 '''); 1004 ''');
1002 options.newFile = '/project/test.dart'; 1005 _setOptions('/project/test.dart');
1003 return assertSuccessfulRefactoring(() { 1006 return assertSuccessfulRefactoring(() {
1004 return _sendMoveRequest(); 1007 return _sendMoveRequest();
1005 }, ''' 1008 }, '''
1006 import 'dart:math'; 1009 import 'dart:math';
1007 import 'bin/lib.dart'; 1010 import 'bin/lib.dart';
1008 '''); 1011 ''');
1009 } 1012 }
1010 1013
1011 Future<Response> _sendMoveRequest() { 1014 Future<Response> _sendMoveRequest() {
1012 Request request = new EditGetRefactoringParams( 1015 Request request = new EditGetRefactoringParams(
(...skipping 734 matching lines...) Expand 10 before | Expand all | Expand 10 after
1747 .toRequest('0'); 1750 .toRequest('0');
1748 return _assertErrorResposeNoIndex(request); 1751 return _assertErrorResposeNoIndex(request);
1749 } 1752 }
1750 1753
1751 _assertErrorResposeNoIndex(Request request) async { 1754 _assertErrorResposeNoIndex(Request request) async {
1752 Response response = await serverChannel.sendRequest(request); 1755 Response response = await serverChannel.sendRequest(request);
1753 expect(response.error, isNotNull); 1756 expect(response.error, isNotNull);
1754 expect(response.error.code, RequestErrorCode.NO_INDEX_GENERATED); 1757 expect(response.error.code, RequestErrorCode.NO_INDEX_GENERATED);
1755 } 1758 }
1756 } 1759 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698