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

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

Issue 1847063005: [Media, UI] Change MediaNotification style to MediaStyle (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: proguards Created 4 years, 8 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
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 506a6006b08396a80ede015e8b12cf18f3c70e51..f129f13c26efc6e51d2b2f9e28490bca84b96ccb 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
@@ -13,9 +13,11 @@ import android.widget.TextView;
import org.chromium.base.ObserverList;
import org.chromium.base.ThreadUtils;
+import org.chromium.base.test.util.CommandLineFlags;
import org.chromium.base.test.util.Restriction;
import org.chromium.chrome.R;
import org.chromium.chrome.browser.ChromeActivity;
+import org.chromium.chrome.browser.ChromeFeatureList;
import org.chromium.chrome.browser.tab.Tab;
import org.chromium.chrome.test.ChromeActivityTestCaseBase;
import org.chromium.chrome.test.util.ChromeRestriction;
@@ -46,38 +48,33 @@ public class NotificationTitleUpdatedTest extends ChromeActivityTestCaseBase<Chr
simulateUpdateTitle(mTab, "title1");
}
- @SmallTest
- public void testSessionStatePlaying() throws InterruptedException {
+ private void testSessionStatePlayingInternal() throws InterruptedException {
simulateMediaSessionStateChanged(mTab, true, false);
assertTitleMatches("title1");
simulateUpdateTitle(mTab, "title2");
assertTitleMatches("title2");
}
- @SmallTest
- public void testSessionStatePaused() throws InterruptedException {
+ private void testSessionStatePausedInternal() throws InterruptedException {
simulateMediaSessionStateChanged(mTab, true, true);
assertTitleMatches("title1");
simulateUpdateTitle(mTab, "title2");
assertTitleMatches("title2");
}
- @SmallTest
- public void testSessionStateUncontrollable() throws InterruptedException {
+ private void testSessionStateUncontrollableInternal() throws InterruptedException {
simulateMediaSessionStateChanged(mTab, true, false);
assertTitleMatches("title1");
simulateMediaSessionStateChanged(mTab, false, false);
simulateUpdateTitle(mTab, "title2");
}
- @SmallTest
- public void testMediaMetadaSetsTitle() throws InterruptedException {
+ private void testMediaMetadataSetsTitleInternal() throws InterruptedException {
simulateMediaSessionStateChanged(mTab, true, false, new MediaMetadata("title2", "", ""));
assertTitleMatches("title2");
}
- @SmallTest
- public void testMediaMetadaOverridesTitle() throws InterruptedException {
+ private void testMediaMetadataOverridesTitleInternal() throws InterruptedException {
simulateMediaSessionStateChanged(mTab, true, false, new MediaMetadata("title2", "", ""));
assertTitleMatches("title2");
@@ -94,9 +91,7 @@ public class NotificationTitleUpdatedTest extends ChromeActivityTestCaseBase<Chr
* 4. change the title of newTab and then mTab to different names,
* the notification should have the title of newTab.
*/
- @SmallTest
- @Restriction({ChromeRestriction.RESTRICTION_TYPE_PHONE, RESTRICTION_TYPE_NON_LOW_END_DEVICE})
- public void testMultipleTabs() throws Throwable {
+ private void testMultipleTabsInternal() throws Throwable {
simulateMediaSessionStateChanged(mTab, true, false);
assertTitleMatches("title1");
simulateMediaSessionStateChanged(mTab, false, false);
@@ -110,6 +105,82 @@ public class NotificationTitleUpdatedTest extends ChromeActivityTestCaseBase<Chr
assertTitleMatches("title3");
}
+ @SmallTest
+ @CommandLineFlags.Add("enable-features=MediaStyleNotification")
+ public void testSessionStatePlaying_MediaStyleNotification() throws InterruptedException {
+ testSessionStatePlayingInternal();
+ }
+
+ @SmallTest
+ @CommandLineFlags.Add("enable-features=MediaStyleNotification")
+ public void testSessionStatePaused_MediaStyleNotification() throws InterruptedException {
+ testSessionStatePausedInternal();
+ }
+
+ @SmallTest
+ @CommandLineFlags.Add("enable-features=MediaStyleNotification")
+ public void testSessionStateUncontrollable_MediaStyleNotification()
+ throws InterruptedException {
+ testSessionStateUncontrollableInternal();
+ }
+
+ @SmallTest
+ @CommandLineFlags.Add("enable-features=MediaStyleNotification")
+ public void testMediaMetadataSetsTitle_MediaStyleNotification() throws InterruptedException {
+ testMediaMetadataSetsTitleInternal();
+ }
+
+ @SmallTest
+ @CommandLineFlags.Add("enable-features=MediaStyleNotification")
+ public void testMediaMetadataOverridesTitle_MediaStyleNotification()
+ throws InterruptedException {
+ testMediaMetadataOverridesTitleInternal();
+ }
+
+ @SmallTest
+ @Restriction({ChromeRestriction.RESTRICTION_TYPE_PHONE, RESTRICTION_TYPE_NON_LOW_END_DEVICE})
+ @CommandLineFlags.Add("enable-features=MediaStyleNotification")
+ public void testMultipleTabs_MediaStyleNotification() throws Throwable {
+ testMultipleTabsInternal();
+ }
+
+ @SmallTest
+ @CommandLineFlags.Add("disable-features=MediaStyleNotification")
+ public void testSessionStatePlaying_CustomNotification() throws InterruptedException {
+ testSessionStatePlayingInternal();
+ }
+
+ @SmallTest
+ @CommandLineFlags.Add("disable-features=MediaStyleNotification")
+ public void testSessionStatePaused_CustomNotification() throws InterruptedException {
+ testSessionStatePausedInternal();
+ }
+
+ @SmallTest
+ @CommandLineFlags.Add("disable-features=MediaStyleNotification")
+ public void testSessionStateUncontrollable_CustomNotification() throws InterruptedException {
+ testSessionStateUncontrollableInternal();
+ }
+
+ @SmallTest
+ @CommandLineFlags.Add("disable-features=MediaStyleNotification")
+ public void testMediaMetadataSetsTitle_CustomNotification() throws InterruptedException {
+ testMediaMetadataSetsTitleInternal();
+ }
+
+ @SmallTest
+ @CommandLineFlags.Add("disable-features=MediaStyleNotification")
+ public void testMediaMetadataOverridesTitle_CustomNotification() throws InterruptedException {
+ testMediaMetadataOverridesTitleInternal();
+ }
+
+ @SmallTest
+ @Restriction({ChromeRestriction.RESTRICTION_TYPE_PHONE, RESTRICTION_TYPE_NON_LOW_END_DEVICE})
+ @CommandLineFlags.Add("disable-features=MediaStyleNotification")
+ public void testMultipleTabs_CustomNotification() throws Throwable {
+ testMultipleTabsInternal();
+ }
+
@Override
public void startMainActivity() throws InterruptedException {
startMainActivityOnBlankPage();
@@ -169,8 +240,17 @@ public class NotificationTitleUpdatedTest extends ChromeActivityTestCaseBase<Chr
View contentView = notification.contentView.apply(
getActivity().getApplicationContext(), null);
- TextView titleView = (TextView) contentView.findViewById(R.id.title);
- assertEquals(title, titleView.getText());
+ String observedText = null;
+ if (ChromeFeatureList.isEnabled(ChromeFeatureList.MEDIA_STYLE_NOTIFICATION)) {
+ observedText = ((TextView) contentView.findViewById(android.R.id.title))
+ .getText()
+ .toString();
+ } else {
+ observedText = ((TextView) contentView.findViewById(R.id.title))
+ .getText()
+ .toString();
+ }
+ assertEquals(title, observedText);
}
});
}

Powered by Google App Engine
This is Rietveld 408576698