-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Timeout unfulfilled request to decodingInfo and requestMediaKeyS…
…ystemAccess (#7682) On some (Android) WebView environments, decodingInfo and requestMediaKeySystemAccess will not resolve or reject, at least if RESOURCE_PROTECTED_MEDIA_ID is not set. This is a workaround for that issue. Closes #7680
- Loading branch information
Showing
4 changed files
with
92 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/*! @license | ||
* Shaka Player | ||
* Copyright 2016 Google LLC | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
describe('Functional', () => { | ||
const Functional = shaka.util.Functional; | ||
describe('promiseWithTimeout', () => { | ||
it('resolves if asyncProcess resolves within the timeout', async () => { | ||
const asyncProcess = new Promise((resolve) => | ||
setTimeout(() => resolve('success'), 100), | ||
); | ||
const result = await Functional.promiseWithTimeout(1, asyncProcess); | ||
expect(result).toBe('success'); | ||
}); | ||
|
||
it('rejects if asyncProcess rejects', async () => { | ||
const asyncProcess = new Promise((_, reject) => | ||
setTimeout(() => reject('error'), 100), | ||
); | ||
const promise = Functional.promiseWithTimeout(1, asyncProcess); | ||
await expectAsync(promise).toBeRejectedWith('error'); | ||
}); | ||
|
||
it('rejects if asyncProcess takes longer than the timeout', async () => { | ||
const asyncProcess = new Promise((resolve) => | ||
setTimeout(() => resolve('success'), 2000), | ||
); | ||
const promise = Functional.promiseWithTimeout(1, asyncProcess); | ||
await expectAsync(promise).toBeRejected(); | ||
}); | ||
}); | ||
}); |