In the DASH parser, if there was no suggestedPresentationDelay and
ignoreMinBufferTime was set to true, the parser would set the
presentationDelay to NaN. This was because Math.max() will return NaN
if undefined is passed into it.
This changes minBufferTime to default to 0, if ignoreMinBufferTime is
true.
Fixes#2015
Change-Id: I8fc61706a04d14fd729e2185ce993a8bc87e48e5
This fixes a TODO and fixes setting the "active" track when switching
languages when not displaying text.
Fixes#2010
Change-Id: Ic4cf4126ffb9b93a09af998e20f9da0e7af852fb
This is a helper to aid in iterating over items. This returns a list
of objects that contain:
- "item": The current value.
- "prev": The previous value in the list.
- "next": The next value in the list.
- "i": The zero-based index in the list.
Issue #1518
Change-Id: Id18ab977e3ae45dfbfd2b4137a1bffb6e53c6bce
This ensures that we get the expected types and that type coercion
doesn't convert between types. This also ensures we are consistent
in how we check for equality of primitives in tests.
Change-Id: I9f3aacdf25ab1afe5e8d6e4b895b5299ee687d54
Instead of checking each property separately, just use
jasmine.objectContaining. This also adds a utility for matching a
number that is close to an expected value. This is required when
matching objects with toEqual().
Change-Id: I4de49cfaf254e0752beffc97c578a77f9ec8ee95
This error wasn't caught before, but was fixed in a recent CL. This
adds a test to ensure we don't regress later.
Change-Id: I10e72303c39de82bb9a1f7cb4a6b171c46fdbecd
This changes several classes to use the Destroyer class to handle
destroy(). This also changes the behavior to not ignore destruction
and instead throw a new error. This is more clear for callers and
ensures we propagate errors.
Change-Id: I756c085639558509c22e5c43d69ddf4acd28d46f
This converts them to be normal async tests instead of mocking the
clock and Promises. This uses some internals on the DASH parser for
updates to allow the tests to complete quickly.
Issue #1379
Issue #1953
Change-Id: I6d21d124a290920e568b8a275221140e1b27941b
Apparently calling play() causes the playbackRate to be set back to 1,
so we need to call play() before setting the rate.
Fixes: 135520981
Change-Id: Ibea1cbd7c0ee4605b10b0fee87a8b5c069e04fa3
- Reduce times for "short delays".
- Remove backoff delay from networking tests.
- Avoid hard-coding delays in the library.
- Move Storage tests to integration tests since they use indexedDB (and
take over 200ms each to run).
This reduces the time it takes to run unit tests (with --quick) from
50 seconds to about 6 seconds. Now all but one unit test finish <100ms.
Change-Id: I88461472a87c4cf750a36d07d07422818e069a4d
A recent refactoring caused a test failure on Chrome due to a Promise
getting rejected without a "catch" block and getting an unexpected
rejection error. This adds the expectation first so we don't get that
error.
This also removes the empty "catch" blocks since we use async/await,
which introduces another Promise, so the "catch" block won't suppress
the unhandled rejections like we want.
Change-Id: Ib217b4b374668d800a0eeb1a9b8069269bccf261
The StatusPromise isn't needed when just checking for resolve/reject;
we can use await or expectAsync for that. So this removes the usages
of StatusPromise that only check for resolve/reject.
This also renames the destroy() variables to "d" to make them different
from the operational promises.
Change-Id: I48e807d84e56ee28b7489c572570e11e6325a4ed
This change splits ui tests into general tests and customization.
This is a base for adding more customization tests and creating a
suit for a11y tests.
Change-Id: Icd293ac382ec4a14e15b5be57bf194f83e45f89d
This add a filterDescribe that can be used to filter groups of tests
based on platform support. This consolidates the different test
filtering to one place.
Change-Id: I8f320fcf0edfa2d984433890fcfc3714e78b195b
Some platforms (e.g. IE11 and Tizen) don't support passing an object as
the third argument to addEventListener. When we do, it interprets it
as a "true" for the capture value and causes the listener to be called
at the wrong time. This now detects whether the browser supports this
and calls the boolean version if not.
Fixes#1979
Change-Id: I05b3f5e536a9bcb5c275cac7f243a9ccc88f8149
This upgrades our version of Jasmine and drops the expectAsync
polyfill we added to compensate in Jasmine 2. This also drops the
direct dependency on Jasmine, preferring the indirect version expected
by an upgraded version of karma-jasmine.
Closes#1949
Change-Id: Ibbdb26e9a20ab9b9d8b152678b65c63feed8633c
It's not clear how this mistake went undetected, but the build bot
passed it. Without this fix, plenty of tests are failing.
Change-Id: I576e079b4f997cb2c89ca3ba4484312d42c7541d
These modules are loaded by the tests w/ require() and assigned to
window, but the externs declare the namespaces as "const". If they
are declared const, then assigning them in test/test/boot.js is a
problem for the newer compiler. To work around this, assign them
using bracket notation.
Issue #1852
Change-Id: I2319ada7cdf502b5f1a5a3e65e9491c666404c89
This also removes the unused SimpleIDB type and removes the duplicate
code in Utils that appears in Waiter.
Issue #1157
Change-Id: Ib3cfc16212b9d169b360825a25a084c5ebd7b80f
"CastSender init installs a callback if the cast API is not available"
would fail sometimes with an upgrade to Jasmine 3 (5/500 times). The
failure had to do with the use of a global initialization callback.
It is not clear why upgrading Jasmine caused this issue to become more
apparent.
The test expected that the callback would not exist until an instance
had been created. However, the callback, being global, might still be
around from another instance. The callback would only be removed
after a successful initialization, so if an instance were created by
another test suite (such as the UI), and destroyed before being
initialized (a normal thing in a test environment with no cast API),
then the global callback would still exist when the CastSender tests
were run.
The best solution seems to be:
- Decouple the global callback from any particular instance of
CastSender, and use it to initialize any living instances of
CastSender when invoked
- Remove expectations on the prior existence of the global callback
when the test begins
- Don't rely on the global callback in the unit tests, since
integration tests at the top level can overwrite the global
callback when they load the compiled build
After the fix, the test passed in 500/500 complete test runs.
Change-Id: Id5f5775cf0860d5dfbd6aeb87fa11fd2f2a1297e
Code in karma-jasmine's adapter will malform test failures when the
expectation message contains a stack trace, losing the failure message
and mixing up the stack trace of the failure. To avoid this, we
modify shaka.util.Error not to create a stack trace. This trace is
not available in production, and there is never any need for it in the
tests.
One test expectation had to be updated. The previous version of
jasmineError would use the original error by reference. Now that it's
capturing a few fields explicitly, the severity value doesn't update
when NetworkingEngine modifies the original.
Change-Id: If7af93a1a0357df9763dbf6a4afc45db2c8317df
CastProxy needs to be converted at the same time so that it can properly
adapt to the changes to Player's structure.
This only converts those classes to be ES6 classes, and does not make any
other ES6 conversions to them. That will be a follow-up CL.
Issue #1157
Change-Id: I0e0f2ce9a62639060a645969a9cc2ae6d0a400cd
"StreamingEngine switchVariant/switchTextStream will not clear buffers
if streams have not changed" would fail sometimes with an upgrade to
Jasmine 3 (14/500 runs). Further investigation revealed that a race
would cause the presentation time to be accessed before it was set,
which led to a segment position of NaN, and a segment reference with
start and end time of NaN. It is not clear why upgrading Jasmine
caused this race to become more apparent.
This fixes the problem at several levels:
- An invalid segment position in the ManifestGenerator will cause a
failed assertion.
- An uninitialized presentation time in the StreamingEngine unit
tests, which led to the invalid segment position, will cause a
failed assertion.
- The presentation time for the switchVariant test is now initialized
properly.
After the fix, the test passed in 500/500 complete test runs.
Change-Id: I5c4c52a9e2a89edb61f7d99721be3df840bba30d
This changes how the spies are created. This should still allow using
them as their base classes but still access the spies as a spy (i.e.
using their "calls" property).
Issue #1157
Change-Id: I36840bcc8f4491eedbe90019047228bc65a048a2
This makes progress callbacks into a required parameter on all network
scheme plugins. This does not mean that every plugin must make use of
the callback, but every caller must supply the callback.
In production, NetworkingEngine already supplies this callback
universally, so our HTTP plugins make use of it whenever progress data
is available.
Our tests, however, did not always supply this callback, leading to
test failures. These failures were more likely to show up in Jasmine
3 than Jasmine 2 for some reason, which caused us to downgrade back to
Jasmine 2 recently.
By making the callback required, we can clean up this inconsistency
between test and production and give the HTTP plugins what they expect
in all cases.
Issue #1949
Change-Id: I8a6e1904e73cf7ca6ae8f3964261c339f404854d