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

Side by Side Diff: pkg/analysis_server/test/protocol_test.dart

Issue 332993006: Implemented analysis.setPrioritySource (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comments Created 6 years, 6 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.protocol; 5 library test.protocol;
6 6
7 import 'dart:convert'; 7 import 'dart:convert';
8 8
9 import 'package:analysis_server/src/protocol.dart'; 9 import 'package:analysis_server/src/protocol.dart';
10 import 'package:unittest/unittest.dart'; 10 import 'package:unittest/unittest.dart';
(...skipping 510 matching lines...) Expand 10 before | Expand all | Expand 10 after
521 Response response = new Response.unknownRequest(new Request('0', '')); 521 Response response = new Response.unknownRequest(new Request('0', ''));
522 expect(response.id, equals('0')); 522 expect(response.id, equals('0'));
523 expect(response.error, isNotNull); 523 expect(response.error, isNotNull);
524 expect(response.toJson(), equals({ 524 expect(response.toJson(), equals({
525 Response.ID: '0', 525 Response.ID: '0',
526 Response.ERROR: {'code': -7, 'message': 'Unknown request'} 526 Response.ERROR: {'code': -7, 'message': 'Unknown request'}
527 })); 527 }));
528 } 528 }
529 529
530 @runTest 530 @runTest
531 static void create_unanalyzedPriorityFiles() {
532 Response response = new Response.unanalyzedPriorityFiles(new Request('0', '' ), 'file list');
533 expect(response.id, equals('0'));
534 expect(response.error, isNotNull);
535 expect(response.toJson(), equals({
536 Response.ID: '0',
537 Response.ERROR: {'code': -11, 'message': "Unanalyzed files cannot be a pri ority: 'file list'"}
538 }));
539 }
540
541 @runTest
531 static void setResult() { 542 static void setResult() {
532 String resultName = 'name'; 543 String resultName = 'name';
533 String resultValue = 'value'; 544 String resultValue = 'value';
534 Response response = new Response('0'); 545 Response response = new Response('0');
535 response.setResult(resultName, resultValue); 546 response.setResult(resultName, resultValue);
536 expect(response.getResult(resultName), same(resultValue)); 547 expect(response.getResult(resultName), same(resultValue));
537 expect(response.toJson(), equals({ 548 expect(response.toJson(), equals({
538 Response.ID: '0', 549 Response.ID: '0',
539 Response.RESULT: { 550 Response.RESULT: {
540 resultName: resultValue 551 resultName: resultValue
(...skipping 25 matching lines...) Expand all
566 original.setResult('foo', 'bar'); 577 original.setResult('foo', 'bar');
567 Response response = new Response.fromJson(original.toJson()); 578 Response response = new Response.fromJson(original.toJson());
568 expect(response.id, equals('myId')); 579 expect(response.id, equals('myId'));
569 Map<String, Object> result = response.result; 580 Map<String, Object> result = response.result;
570 expect(result.length, equals(1)); 581 expect(result.length, equals(1));
571 expect(result['foo'], equals('bar')); 582 expect(result['foo'], equals('bar'));
572 } 583 }
573 } 584 }
574 585
575 Matcher _throwsRequestFailure = throwsA(new isInstanceOf<RequestFailure>()); 586 Matcher _throwsRequestFailure = throwsA(new isInstanceOf<RequestFailure>());
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698