[Android Unit Tests] Fix flaky media notification test
- Previously, MediaNotificationManagerServiceLifecycleTest had a test which failed when run individually, despite passing when all of the tests in that class were run, presumably due to the custom shadow observer picking up on notifications shown by other tests. - The only way I could get the test to always pass while still using the custom shadow observer was to reset the observer at the start of the test, and change the production code to notify via the non-compat NotificationManager. - However, turns out we can simply query Robolectric's built-in shadow of the notification manager, which has a convenient accessor method for the number of notifications it has shown, works for notifications posted to NotificationManagerCompat, and doesn't appear to need manual resetting. - Hence deleting the inferior MediaNotificationTestShadowNotificationManager Bug: 867879 Change-Id: I14639648c8c1f3e0740da4bb1877b9aa21424e33 Reviewed-on: https://chromium-review.googlesource.com/1151304Reviewed-by:Mounir Lamouri <mlamouri@chromium.org> Commit-Queue: Anita Woodruff <awdf@chromium.org> Cr-Commit-Position: refs/heads/master@{#578292}
Showing
Please register or sign in to comment