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

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: Reorder. 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;
} catch (InterruptedException e) {
// Intentionally do nothing
return false;
« no previous file with comments | « content/public/browser/web_contents_observer.h ('k') | content/renderer/media/android/renderer_media_player_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698