From 87e91874ee8afcc1007a63135711d02e3cd79deb Mon Sep 17 00:00:00 2001 From: Joey Parrish Date: Tue, 17 May 2022 11:18:59 -0700 Subject: [PATCH] test: Disable offline for Xbox One (#4232) Xbox One tests have been failing often for some time now, so it went unnoticed that offline was not working. It seems that IndexedDB is not working properly on Xbox, and the platform throws `UnknownError`. This restricts offline so that it is not triggered on Xbox One, and this also fixes the filtering of our offline tests to respect the offline storage muxer's support method. --- lib/offline/indexeddb/storage_mechanism.js | 6 ++++-- test/offline/indexeddb_storage_unit.js | 2 +- test/offline/storage_compatibility_unit.js | 2 +- test/test/boot.js | 9 +++++++++ test/test/externs/filters.js | 4 ++++ 5 files changed, 19 insertions(+), 4 deletions(-) diff --git a/lib/offline/indexeddb/storage_mechanism.js b/lib/offline/indexeddb/storage_mechanism.js index 88a2fb0afa..9019e7d4ca 100644 --- a/lib/offline/indexeddb/storage_mechanism.js +++ b/lib/offline/indexeddb/storage_mechanism.js @@ -368,8 +368,10 @@ shaka.offline.indexeddb.StorageMechanism.SESSION_ID_STORE = 'session-ids'; shaka.offline.StorageMuxer.register( 'idb', () => { - // Offline storage is not supported on the Chromecast platform. - if (shaka.util.Platform.isChromecast()) { + // Offline storage is not supported on the Chromecast or Xbox One + // platforms. + if (shaka.util.Platform.isChromecast() || + shaka.util.Platform.isXboxOne()) { return null; } // Offline storage requires the IndexedDB API. diff --git a/test/offline/indexeddb_storage_unit.js b/test/offline/indexeddb_storage_unit.js index f210b9b496..40396656b4 100644 --- a/test/offline/indexeddb_storage_unit.js +++ b/test/offline/indexeddb_storage_unit.js @@ -4,7 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -filterDescribe('IndexeddbStorageCell', () => window.indexedDB, () => { +filterDescribe('IndexeddbStorageCell', offlineSupported, () => { const IndexedDBUtils = shaka.test.IndexedDBUtils; const OfflineUtils = shaka.test.OfflineUtils; const Util = shaka.test.Util; diff --git a/test/offline/storage_compatibility_unit.js b/test/offline/storage_compatibility_unit.js index 8f97b4fafe..32bdb426f0 100644 --- a/test/offline/storage_compatibility_unit.js +++ b/test/offline/storage_compatibility_unit.js @@ -91,7 +91,7 @@ const compatibilityTestsMetadata = [ }, ]; -filterDescribe('Storage Compatibility', () => window.indexedDB, () => { +filterDescribe('Storage Compatibility', offlineSupported, () => { for (const metadata of compatibilityTestsMetadata) { describe(metadata.name, () => { makeTests(metadata); diff --git a/test/test/boot.js b/test/test/boot.js index 999bd6f425..99e7d70259 100644 --- a/test/test/boot.js +++ b/test/test/boot.js @@ -242,6 +242,15 @@ window.xfilterDescribe = (describeName, cond, describeBody) => { window['describe'] = oldDescribe; }; +/** + * A very short alias for filtering offline integration tests. + * + * @return {boolean} + */ +window.offlineSupported = () => { + return shaka.offline.StorageMuxer.support(); +}; + /** * Load node modules used in testing and install them into window. * @return {!Promise} diff --git a/test/test/externs/filters.js b/test/test/externs/filters.js index 2417299ea1..28616add81 100644 --- a/test/test/externs/filters.js +++ b/test/test/externs/filters.js @@ -38,3 +38,7 @@ var filterDescribe = function(name, cond, callback) {}; * @param {function()} callback */ var xfilterDescribe = function(name, cond, callback) {}; + + +/** @return {boolean} */ +var offlineSupported = function() {};