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]>
30 lines
1.0 KiB
JavaScript
30 lines
1.0 KiB
JavaScript
/*! @license
|
|
* Shaka Player
|
|
* Copyright 2016 Google LLC
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*/
|
|
|
|
describe('TitanOS', () => {
|
|
/* eslint-disable @stylistic/max-len */
|
|
// See: https://docs.titanos.tv/user-agents
|
|
// cspell:disable
|
|
const titanOs = 'Mozilla/5.0 (Linux ) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.6261.128 Safari/537.36 OMI/4.24.3.93.MIKE.227 Model/Vestel-MB190 VSTVB MB100 FVC/9.0 (VESTEL; MB190; ) HbbTV/1.7.1 (+DRM; VESTEL; MB190; 0.9.0.0; ; _TV__2025;) TitanOS/3.0 (Vestel MB190 VESTEL) SmartTvA/3.0.0';
|
|
// cspell:enable
|
|
/* eslint-enable @stylistic/max-len */
|
|
|
|
const Util = shaka.test.Util;
|
|
const originalUserAgent = navigator.userAgent;
|
|
|
|
afterEach(() => {
|
|
Util.setUserAgent(originalUserAgent);
|
|
});
|
|
|
|
it('reports the right device name and type', () => {
|
|
Util.setUserAgent(titanOs);
|
|
const device = new shaka.device.TitanOS();
|
|
expect(device.getDeviceName()).toBe('TitanOS');
|
|
expect(device.getDeviceType()).toBe(shaka.device.IDevice.DeviceType.TV);
|
|
expect(device.getVersion()).toBe(null);
|
|
});
|
|
});
|