Commit Graph

134 Commits

Author SHA1 Message Date
Joey Parrish 7155ec73bc test: Switch local Chrome, Edge, Firefox, and Safari launchers to WebDriver-based (#3921)
* test: Switch local Chrome, Edge, Firefox, and Safari launchers to WebDriver-based

This will enable WebDriver-based screenshot tests in local test runs.

* test: Add screenshots for Edge on Mac
2022-02-03 18:54:07 -08:00
Joey Parrish 76d4fd9553 test: Make screenshot comparisons more tolerant (#3916)
Instead of pixel-wise comparison with a change threshold, we now use a
structural similarity (ssim) module to decide how much a screenshot
has changed.  This better tolerates small rendering differences due to
differences in GPUs across machines.
2022-01-31 15:20:43 -08:00
Joey Parrish d15397bfcc chore: Upgrade Karma Safari launcher
This newer launcher is based on WebDriver and seems to work better with GitHub Actions.

Change-Id: I8ea0ff5cd1c975179ffe99c04a9c99601815855f
2022-01-09 19:52:24 +00:00
Joey Parrish 824d8b5fa1 chore: Update master branch version number to prepare for v3.3 release
Change-Id: Ie7565815c52bd94f571c9029d0a521b6d8e9a923
2022-01-07 12:01:22 -08:00
Joey Parrish 291c93e5fd chore: Update changelogs for v3.2.0, v3.1.2, v3.0.13
Change-Id: I2080bc4cf7547cc784f780893f2f7de7144bea0e
2021-07-14 08:37:59 -07:00
Joey Parrish 87797157af chore: Upgrade compiler
The latest compiler should treat `@expose` as a parser error, so the
BanExpose conformance rule is no longer needed.

This upgrades the compiler & closure libraries to the latest releases
from NPM, makes matching updates to the compiler command line (no more
`strictMissingRequire` error category), and removes the BanExpose
conformance rule.

Change-Id: I45e8e71ad5f42fee289a8ddd30141e15f3f425a8
2021-05-13 13:15:09 -07:00
Joey Parrish d5f10bb33c chore: Update changelog for v3.1.0
Change-Id: I376d50f099fdd3ecd3622d9ac0c4b90f14424fdb
2021-04-30 01:01:05 +00:00
Michelle Zhuo c2db6d4896 fix(MediaCap): update EME polyfill version
Issue #1391

Change-Id: I9f990b4e77950b436a0f007999f55bb160d1673b
2021-04-20 16:08:46 +00:00
Álvaro Velad Galván e6108060bd test: Allow testing with Edge Chromium in Karma (#3265) 2021-03-30 16:36:53 -07:00
Michelle Zhuo 57ee23812e feat(MediaCap): Use MediaCapabilities for supporting info
In StreamUtils, use MediaCapabilities.decodingInfo() instead of
MediaSource.isTypeSupported() to check if the stream is supported.

MediaCapabilities.decodingInfo() takes an
MediaDecodingConfiguration object as input, and returns a Promise
with a MediaCapabilitiesInfo object. The returned object tells us
whether decoding the media is supported, smooth, and
powerefficient.

Steps:
1. Create a MediaDecodingConfiguration object for each variant as
   the input.
2. Query the decodingInfo API with the config.
3. Get the 'supported' info from the decodingInfo result, to know
   whether the variant is supported.

Issue #1391

Change-Id: I8fc2d3ec6a9868f38269d550d35f45c298faae98
2021-03-12 21:41:53 +00:00
Joey Parrish 0f9bf71994 test: Fix detection of Xbox & Chromecast in Karma
Karma had an explicit dependency on ua-parser-js "0.7.22".  Not
"^0.7.22", which is a range including newer bugfix releases, but
_exactly_ 0.7.22.  This meant our explicit requirement for a newer
version of ua-parser-js wasn't working, because it conflicted with
Karma's.

This dependency bug was fixed in Karma v6.  Upgrading Karma to v6
allows us to get an updated version of ua-parser-js which includes
fixes for Xbox & Chromecast detection.  (Karma's new dependency is
"^0.7.23", which includes 0.7.24, where Xbox detection was fixed.)

We will keep our explicit dependency on ua-parser-js "^0.7.24", which
will ensure we don't get 0.7.23, which could not correctly detect Xbox
One (which we now support).  But this explicit dependency no longer
conflict's with Karma's, and will serve as an "upgrade" to theirs.

Change-Id: I72b0df9c1bda33c0ae937d79e0b143b1219ef1cb
2021-02-26 22:11:38 +00:00
Joey Parrish eb4023f6df test: Unfork ua-parser-js
The ua-parser-js fork was created to add Xbox One detection support,
but the PR has been merged and the released upstream as 0.7.24.

Change-Id: I14016837bc20da43b077fef7654f9bab8404046e
2021-02-22 11:01:14 -08:00
Joey Parrish f9065705f4 test: Fix recognition of Xbox One in Karma
This updates the UA parser to one that recognizes Xbox devices
including Xbox One.  Corresponds to PR faisalman/ua-parser-js#479

Change-Id: I5e92e78b06c981df1659f73264b6fabfc5eb56ac
2021-02-10 20:37:51 +00:00
Joey Parrish 7544670ee5 chore: Upgrade eslint
The new eslint found many style errors which have now been corrected.

It also complains a lot about atomic update issues that do not seem to
exist, so that rule has been disabled.

This upgrade will allow us to adopt eslint's "id-denylist" instead of
the older "id-blacklist" rule, the name of which violates new Google
guidelines about respectful language.

Bug: 178203011

Change-Id: Ia65581b96e4dd1331f720fa396183dca020b9caf
2021-02-01 23:36:12 +00:00
Theodore Abshire 4ace4395b9 chore: Upgrade stylelint
For a while, we were forced to use a fork of stylelint with a
bugfix necessary for our test bots to run the tool.
That behavior has now been merged into normal stylelint, so we
can stop using that fork.

Change-Id: I51196f8dab73ac1f814137d2f191a08c231fd369
2021-01-07 23:06:16 +00:00
Joey Parrish dd1674be7f chore: Upgrade less
We used to avoid less v3.12 because of a bug, but it seems to be fixed
in less v3.13.

Change-Id: I83a517cec264d4f00af5e1ff31e9be68d5cef2e1
2021-01-07 13:04:01 -08:00
Joey Parrish fc0df44645 chore: Release v2.5.19 and v3.0.7
Change-Id: I07b597b66af49ccd7dc5610965abe55c3156383f
2021-01-06 15:08:29 -08:00
Álvaro Velad Galván 2c07646fee chore: Update mux.js (#3023)
This new version supports CEA-708
2020-12-16 17:40:51 -08:00
michellezhuo 221f8a82e0 build: add goog.require for compiler upgrade (Part 7)
Change-Id: I4607f36260eed511ed71d5672fde8a0e1afd61d7
2020-10-16 20:37:05 -07:00
michellezhuo 81a487aae3 build: add goog.require for compiler upgrade (Part 6)
Change-Id: I9b92f9432a8d6bfe0d9d48c76ab1ce74a9994e0f
2020-10-16 16:10:20 -07:00
Joey Parrish fe6c192d39 build: Generate TypeScript defs with Clutz
The output of Clutz is not directly usable.  We must perform several
transformations on the generated defs:

 - Remove the prefix clutz puts on all namespaces ("ಠ_ಠ.clutz")
 - Replace "GlobalObject" (from Clutz) with TypeScript-native "object"
 - Remove "Global" prefix from Date, Element, Event, and EventTarget
   and use the original definitions instead
 - Remove "protected", which appears on some fields, but is only
   supported on methods
 - Remove duplicate extension of EventTarget on IAdManager
 - Transform "Promise | null | undefined" return type into "Promise |
   void"
 - Fix the definitions of Error and shaka.util.Error
 - Remove an unnecessary second interface on SegmentIndex types
 - Remove definitions for Closure Compiler built-ins

We still need some basic TypeScript sample code that references Shaka
Player, so that we can try to compile it and automatically verify that
the defs work at every commit.

Issue #1030

Change-Id: If394269205e57dbcce4e0f76f6ef582fba0afacb
2020-10-15 03:56:18 +00:00
Michelle Zhuo 1405997a35 feat(text): Add polyfill for TextDecoder/TextEncoder
TextDecoder/TextEncoder is not supported in IE and legacy Edge.
Add a polyfill for that.

Issue #2843
b/168908529

Change-Id: Ia7a3ca87081835fd7dc8e607e05d8090730f9fc5
2020-09-23 23:23:16 +00:00
Theodore Abshire f5f207bc65 fix: Switch to using branch of StyleLint fork
For backwards compatibility reasons, the StyleLint PR had to
be moved to a separate branch of our StyleLint fork. This
changes Shaka Player to use that branch.

Change-Id: Ia1d1ad475a446f36b6c16262320dbd36acb99d8a
2020-09-09 17:36:58 -07:00
Theodore Abshire de478295ca fix: Prepare to adopt newest version of StyleLint
Previously, StyleLint had a problem that was preventing us from
using their library in our buildbot tests. To get around this, we
made a custom branch of their library.
Recently, they almost fixed the issue. There's just one minor change
left before we can use their master branch. In the meantime, this
CL changes Shaka Player to use a new fork of StyleLint that is based
on their current master branch, and makes the LESS modifications
that the newest versions ask for.

Change-Id: I78624b3d366e6c22c577ca6707f5a3311f8e808e
2020-09-02 14:32:57 -07:00
Joey Parrish 34a20d056d test: Improved UA parser with Chromecast support
Our Chromecast tests have started reporting the device as "Linux
aarch64", which is not useful.  This moves us to a fork of
ua-parser-js which can recognize a Chromecast and report its firmware
version.  A pull request has been submitted at
faisalman/ua-parser-js#439.

Change-Id: I158cc2b0dd6fb6ec03825ac9648b05a3096da31b
2020-08-12 11:08:01 -07:00
Joey Parrish d9122a1b8d test: Update Karma and Jasmine
The latest version of Jasmine has deprecated several properties of
jasmine.Env in favor of a configure() method.  This updates our
bootstrap code to use the configure() method.

The latest version of the karma-jasmine adapter hard-codes its own
specFilter configuration at a time that overwrites ours.  There is no
way to configure karma-jasmine not to do this, so we shim
jasmine.getEnv().execute() to work around it.

I filed karma-runner/karma-jasmine#273 to track this latter issue.

Change-Id: Ie6a32f67009b52edeeb8f1974ee131753a75ba3f
2020-08-04 10:36:15 -07:00
Jacob Trimble 1a4d03e463 fix: Workaround less 3.12.0 bug.
Change-Id: Ifb2b1f91eb2f2697fe24d73f0fcb188dab97486f
2020-07-15 14:16:01 -07:00
Joey Parrish 74d9f031e1 chore: Update mux.js
The new version has license headers, which means mux.js release
bundles now comply with some internal Google policies, which in turn
simplifies some of our internal release procedures for Shaka Player.

Change-Id: I796775231c2be2b252d7cbd7adce5d4002e4df76
2020-06-16 00:17:16 +00:00
Joey Parrish b84061a764 build: Upgrade the compiler
This upgrades the compiler to the latest release and fixes some type
errors in the tests found by the new compiler.

Change-Id: I3a555cbdfc94c51fb0683f8397c6adb8ea43f120
2020-06-11 22:03:47 +00:00
Joey Parrish 1b5ba6d6cd Update changelog and bump versions for v3.0
Change-Id: I6ab88140d03b2aeb238fff5eb54802e4b3e104b7
2020-06-01 15:57:31 -07:00
Joey Parrish b839340220 Add screenshot-based layout tests for subtitles
This adds our first screenshot-based layout tests and the
infrastructure to use WebDriver for screenshots through Karma.
This new kind of test will be skipped in any non-WebDriver context.

There are many pieces to this system.

First, we update the Karma WebDriver launcher to a newly-released
version that lets us access the client spec object from the launcher.

Second, we build a Karma middleware plugin to respond to HTTP requests
from the tests.  We handle /screenshot/isSupported and return a bool
so tests can be skipped on non-WebDriver launchers.  We also handle
/screenshot/diff to take the screenshot and compare it to a known-good
version.

The screenshot is a full-page screenshot, since element screenshots
don't work consistently across all the browsers in our test lab.  The
screenshot is then cropped to a rectangle specified in the request.
This rectangle is measured to match a specific element, so in
practice, we are screenshotting just one element.

Browsers use sub-pixel rendering, effectively rendering at a scale
larger than the "pixels" seen by JS.  The screenshot comes in at this
scale, so the requested cropping rectangle is scaled to match, then
the cropped screenshot is scaled down to the JS-measured size.

Because of sub-pixel rendering, element offsets can be non-integer
numbers.  Normally, Karma puts the tests in a iframe, above which is a
variable-height banner showing which devices are connected to Karma
and what state they are in.  So this variation and the lack of integer
offsets means we can run into stability issues due to rounding errors.
To make offsets consistent and improve stability of the screenshots,
this banner is now disabled in our Karma config.

The cropping, scaling, and diffing of images is handled Karma-side by
a node module called Jimp.

Before we start the layout tests for UITextDisplayer, we use a node
module in the browser called fontfaceonload to wait for our web fonts
to be fully loaded.  This module is a polyfill that polls on IE and
uses a standard API in modern browsers to wait for our font to load.
This is all wrapped into a new test util called waitForFont.

Screenshots are stored in test/test/assets/screenshots/ and are
organized into folders by platform and browser and named according to
an identifier specified by each test case.  The new screenshot is
written to disk with the suffix "-new", and a diff image is written
with the suffix "-diff".  When a test fails, we can review the changes
in a browser with test/test/assets/screenshots/review.html.  The
known-good screenshots can be updated with the new tool
build/updateScreenshots.py.

Change-Id: Ib477fd3c459de466c6dc91e9a60d3e2579164b12
2020-05-26 22:38:04 +00:00
Joey Parrish a3f1c0220f Fix CEA caption extraction for b-frame content
This updates to mux.js 5.6.3, which includes a fix for v1 trun box
parsing to fix caption extraction for content with b-frames.

Closes #2395

Change-Id: I206ce26bb43e8187599e8ca7be2e718f4ea345c3
2020-05-07 14:01:26 -07:00
Joey Parrish 1076b78465 Unfork Closure base and update the compiler
The Closure Library's base.js, the Closure Compiler, and the Closure
deps-writer are all now loaded via NPM instead of commiting them
directly to the repo.  This also updates both the library and compiler
to the latest version: 20200406.

We still have a fork of the Closure Library's URI parser.  The latest
upstream version of that has too many dependencies on the rest of the
library to import directly from NPM.

Some internals of the build system have been refactored, and the
"complete" set of files in the build system now includes third_party.

Our forked URI parser does not pass lint checks yet, so the linter
does not run over third_party yet.

A couple of overly-severe sets of compiler checks have been disabled,
since even the latest Closure Library's base.js doesn't pass them.

The script-loader in load.js had to be updated for compatibility with
the new Closure Library.  If you don't return "true" now, Closure's
base.js will stop loading subsequent source files.

Some local externs that we had written are now available from the
compiler, so our local copies have been deleted.

A few type-related changes have been made as well, removing casts that
were necessary with the old compiler, but not necessary with the new
one.

Finally, this corrects some type issues in the tests using the new
"typeof" annotation from the compiler.  This allows us to type a
variable as a class defined elsewhere.  For example, after loading the
compiled library, we can reference compiledShaka.Player, which has the
type "typeof shaka.Player".  The compiler can then type-check all uses
of it in the tests.

Closes #2528 (bad polyfill code generated by the old compiler)

Change-Id: I62ec61e82d4edf342b2c576c2d4f89f11562ee65
2020-04-30 19:32:30 -07:00
Joey Parrish 42afedd1e4 Update to mux.js 5.5.4
This gets us a fix for a closed caption parsing issue described in
videojs/mux.js#330 and fixed in videojs/mux.js#333:

> Atypical streams containing 2+ SEI NAL payloads of type 0x04
> (CEA-708 caption content) in the sei_rbsp (specifically a DTG1
> payload preceding a GA94 payload) fail to display captions in this
> scenario, as the current logic results in parseSei() prematurely
> returning with the DTG1 payload.
>
> By checking for the user ID within parseSei, mux.js can continue
> iterating through the sei_rbsp for the GA94 payload.

Change-Id: I9d90419643279a1273187e0354b5e991cd609ba2
2020-04-14 10:26:39 -07:00
michellezhuo 734d129fcd Add Support for HLS Discontinuity
Closes #2397
Closes #1335

Change-Id: I6f540c42c72bf0ae36239b682d4016cca3981c0f
2020-04-09 14:59:42 -07:00
Theodore Abshire 25396ce403 Load pwacompat through npm.
Loading pwacompat off of jsdelivr was flagged as a security issue
through an automated scan. Since Google does not control jsdelivr,
that is theoretically true.
This just loads a local version of pwacompat via npm, and uses that
instead.

Change-Id: Iba9288a1d440dfdfa039a32b530f6da981c5b055
2020-02-28 10:43:14 -08:00
Joey Parrish 2714e3127d Update EME polyfill dependency
This release fixed an issue with some versions of Edge.

Closes #2413

Change-Id: I76e5b5f8d36f37d33cdee6e00b91b480ceadde42
2020-02-21 22:58:41 +00:00
Joey Parrish 8a3708de76 Update encryption scheme polyfill
The new release includes support for encryption scheme queries in
MediaCapabilities.

Change-Id: I041773ed4e8e957123bfd3b666749999a72a7da3
2019-12-20 22:50:38 +00:00
Joey Parrish 0ad9aa3fd9 Fix EME polyfill issues
This fixes several inter-related issues:
 1. Catch errors in polyfill installation so that test setup isn't
    interrupted half-way through
 2. Use the compiled polyfill in tests, fixing polyfill installation
    error during tests on IE
 3. Require at least version 1.0.2 of the polyfill, since 1.0.0 had
    bugs in the module export and 1.0.1 had an infinite recursion bug

Change-Id: I38c973152409d9b3168e70e82f20579566663208
2019-12-02 12:28:28 -08:00
Joey Parrish b9b4118938 Add a polyfill for EME encryption scheme queries
Note that the encryptionScheme field isn't being used by Shaka Player
yet, but that this will enable us to experiment with it ahead of the
full launch of the feature in browsers.

See also:
 - https://wicg.github.io/encrypted-media-encryption-scheme/
 - https://github.com/WICG/encrypted-media-encryption-scheme/issues/13
 - https://github.com/w3c/encrypted-media/pull/457

Change-Id: I9e8c2b6ce4ce3f4fe634fa4164669c69959e7fde
2019-11-22 18:18:36 +00:00
Jacob Trimble 568cc46720 Add a custom eslint plugin for private names.
This plugin can be used to write custom eslint rules.  This adds a
single rule to check we name private members correctly.  This plugin
does not get added to NPM, it is only used locally.

Fixes #1553

Change-Id: Ifdf9208d2bd0d09e1adb9c281b0be34266a867c9
2019-08-16 16:15:49 +00:00
Theodore Abshire f24c4a783f Added stylelint, a linter for our CSS/less files.
Also unified CSS/less style based on that.
This does have to use a forked version of stylelint, since there
is a bug (?) in the globbing library they use that causes it to
fail on our buildbot. I found the simplest solution was just to add
an option to disable globbing, a feature we weren't using anyway.

Closes #1867

Change-Id: I9295b01d5b15d060356e314938b64b551b75de6a
2019-08-08 18:38:19 +00:00
Joey Parrish 51a3789ca0 Update karma-webdriver-launcher
This updates karma-webdriver-launcher.  The new version has an updated
"wd" module dependency and additional debugging information which was
helpful to us in addressing a problem with our testing infrastructure.

b/137548763

Change-Id: Id7fbe53a4c11ff09804a74616791b2e77028386e
2019-07-22 16:47:17 +00:00
Jacob Trimble a6b0bb6f8b Remove PromiseMock from StreamingEngine tests.
Issue #1379
Issue #1953

Change-Id: I21cbb436723f3207c707f1596ebb0f8142bab4e4
2019-07-09 11:05:54 -07:00
Jacob Trimble 98b8d55575 Workaround error in promise-polyfill.
A recent push to promise-polyfill (used by our promise-mock) caused
errors in our tests.  This blacklists the new release until they
release a fix.

See taylorhakes/promise-polyfill#103

Change-Id: I65784e393143a21769c0a40e3f8b93cf189f7e8d
2019-06-14 12:00:16 -07:00
Joey Parrish b042a8198b Upgrade to Jasmine 3
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
2019-06-05 20:43:33 +00:00
Joey Parrish 2cf09d6301 Fix source map support in tests
This fixes incompatibilites between Karma and Babel with regard to
source maps.

Babel rewrites our code on-the-fly in the testing environment so that
we can run ES6 code and tests on older platforms.  When Babel does
this, it creates inline source maps which map the modified code back
to the original code.

Previously, the karma-source-map-support Karma framework was using
these inline source maps to map stack traces back to the original
code.  This framework, however, uses a V8-specific hook to modify
Error objects, so this only works on Chrome and Opera.

But it turns out that Karma itself already supports source maps for
formatting errors.  For some reason, though, a third-party module is
necessary to connect the dots and make Karma aware of Babel's inline
source maps.  For this, we are now using the karma-sourcemap-loader
Karma preprocessor.

We now have meaningful stack traces on all platforms.

Change-Id: If6033334bb1afb35020f17ae443d6e2192ea5d08
2019-05-22 07:43:48 -07:00
Joey Parrish f6fdec48b9 Fix coverage reports
This changes from using Karma's "coverage" preprocessor to using a
Babel plugin called "istanbul" which adds the coverage instrumentation
to the code.  Because it happens in Babel, all the code
transformations happen in one place, with consistent source maps.
Backtraces in error messages will show the original line numbers, and
code coverage reports will refer to the original line numbers, as
well.

Closes #1693

Change-Id: I706cf21c109f3ec7fa30c6899ca9872c0f8be9d1
2019-05-21 21:37:24 +00:00
Theodore Abshire 96c1f8795c Switch to using tippy.js for tooltips.
Previously, we were using MDL tooltips for our tooltips.
They seemed fine at first, but proved very temperamental; we had to
jump through hoops to get them to work inside MDL cards, and they kept
breaking for various reasons.
This instead adds the third-party tippy.js module, and uses that to make
tooltips instead.

Change-Id: I37ae9c9ade4e3c4dd6cbb1b86601377ed5d9e54f
2019-05-21 16:46:02 +00:00
Joey Parrish 4a8f67686c Downgrade jasmine
This seems to resolve some issues with seemingly unexplainable test
failures since the recent module upgrade.

Issue #1949

Change-Id: I4423f3f9834cdbd71c1432d391aa452a16459e2b
2019-05-17 17:08:19 +00:00