Skip to content

Commit

Permalink
Enable a few more server tests under CFE
Browse files Browse the repository at this point in the history
Change-Id: I5f0bd750d3da7658f836e45f02da5ef157e752ff
Reviewed-on: https://dart-review.googlesource.com/68960
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
  • Loading branch information
bwilkerson authored and commit-bot@chromium.org committed Aug 8, 2018
1 parent 75f92ac commit 83aa463
Show file tree
Hide file tree
Showing 14 changed files with 115 additions and 119 deletions.
27 changes: 0 additions & 27 deletions pkg/analysis_server/test/abstract_context.dart
Original file line number Diff line number Diff line change
Expand Up @@ -112,33 +112,6 @@ class _IsTestGroup {
return source;
}

/**
* Call a test that we think will fail.
*
* Ensure that we return any thrown exception correctly (avoiding the
* package:test zone error handler).
*/
Future callFailingTest(Future Function() expectedFailingTestFn) {
final Completer completer = new Completer();

try {
runZoned(
() async => await expectedFailingTestFn(),
onError: (error) {
completer.completeError(error);
},
).then((result) {
completer.complete(result);
}).catchError((error) {
completer.completeError(error);
});
} catch (error) {
completer.completeError(error);
}

return completer.future;
}

/**
* Re-configure the driver. This is necessary, for example, after defining a
* new package that test code will reference.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import 'package:test/test.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';

import '../analysis_abstract.dart';
import '../test_utilities/utillities.dart';

main() {
defineReflectiveSuite(() {
Expand Down
27 changes: 0 additions & 27 deletions pkg/analysis_server/test/analysis_abstract.dart
Original file line number Diff line number Diff line change
Expand Up @@ -106,33 +106,6 @@ class AbstractAnalysisTest extends Object with ResourceProviderMixin {
return testFile;
}

/**
* Call a test that we think will fail.
*
* Ensure that we return any thrown exception correctly (avoiding the
* package:test zone error handler).
*/
Future callFailingTest(Future Function() expectedFailingTestFn) {
final Completer completer = new Completer();

try {
runZoned(
() async => await expectedFailingTestFn(),
onError: (error) {
completer.completeError(error);
},
).then((result) {
completer.complete(result);
}).catchError((error) {
completer.completeError(error);
});
} catch (error) {
completer.completeError(error);
}

return completer.future;
}

AnalysisServer createAnalysisServer() {
//
// Process plugins
Expand Down
27 changes: 0 additions & 27 deletions pkg/analysis_server/test/completion_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2607,31 +2607,4 @@ class A<Z extends X> {
}
}
}

/**
* Call a test that we think will fail.
*
* Ensure that we return any thrown exception correctly (avoiding the
* package:test zone error handler).
*/
Future callFailingTest(Future Function() expectedFailingTestFn) {
final Completer completer = new Completer();

try {
runZoned(
() async => await expectedFailingTestFn(),
onError: (error) {
completer.completeError(error);
},
).then((result) {
completer.complete(result);
}).catchError((error) {
completer.completeError(error);
});
} catch (error) {
completer.completeError(error);
}

return completer.future;
}
}
42 changes: 39 additions & 3 deletions pkg/analysis_server/test/context_manager_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,11 @@ import 'src/plugin/plugin_manager_test.dart';
main() {
defineReflectiveSuite(() {
defineReflectiveTests(AbstractContextManagerTest);
defineReflectiveTests(AbstractContextManagerTest_UseCFE);
defineReflectiveTests(ContextManagerWithNewOptionsTest);
defineReflectiveTests(ContextManagerWithNewOptionsTest_UseCFE);
defineReflectiveTests(ContextManagerWithOldOptionsTest);
defineReflectiveTests(ContextManagerWithOldOptionsTest_UseCFE);
});
}

