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

Unified Diff: content/public/test/android/javatests/src/org/chromium/content/browser/test/util/DOMUtils.java

Issue 1570043002: Implement MediaSession on top of the WebMediaPlayerDelegate. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@media_session
Patch Set: Comments. Fix test? Created 4 years, 11 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: content/public/test/android/javatests/src/org/chromium/content/browser/test/util/DOMUtils.java
diff --git a/content/public/test/android/javatests/src/org/chromium/content/browser/test/util/DOMUtils.java b/content/public/test/android/javatests/src/org/chromium/content/browser/test/util/DOMUtils.java
index f9c2801fa2430643768007542468eabfe43f0483..1f43af6d7547d26d104570d14b11e5da96e225fd 100644
--- a/content/public/test/android/javatests/src/org/chromium/content/browser/test/util/DOMUtils.java
+++ b/content/public/test/android/javatests/src/org/chromium/content/browser/test/util/DOMUtils.java
@@ -76,6 +76,17 @@ public class DOMUtils {
}
/**
+ * Returns the current time of the media with given {@code id}.
+ * @param webContents The WebContents in which the media element lives.
+ * @param id The element's id to check.
+ * @return the current time (in seconds) of the media.
+ */
+ private static double getCurrentTime(final WebContents webContents, final String id)
+ throws InterruptedException, TimeoutException {
+ return getNodeField("currentTime", webContents, id, Double.class);
+ }
+
+ /**
* Waits until the playback of the media with given {@code id} has started.
* @param webContents The WebContents in which the media element lives.
* @param id The element's id to check.
@@ -86,7 +97,9 @@ public class DOMUtils {
@Override
public boolean isSatisfied() {
try {
- return !DOMUtils.isMediaPaused(webContents, id);
+ // Playback can't be reliably detected until current time moves forward.
+ return !DOMUtils.isMediaPaused(webContents, id)
+ && DOMUtils.getCurrentTime(webContents, id) > 0;
mlamouri (slow - plz ping) 2016/01/26 21:02:50 I think the test fails because of this. We used to
DaleCurtis 2016/01/26 21:23:33 Haven't tried w/o this. It's possible this is chan
DaleCurtis 2016/01/26 21:59:27 Looks like MediaPlayerBridge is returning the dura
DaleCurtis 2016/01/27 00:17:08 I can't get the emulator up, so I'll have to image
DaleCurtis 2016/01/27 02:25:13 Using mp3 clips causes the tests to pass, so I've
DaleCurtis 2016/01/27 02:31:12 I should mention I validated the ogg files with og
} catch (InterruptedException e) {
// Intentionally do nothing
return false;

Powered by Google App Engine
This is Rietveld 408576698