It turns out that, on some browsers, incomplete XML does not properly
parse. This means the parseFirstCue tests did not work on those platforms.
This modifies those tests on platforms that do not support partial XML;
when no support is detected, it instead tries to get the first cue
from a non-partial segment.
This also modifies the HLS parser to only load partial text segments if
the text parser supports it; otherwise, the hls parser will load full
captions in order to extract start times.
b/137945635
Issue #2037
Change-Id: I58112864a818baf155b365a65fba1c8a56eb9520
MediaSource throws if endOfStream() is called when
its readyState is equal to 'ended.' This happens if
endOfStream() has already been called.
This change ensures that we don't try to call endOfStream
on the MediaSource that has already marked as 'ended.'
Closes#2050.
Change-Id: I2672b297f0ebb7fd67afcf72ee52df6d5bacf761
This is not run regularly or by default, and many things about it were
broken since the last time we paid attention to it.
The DRM checks were broken in the demo app refactor for v2.5, and
other parts were broken for even longer.
Change-Id: I053f2615a749e7e7d6252f689d16c50b99cf94ff
1. Make createPeriod_() and createVariantsForTag_() clearer to read.
2. Simplify and remove duplicate code.
Change-Id: Idda7cb40f33905afd9512d427d7e78cb6c96ede9
In a recent refactor that made some internals of DASH parsing async for the first time, we broke the creation of SegmentReferences by having createUris close around values that changed later. This fixes the bug and adds a regression test.
Previously, when the text engine tried to load the start time of
a segment, it would parse every cue in that segment, then check the
time of the first cue. This was judged to not be a significant
performance issue, as parsing cues is a fast operation. However, it
did have an unintended side-effect: in some situations, this method
was being passed partial segments; notably, the HLS parser would load
the first 2048kb of the stream's texts to extract timing data.
If the caption parsers tried to actually parse an incomplete caption,
they would error.
This gives the text parsers "parseFirstCue" methods, and uses those
methods when it only needs the first cue anyway.
Fixes#2037
Change-Id: I2a1fb2f1a96d98967f0c6e6a5c277914a28b42ad
I promised Theodore to add a test for this.
A Lannister always pays his (technical) debts.
Issue #1938
Change-Id: I9741b8c65a4a26b1c07ed1feb9082751dab49505
During a refactor ("Replace find/get callbacks with SegmentIndex"),
this test changed from using a hard-coded segment position to looking
one up based on the live edge. But using the exact live edge leads to
some amount of flakiness.
Back off the live edge enough to make sure you're not on the trailing
edge of the segment.
Fixes b/137286528
Change-Id: Ic4e869e8a3b1ceaf45dc14b04ea0e987bd690453
These factories require actual functions, not arrow functions. This
was only working so far because of Babel translating the code to ES5.
Closes#1953
Change-Id: If05d11f4a66f920077343c3e1759964f41e4433c
The default test timeout is 120 seconds, which makes debugging test
timeouts take a long time. This allows changing the timeout on the
command-line.
Change-Id: Ibb27e35b9ae4b71f192841ecc6ccd90ab652b0cf
This was broken in "Replace find/get callbacks with SegmentIndex"
because automated tests for SegmentBase did not cover multiple
Representations with different index/init ranges. Once the parsing
became async in the previous change, the index information was being
pulled from the last Representation parsed, rather than any specific
one.
This fixes the issue by making a shallow copy of the parsing context,
as was already done for SegmentTemplate.
SegmentList is synchronous, so it was not affected.
Issue #1339
Change-Id: I09c606c464b49c99d35d1031734b64872cfa6599
This replaces find/get callbacks in Stream with a SegmentIndex. With
the exception of DASH's SegmentTemplate+duration, all manifests were
already backed by SegmentIndex. Now, all manifests are backed by
SegmentIndex. This will simplify Period-flattening, in which all
tracks will be represented by a list of segments, some of which come
from different Periods.
The SegmentIndex in Stream will not be created until
createSegmentIndex is called. Prior to this change, the find/get
callbacks could be invoked without createSegmentIndex() in some cases
(excluding DASH's SegmentBase), which some lazy tests took advantage
of. Now that find/get are methods on SegmentIndex, createSegmentIndex
must be called in all cases. The tests have been updated accordingly.
Making SegmentIndex generation async in all cases exposed some issues
with the parser context being modified in-place between one
Representation and the next. So the parser now makes a shallow copy
of the context before it is bound into an async callback.
To facilitate updating the SegmentIndex for SegmentTemplate+duration
content, SegmentIndex now has a method to update its list on a timer.
Once per segment duration, the index will be updated to add and remove
SegmentReferences.
The initial expansion of SegmentTemplate+duration will be limited to a
relatively small number of segments, to avoid excessive CPU or memory
consumption. This defaults to 1000 segments, but is configurable.
Issue #1339
Change-Id: I99c007b1096c3b396d04a729750cd7b743cb899d
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