Expand Down Expand Up @@ -1644,6 +1647,12 @@ test_pack:lib/''');
}
}

@reflectiveTest
class AbstractContextManagerTest_UseCFE extends AbstractContextManagerTest {
@override
bool get useCFE => true;
}

abstract class ContextManagerTest extends Object with ResourceProviderMixin {
/**
* The name of the 'bin' directory.
Expand Down Expand Up @@ -1720,6 +1729,11 @@ abstract class ContextManagerTest extends Object with ResourceProviderMixin {

SourceFactory get sourceFactory => callbacks.sourceFactory;

/**
* Return `true` to enable the Dart 2.0 Common Front End.
*/
bool get useCFE => false;

Map<String, List<Folder>> get _currentPackageMap => _packageMap(projPath);

/**
Expand Down Expand Up @@ -1756,7 +1770,8 @@ abstract class ContextManagerTest extends Object with ResourceProviderMixin {
PerformanceLog logger = new PerformanceLog(new NullStringSink());
AnalysisDriverScheduler scheduler = new AnalysisDriverScheduler(logger);
callbacks = new TestContextManagerCallbacks(
resourceProvider, sdkManager, logger, scheduler);
resourceProvider, sdkManager, logger, scheduler,
useCFE: useCFE);
manager.callbacks = callbacks;
}

Expand Down Expand Up @@ -1792,11 +1807,25 @@ class ContextManagerWithNewOptionsTest extends ContextManagerWithOptionsTest {
}
}

@reflectiveTest
class ContextManagerWithNewOptionsTest_UseCFE
extends ContextManagerWithNewOptionsTest {
@override
bool get useCFE => true;
}

@reflectiveTest
class ContextManagerWithOldOptionsTest extends ContextManagerWithOptionsTest {
String get optionsFileName => AnalysisEngine.ANALYSIS_OPTIONS_FILE;
}

@reflectiveTest
class ContextManagerWithOldOptionsTest_UseCFE
extends ContextManagerWithOldOptionsTest {
@override
bool get useCFE => true;
}

abstract class ContextManagerWithOptionsTest extends ContextManagerTest {
String get optionsFileName;

Expand Down Expand Up @@ -2476,6 +2505,11 @@ class TestContextManagerCallbacks extends ContextManagerCallbacks {
*/
final AnalysisDriverScheduler scheduler;

/**
* A flag indicating whether to enable the Dart 2.0 Common Front End.
*/
final bool useCFE;

/**
* The list of `flushedFiles` in the last [removeContext] invocation.
*/
Expand All @@ -2490,7 +2524,8 @@ class TestContextManagerCallbacks extends ContextManagerCallbacks {
NotificationManager notificationManager = new TestNotificationManager();

TestContextManagerCallbacks(
this.resourceProvider, this.sdkManager, this.logger, this.scheduler);
this.resourceProvider, this.sdkManager, this.logger, this.scheduler,
{this.useCFE = false});

/**
* Return the current set of analysis options.
Expand Down Expand Up @@ -2543,7 +2578,8 @@ class TestContextManagerCallbacks extends ContextManagerCallbacks {
new FileContentOverlay(),
contextRoot,
sourceFactory,
analysisOptions);
analysisOptions,
useCFE: useCFE);
driverMap[path] = currentDriver;
currentDriver.exceptions.listen((ExceptionResult result) {
AnalysisEngine.instance.logger
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import 'package:analysis_server/protocol/protocol_generated.dart';
import 'package:test/test.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';

import '../../test_utilities/utillities.dart';
import '../support/integration_tests.dart';

main() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import 'package:analysis_server/protocol/protocol_generated.dart';
import 'package:test/test.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';

import '../../test_utilities/utillities.dart';
import '../support/integration_tests.dart';

main() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,33 +164,6 @@ abstract class AbstractAnalysisServerIntegrationTest
// TODO(devoncarew): Remove this when --use-cfe goes away.
bool get useCFE => false;

/**
* Call a test that we think will fail.
*
* Ensure that we return any thrown exception correctly (avoiding the
* package:test zone error handler).
*/
Future callFailingTest(Future Function() expectedFailingTestFn) {
final Completer completer = new Completer();

try {
runZoned(
() async => await expectedFailingTestFn(),
onError: (error) {
completer.completeError(error);
},
).then((result) {
completer.complete(result);
}).catchError((error) {
completer.completeError(error);
});
} catch (error) {
completer.completeError(error);
}

return completer.future;
}

/**
* Print out any messages exchanged with the server. If some messages have
* already been exchanged with the server, they are printed out immediately.
Expand Down
1 change: 1 addition & 0 deletions pkg/analysis_server/test/search/type_hierarchy_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import 'package:test/test.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';

import '../analysis_abstract.dart';
import '../test_utilities/utillities.dart';

main() {
defineReflectiveSuite(() {
Expand Down
7 changes: 0 additions & 7 deletions pkg/analysis_server/test/services/correction/status_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ main() {
defineReflectiveTests(RefactoringLocationTest);
defineReflectiveTests(RefactoringLocationTest_UseCFE);
defineReflectiveTests(RefactoringStatusTest);
defineReflectiveTests(RefactoringStatusTest_UseCFE);
});
}

Expand Down Expand Up @@ -241,9 +240,3 @@ class RefactoringStatusTest {
expect(refactoringStatus.message, 'msg');
}
}

@reflectiveTest
class RefactoringStatusTest_UseCFE extends RefactoringStatusTest {
@override
bool get useCFE => true;
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import 'package:analysis_server/src/services/refactoring/refactoring.dart';
import 'package:test/test.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';

import '../../test_utilities/utillities.dart';
import 'abstract_refactoring.dart';

main() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import 'package:analyzer_plugin/protocol/protocol_common.dart';
import 'package:test/test.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';

import '../../test_utilities/utillities.dart';
import 'abstract_rename.dart';

main() {
Expand Down
39 changes: 38 additions & 1 deletion pkg/analysis_server/test/services/search/search_engine_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,12 @@ import 'package:test/test.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';

import '../../mock_sdk.dart';
import '../../test_utilities/utillities.dart';

main() {
defineReflectiveSuite(() {
defineReflectiveTests(SearchEngineImplTest);
defineReflectiveTests(SearchEngineImplTest_UseCFE);
});
}

Expand All @@ -39,6 +41,11 @@ class SearchEngineImplTest extends Object with ResourceProviderMixin {

AnalysisDriverScheduler scheduler;

/**
* Return `true` to enable the Dart 2.0 Common Front End.
*/
bool get useCFE => false;

void setUp() {
sdk = new MockSdk(resourceProvider: resourceProvider);
logger = new PerformanceLog(logBuffer);
Expand Down Expand Up @@ -468,6 +475,36 @@ class B extends A {}
contentOverlay,
null,
new SourceFactory(resolvers, null, resourceProvider),
new AnalysisOptionsImpl());
new AnalysisOptionsImpl(),
useCFE: useCFE);
}
}

@reflectiveTest
class SearchEngineImplTest_UseCFE extends SearchEngineImplTest {
@override
bool get useCFE => true;

@failingTest
@override
test_searchAllSubtypes() => super.test_searchAllSubtypes();

@failingTest
@override
test_searchAllSubtypes_acrossDrivers() =>
super.test_searchAllSubtypes_acrossDrivers();

@failingTest
@override
test_searchMemberReferences() =>
callFailingTest(super.test_searchMemberReferences());

@failingTest
@override
test_searchReferences() => super.test_searchReferences();

@failingTest
@override
test_searchReferences_discover_owned() =>
super.test_searchReferences_discover_owned();
}
Loading

0 comments on commit 83aa463

Please sign in to comment.