diff --git a/packages/flutter/test/foundation/bit_field_test.dart b/packages/flutter/test/foundation/bit_field_test.dart index 9fff4dd155..8804d61a0c 100644 --- a/packages/flutter/test/foundation/bit_field_test.dart +++ b/packages/flutter/test/foundation/bit_field_test.dart @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +@TestOn('!chrome') + import 'package:flutter/foundation.dart'; import '../flutter_test_alternative.dart'; diff --git a/packages/flutter/test/foundation/consolidate_response_test.dart b/packages/flutter/test/foundation/consolidate_response_test.dart index 9bbe8f9002..b7314e0478 100644 --- a/packages/flutter/test/foundation/consolidate_response_test.dart +++ b/packages/flutter/test/foundation/consolidate_response_test.dart @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +@TestOn('!chrome') + import 'dart:async'; import 'dart:io'; diff --git a/packages/flutter/test/foundation/error_reporting_test.dart b/packages/flutter/test/foundation/error_reporting_test.dart index 113105a45a..086ecb60b0 100644 --- a/packages/flutter/test/foundation/error_reporting_test.dart +++ b/packages/flutter/test/foundation/error_reporting_test.dart @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +@TestOn('!chrome') // web has different stack traces + import 'dart:async'; import 'package:flutter/foundation.dart'; diff --git a/packages/flutter/test/foundation/isolates_test.dart b/packages/flutter/test/foundation/isolates_test.dart index 25c6962268..bccb249900 100644 --- a/packages/flutter/test/foundation/isolates_test.dart +++ b/packages/flutter/test/foundation/isolates_test.dart @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +@TestOn('!chrome') // isolates not supported on the web. + import 'package:flutter/foundation.dart'; import '../flutter_test_alternative.dart'; diff --git a/packages/flutter/test/foundation/serialization_test.dart b/packages/flutter/test/foundation/serialization_test.dart index 1510d20923..6958bbf324 100644 --- a/packages/flutter/test/foundation/serialization_test.dart +++ b/packages/flutter/test/foundation/serialization_test.dart @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +@TestOn('!chrome') // web does not support certain 64bit behavior + import 'dart:typed_data'; import 'package:flutter/foundation.dart'; diff --git a/packages/flutter/test/foundation/service_extensions_test.dart b/packages/flutter/test/foundation/service_extensions_test.dart index f15bc5fef6..2150da2c2c 100644 --- a/packages/flutter/test/foundation/service_extensions_test.dart +++ b/packages/flutter/test/foundation/service_extensions_test.dart @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +@TestOn('!chrome') + import 'dart:async'; import 'dart:convert'; import 'dart:typed_data'; diff --git a/packages/flutter/test/foundation/stack_trace_test.dart b/packages/flutter/test/foundation/stack_trace_test.dart index 61a895bb10..e935c24512 100644 --- a/packages/flutter/test/foundation/stack_trace_test.dart +++ b/packages/flutter/test/foundation/stack_trace_test.dart @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +@TestOn('!chrome') // web has different stack traces + import 'package:flutter/foundation.dart'; import '../flutter_test_alternative.dart'; diff --git a/packages/flutter_test/lib/src/binding.dart b/packages/flutter_test/lib/src/binding.dart index 4d6a43563b..a485b77933 100644 --- a/packages/flutter_test/lib/src/binding.dart +++ b/packages/flutter_test/lib/src/binding.dart @@ -23,6 +23,7 @@ import 'package:stack_trace/stack_trace.dart' as stack_trace; import 'package:vector_math/vector_math_64.dart'; import 'goldens.dart'; +import 'platform.dart'; import 'stack_manipulation.dart'; import 'test_async_utils.dart'; import 'test_exception_reporter.dart'; @@ -151,7 +152,7 @@ abstract class TestWidgetsFlutterBinding extends BindingBase /// environment variables for a variable called `FLUTTER_TEST`.) static WidgetsBinding ensureInitialized() { if (WidgetsBinding.instance == null) { - if (Platform.environment.containsKey('FLUTTER_TEST')) { + if (isBrowser || Platform.environment.containsKey('FLUTTER_TEST')) { AutomatedTestWidgetsFlutterBinding(); } else { LiveTestWidgetsFlutterBinding(); @@ -248,6 +249,9 @@ abstract class TestWidgetsFlutterBinding extends BindingBase return TestAsyncUtils.guard(() async { assert(inTest); final Locale locale = Locale(languageCode, countryCode == '' ? null : countryCode); + if (isBrowser) { + return; + } dispatchLocalesChanged([locale]); }); } @@ -586,7 +590,7 @@ abstract class TestWidgetsFlutterBinding extends BindingBase runApp(Container(key: UniqueKey(), child: _preTestMessage)); // Reset the tree to a known state. await pump(); - final bool autoUpdateGoldensBeforeTest = autoUpdateGoldenFiles; + final bool autoUpdateGoldensBeforeTest = autoUpdateGoldenFiles && !isBrowser; final TestExceptionReporter reportTestExceptionBeforeTest = reportTestException; final ErrorWidgetBuilder errorWidgetBuilderBeforeTest = ErrorWidget.builder; @@ -601,7 +605,7 @@ abstract class TestWidgetsFlutterBinding extends BindingBase runApp(Container(key: UniqueKey(), child: _postTestMessage)); // Unmount any remaining widgets. await pump(); invariantTester(); - _verifyAutoUpdateGoldensUnset(autoUpdateGoldensBeforeTest); + _verifyAutoUpdateGoldensUnset(autoUpdateGoldensBeforeTest && !isBrowser); _verifyReportTestExceptionUnset(reportTestExceptionBeforeTest); _verifyErrorWidgetBuilderUnset(errorWidgetBuilderBeforeTest); _verifyInvariants(); @@ -750,6 +754,9 @@ class AutomatedTestWidgetsFlutterBinding extends TestWidgetsFlutterBinding { static Set _allowedAssetKeys; void _mockFlutterAssets() { + if (isBrowser) { + return; + } if (!Platform.environment.containsKey('UNIT_TEST_ASSETS')) { return; }