Commit Graph

24 Commits

Author SHA1 Message Date
Joey Parrish 7e6a0f38ff fix: Correct license headers in misc. files
This corrects/normalizes license headers in misc. files, such as
config files, docs, build tools, tests, and externs.  This does not
affect the compiled output, and is only done for consistency.

Issue #2638

Change-Id: I9d8da2de55243b08d7df2b743aac73c6f15e858a
2020-06-09 16:13:56 -07:00
Joey Parrish 11f3347a48 Fix static method aliases
We used to alias static utility methods by assigning the method itself
to a local variable.  This is not allowed by the new Closure Compiler
release that we are adopting, and for good reason.

The old compiler did not understand the use of "this" in static
methods, but the new one does.  And it turns out that when we start
using "this" in static methods (see #2532), aliasing the method itself
can break everything.

When you refer to "this" in a static method, it refers to the class.
This is really useful in utility classes that have private static
methods they use to perform common tasks.  However, just as it ruins
the value of "this" to alias an instance method, the same is true of
an ES6 class's static method.

The fix is to always alias the class instead of the method.  The new
compiler will simply not let us get away with the old way any more, so
regressions after this are unlikely.

Issue #2528 (compiler upgrade)
Issue #2532 (static "this")

Change-Id: Id800d466e639c7cbcf4aa6fbb05114c772a2229f
2020-04-30 19:28:53 +00:00
Joey Parrish 7dd21dbdb2 Fix asset-specific configuration for external playback tests
These tests have been broken since the refactor of our demo asset
objects.  The new Asset class changed some of the types of its
members, but offered methods to configure Player and NetworkingEngine.
The external playback tests were never updated to match, and so fail
for any encrypted asset or any asset using network filters.

This affects both v2.5.x and the master branch leading up to v2.6.

Change-Id: Ia3751d7fc83387bc1565e69ac8d2ed32564804cb
2020-01-07 21:32:12 +00:00
Joey Parrish 6da39f52e4 Use utility for loading shaka library in external asset tests
We already had this utility, but we did'nt use it here for some reason.

Change-Id: Ib225c7b3f8f0470663ba8d3dd3ba9543af74abd2
2020-01-06 15:39:47 -08:00
Jacob Trimble 011749e95f Standardize argument comments.
This changes the eslint rule to enforce a strict pattern for the
argument comments.  The comment must appear before the argument and
must be /* foo= */.  This still ignores line comments.

Change-Id: I3afb01c65e1088eda13facb3aeeaa7595a2f5aee
2020-01-06 19:40:52 +00:00
Joey Parrish a48f8792a9 Move test-only method to test utils
This method should probably never have been in the library, since it
creates a fixed-sized, muted element.

Change-Id: I53b474305465bef34d43ce40ec5e7dedceb20a25
2020-01-06 18:57:28 +00:00
Joey Parrish 64896d70b0 Use shorter license header
This reflects changes in Google's policy on JavaScript license
headers, which should be smaller to avoid increasing the size of the
binary unnecessarily.

This also updates the company name from "Google, Inc" to "Google LLC".

Change-Id: I3f8b9ed3700b6351f43173d50c94d35c333e82b4
2019-11-22 18:18:36 +00:00
Theodore Abshire 4c6325de08 Added localization system to demo.
No localizations exist currently, but this adds the framework for them.

Change-Id: I81a8cab128884753c765a192181d5d88f0ed13f1
2019-11-18 19:41:58 +00:00
Joey Parrish 124ab33727 Fix custom asset test
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
2019-07-19 15:59:13 -07:00
Jacob Trimble 83de1ad634 Use toBe instead of toEqual for primitives.
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
2019-06-26 18:57:18 +00:00
Jacob Trimble 799e96c05c Convert test utils to ES6.
This also removes the unused SimpleIDB type and removes the duplicate
code in Utils that appears in Waiter.

Issue #1157

Change-Id: Ib3cfc16212b9d169b360825a25a084c5ebd7b80f
2019-06-03 18:41:17 +00:00
Jacob Trimble e59187adf5 Convert player tests to ES6.
Issue #1157

Change-Id: Ib405576ff77e324e5586b93cdbfddcde69d264ab
2019-05-22 16:14:19 +00:00
Jacob Trimble 0dd64074b9 Only allow one statement per line.
With the new style rule, we cannot have two statements on the same line.
So we can no longer have an "if" on a single line and we cannot have
an arrow function with a body on the same line as when it is used.
This is mostly a manual change.

Change-Id: I2285202dd5ecbad764308bc725e6d317ff2ee7f0
2019-05-13 22:11:50 +00:00
Jacob Trimble c81389741f Prefer const over let.
A coming update to the Google eslint config will require using "const"
over "let".  This makes that one change to isolate the big changes.

Change-Id: I7d0974c3ae15c53cc45a6b07bf9f6586e2d34aca
2019-05-08 09:22:10 -07:00
Theodore Abshire efc2ed3df1 Added new demo page.
This is a complete replacement for the old demo page, made to be more
modern-looking and easier to maintain. It contains new features such as
remembering the URIs you provide for custom assets, and searching through
the default assets by feature.
This demo page is not quite ready for release yet, but it's getting close.

Change-Id: Iad01d1fc02c3cd238d73b9b9e02dbb4301cb6f2a
2019-05-01 19:58:18 +00:00
Joey Parrish eff0d47c08 Factor out Tizen workaround
There is a workaround for a Tizen bug which appears in many of our
test suites.  To avoid having to add this to yet more, this change
factors out the workaround such that it applies to all tests.

Change-Id: Ie34c81bfcac94310bf3cd021fd4f2d55905b647a
2019-04-18 09:27:51 -07:00
Joey Parrish 322876dbb6 Fix src= tests
The integration tests for src= failed almost universally on Tizen, but
a few failed on other platforms, as well.  The issue was the fixed
delays in those tests.  This replaces those fixed delays with an
event-based utility that solved the same problem in other Player
integration tests.

Issue #816
Issue #997

Change-Id: Ib43cbb139ef77be1219e60d1fd5009aa403cc4cb
2019-04-16 20:43:41 +00:00
Sandra Lokshina 493d459c47 Add a DOM util.
Change-Id: Ia0941868f20dbb42fa0fe02a639015ac244a65ed
2019-04-05 12:01:59 -07:00
Aaron Vaage 43afe3a7c8 Refactor Event Manager To "Release" and not "Destroy"
We often use the IDestroyable interface to provide us with a standardized
way to break internal references and tear-down objects, however many
objects don't need this to be async. Once using IDestroyable, everyone
must assume that you must be async.

This change introduces IReleasable, a sibling to IDestryable, which
provides the |release| method. IReleasable is the synchronous version of
IDestroyable.

This change converts EventManager from IDestroyable to IReleasable as
the first of many conversions.

Change-Id: Ic3e90e594abc1c7326eccbe2521eb71676b74a09
2019-01-24 01:11:38 +00:00
Joey Parrish 068a26c240 Improve robustness of external asset tests
This fixes several sources of flake in the external asset tests:

 - Network-based flake, introduced when the NetworkInfo API gave us
   a non-hard-coded default bandwidth estimate and when crossing
   period boundaries
 - End detection, in which we see varying behavior across browsers
   and must be more forgiving in our expectations
 - Start detection, in which some hardware platforms (Chromecast)
   take longer to start playback than we might guess
 - Gaps, in which some platforms (Safari, Firefox) get stuck in gaps
   that other platforms do not

Bug: 28087927
Pre-work for issue #1597

Change-Id: I2516dfac176e67eefd13983944280764c057ab89
2018-11-28 00:47:01 +00:00
Sandra Lokshina 6b1ca2d229 Initial release of Shaka Player UI
Other contributors:
 - @joeyparrish
 - @michellezhuogg
 - @TheModMaker
 - @theodab
 - @vaage

Change-Id: If6df33d9ab5035d1ead4402004f7de37ee8470f4
2018-11-16 14:40:37 -08:00
Joey Parrish 7ac5e4692b Isolate custom asset test
Now, unit tests will not be served when running a custom asset test.
This makes the results saner, showing only the one custom asset test
instead of showing 1300+ skipped tests.

Custom asset test flags will also implicitly cause the relevant test
files to be served, rather than requiring --external as well.

Change-Id: I117c3fa90ab16bd059530ab716a17d2462906419
2018-09-16 19:44:41 -07:00
Joey Parrish 7091275cbf Replace indexOf with includes, startsWith
This replaces almost every instance of indexOf on both String and
Array.  There are very few places where we really wanted an index.
Mostly, indexOf was used to check for inclusion.

Change-Id: I08e299768b6ffdb4bfc30b39b5d82a058c6d1b56
2018-09-14 19:10:56 +00:00
Joey Parrish 09af04b0c2 Don't count external asset tests as skipped
By splitting out external asset tests into a separate file, we can
instruct karma to load them only when they will be run.  This reduces
the number of "skipped" tests that show up in our test runs.

Ultimately, this can help us identify tests that are being skipped on
accident, so that we can fix our nightly test infrastructure.

Change-Id: Iac27ec07ff7e814824158b3e1821111a3f5a136d
2018-07-31 19:09:56 +00:00