Files
Álvaro Velad GalvánandClaude Opus 4.8 b527a70c57 test: Add unit tests for Hisense, PlayStation, TitanOS, TiVoOS, Vizio and Xbox (#10275)
Add unit tests covering version parsing, device identity, browser engine
and version-specific behavior for the six device classes, using real
user agent strings from the vendor specifications.

While adding the TiVoOS test it became apparent that shaka.device.TiVoOS
was only listed in build/types/devices, so the device was never required
from the uncompiled entry points and therefore never registered in
uncompiled/debug builds (nor available to the tests). Add the missing
goog.require to shaka-player.uncompiled.js and
transmuxer_worker.uncompiled.js.

Co-authored-by: Claude Opus 4.8 <[email protected]>
2026-07-12 10:02:08 -07:00

45 lines
1.4 KiB
JavaScript

/*! @license
* Shaka Player
* Copyright 2016 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
describe('Xbox', () => {
/* eslint-disable @stylistic/max-len */
// Xbox One ships the legacy EdgeHTML browser (token "Edge/").
const xboxOne = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; Xbox; Xbox One) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.140 Safari/537.36 Edge/18.18363';
/* eslint-enable @stylistic/max-len */
const Util = shaka.test.Util;
const originalUserAgent = navigator.userAgent;
afterEach(() => {
Util.setUserAgent(originalUserAgent);
});
it('checks Xbox version', () => {
Util.setUserAgent(xboxOne);
expect(new shaka.device.Xbox().getVersion()).toBe(18);
});
it('detects the legacy Edge browser engine', () => {
Util.setUserAgent(xboxOne);
expect(new shaka.device.Xbox().getBrowserEngine())
.toBe(shaka.device.IDevice.BrowserEngine.EDGE);
});
it('reports the right device name and type', () => {
Util.setUserAgent(xboxOne);
const device = new shaka.device.Xbox();
expect(device.getDeviceName()).toBe('Xbox');
expect(device.getDeviceType())
.toBe(shaka.device.IDevice.DeviceType.CONSOLE);
});
it('overrides Dolby Vision codecs on legacy Edge', () => {
Util.setUserAgent(xboxOne);
expect(new shaka.device.Xbox().shouldOverrideDolbyVisionCodecs())
.toBe(true);
});
});