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

Side by Side Diff: pkg/analyzer/test/generated/engine_test.dart

Issue 1033383002: Gracefully handle IO exceptions while resolving URIs (issue 23023) (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
« no previous file with comments | « pkg/analyzer/lib/src/generated/engine.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 // This code was auto-generated, is not intended to be edited, and is subject to 5 // This code was auto-generated, is not intended to be edited, and is subject to
6 // significant change. Please see the README file for more information. 6 // significant change. Please see the README file for more information.
7 7
8 library engine.engine_test; 8 library engine.engine_test;
9 9
10 import 'dart:async'; 10 import 'dart:async';
(...skipping 4521 matching lines...) Expand 10 before | Expand all | Expand 10 after
4532 visited = true; 4532 visited = true;
4533 return null; 4533 return null;
4534 } 4534 }
4535 } 4535 }
4536 4536
4537 class LintGeneratorTest_Linter_Null_Visitor extends Linter { 4537 class LintGeneratorTest_Linter_Null_Visitor extends Linter {
4538 @override 4538 @override
4539 AstVisitor getVisitor() => null; 4539 AstVisitor getVisitor() => null;
4540 } 4540 }
4541 4541
4542 class MockSourceFactory extends SourceFactory {
4543 MockSourceFactory() : super([]);
4544 Source resolveUri(Source containingSource, String containedUri) {
4545 throw new JavaIOException();
4546 }
4547 }
4548
4542 @reflectiveTest 4549 @reflectiveTest
4543 class ParseDartTaskTest extends EngineTestCase { 4550 class ParseDartTaskTest extends EngineTestCase {
4544 void test_accept() { 4551 void test_accept() {
4545 ParseDartTask task = new ParseDartTask(null, null, null, null); 4552 ParseDartTask task = new ParseDartTask(null, null, null, null);
4546 expect(task.accept(new ParseDartTaskTestTV_accept()), isTrue); 4553 expect(task.accept(new ParseDartTaskTestTV_accept()), isTrue);
4547 } 4554 }
4548 4555
4549 void test_getCompilationUnit() { 4556 void test_getCompilationUnit() {
4550 ParseDartTask task = new ParseDartTask(null, null, null, null); 4557 ParseDartTask task = new ParseDartTask(null, null, null, null);
4551 expect(task.compilationUnit, isNull); 4558 expect(task.compilationUnit, isNull);
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
4620 part 'part.dart'; 4627 part 'part.dart';
4621 class A {}'''; 4628 class A {}''';
4622 Source source = new TestSource('/test.dart', content); 4629 Source source = new TestSource('/test.dart', content);
4623 InternalAnalysisContext context = new AnalysisContextImpl(); 4630 InternalAnalysisContext context = new AnalysisContextImpl();
4624 context.sourceFactory = new SourceFactory([new FileUriResolver()]); 4631 context.sourceFactory = new SourceFactory([new FileUriResolver()]);
4625 ParseDartTask task = _createParseTask(context, source, content); 4632 ParseDartTask task = _createParseTask(context, source, content);
4626 task.perform( 4633 task.perform(
4627 new ParseDartTaskTestTV_perform_validateDirectives(context, source)); 4634 new ParseDartTaskTestTV_perform_validateDirectives(context, source));
4628 } 4635 }
4629 4636
4637 void test_resolveDirective_dartUri() {
4638 GatheringErrorListener listener = new GatheringErrorListener();
4639 ImportDirective directive = AstFactory.importDirective3('dart:core', null);
4640 AnalysisContext context = AnalysisContextFactory.contextWithCore();
4641 Source source =
4642 ParseDartTask.resolveDirective(context, null, directive, listener);
4643 expect(source, isNotNull);
4644 }
4645
4646 void test_resolveDirective_exception() {
4647 GatheringErrorListener listener = new GatheringErrorListener();
4648 ImportDirective directive = AstFactory.importDirective3('dart:core', null);
4649 AnalysisContext context = new AnalysisContextImpl();
4650 context.sourceFactory = new MockSourceFactory();
4651 Source source =
4652 ParseDartTask.resolveDirective(context, null, directive, listener);
4653 expect(source, isNull);
4654 expect(listener.errors.length, 1);
scheglov 2015/03/27 23:05:58 expect(listener.errors, hasLength(1));
Brian Wilkerson 2015/03/27 23:51:57 Done
4655 }
4656
4630 /** 4657 /**
4631 * Create and return a task that will parse the given content from the given s ource in the given 4658 * Create and return a task that will parse the given content from the given s ource in the given
4632 * context. 4659 * context.
4633 * 4660 *
4634 * @param context the context to be passed to the task 4661 * @param context the context to be passed to the task
4635 * @param source the source to be parsed 4662 * @param source the source to be parsed
4636 * @param content the content of the source to be parsed 4663 * @param content the content of the source to be parsed
4637 * @return the task that was created 4664 * @return the task that was created
4638 * @throws AnalysisException if the task could not be created 4665 * @throws AnalysisException if the task could not be created
4639 */ 4666 */
(...skipping 1936 matching lines...) Expand 10 before | Expand all | Expand 10 after
6576 @override 6603 @override
6577 bool exists() => true; 6604 bool exists() => true;
6578 } 6605 }
6579 6606
6580 class _UniversalCachePartitionTest_test_setMaxCacheSize 6607 class _UniversalCachePartitionTest_test_setMaxCacheSize
6581 implements CacheRetentionPolicy { 6608 implements CacheRetentionPolicy {
6582 @override 6609 @override
6583 RetentionPriority getAstPriority(Source source, SourceEntry sourceEntry) => 6610 RetentionPriority getAstPriority(Source source, SourceEntry sourceEntry) =>
6584 RetentionPriority.LOW; 6611 RetentionPriority.LOW;
6585 } 6612 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/generated/engine.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698