Remove use of MockCompiler from type_test_helper

Change-Id: Ia3607574f0f01db833ecf5d72d6bc5087757c180
Reviewed-on: https://dart-review.googlesource.com/53800
Reviewed-by: Sigmund Cherem <sigmund@google.com>
diff --git a/tests/compiler/dart2js/generic_methods/function_type_variable_test.dart b/tests/compiler/dart2js/generic_methods/function_type_variable_test.dart
index 0c4ed18..aaef4ea 100644
--- a/tests/compiler/dart2js/generic_methods/function_type_variable_test.dart
+++ b/tests/compiler/dart2js/generic_methods/function_type_variable_test.dart
@@ -39,7 +39,7 @@
     }
     void F11<Q extends C3<Q>>(Q q) {}
     void F12<P extends C3<P>>(P p) {}
-  """), compileMode: CompileMode.kernel, options: [Flags.strongMode]);
+  """), options: [Flags.strongMode]);
 
     testToString(FunctionType type, String expectedToString) {
       Expect.equals(expectedToString, type.toString());
diff --git a/tests/compiler/dart2js/generic_methods/generic_method_type_test.dart b/tests/compiler/dart2js/generic_methods/generic_method_type_test.dart
index 0357757..3d90b38 100644
--- a/tests/compiler/dart2js/generic_methods/generic_method_type_test.dart
+++ b/tests/compiler/dart2js/generic_methods/generic_method_type_test.dart
@@ -22,13 +22,10 @@
 
 main() {
   asyncTest(() async {
-    TypeEnvironment env = await TypeEnvironment.create(
-        """
+    TypeEnvironment env = await TypeEnvironment.create("""
       ${createTypedefs(signatures, prefix: 't')}
       ${createMethods(signatures, prefix: 'm')}
-    """,
-        compileMode: CompileMode.kernel,
-        options: [Flags.strongMode]);
+    """, options: [Flags.strongMode]);
 
     for (FunctionTypeData data in signatures) {
       FunctionType functionType = env.getElementType('t${data.name}');
diff --git a/tests/compiler/dart2js/inference/type_mask2_test.dart b/tests/compiler/dart2js/inference/type_mask2_test.dart
index 2f2362a..a3c40a0 100644
--- a/tests/compiler/dart2js/inference/type_mask2_test.dart
+++ b/tests/compiler/dart2js/inference/type_mask2_test.dart
@@ -24,16 +24,16 @@
 }
 
 void main() {
-  runTests(CompileMode compileMode) async {
-    await testUnionTypeMaskFlatten(compileMode);
-    await testStringSubtypes(compileMode);
+  runTests({bool useOldFrontend}) async {
+    await testUnionTypeMaskFlatten(useOldFrontend: useOldFrontend);
+    await testStringSubtypes(useOldFrontend: useOldFrontend);
   }
 
   asyncTest(() async {
     print('--test from ast---------------------------------------------------');
-    await runTests(CompileMode.memory);
+    await runTests(useOldFrontend: true);
     print('--test from kernel------------------------------------------------');
-    await runTests(CompileMode.kernel);
+    await runTests(useOldFrontend: false);
   });
 }
 
@@ -92,7 +92,7 @@
   return union;
 }
 
-Future testUnionTypeMaskFlatten(CompileMode compileMode) async {
+Future testUnionTypeMaskFlatten({bool useOldFrontend}) async {
   TypeEnvironment env = await TypeEnvironment.create(r"""
       class A {}
       class B {}
@@ -107,7 +107,7 @@
         new D();
         new E();
       }
-      """, compileMode: compileMode);
+      """, useOldFrontend: useOldFrontend);
 
   ClosedWorld closedWorld = env.closedWorld;
 
@@ -210,14 +210,14 @@
       containedClasses: [A, B, E]);
 }
 
-Future testStringSubtypes(CompileMode compileMode) async {
+Future testStringSubtypes({bool useOldFrontend}) async {
   TypeEnvironment env = await TypeEnvironment.create('',
       mainSource: r"""
       main() {
         '' is String;
       }
       """,
-      compileMode: compileMode);
+      useOldFrontend: useOldFrontend);
   ClosedWorld closedWorld = env.closedWorld;
 
   ClassEntity Object_ = env.getElement("Object");
diff --git a/tests/compiler/dart2js/inference/union_type_test.dart b/tests/compiler/dart2js/inference/union_type_test.dart
index 6b0bcdf..39166f6 100644
--- a/tests/compiler/dart2js/inference/union_type_test.dart
+++ b/tests/compiler/dart2js/inference/union_type_test.dart
@@ -9,7 +9,7 @@
 import '../type_test_helper.dart';
 
 main() {
-  runTest(CompileMode compileMode) async {
+  runTest({bool useOldFrontend}) async {
     TypeEnvironment env = await TypeEnvironment.create(r"""
       class A {}
       class B {}
@@ -18,7 +18,7 @@
         new A();
         new B();
       }
-      """, compileMode: compileMode);
+      """, useOldFrontend: useOldFrontend);
     ClosedWorld world = env.closedWorld;
     FlatTypeMask mask1 = new FlatTypeMask.exact(env.getClass('A'));
     FlatTypeMask mask2 = new FlatTypeMask.exact(env.getClass('B'));
@@ -29,8 +29,8 @@
 
   asyncTest(() async {
     print('--test from ast---------------------------------------------------');
-    await runTest(CompileMode.memory);
+    await runTest(useOldFrontend: true);
     print('--test from kernel------------------------------------------------');
-    await runTest(CompileMode.kernel);
+    await runTest(useOldFrontend: false);
   });
 }
diff --git a/tests/compiler/dart2js/instantiated_classes_test.dart b/tests/compiler/dart2js/instantiated_classes_test.dart
index 11a276a..7c10a5d9 100644
--- a/tests/compiler/dart2js/instantiated_classes_test.dart
+++ b/tests/compiler/dart2js/instantiated_classes_test.dart
@@ -22,8 +22,7 @@
       }
       mainSource.write('}');
       dynamic env = await TypeEnvironment.create(source,
-          mainSource: mainSource.toString(),
-          compileMode: useKernel ? CompileMode.kernel : CompileMode.memory);
+          mainSource: mainSource.toString(), useOldFrontend: !useKernel);
       LibraryEntity mainLibrary =
           env.compiler.frontendStrategy.elementEnvironment.mainLibrary;
       Iterable<ClassEntity> expectedClasses =
diff --git a/tests/compiler/dart2js/model/class_set_test.dart b/tests/compiler/dart2js/model/class_set_test.dart
index f2d7b83..0740ead 100644
--- a/tests/compiler/dart2js/model/class_set_test.dart
+++ b/tests/compiler/dart2js/model/class_set_test.dart
@@ -19,21 +19,21 @@
 void main() {
   asyncTest(() async {
     print('--test from ast---------------------------------------------------');
-    await testAll(CompileMode.memory);
+    await testAll(useOldFrontend: true);
     print('--test from kernel------------------------------------------------');
-    await testAll(CompileMode.kernel);
+    await testAll(useOldFrontend: false);
     print('--test from kernel (strong)---------------------------------------');
-    await testAll(CompileMode.kernel, strongMode: true);
+    await testAll(useOldFrontend: false, strongMode: true);
   });
 }
 
-testAll(CompileMode compileMode, {bool strongMode: false}) async {
-  await testIterators(compileMode);
-  await testForEach(compileMode);
-  await testClosures(compileMode, strongMode);
+testAll({bool useOldFrontend, bool strongMode: false}) async {
+  await testIterators(useOldFrontend: useOldFrontend);
+  await testForEach(useOldFrontend: useOldFrontend);
+  await testClosures(useOldFrontend: useOldFrontend, strongMode: strongMode);
 }
 
-testIterators(CompileMode compileMode) async {
+testIterators({bool useOldFrontend}) async {
   var env = await TypeEnvironment.create(r"""
       ///        A
       ///       / \
@@ -57,7 +57,7 @@
         new F();
         new G();
       }
-      """, compileMode: compileMode);
+      """, useOldFrontend: useOldFrontend);
   ClosedWorld world = env.closedWorld;
 
   ClassEntity A = env.getClass("A");
@@ -356,7 +356,7 @@
   Expect.isNull(iterator.current);
 }
 
-testForEach(CompileMode compileMode) async {
+testForEach({bool useOldFrontend}) async {
   var env = await TypeEnvironment.create(r"""
       ///        A
       ///       / \
@@ -387,7 +387,7 @@
         new H();
         new I();
       }
-      """, compileMode: compileMode);
+      """, useOldFrontend: useOldFrontend);
   ClosedWorld world = env.closedWorld;
 
   ClassEntity A = env.getClass("A");
@@ -590,7 +590,7 @@
       find: I, anySubtype: true, expectedResult: true);
 }
 
