0

[fuchsia] fix cast-streaming test

It includes several fixes here and there, and gets rid of the
unnecessary retry on astro.

I explained most of the outstanding changes in the comments inline.

Cq-Include-Trybots: luci.chrome.try:fuchsia-cast-astro,fuchsia-cast-nelson,fuchsia-cast-sherlock
Change-Id: I0ab3aea99214c390ed0c7a0dd914fcc2d465102d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5833214
Reviewed-by: Brian Sheedy <bsheedy@chromium.org>
Commit-Queue: Zijie He <zijiehe@google.com>
Cr-Commit-Position: refs/heads/main@{#1350920}
This commit is contained in:
Hzj_jie
2024-09-04 17:53:23 +00:00
committed by Chromium LUCI CQ
parent 35ff849584
commit c289d96b9d
3 changed files with 17 additions and 25 deletions
content/test/gpu/gpu_tests
fuchsia_web/shell/cast_streaming_shell_data

@@ -45,12 +45,15 @@ class CastStreamingIntegrationTest(
# This property actually comes off the class, not 'self'. # This property actually comes off the class, not 'self'.
tab = self.tab tab = self.tab
tab.action_runner.WaitForJavaScriptCondition(
'document.readyState === "complete"')
# Request a frame. # Request a frame.
tab.ExecuteJavaScript('domAutomationController.setFrameRequest(1)') tab.ExecuteJavaScript('domAutomationController.setFrameRequest(1)')
# Wait until the test is done. # Wait until the test is done.
tab.action_runner.WaitForJavaScriptCondition( tab.action_runner.WaitForJavaScriptCondition(
'domAutomationController._done', timeout=10) 'domAutomationController._done')
has_failed = tab.EvaluateJavaScript('domAutomationController._failure') has_failed = tab.EvaluateJavaScript('domAutomationController._failure')
try: try:
@@ -58,7 +61,7 @@ class CastStreamingIntegrationTest(
self.fail('page indicated test failure') self.fail('page indicated test failure')
else: else:
# Actually run the test and capture the screenshot. # Actually run the test and capture the screenshot.
screenshot = tab.Screenshot(5) screenshot = tab.Screenshot()
self._UploadTestResultToSkiaGold(page.name, screenshot, page) self._UploadTestResultToSkiaGold(page.name, screenshot, page)
finally: finally:
self._RestartBrowser('Must restart after every test') self._RestartBrowser('Must restart after every test')

@@ -89,5 +89,3 @@
################### ###################
# Failures/Flakes # # Failures/Flakes #
################### ###################
crbug.com/1420075 [ fuchsia-board-astro ] CastStreaming_VP8_1Frame [ RetryOnFailure ]

@@ -11,21 +11,21 @@ domAutomationController._frame_request = 0;
domAutomationController._done = false; domAutomationController._done = false;
domAutomationController._failure = false; domAutomationController._failure = false;
function requestVideoFrameCallback() {
const video = document.querySelector('video');
if (!video) {
console.log('Video element could not be found');
window.close();
return;
}
video.requestVideoFrameCallback(domAutomationController.addFrame);
}
// Waits for document to be fully loaded before calling // Waits for document to be fully loaded before calling
// requestVideoFrameCallback. // requestVideoFrameCallback.
document.onreadystatechange = function() { document.onreadystatechange = function() {
if (document.readystate === 'complete') { if (document.readyState === 'complete') {
requestVideoFrameCallback(); const video = document.querySelector('video');
if (!video) {
console.log('Video element could not be found');
window.close();
return;
}
video.requestVideoFrameCallback(function(now, metadata) {
// Increments frame count when a frame is presented for composition.
domAutomationController._frame_count++;
domAutomationController.checkTermination();
});
} }
} }
@@ -40,15 +40,6 @@ domAutomationController.checkTermination = function() {
} }
} }
// Increments frame count when a frame is presented for composition.
domAutomationController.addFrame = function(now, metadata) {
domAutomationController._frame_count++;
domAutomationController.checkTermination();
if (!this._done) {
requestVideoFrameCallback();
}
}
// Tracks frame requests. // Tracks frame requests.
domAutomationController.setFrameRequest = function(frame_request) { domAutomationController.setFrameRequest = function(frame_request) {
this._frame_request = frame_request; this._frame_request = frame_request;