0

[media] Fix media foundation key system fallback browser test

Two issues were found to make this test flaky:
1. `CHECK(false)` sometimes triggers OS dialogue. Opt to use
   `base::ImmediateCrash()` instead.
2. HTML test page should run the test on `<body>` load.

Bug: 393557668
Change-Id: I8834378b36ae4e449c60a811bdf593051aa53b8a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6227416
Commit-Queue: Feras Aldahlawi <feras@chromium.org>
Reviewed-by: John Rummell <jrummell@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1415200}
This commit is contained in:
Feras Aldahlawi
2025-02-03 14:28:42 -08:00
committed by Chromium LUCI CQ
parent 9098ac02ab
commit 07eebb44ed
3 changed files with 7 additions and 6 deletions

@ -1692,9 +1692,8 @@ IN_PROC_BROWSER_TEST_F(MediaFoundationEncryptedMediaTest,
false, PlayCount::ONCE, kEmeNotSupportedError);
}
// TODO(https://crbug.com/393557668): Re-enable the test.
IN_PROC_BROWSER_TEST_F(MediaFoundationEncryptedMediaTest,
DISABLED_FallbackTest_KeySystemNotSupported) {
FallbackTest_KeySystemNotSupported) {
if (!IsMediaFoundationEncryptedPlaybackSupported()) {
GTEST_SKIP() << "MediaFoundationEncryptedPlayback not supported on device.";
}

@ -283,8 +283,10 @@ STDMETHODIMP MediaFoundationClearKeySession::GetKeyStatuses(
return E_OUTOFMEMORY;
}
CHECK(keys_info_[i]->key_id != kCrashKeyId)
<< "Crash on special crash key ID.";
// Crash on special crash key ID.
if (keys_info_[i]->key_id == kCrashKeyId) {
base::ImmediateCrash();
}
key_status_array[i].eMediaKeyStatus = ToMFKeyStatus(keys_info_[i]->status);
memcpy(key_status_array[i].pbKeyId, keys_info_[i]->key_id.data(),

@ -1,6 +1,8 @@
<!DOCTYPE html>
<html>
<title>Test crashing media foundation cdm removes it from available key systems</title>
<div id="console"></div>
<body onload="runTest();"></body>
<script src='eme_player_js/app_loader.js' type='text/javascript'></script>
<script type='text/javascript'>
@ -67,7 +69,5 @@
Utils.setResultInTitle('ENDED');
});
}
</script>
</html>