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]>
31 lines
1.1 KiB
JavaScript
31 lines
1.1 KiB
JavaScript
/*! @license
|
|
* Shaka Player
|
|
* Copyright 2016 Google LLC
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*/
|
|
|
|
describe('TiVoOS', () => {
|
|
/* eslint-disable @stylistic/max-len */
|
|
// cspell:disable
|
|
const tivoOs = 'Mozilla/5.0 (Linux ) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.5359.128 Safari/537.36 OPR/46.0.2207.0 OMI/4.23.2.96.LIMA2.127 Model/Vestel-MB180 VSTVB MB100 HbbTV/1.6.1 (+DRM; VESTEL; MB180; 1.63.0.0; ; _TV_G32_2023;) TiVoOS/1.0.0 (Vestel MB180 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, type and engine', () => {
|
|
Util.setUserAgent(tivoOs);
|
|
const device = new shaka.device.TiVoOS();
|
|
expect(device.getDeviceName()).toBe('TiVoOS');
|
|
expect(device.getDeviceType()).toBe(shaka.device.IDevice.DeviceType.TV);
|
|
expect(device.getBrowserEngine())
|
|
.toBe(shaka.device.IDevice.BrowserEngine.CHROMIUM);
|
|
expect(device.getVersion()).toBe(null);
|
|
});
|
|
});
|