Wire dart2js through flutter tool, add compilation test (#27668)

diff --git a/dev/bots/test.dart b/dev/bots/test.dart
index 41dd11e..947d0d02 100644
--- a/dev/bots/test.dart
+++ b/dev/bots/test.dart
@@ -167,10 +167,22 @@
     await _flutterBuildApk(path);
     await _flutterBuildIpa(path);
   }
+  await _flutterBuildDart2js(path.join('dev', 'integration_tests', 'web'));
 
   print('${bold}DONE: All build tests successful.$reset');
 }
 
+Future<void> _flutterBuildDart2js(String relativePathToApplication) async {
+  print('Running Dart2JS build tests...');
+  await runCommand(flutter,
+    <String>['build', 'web', '-v'],
+    workingDirectory: path.join(flutterRoot, relativePathToApplication),
+    expectNonZeroExit: false,
+    timeout: _kShortTimeout,
+  );
+  print('Done.');
+}
+
 Future<void> _flutterBuildAot(String relativePathToApplication) async {
   print('Running AOT build tests...');
   await runCommand(flutter,
diff --git a/dev/integration_tests/web/lib/main.dart b/dev/integration_tests/web/lib/main.dart
new file mode 100644
index 0000000..49c544c
--- /dev/null
+++ b/dev/integration_tests/web/lib/main.dart
@@ -0,0 +1,13 @@
+// Copyright 2019 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+import 'package:flutter/widgets.dart';
+
+void main() {
+  runApp(Center(
+    // Can remove when https://github.com/dart-lang/sdk/issues/35801 is fixed.
+    // ignore: prefer_const_constructors
+    child: Text('Hello, World', textDirection: TextDirection.ltr),
+  ));
+}
diff --git a/dev/integration_tests/web/pubspec.yaml b/dev/integration_tests/web/pubspec.yaml
new file mode 100644
index 0000000..8749907
--- /dev/null
+++ b/dev/integration_tests/web/pubspec.yaml
@@ -0,0 +1,17 @@
+name: web_integration
+description: Integration test for web compilation.
+
+environment:
+  # The pub client defaults to an <2.0.0 sdk constraint which we need to explicitly overwrite.
+  sdk: ">=2.0.0-dev.68.0 <3.0.0"
+
+dependencies:
+  flutter:
+    sdk: flutter
+
+  collection: 1.14.11 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
+  meta: 1.1.6 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
+  typed_data: 1.1.6 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
+  vector_math: 2.0.8 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
+
+# PUBSPEC CHECKSUM: d53c