MediaNotificationManagerServiceLifecycleTest.updateNotificationSetsServiceBackgroundWhenPausedAndSupportsSwipeAway fails when run on its own |
||
Issue description
Running all tests in that class it passes:
ninja -C out/AndroidDebug -j2000 -l20 chrome_junit_tests && out/AndroidDebug/bin/run_chrome_junit_tests -f "*MediaNotificationManagerServiceLifecycleTest.*"
15 TESTS PASSED
But running it on its own fails:
ninja -C out/AndroidDebug -j2000 -l20 chrome_junit_tests && out/AndroidDebug/bin/run_chrome_junit_tests -f "*MediaNotificationManagerServiceLifecycleTest.updateNotificationSetsServiceBackgroundWhenPausedAndSupportsSwipeAway*"
Wanted but not invoked:
notificationManager.notify(
0,
<any android.app.Notification>
);
-> at org.chromium.chrome.browser.media.ui.MediaNotificationManagerServiceLifecycleTest.updateNotificationSetsServiceB
ackgroundWhenPausedAndSupportsSwipeAway(MediaNotificationManagerServiceLifecycleTest.java:242)
Actually, there were zero interactions with this mock.
at org.chromium.chrome.browser.media.ui.MediaNotificationManagerServiceLifecycleTest.updateNotificationSetsSer
viceBackgroundWhenPausedAndSupportsSwipeAway(MediaNotificationManagerServiceLifecycleTest.java:242)
,
Jul 26
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/56a9bbc9d8dff1ab89d8be3fb72d7447c6211cbb commit 56a9bbc9d8dff1ab89d8be3fb72d7447c6211cbb Author: Anita Woodruff <awdf@chromium.org> Date: Thu Jul 26 14:21:00 2018 [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/1151304 Reviewed-by: Mounir Lamouri <mlamouri@chromium.org> Commit-Queue: Anita Woodruff <awdf@chromium.org> Cr-Commit-Position: refs/heads/master@{#578292} [modify] https://crrev.com/56a9bbc9d8dff1ab89d8be3fb72d7447c6211cbb/chrome/android/java_sources.gni [modify] https://crrev.com/56a9bbc9d8dff1ab89d8be3fb72d7447c6211cbb/chrome/android/junit/src/org/chromium/chrome/browser/media/ui/MediaNotificationActionsUpdatedTest.java [modify] https://crrev.com/56a9bbc9d8dff1ab89d8be3fb72d7447c6211cbb/chrome/android/junit/src/org/chromium/chrome/browser/media/ui/MediaNotificationFaviconTest.java [modify] https://crrev.com/56a9bbc9d8dff1ab89d8be3fb72d7447c6211cbb/chrome/android/junit/src/org/chromium/chrome/browser/media/ui/MediaNotificationManagerServiceActionsTest.java [modify] https://crrev.com/56a9bbc9d8dff1ab89d8be3fb72d7447c6211cbb/chrome/android/junit/src/org/chromium/chrome/browser/media/ui/MediaNotificationManagerServiceLifecycleTest.java [delete] https://crrev.com/1dbc3a455c5f0420e2ba571ba9ee5819a172fc60/chrome/android/junit/src/org/chromium/chrome/browser/media/ui/MediaNotificationTestShadowNotificationManager.java [modify] https://crrev.com/56a9bbc9d8dff1ab89d8be3fb72d7447c6211cbb/chrome/android/junit/src/org/chromium/chrome/browser/media/ui/MediaNotificationTitleUpdatedTest.java
,
Jul 26
|
||
►
Sign in to add a comment |
||
Comment 1 by awdf@chromium.org
, Jul 26