Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(837)

Unified Diff: chrome/android/javatests/src/org/chromium/chrome/browser/media/ui/NotificationTitleUpdatedTest.java

Issue 2714993002: [Media>UI] Fix a media notification update issue when audio focus changes between tabs (Closed)
Patch Set: fixed test and addressed nits Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/android/java/src/org/chromium/chrome/browser/media/ui/MediaNotificationManager.java ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/android/javatests/src/org/chromium/chrome/browser/media/ui/NotificationTitleUpdatedTest.java
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/media/ui/NotificationTitleUpdatedTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/media/ui/NotificationTitleUpdatedTest.java
index 7b71e02be318b87259c957128e67d764633bb013..c49a01f85cd46a78358ccdb95cee6ce7325e2df9 100644
--- a/chrome/android/javatests/src/org/chromium/chrome/browser/media/ui/NotificationTitleUpdatedTest.java
+++ b/chrome/android/javatests/src/org/chromium/chrome/browser/media/ui/NotificationTitleUpdatedTest.java
@@ -103,8 +103,8 @@ public class NotificationTitleUpdatedTest extends ChromeActivityTestCaseBase<Chr
* Test if a notification accepts the title update from another tab, using the following steps:
* 1. set the title of mTab, start the media session, a notification should show up;
* 2. stop the media session of mTab, the notification shall hide;
- * 3. create newTab, set the title of mTab, start the media session of mTab,
- * a notification should show up;
+ * 3. create newTab, start the media session of newTab, a notification should show up,
+ * set the title of newTab, the notification title should match newTab;
* 4. change the title of newTab and then mTab to different names,
* the notification should have the title of newTab.
*/
@@ -124,6 +124,32 @@ public class NotificationTitleUpdatedTest extends ChromeActivityTestCaseBase<Chr
assertTitleMatches("title3");
}
+ /**
+ * Test for the notification should not update for a paused tab if it mismatches the current tab
+ * id:
+ * 1. set the title of mTab, start the media session, a notification should show up;
+ * 2. create newTab, start the media session of newTab, a notification should show up,
+ * set the title of newTab, the notification will match the title;
+ * 3. stop the media session of mTab, and change its title, the notification should not
+ * change.
+ */
+ @SmallTest
+ @Restriction({ChromeRestriction.RESTRICTION_TYPE_PHONE, RESTRICTION_TYPE_NON_LOW_END_DEVICE})
+ public void testPreferLastActiveTab() throws Throwable {
+ simulateMediaSessionStateChanged(mTab, true, false);
+ assertTitleMatches("title1");
+
+ Tab newTab = loadUrlInNewTab("about:blank");
+ assertNotNull(newTab);
+
+ simulateMediaSessionStateChanged(newTab, true, false);
+ simulateUpdateTitle(newTab, "title3");
+
+ simulateMediaSessionStateChanged(mTab, false, false);
+ simulateUpdateTitle(mTab, "title2");
+ assertTitleMatches("title3");
+ }
+
@SmallTest
public void testMediaMetadataResetsAfterNavigation() throws Throwable {
loadUrl("about:blank");
« no previous file with comments | « chrome/android/java/src/org/chromium/chrome/browser/media/ui/MediaNotificationManager.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698