Skip to content

Commit

Permalink
Fix tests that reference the flutter package
Browse files Browse the repository at this point in the history
Change-Id: Idd1949db259d747abb063328901f42be29ba57b2
Reviewed-on: https://dart-review.googlesource.com/68581
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
  • Loading branch information
bwilkerson authored and commit-bot@chromium.org committed Aug 7, 2018
1 parent de40820 commit bc8a838
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 11 deletions.
10 changes: 10 additions & 0 deletions pkg/analysis_server/test/abstract_context.dart
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ class AbstractContextTest extends Object with ResourceProviderMixin {
addMetaPackageSource();
Folder libFolder = configureFlutterPackage(resourceProvider);
packageMap['flutter'] = [libFolder];
configureDriver();
}

Source addMetaPackageSource() => addPackageSource('meta', 'meta.dart', r'''
Expand Down Expand Up @@ -98,6 +99,7 @@ class _IsTestGroup {
packageMap[packageName] = [newFolder('/pubcache/$packageName/lib')];
File file =
newFile('/pubcache/$packageName/lib/$filePath', content: content);
configureDriver();
return file.createSource();
}

Expand All @@ -110,6 +112,14 @@ class _IsTestGroup {
return source;
}

/**
* Re-configure the driver. This is necessary, for example, after defining a
* new package that test code will reference.
*/
void configureDriver() {
driver.configure();
}

void configurePreviewDart2() {
driver.configure(
analysisOptions: new AnalysisOptionsImpl.from(driver.analysisOptions)
Expand Down
4 changes: 0 additions & 4 deletions pkg/analysis_server/test/services/correction/assist_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6315,10 +6315,6 @@ class AssistProcessorTest_UseCFE extends AssistProcessorTest {
@override
bool get useCFE => true;

// Many of these tests are failing because the CFE is not able to find the
// flutter package. It seems likely that there is a problem with the way the
// tests (or some underlying layer) is passing package resolution to the CFE.

@failingTest
@override
test_addTypeAnnotation_parameter_BAD_hasExplicitType() =>
Expand Down
1 change: 1 addition & 0 deletions pkg/analysis_server/test/services/correction/fix_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4551,6 +4551,7 @@ main() {
testFile = '/project/lib/test.dart';
packageMap['project'] = [newFolder('/project/lib')];
addSource('/project/lib/src/lib.dart', 'class Test {}');
configureDriver();
await resolveTestUnit('''
main() {
Test t;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,7 @@ class FlutterOutlineComputerTest extends AbstractOutlineComputerTest {
@override
void setUp() {
super.setUp();
Folder libFolder = configureFlutterPackage(resourceProvider);
packageMap['flutter'] = [libFolder];
addFlutterPackage();
}

test_columnWithChildren() async {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class FlutterCorrectionTest extends AbstractSingleUnitTest {
@override
void setUp() {
super.setUp();
packageMap['flutter'] = [configureFlutterPackage(resourceProvider)];
addFlutterPackage();
}

test_addForDesignTimeConstructor_BAD_notClass() async {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@ class FlutterOutlineComputerTest extends AbstractContextTest {
void setUp() {
super.setUp();
testPath = resourceProvider.convertPath('/test.dart');
Folder libFolder = configureFlutterPackage(resourceProvider);
packageMap['flutter'] = [libFolder];
addFlutterPackage();
}

test_attribute_namedExpression() async {
Expand Down Expand Up @@ -473,6 +472,7 @@ class MyWidget extends StatelessWidget {

testPath = resourceProvider.convertPath('/home/user/test/lib/test.dart');
newFile('/home/user/test/lib/my_lib.dart', content: '');
configureDriver();

await _computeOutline('''
import 'package:flutter/widgets.dart';
Expand Down
3 changes: 1 addition & 2 deletions pkg/analysis_server/test/src/utilities/flutter_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ class FlutterTest extends AbstractSingleUnitTest {
@override
void setUp() {
super.setUp();
Folder libFolder = configureFlutterPackage(resourceProvider);
packageMap['flutter'] = [libFolder];
addFlutterPackage();
}

test_getWidgetPresentationText_icon() async {
Expand Down

0 comments on commit bc8a838

Please sign in to comment.