-testClosures(CompileMode compileMode, bool strongMode) async {
+testClosures({bool useOldFrontend, bool strongMode}) async {
   var env = await TypeEnvironment.create(r"""
       class A {
         call() => null;
@@ -603,7 +603,7 @@
         local() {}
       }
       """,
-      compileMode: compileMode,
+      useOldFrontend: useOldFrontend,
       options: strongMode ? [Flags.strongMode] : [],
       testBackendWorld: true);
   ClosedWorld world = env.closedWorld;
diff --git a/tests/compiler/dart2js/model/const_exp_test.dart b/tests/compiler/dart2js/model/const_exp_test.dart
deleted file mode 100644
index a8b93f0..0000000
--- a/tests/compiler/dart2js/model/const_exp_test.dart
+++ /dev/null
@@ -1,109 +0,0 @@
-// Copyright (c) 2014, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-import 'dart:async';
-import 'package:async_helper/async_helper.dart';
-import 'package:expect/expect.dart';
-import '../type_test_helper.dart';
-
-test(String constantInitializer, [String expectedOutput]) {
-  if (expectedOutput == null) {
-    expectedOutput = constantInitializer;
-  }
-  return () => TypeEnvironment.create("""
-    class Class<T, S> {
-      final a;
-      final b;
-      final c;
-      const Class(this.a, {this.b, this.c: true});
-      const Class.named([this.a, this.b = 0, this.c = 2]);
-
-      static const staticConstant = 0;
-      static staticFunction() {}
-    }
-    const t = true;
-    const f = false;
-    const toplevelConstant = 0;
-    toplevelFunction() {}
-    const constant = $constantInitializer;
-""", expectNoWarningsOrErrors: true).then((env) {
-        dynamic element = env.getElement('constant');
-        Expect.isNotNull(element, "Element 'constant' not found.");
-
-        /// ignore: undefined_getter
-        var constant = element.constant;
-        var value = env.compiler.constants.getConstantValue(constant);
-        Expect.isNotNull(constant, "No constant computed for '$element'.");
-        Expect.equals(
-            expectedOutput,
-            constant.toDartText(),
-            "Unexpected to string '${constant.toDartText()}' for constant "
-            "'$constantInitializer' of value "
-            "${value.toStructuredText()}");
-      });
-}
-
-void main() {
-  asyncTest(() => Future.forEach([
-        test('null'),
-        test('0'),
-        test('1.5'),
-        test('true'),
-        test('false'),
-        test('"f"'),
-        test('"a" "b"', '"ab"'),
-        test('const []'),
-        test('const <int>[0, 1]'),
-        test('const <dynamic>[0, 1]', 'const [0, 1]'),
-        test('const {}'),
-        test('const {0: 1, 2: 3}'),
-        test('const <String, int>{"0": 1, "2": 3}'),
-        test('const <String, dynamic>{"0": 1, "2": 3}'),
-        test('const <dynamic, dynamic>{"0": 1, "2": 3}',
-            'const {"0": 1, "2": 3}'),
-        test('const Class(0)'),
-        test('const Class(0, b: 1)'),
-        test('const Class(0, c: 2)'),
-        test('const Class(0, b: 3, c: 4)'),
-        test('const Class.named()'),
-        test('const Class.named(0)'),
-        test('const Class.named(0, 1)'),
-        test('const Class.named(0, 1, 2)'),
-        test('const Class<String, int>(0)'),
-        test('const Class<String, dynamic>(0)'),
-        test('const Class<dynamic, String>(0)'),
-        test('const Class<dynamic, dynamic>(0)', 'const Class(0)'),
-        test('toplevelConstant'),
-        test('toplevelFunction'),
-        test('Class.staticConstant'),
-        test('Class.staticFunction'),
-        test('#a'),
-        test('1 + 2'),
-        test('1 + 2 + 3'),
-        test('1 + -2'),
-        test('-1 + 2'),
-        test('(1 + 2) + 3', '1 + 2 + 3'),
-        test('1 + (2 + 3)', '1 + 2 + 3'),
-        test('1 * 2'),
-        test('1 * 2 + 3'),
-        test('1 * (2 + 3)'),
-        test('1 + 2 * 3'),
-        test('(1 + 2) * 3'),
-        test('false || identical(0, 1)'),
-        test('!identical(0, 1)'),
-        test('!identical(0, 1) || false'),
-        test('!(identical(0, 1) || false)'),
-        test('identical(0, 1) ? 3 * 4 + 5 : 6 + 7 * 8'),
-        test('t ? f ? 0 : 1 : 2'),
-        test('(t ? t : f) ? f ? 0 : 1 : 2'),
-        test('t ? t : f ? f ? 0 : 1 : 2'),
-        test('t ? t ? t : t : t ? t : t'),
-        test('t ? (t ? t : t) : (t ? t : t)', 't ? t ? t : t : t ? t : t'),
-        test(
-            'const [const <dynamic, dynamic>{0: true, "1": "c" "d"}, '
-            'const Class(const Class<dynamic, dynamic>(toplevelConstant))]',
-            'const [const {0: true, "1": "cd"}, '
-            'const Class(const Class(toplevelConstant))]'),
-      ], (f) => f()));
-}
diff --git a/tests/compiler/dart2js/model/constant_expression_test.dart b/tests/compiler/dart2js/model/constant_expression_test.dart
index efe465e..ae5ec8a 100644
--- a/tests/compiler/dart2js/model/constant_expression_test.dart
+++ b/tests/compiler/dart2js/model/constant_expression_test.dart
@@ -55,7 +55,22 @@
 }
 
 const List<TestData> DATA = const [
-  const TestData('', const [
+  const TestData('''
+class Class<T, S> {
+  final a;
+  final b;
+  final c;
+  const Class(this.a, {this.b, this.c: true});
+  const Class.named([this.a, this.b = 0, this.c = 2]);
+
+  static const staticConstant = 0;
+  static staticFunction() {}
+}
+const t = true;
+const f = false;
+const toplevelConstant = 0;
+toplevelFunction() {}
+''', const [
     const ConstantData('null', ConstantExpressionKind.NULL),
     const ConstantData('false', ConstantExpressionKind.BOOL),
     const ConstantData('true', ConstantExpressionKind.BOOL),
@@ -78,13 +93,24 @@
     const ConstantData('proxy', ConstantExpressionKind.FIELD),
     const ConstantData('Object', ConstantExpressionKind.TYPE),
     const ConstantData('#name', ConstantExpressionKind.SYMBOL),
+    const ConstantData('const []', ConstantExpressionKind.LIST),
     const ConstantData('const [0, 1]', ConstantExpressionKind.LIST,
         strongText: 'const <int>[0, 1]'),
     const ConstantData('const <int>[0, 1]', ConstantExpressionKind.LIST),
+    const ConstantData('const <dynamic>[0, 1]', ConstantExpressionKind.LIST,
+        text: 'const [0, 1]'),
+    const ConstantData('const {}', ConstantExpressionKind.MAP),
     const ConstantData('const {0: 1, 2: 3}', ConstantExpressionKind.MAP,
         strongText: 'const <int, int>{0: 1, 2: 3}'),
     const ConstantData(
         'const <int, int>{0: 1, 2: 3}', ConstantExpressionKind.MAP),
+    const ConstantData(
+        'const <String, int>{"0": 1, "2": 3}', ConstantExpressionKind.MAP),
+    const ConstantData(
+        'const <String, dynamic>{"0": 1, "2": 3}', ConstantExpressionKind.MAP),
+    const ConstantData(
+        'const <dynamic, dynamic>{"0": 1, "2": 3}', ConstantExpressionKind.MAP,
+        text: 'const {"0": 1, "2": 3}'),
     const ConstantData('const bool.fromEnvironment("foo", defaultValue: false)',
         ConstantExpressionKind.BOOL_FROM_ENVIRONMENT),
     const ConstantData('const int.fromEnvironment("foo", defaultValue: 42)',
@@ -92,6 +118,74 @@
     const ConstantData(
         'const String.fromEnvironment("foo", defaultValue: "bar")',
         ConstantExpressionKind.STRING_FROM_ENVIRONMENT),
+    const ConstantData('const Class(0)', ConstantExpressionKind.CONSTRUCTED),
+    const ConstantData(
+        'const Class(0, b: 1)', ConstantExpressionKind.CONSTRUCTED),
+    const ConstantData(
+        'const Class(0, c: 2)', ConstantExpressionKind.CONSTRUCTED),
+    const ConstantData(
+        'const Class(0, b: 3, c: 4)', ConstantExpressionKind.CONSTRUCTED),
+    const ConstantData(
+        'const Class.named()', ConstantExpressionKind.CONSTRUCTED),
+    const ConstantData(
+        'const Class.named(0)', ConstantExpressionKind.CONSTRUCTED),
+    const ConstantData(
+        'const Class.named(0, 1)', ConstantExpressionKind.CONSTRUCTED),
+    const ConstantData(
+        'const Class.named(0, 1, 2)', ConstantExpressionKind.CONSTRUCTED),
+    const ConstantData(
+        'const Class<String, int>(0)', ConstantExpressionKind.CONSTRUCTED),
+    const ConstantData(
+        'const Class<String, dynamic>(0)', ConstantExpressionKind.CONSTRUCTED),
+    const ConstantData(
+        'const Class<dynamic, String>(0)', ConstantExpressionKind.CONSTRUCTED),
+    const ConstantData(
+        'const Class<dynamic, dynamic>(0)', ConstantExpressionKind.CONSTRUCTED,
+        text: 'const Class(0)'),
+    const ConstantData('toplevelConstant', ConstantExpressionKind.FIELD),
+    const ConstantData('toplevelFunction', ConstantExpressionKind.FUNCTION),
+    const ConstantData('Class.staticConstant', ConstantExpressionKind.FIELD),
+    const ConstantData('Class.staticFunction', ConstantExpressionKind.FUNCTION),
+    const ConstantData('1 + 2', ConstantExpressionKind.BINARY),
+    const ConstantData('1 + 2 + 3', ConstantExpressionKind.BINARY),
+    const ConstantData('1 + -2', ConstantExpressionKind.BINARY),
+    const ConstantData('-1 + 2', ConstantExpressionKind.BINARY),
+    const ConstantData('(1 + 2) + 3', ConstantExpressionKind.BINARY,
+        text: '1 + 2 + 3'),
+    const ConstantData('1 + (2 + 3)', ConstantExpressionKind.BINARY,
+        text: '1 + 2 + 3'),
+    const ConstantData('1 * 2', ConstantExpressionKind.BINARY),
+    const ConstantData('1 * 2 + 3', ConstantExpressionKind.BINARY),
+    const ConstantData('1 * (2 + 3)', ConstantExpressionKind.BINARY),
+    const ConstantData('1 + 2 * 3', ConstantExpressionKind.BINARY),
+    const ConstantData('(1 + 2) * 3', ConstantExpressionKind.BINARY),
+    const ConstantData(
+        'false || identical(0, 1)', ConstantExpressionKind.BINARY),
+    const ConstantData('!identical(0, 1)', ConstantExpressionKind.UNARY),
+    const ConstantData(
+        '!identical(0, 1) || false', ConstantExpressionKind.BINARY),
+    const ConstantData(
+        '!(identical(0, 1) || false)', ConstantExpressionKind.UNARY),
+    const ConstantData('identical(0, 1) ? 3 * 4 + 5 : 6 + 7 * 8',
+        ConstantExpressionKind.CONDITIONAL),
+    const ConstantData('t ? f ? 0 : 1 : 2', ConstantExpressionKind.CONDITIONAL),
+    const ConstantData(
+        '(t ? t : f) ? f ? 0 : 1 : 2', ConstantExpressionKind.CONDITIONAL),
+    const ConstantData(
+        't ? t : f ? f ? 0 : 1 : 2', ConstantExpressionKind.CONDITIONAL),
+    const ConstantData(
+        't ? t ? t : t : t ? t : t', ConstantExpressionKind.CONDITIONAL),
+    const ConstantData(
+        't ? (t ? t : t) : (t ? t : t)', ConstantExpressionKind.CONDITIONAL,
+        text: 't ? t ? t : t : t ? t : t'),
+    const ConstantData(
+        'const [const <dynamic, dynamic>{0: true, "1": "c" "d"}, '
+        'const Class(const Class<dynamic, dynamic>(toplevelConstant))]',
+        ConstantExpressionKind.LIST,
+        text: 'const [const {0: true, "1": "cd"}, '
+            'const Class(const Class(toplevelConstant))]',
+        strongText: 'const <Object>[const {0: true, "1": "cd"}, '
+            'const Class(const Class(toplevelConstant))]'),
   ]),
   const TestData('''
 class A {
diff --git a/tests/compiler/dart2js/model/constant_value_test.dart b/tests/compiler/dart2js/model/constant_value_test.dart
index 2e44dba..3a5d4fb 100644
--- a/tests/compiler/dart2js/model/constant_value_test.dart
+++ b/tests/compiler/dart2js/model/constant_value_test.dart
@@ -22,7 +22,7 @@
 
       C(this.field1, this.field2);
     }
-    ''');
+    ''', useOldFrontend: true);
     ClassElement C = env.getElement('C');
     FieldElement field1 = C.lookupLocalMember('field1');
     FieldElement field2 = C.lookupLocalMember('field2');
diff --git a/tests/compiler/dart2js/model/future_or_test.dart b/tests/compiler/dart2js/model/future_or_test.dart
index e1598ee..4da2f32 100644
--- a/tests/compiler/dart2js/model/future_or_test.dart
+++ b/tests/compiler/dart2js/model/future_or_test.dart
@@ -11,8 +11,7 @@
 
 main() {
   asyncTest(() async {
-    var env = await TypeEnvironment.create(
-        '''
+    var env = await TypeEnvironment.create('''
 Future<num> futureNum() async => null;
 FutureOr<num> futureOrNum() async => null;
 
@@ -34,9 +33,7 @@
   Future<T> futureT() async => null;
   FutureOr<T> futureOrT() async => null;
 }
-''',
-        compileMode: CompileMode.kernel,
-        options: [Flags.strongMode]);
+''', options: [Flags.strongMode]);
     FunctionType getFunctionType(String name, String expectedType,
         [ClassEntity cls]) {
       FunctionType type = env.getMemberType(name, cls);
diff --git a/tests/compiler/dart2js/mixin_typevariable_test.dart b/tests/compiler/dart2js/model/mixin_typevariable_test.dart
similarity index 95%
rename from tests/compiler/dart2js/mixin_typevariable_test.dart
rename to tests/compiler/dart2js/model/mixin_typevariable_test.dart
index b2bcd618..cf8a6d8 100644
--- a/tests/compiler/dart2js/mixin_typevariable_test.dart
+++ b/tests/compiler/dart2js/model/mixin_typevariable_test.dart
@@ -4,11 +4,11 @@
 
 library mixin_typevariable_test;
 
-import 'package:expect/expect.dart';
-import "package:async_helper/async_helper.dart";
-import 'type_test_helper.dart';
+import 'package:async_helper/async_helper.dart';
 import 'package:compiler/src/elements/resolution_types.dart';
-import "package:compiler/src/elements/elements.dart" show ClassElement;
+import 'package:compiler/src/elements/elements.dart' show ClassElement;
+import 'package:expect/expect.dart';
+import '../type_test_helper.dart';
 
 void main() {
   testMixinSupertypes();
@@ -24,7 +24,7 @@
 
       class C1<C1_T> extends S<C1_T> with M1<C1_T>, M2<C1_T>, M3<C1_T> {}
       class C2<C2_T> = S<C2_T> with M1<C2_T>, M2<C2_T>, M3<C2_T>;
-      """, expectNoWarningsOrErrors: true).then((env) {
+      """, expectNoWarningsOrErrors: true, useOldFrontend: true).then((env) {
         ClassElement Object = env.getElement('Object');
         ClassElement S = env.getElement('S');
         ClassElement M1 = env.getElement('M1');
@@ -87,7 +87,7 @@
 
       class F1<F1_T> extends A<_> with B<_, B<F1_T, _>> {}
       class F2<F2_T> = A<_> with B<_, B<F2_T, _>>;
-      """, expectNoWarningsOrErrors: true).then((env) {
+      """, expectNoWarningsOrErrors: true, useOldFrontend: true).then((env) {
         ResolutionDartType _dynamic = env['dynamic'];
         ResolutionDartType _ = env['_'];
 
diff --git a/tests/compiler/dart2js/model/subtype_test.dart b/tests/compiler/dart2js/model/subtype_test.dart
index 48445e3..b1dcbfd 100644
--- a/tests/compiler/dart2js/model/subtype_test.dart
+++ b/tests/compiler/dart2js/model/subtype_test.dart
@@ -16,25 +16,35 @@
 void main() {
   asyncTest(() async {
     print('--test from ast---------------------------------------------------');
-    await runTests(CompileMode.memory);
+    await runTests(useOldFrontend: true);
     print('--test from kernel------------------------------------------------');
-    await runTests(CompileMode.kernel);
+    await runTests(useOldFrontend: false);
     print('--test from kernel (strong)---------------------------------------');
-    await runTests(CompileMode.kernel, strongMode: true);
+    await runTests(useOldFrontend: false, strongMode: true);
   });
 }
 
-Future runTests(CompileMode compileMode, {bool strongMode: false}) async {
-  await testCallableSubtype(compileMode, strongMode);
-  await testInterfaceSubtype(compileMode, strongMode);
-  await testFunctionSubtyping(compileMode, strongMode);
-  await testTypedefSubtyping(compileMode, strongMode);
-  await testFunctionSubtypingOptional(compileMode, strongMode);
-  await testTypedefSubtypingOptional(compileMode, strongMode);
-  await testFunctionSubtypingNamed(compileMode, strongMode);
-  await testTypedefSubtypingNamed(compileMode, strongMode);
-  await testTypeVariableSubtype(compileMode, strongMode);
-  await testStrongModeSubtyping(compileMode, strongMode);
+Future runTests({bool useOldFrontend, bool strongMode: false}) async {
+  await testCallableSubtype(
+      useOldFrontend: useOldFrontend, strongMode: strongMode);
+  await testInterfaceSubtype(
+      useOldFrontend: useOldFrontend, strongMode: strongMode);
+  await testFunctionSubtyping(
+      useOldFrontend: useOldFrontend, strongMode: strongMode);
+  await testTypedefSubtyping(
+      useOldFrontend: useOldFrontend, strongMode: strongMode);
+  await testFunctionSubtypingOptional(
+      useOldFrontend: useOldFrontend, strongMode: strongMode);
+  await testTypedefSubtypingOptional(
+      useOldFrontend: useOldFrontend, strongMode: strongMode);
+  await testFunctionSubtypingNamed(
+      useOldFrontend: useOldFrontend, strongMode: strongMode);
+  await testTypedefSubtypingNamed(
+      useOldFrontend: useOldFrontend, strongMode: strongMode);
+  await testTypeVariableSubtype(
+      useOldFrontend: useOldFrontend, strongMode: strongMode);
+  await testStrongModeSubtyping(
+      useOldFrontend: useOldFrontend, strongMode: strongMode);
 }
 
 void testTypes(TypeEnvironment env, DartType subtype, DartType supertype,
@@ -59,7 +69,7 @@
   testTypes(env, subtype, supertype, expectSubtype, expectMoreSpecific);
 }
 
-Future testInterfaceSubtype(CompileMode compileMode, bool strongMode) async {
+Future testInterfaceSubtype({bool useOldFrontend, bool strongMode}) async {
   await TypeEnvironment.create(r"""
       class A<T> {}
       class B<T1, T2> extends A<T1> {}
@@ -67,7 +77,7 @@
       // currently not supported by the implementation.
       class C<T1, T2> extends B<T2, T1> /*implements A<A<T1>>*/ {}
       """,
-      compileMode: compileMode,
+      useOldFrontend: useOldFrontend,
       options: strongMode ? [Flags.strongMode] : []).then((env) {
     void expect(bool expectSubtype, DartType T, DartType S,
         {bool expectMoreSpecific}) {
@@ -306,7 +316,7 @@
   });
 }
 
-Future testCallableSubtype(CompileMode compileMode, bool strongMode) async {
+Future testCallableSubtype({bool useOldFrontend, bool strongMode}) async {
   await TypeEnvironment.create(r"""
       class U {}
       class V extends U {}
@@ -321,7 +331,7 @@
         void m5(V v, int i) => null;
       }
       """,
-      compileMode: compileMode,
+      useOldFrontend: useOldFrontend,
       options: strongMode ? [Flags.strongMode] : []).then((env) {
     void expect(bool expectSubtype, DartType T, DartType S,
         {bool expectMoreSpecific}) {
@@ -369,18 +379,18 @@
       'void', 'inline_void__int', '(void Function(int i) f)'),
 ];
 
-Future testFunctionSubtyping(CompileMode compileMode, bool strongMode) async {
+Future testFunctionSubtyping({bool useOldFrontend, bool strongMode}) async {
   await TypeEnvironment
       .create(createMethods(functionTypesData),
-          compileMode: compileMode,
+          useOldFrontend: useOldFrontend,
           options: strongMode ? [Flags.strongMode] : [])
       .then(functionSubtypingHelper);
 }
 
-Future testTypedefSubtyping(CompileMode compileMode, bool strongMode) async {
+Future testTypedefSubtyping({bool useOldFrontend, bool strongMode}) async {
   await TypeEnvironment
       .create(createTypedefs(functionTypesData),
-          compileMode: compileMode,
+          useOldFrontend: useOldFrontend,
           options: strongMode ? [Flags.strongMode] : [])
       .then(functionSubtypingHelper);
 }
@@ -458,19 +468,19 @@
 ];
 
 Future testFunctionSubtypingOptional(
-    CompileMode compileMode, bool strongMode) async {
+    {bool useOldFrontend, bool strongMode}) async {
   await TypeEnvironment
       .create(createMethods(optionalFunctionTypesData),
-          compileMode: compileMode,
+          useOldFrontend: useOldFrontend,
           options: strongMode ? [Flags.strongMode] : [])
       .then((env) => functionSubtypingOptionalHelper(env, strongMode));
 }
 
 Future testTypedefSubtypingOptional(
-    CompileMode compileMode, bool strongMode) async {
+    {bool useOldFrontend, bool strongMode}) async {
   await TypeEnvironment
       .create(createTypedefs(optionalFunctionTypesData),
-          compileMode: compileMode,
+          useOldFrontend: useOldFrontend,
           options: strongMode ? [Flags.strongMode] : [])
       .then((env) => functionSubtypingOptionalHelper(env, strongMode));
 }
@@ -536,19 +546,18 @@
 ];
 
 Future testFunctionSubtypingNamed(
-    CompileMode compileMode, bool strongMode) async {
+    {bool useOldFrontend, bool strongMode}) async {
   await TypeEnvironment
       .create(createMethods(namedFunctionTypesData),
-          compileMode: compileMode,
+          useOldFrontend: useOldFrontend,
           options: strongMode ? [Flags.strongMode] : [])
       .then((env) => functionSubtypingNamedHelper(env, strongMode));
 }
 
-Future testTypedefSubtypingNamed(
-    CompileMode compileMode, bool strongMode) async {
+Future testTypedefSubtypingNamed({bool useOldFrontend, bool strongMode}) async {
   await TypeEnvironment
       .create(createTypedefs(namedFunctionTypesData),
-          compileMode: compileMode,
+          useOldFrontend: useOldFrontend,
           options: strongMode ? [Flags.strongMode] : [])
       .then((env) => functionSubtypingNamedHelper(env, strongMode));
 }
@@ -589,7 +598,7 @@
   expect(true, 'void___a_int_b_int_c_int', 'void___c_int');
 }
 
-Future testTypeVariableSubtype(CompileMode compileMode, bool strongMode) async {
+Future testTypeVariableSubtype({bool useOldFrontend, bool strongMode}) async {
   await TypeEnvironment.create(r"""
       class A<T> {}
       class B<T extends Object> {}
@@ -602,7 +611,7 @@
       class I<T extends S, S extends U, U extends T> {}
       class J<T extends S, S extends U, U extends S> {}
       """,
-      compileMode: compileMode,
+      useOldFrontend: useOldFrontend,
       options: strongMode ? [Flags.strongMode] : []).then((env) {
     void expect(bool expectSubtype, DartType T, DartType S,
         {bool expectMoreSpecific}) {
@@ -813,7 +822,7 @@
   });
 }
 
-Future testStrongModeSubtyping(CompileMode compileMode, bool strongMode) async {
+Future testStrongModeSubtyping({bool useOldFrontend, bool strongMode}) async {
   await TypeEnvironment.create(r"""
       class ClassWithCall {
         void call() {}
@@ -828,7 +837,7 @@
       takeVoid(void o) => null;
       takeObject(Object o) => null;
       """,
-      compileMode: compileMode,
+      useOldFrontend: useOldFrontend,
       options: strongMode ? [Flags.strongMode] : []).then((env) {
     void expect(bool expectSubtype, DartType T, DartType S) {
       Expect.equals(expectSubtype, env.isSubtype(T, S), '$T <: $S');
diff --git a/tests/compiler/dart2js/model/subtypeset_test.dart b/tests/compiler/dart2js/model/subtypeset_test.dart
index cbaf315..c31a641 100644
--- a/tests/compiler/dart2js/model/subtypeset_test.dart
+++ b/tests/compiler/dart2js/model/subtypeset_test.dart
@@ -17,15 +17,15 @@
 void main() {
   asyncTest(() async {
     print('--test from ast---------------------------------------------------');
-    await runTests(CompileMode.memory);
+    await runTests(useOldFrontend: true);
     print('--test from kernel------------------------------------------------');
-    await runTests(CompileMode.kernel);
+    await runTests(useOldFrontend: false);
     print('--test from kernel (strong)---------------------------------------');
-    await runTests(CompileMode.kernel, strongMode: true);
+    await runTests(useOldFrontend: false, strongMode: true);
   });
 }
 
-runTests(CompileMode compileMode, {bool strongMode: false}) async {
+runTests({bool useOldFrontend, bool strongMode: false}) async {
   var env = await TypeEnvironment.create(r"""
       ///        A
       ///       / \
@@ -55,7 +55,7 @@
         new G();
       }
       """,
-      compileMode: compileMode,
+      useOldFrontend: useOldFrontend,
       options: strongMode ? [Flags.strongMode] : []);
   ClosedWorld world = env.closedWorld;
 
diff --git a/tests/compiler/dart2js/model/type_substitution_test.dart b/tests/compiler/dart2js/model/type_substitution_test.dart
index 72ed70c..a37de8c 100644
--- a/tests/compiler/dart2js/model/type_substitution_test.dart
+++ b/tests/compiler/dart2js/model/type_substitution_test.dart
@@ -49,7 +49,7 @@
       class D<T> extends A<int> {}
       class E<T> extends A<A<T>> {}
       class F<T, U> extends B<F<T, String>> implements A<F<B<U>, int>> {}
-      ''').then((env) {
+      ''', useOldFrontend: true).then((env) {
         ClassElement A = env.getElement("A");
         ClassElement B = env.getElement("B");
         ClassElement C = env.getElement("C");
@@ -158,7 +158,7 @@
         void Typedef1e(Typedef2<S> a) {}
         void Typedef2e(Typedef2<String> b) {}
       }
-      """).then((env) {
+      """, useOldFrontend: true).then((env) {
         var compiler = env.compiler;
 
         ResolutionInterfaceType Class_T_S = env["Class"];
diff --git a/tests/compiler/dart2js/model/world_test.dart b/tests/compiler/dart2js/model/world_test.dart
index 70332ce..7c1243c 100644
--- a/tests/compiler/dart2js/model/world_test.dart
+++ b/tests/compiler/dart2js/model/world_test.dart
@@ -14,22 +14,22 @@
 import '../type_test_helper.dart';
 
 void main() {
-  runTests(CompileMode compileMode) async {
-    await testClassSets(compileMode);
-    await testProperties(compileMode);
-    await testNativeClasses(compileMode);
-    await testCommonSubclasses(compileMode);
+  runTests({bool useOldFrontend}) async {
+    await testClassSets(useOldFrontend: useOldFrontend);
+    await testProperties(useOldFrontend: useOldFrontend);
+    await testNativeClasses(useOldFrontend: useOldFrontend);
+    await testCommonSubclasses(useOldFrontend: useOldFrontend);
   }
 
   asyncTest(() async {
     print('--test from ast---------------------------------------------------');
-    await runTests(CompileMode.memory);
+    await runTests(useOldFrontend: true);
     print('--test from kernel------------------------------------------------');
-    await runTests(CompileMode.kernel);
+    await runTests(useOldFrontend: false);
   });
 }
 
-testClassSets(CompileMode compileMode) async {
+testClassSets({bool useOldFrontend}) async {
   var env = await TypeEnvironment.create(r"""
       class A implements X {}
       class B {}
@@ -53,7 +53,7 @@
         html.window;
         new html.Worker('');
       }
-      """, compileMode: compileMode);
+      """, useOldFrontend: useOldFrontend);
   ClosedWorld closedWorld = env.closedWorld;
   ElementEnvironment elementEnvironment = closedWorld.elementEnvironment;
 
@@ -189,7 +189,7 @@
   testMixinUses(X, []);
 }
 
-testProperties(CompileMode compileMode) async {
+testProperties({bool useOldFrontend}) async {
   var env = await TypeEnvironment.create(r"""
       class A {}
       class A1 extends A {}
@@ -244,7 +244,7 @@
         new G3();
         new H4();
       }
-      """, compileMode: compileMode);
+      """, useOldFrontend: useOldFrontend);
   ClosedWorld closedWorld = env.closedWorld;
 
   check(String name, {bool hasStrictSubtype, bool hasOnlySubclasses}) {
@@ -310,7 +310,7 @@
   check("H4", hasStrictSubtype: false, hasOnlySubclasses: true);
 }
 
-testNativeClasses(CompileMode compileMode) async {
+testNativeClasses({bool useOldFrontend}) async {
   var env = await TypeEnvironment.create('',
       mainSource: r"""
       import 'dart:html' as html;
@@ -321,7 +321,7 @@
             ..getContext(''); // Creates CanvasRenderingContext2D
       }
       """,
-      compileMode: compileMode);
+      useOldFrontend: useOldFrontend);
   ClosedWorld closedWorld = env.closedWorld;
   ElementEnvironment elementEnvironment = closedWorld.elementEnvironment;
   LibraryEntity dart_html = elementEnvironment.lookupLibrary(Uris.dart_html);
@@ -520,7 +520,7 @@
       instantiatedSubtypeCount: 0);
 }
 
-testCommonSubclasses(CompileMode compileMode) async {
+testCommonSubclasses({bool useOldFrontend}) async {
   var env = await TypeEnvironment.create('',
       mainSource: r"""
       class A {}
@@ -546,7 +546,7 @@
         new J();
       }
       """,
-      compileMode: compileMode);
+      useOldFrontend: useOldFrontend);
   ClosedWorld closedWorld = env.closedWorld;
 
   ClassEntity A = env.getElement("A");
diff --git a/tests/compiler/dart2js/needs_no_such_method_test.dart b/tests/compiler/dart2js/needs_no_such_method_test.dart
index 01e467e..b02fceb 100644
--- a/tests/compiler/dart2js/needs_no_such_method_test.dart
+++ b/tests/compiler/dart2js/needs_no_such_method_test.dart
@@ -15,9 +15,9 @@
 void main() {
   asyncTest(() async {
     print('--test from ast---------------------------------------------------');
-    await testClassSets(CompileMode.memory);
+    await testClassSets(useOldFrontend: true);
     print('--test from kernel------------------------------------------------');
-    await testClassSets(CompileMode.kernel);
+    await testClassSets(useOldFrontend: false);
   });
 }
 
@@ -33,7 +33,7 @@
 }
 """;
 
-testClassSets(CompileMode compileMode) async {
+testClassSets({bool useOldFrontend}) async {
   Selector foo, bar, baz;
   ClosedWorld closedWorld;
   ClassEntity superclass, subclass, subtype;
@@ -49,7 +49,7 @@
     testMode = '$instantiated';
 
     var env = await TypeEnvironment.create(CLASSES,
-        mainSource: main.toString(), compileMode: compileMode);
+        mainSource: main.toString(), useOldFrontend: useOldFrontend);
     foo = new Selector.call(const PublicName('foo'), CallStructure.NO_ARGS);
     bar = new Selector.call(const PublicName('bar'), CallStructure.NO_ARGS);
     baz = new Selector.call(const PublicName('baz'), CallStructure.NO_ARGS);
diff --git a/tests/compiler/dart2js/receiver_type_test.dart b/tests/compiler/dart2js/receiver_type_test.dart
index 711633f..64b2c8e 100644
--- a/tests/compiler/dart2js/receiver_type_test.dart
+++ b/tests/compiler/dart2js/receiver_type_test.dart
@@ -14,13 +14,13 @@
 main() {
   asyncTest(() async {
     print('--test from ast---------------------------------------------------');
-    await runTest(CompileMode.memory);
+    await runTest(useOldFrontend: true);
     print('--test from kernel------------------------------------------------');
-    await runTest(CompileMode.kernel);
+    await runTest(useOldFrontend: false);
   });
 }
 
-Future runTest(CompileMode mode) async {
+Future runTest({bool useOldFrontend}) async {
   var env = await TypeEnvironment.create("""
     class A {
       call() {}
@@ -38,7 +38,7 @@
       localFunction() {}
       () {};
     }
-    """, compileMode: mode, testBackendWorld: true);
+    """, useOldFrontend: useOldFrontend, testBackendWorld: true);
 
   Map<String, String> expectedMap = const {
     'A': '[exact=A]',
diff --git a/tests/compiler/dart2js/type_test_helper.dart b/tests/compiler/dart2js/type_test_helper.dart
index 95e82a0..cd84761 100644
--- a/tests/compiler/dart2js/type_test_helper.dart
+++ b/tests/compiler/dart2js/type_test_helper.dart
@@ -17,13 +17,9 @@
     show ClassElement, LibraryElement, TypedefElement;
 import 'package:compiler/src/kernel/kernel_strategy.dart';
 import 'package:compiler/src/world.dart' show ClosedWorld;
-import 'compiler_helper.dart' as mock;
-import 'compiler_helper.dart' show CompileMode;
 import 'memory_compiler.dart' as memory;
 import 'kernel/compiler_helper.dart' as dill;
 
-export 'compiler_helper.dart' show CompileMode;
-
 DartType instantiate(Entity element, List<DartType> arguments) {
   if (element is ClassElement) {
     return new ResolutionInterfaceType(element, arguments);
@@ -42,15 +38,15 @@
   Resolution get resolution => compiler.resolution;
 
   static Future<TypeEnvironment> create(String source,
-      {CompileMode compileMode: CompileMode.mock,
-      bool useDillCompiler: false,
+      {bool useDillCompiler: false,
       bool expectNoErrors: false,
       bool expectNoWarningsOrErrors: false,
       bool stopAfterTypeInference: false,
       String mainSource,
       bool testBackendWorld: false,
       List<String> options: const <String>[],
-      Map<String, String> fieldTypeMap: const <String, String>{}}) async {
+      Map<String, String> fieldTypeMap: const <String, String>{},
+      bool useOldFrontend: false}) async {
     Uri uri;
     Compiler compiler;
     if (mainSource != null) {
@@ -68,7 +64,7 @@
       source = '$mainSource\n$source';
     }
     memory.DiagnosticCollector collector;
-    if (compileMode == CompileMode.kernel) {
+    if (!useOldFrontend) {
       collector = new memory.DiagnosticCollector();
       uri = Uri.parse('memory:main.dart');
       compiler = await dill.compileWithDill(
@@ -86,33 +82,20 @@
             compiler.stopAfterTypeInference = stopAfterTypeInference;
           });
     } else {
-      if (compileMode == CompileMode.mock) {
-        uri = new Uri(scheme: 'source');
-        mock.MockCompiler mockCompiler = mock.mockCompilerFor(source, uri,
-            analyzeAll: !stopAfterTypeInference,
-            analyzeOnly: !stopAfterTypeInference);
-        mockCompiler.diagnosticHandler =
-            mock.createHandler(mockCompiler, source);
-        collector = mockCompiler.diagnosticCollector;
-        compiler = mockCompiler;
-        compiler.stopAfterTypeInference = stopAfterTypeInference;
-        await compiler.run(uri);
-      } else {
-        collector = new memory.DiagnosticCollector();
-        uri = Uri.parse('memory:main.dart');
-        memory.CompilationResult result = await memory.runCompiler(
-            entryPoint: uri,
-            memorySourceFiles: {'main.dart': source},
-            diagnosticHandler: collector,
-            options: stopAfterTypeInference
-                ? ([Flags.useOldFrontend]..addAll(options))
-                : ([Flags.useOldFrontend, Flags.analyzeAll, Flags.analyzeOnly]
-                  ..addAll(options)),
-            beforeRun: (compiler) {
-              compiler.stopAfterTypeInference = stopAfterTypeInference;
-            });
-        compiler = result.compiler;
-      }
+      collector = new memory.DiagnosticCollector();
+      uri = Uri.parse('memory:main.dart');
+      memory.CompilationResult result = await memory.runCompiler(
+          entryPoint: uri,
+          memorySourceFiles: {'main.dart': source},
+          diagnosticHandler: collector,
+          options: stopAfterTypeInference
+              ? ([Flags.useOldFrontend]..addAll(options))
+              : ([Flags.useOldFrontend, Flags.analyzeAll, Flags.analyzeOnly]
+                ..addAll(options)),
+          beforeRun: (compiler) {
+            compiler.stopAfterTypeInference = stopAfterTypeInference;
+          });
+      compiler = result.compiler;
     }
     if (expectNoErrors || expectNoWarningsOrErrors) {
       var errors = collector.errors;