[ermine] Fix broken unittests after flutter roll
This change fixes app_model_test and app_widget_test which fail
after latest flutter roll. Removes the code to return locale
stream, it was not needed by test. Adds an additional pumpAndSettle
to app_widget_test for the test to pass. I suspect this could be
due to change in flutter framework needing additional frames to
initialize MaterialApp.
Test: All unittests pass.
Bug: 54945
Change-Id: I979abf2aed42332996b71a1c09aad6c261bca9c2
Reviewed-on: https://fuchsia-review.googlesource.com/c/experiences/+/403173
Commit-Queue: Sanjay Chouksey <sanjayc@google.com>
Reviewed-by: Chase Latta <chaselatta@google.com>
Testability-Review: Chase Latta <chaselatta@google.com>
diff --git a/session_shells/BUILD.gn b/session_shells/BUILD.gn
index 8ba33b3..15f8203 100644
--- a/session_shells/BUILD.gn
+++ b/session_shells/BUILD.gn
@@ -16,8 +16,7 @@
_flutter_tester_tests += [
"ermine/settings:ermine_settings_unittests($host_toolchain)",
- #TODO(fxb/54945) Temporarily disable test
- #"ermine/shell:ermine_unittests($host_toolchain)",
+ "ermine/shell:ermine_unittests($host_toolchain)",
"ermine/tiler:tiler_unittests($host_toolchain)",
"ermine/keyboard_shortcuts:keyboard_shortcuts_unittests($host_toolchain)",
]
diff --git a/session_shells/ermine/shell/test/app_model_test.dart b/session_shells/ermine/shell/test/app_model_test.dart
index d8b7b71..b95f8f8 100644
--- a/session_shells/ermine/shell/test/app_model_test.dart
+++ b/session_shells/ermine/shell/test/app_model_test.dart
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-import 'dart:ui';
-
import 'package:keyboard_shortcuts/keyboard_shortcuts.dart'
show KeyboardShortcuts;
import 'package:fuchsia_internationalization_flutter/internationalization.dart';
@@ -35,8 +33,6 @@
statusModel = MockStatusModel();
clustersModel = MockClustersModel();
- when(localeSource.stream()).thenAnswer((_) => Stream<Locale>.empty());
-
appModel = _TestAppModel(
keyboardShortcuts: keyboardShortcuts,
pointerEventsListener: pointerEventsListener,
diff --git a/session_shells/ermine/shell/test/app_widget_test.dart b/session_shells/ermine/shell/test/app_widget_test.dart
index c52a72a..7985de4 100644
--- a/session_shells/ermine/shell/test/app_widget_test.dart
+++ b/session_shells/ermine/shell/test/app_widget_test.dart
@@ -63,6 +63,7 @@
await tester.pumpWidget(app);
await tester.pumpAndSettle();
+ await tester.pumpAndSettle();
expect(find.byWidget(app.recents), findsOneWidget);
expect(find.byWidget(app.overview), findsOneWidget);