Commit 6e5b06e0 authored by avayvod's avatar avayvod Committed by Commit bot

[Cast, Tests] Handle low end and JB devices that don't preload videos

BUG=652872,652389
TEST=run_chrome_public_test_apk --verbose --gtest_filter=org.chromium.chrome.browser.media.remote.* on both low end and not a low end device.

Since https://codereview.chromium.org/2344353003 on low-end and JB devices videos
are not preloaded so we have to trigger that in a button onclick handler.

Review-Url: https://codereview.chromium.org/2400543002
Cr-Commit-Position: refs/heads/master@{#423775}
parent 65b61482
...@@ -159,6 +159,7 @@ public class CastSwitchVideoTest extends CastTestBase { ...@@ -159,6 +159,7 @@ public class CastSwitchVideoTest extends CastTestBase {
TimeoutException { TimeoutException {
final Tab tab = getActivity().getActivityTab(); final Tab tab = getActivity().getActivityTab();
WebContents webContents = tab.getWebContents(); WebContents webContents = tab.getWebContents();
DOMUtils.clickNode(this, tab.getContentViewCore(), "button1");
waitUntilVideoReady(videoElement, webContents); waitUntilVideoReady(videoElement, webContents);
Rect videoRect = DOMUtils.getNodeBounds(webContents, videoElement); Rect videoRect = DOMUtils.getNodeBounds(webContents, videoElement);
...@@ -170,6 +171,7 @@ public class CastSwitchVideoTest extends CastTestBase { ...@@ -170,6 +171,7 @@ public class CastSwitchVideoTest extends CastTestBase {
final Tab tab = getActivity().getActivityTab(); final Tab tab = getActivity().getActivityTab();
WebContents webContents = tab.getWebContents(); WebContents webContents = tab.getWebContents();
DOMUtils.clickNode(this, tab.getContentViewCore(), "button1");
waitUntilVideoReady(videoElement, webContents); waitUntilVideoReady(videoElement, webContents);
// Need to click on the video first to overcome the user gesture requirement. // Need to click on the video first to overcome the user gesture requirement.
......
...@@ -262,6 +262,7 @@ public abstract class CastTestBase extends ChromeActivityTestCaseBase<ChromeActi ...@@ -262,6 +262,7 @@ public abstract class CastTestBase extends ChromeActivityTestCaseBase<ChromeActi
WebContents webContents = currentTab.getWebContents(); WebContents webContents = currentTab.getWebContents();
DOMUtils.clickNode(this, currentTab.getContentViewCore(), "button1");
waitUntilVideoReady(VIDEO_ELEMENT, webContents); waitUntilVideoReady(VIDEO_ELEMENT, webContents);
return DOMUtils.getNodeBounds(webContents, VIDEO_ELEMENT); return DOMUtils.getNodeBounds(webContents, VIDEO_ELEMENT);
......
...@@ -4,5 +4,12 @@ ...@@ -4,5 +4,12 @@
<!-- Width should be large enough to dispaly all media controls without needing <!-- Width should be large enough to dispaly all media controls without needing
an overflow menu. --> an overflow menu. -->
<video src="test.webm" controls id="video" width=500></video> <video src="test.webm" controls id="video" width=500></video>
<script>
function loadvideo() {
var video = document.getElementById('video');
video.load();
}
</script>
<button id="button1" onclick="loadvideo()">Click me</button>
</body> </body>
</html> </html>
...@@ -2,5 +2,12 @@ ...@@ -2,5 +2,12 @@
<title>test</title> <title>test</title>
<body bgcolor="Silver"> <body bgcolor="Silver">
<video src="test2.webm" controls id="video"></video> <video src="test2.webm" controls id="video"></video>
<script>
function loadvideo() {
var video = document.getElementById('video');
video.load();
}
</script>
<button id="button1" onclick="loadvideo()">Click me</button>
</body> </body>
</html> </html>
...@@ -3,5 +3,14 @@ ...@@ -3,5 +3,14 @@
<body bgcolor="Silver"> <body bgcolor="Silver">
<video src="test.webm" controls id="video"></video> <video src="test.webm" controls id="video"></video>
<video src="test2.webm" controls id="video2"></video> <video src="test2.webm" controls id="video2"></video>
<script>
function loadvideos() {
var video = document.getElementById('video');
var video2 = document.getElementById('video2');
video.load();
video2.load();
}
</script>
<button id="button1" onclick="loadvideos()">Click me</button>
</body> </body>
</html> </html>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment