Skip to content

Commit

Permalink
Prepare video pixel tests for trace tests.
Browse files Browse the repository at this point in the history
Use constant frame four-color video instead. This is because
if we want to play the video and do screen capture, it will
be flaky if colors vary from frame to frame.

Also, wait until video's current time > 0 to do screen capture
or other verification, and hopefully this gets rid of flakiness.

BUG=867136,869677,774809,716564,921279,860548
TEST=gpu bots
R=piman@chromium.org,magchen@chromium.org,dalecurtis@chromium.org

Change-Id: I809b433cf5a83b597781dc1d79c944cd88dbf22f
Reviewed-on: https://chromium-review.googlesource.com/c/1431392
Commit-Queue: Zhenyao Mo <zmo@chromium.org>
Reviewed-by: Dale Curtis <dalecurtis@chromium.org>
Reviewed-by: Maggie Chen <magchen@chromium.org>
Reviewed-by: Antoine Labour <piman@chromium.org>
Cr-Commit-Position: refs/heads/master@{#625548}
  • Loading branch information
zhenyao authored and Commit Bot committed Jan 24, 2019
1 parent c91aee8 commit cfbc80d
Show file tree
Hide file tree
Showing 15 changed files with 242 additions and 313 deletions.
5 changes: 2 additions & 3 deletions chrome/test/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -371,14 +371,13 @@ group("telemetry_gpu_integration_test") {
"//third_party/webgl/",
"//content/test/gpu/run_gpu_integration_test.py",

# For pixel_test
"//media/test/data/bear.mp4",
"//media/test/data/bear-vp9.webm",
# For pixel_test and trace_test
"//media/test/data/four-colors.mp4",
"//media/test/data/four-colors-aspect-4x3.mp4",
"//media/test/data/four-colors-rot-90.mp4",
"//media/test/data/four-colors-rot-180.mp4",
"//media/test/data/four-colors-rot-270.mp4",
"//media/test/data/four-colors-vp9.webm",
]

# For pixel_test and maps_pixel_test. Because this links to a CIPD
Expand Down
19 changes: 1 addition & 18 deletions content/test/data/gpu/pixel_video_complex_overlays.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,24 +18,7 @@
transform: rotate(20deg);
}
</style>
<script>
var video;

function main() {
video = document.getElementById("video");
video.loop = true;
video.addEventListener('timeupdate', SendSuccess);
video.play();
}

function SendSuccess() {
if (video.currentTime > 0) {
video.removeEventListener('timeupdate', SendSuccess);
domAutomationController.send("SUCCESS");
}
}

</script>
<script src="pixel_video_test.js"></script>
</head>
<body onload="main()">
<div id="container" style="position:absolute; top:0px; left:0px;">
Expand Down
29 changes: 3 additions & 26 deletions content/test/data/gpu/pixel_video_mp4.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,35 +14,12 @@
margin: 0px auto;
}
</style>
<script>
var g_swapsBeforeAck = 15;
var video;

function main()
{
video = document.getElementById("video");
if (video.readyState >= 4) {
waitForFinish();
} else {
video.addEventListener('canplaythrough', waitForFinish, true);
}
}

function waitForFinish()
{
if (g_swapsBeforeAck == 0) {
domAutomationController.send("SUCCESS");
} else {
g_swapsBeforeAck--;
window.requestAnimationFrame(waitForFinish);
}
}
</script>
<script src="pixel_video_test.js"></script>
</head>
<body onload="main()">
<div id="container" style="position:absolute; top:0px; left:0px">
<video class="nomargin" id="video">
<source src="/media/test/data/bear.mp4" type="video/mp4">
<video class="nomargin" id="video" width="240" height="135">
<source src="/media/test/data/four-colors.mp4" type="video/mp4">
</video>
</div>
</body>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,30 +14,7 @@
margin: 0px auto;
}
</style>
<script>
var g_swapsBeforeAck = 15;
var video;

function main()
{
video = document.getElementById("video");
if (video.readyState >= 4) {
waitForFinish();
} else {
video.addEventListener('canplaythrough', waitForFinish, true);
}
}

function waitForFinish()
{
if (g_swapsBeforeAck == 0) {
domAutomationController.send("SUCCESS");
} else {
g_swapsBeforeAck--;
window.requestAnimationFrame(waitForFinish);
}
}
</script>
<script src="pixel_video_test.js"></script>
</head>
<body onload="main()">
<div id="container" style="position:absolute; top:0px; left:0px">
Expand Down
25 changes: 1 addition & 24 deletions content/test/data/gpu/pixel_video_mp4_four_colors_rot_180.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,30 +14,7 @@
margin: 0px auto;
}
</style>
<script>
var g_swapsBeforeAck = 15;
var video;

function main()
{
video = document.getElementById("video");
if (video.readyState >= 4) {
waitForFinish();
} else {
video.addEventListener('canplaythrough', waitForFinish, true);
}
}

function waitForFinish()
{
if (g_swapsBeforeAck == 0) {
domAutomationController.send("SUCCESS");
} else {
g_swapsBeforeAck--;
window.requestAnimationFrame(waitForFinish);
}
}
</script>
<script src="pixel_video_test.js"></script>
</head>
<body onload="main()">
<div id="container" style="position:absolute; top:0px; left:0px">
Expand Down
25 changes: 1 addition & 24 deletions content/test/data/gpu/pixel_video_mp4_four_colors_rot_270.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,30 +14,7 @@
margin: 0px auto;
}
</style>
<script>
var g_swapsBeforeAck = 15;
var video;

function main()
{
video = document.getElementById("video");
if (video.readyState >= 4) {
waitForFinish();
} else {
video.addEventListener('canplaythrough', waitForFinish, true);
}
}

function waitForFinish()
{
if (g_swapsBeforeAck == 0) {
domAutomationController.send("SUCCESS");
} else {
g_swapsBeforeAck--;
window.requestAnimationFrame(waitForFinish);
}
}
</script>
<script src="pixel_video_test.js"></script>
</head>
<body onload="main()">
<div id="container" style="position:absolute; top:0px; left:0px">
Expand Down
25 changes: 1 addition & 24 deletions content/test/data/gpu/pixel_video_mp4_four_colors_rot_90.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,30 +14,7 @@
margin: 0px auto;
}
</style>
<script>
var g_swapsBeforeAck = 15;
var video;

function main()
{
video = document.getElementById("video");
if (video.readyState >= 4) {
waitForFinish();
} else {
video.addEventListener('canplaythrough', waitForFinish, true);
}
}

function waitForFinish()
{
if (g_swapsBeforeAck == 0) {
domAutomationController.send("SUCCESS");
} else {
g_swapsBeforeAck--;
window.requestAnimationFrame(waitForFinish);
}
}
</script>
<script src="pixel_video_test.js"></script>
</head>
<body onload="main()">
<div id="container" style="position:absolute; top:0px; left:0px">
Expand Down
25 changes: 1 addition & 24 deletions content/test/data/gpu/pixel_video_nonroot.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,30 +23,7 @@
color-stop(1.00, rgba(0,0,0,0)));
}
</style>
<script>
var g_swapsBeforeAck = 15;
var video;

function main()
{
video = document.getElementById("video");
if (video.readyState >= 4) {
waitForFinish();
} else {
video.addEventListener('canplaythrough', waitForFinish, true);
}
}

function waitForFinish()
{
if (g_swapsBeforeAck == 0) {
domAutomationController.send("SUCCESS");
} else {
g_swapsBeforeAck--;
window.requestAnimationFrame(waitForFinish);
}
}
</script>
<script src="pixel_video_test.js"></script>
</head>
<body onload="main()">
<div id="container" style="position:absolute; top:0px; left:0px;">
Expand Down
19 changes: 19 additions & 0 deletions content/test/data/gpu/pixel_video_test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

var video;

function main() {
video = document.getElementById("video");
video.loop = true;
video.addEventListener('timeupdate', SendSuccess);
video.play();
}

function SendSuccess() {
if (video.currentTime > 0) {
video.removeEventListener('timeupdate', SendSuccess);
domAutomationController.send("SUCCESS");
}
}
25 changes: 1 addition & 24 deletions content/test/data/gpu/pixel_video_underlay.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,30 +14,7 @@
margin: 0px auto;
}
</style>
<script>
var g_swapsBeforeAck = 15;
var video;

function main()
{
video = document.getElementById("video");
if (video.readyState >= 4) {
waitForFinish();
} else {
video.addEventListener('canplaythrough', waitForFinish, true);
}
}

function waitForFinish()
{
if (g_swapsBeforeAck == 0) {
domAutomationController.send("SUCCESS");
} else {
g_swapsBeforeAck--;
window.requestAnimationFrame(waitForFinish);
}
}
</script>
<script src="pixel_video_test.js"></script>
</head>
<body onload="main()">
<div id="container" style="position:absolute; top:0px; left:0px">
Expand Down
30 changes: 3 additions & 27 deletions content/test/data/gpu/pixel_video_vp9.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,36 +14,12 @@
margin: 0px auto;
}
</style>
<script>
var g_swapsBeforeAck = 15;
var video;

function main()
{
video = document.getElementById("video");
if (video.readyState >= 4) {
waitForFinish();
} else {
video.addEventListener('canplaythrough', waitForFinish, true);
}
}

function waitForFinish()
{
console.log("readyState" + video.readyState);
if (g_swapsBeforeAck == 0) {
domAutomationController.send("SUCCESS");
} else {
g_swapsBeforeAck--;
window.requestAnimationFrame(waitForFinish);
}
}
</script>
<script src="pixel_video_test.js"></script>
</head>
<body onload="main()">
<div id="container" style="position:absolute; top:0px; left:0px">
<video class="nomargin" id="video">
<source src="/media/test/data/bear-vp9.webm" type="video/webm">
<video class="nomargin" id="video" width="240" height="135">
<source src="/media/test/data/four-colors-vp9.webm" type="video/webm">
</video>
</div>
</body>
Expand Down
Loading

0 comments on commit cfbc80d

Please sign in to comment.