Files
shaka-player/lib
Joey Parrish 8569b1a2c7 Fix CastSender test flake
"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
2019-06-03 16:53:36 +00:00
..
2019-05-28 23:20:03 +00:00
2019-06-03 16:53:36 +00:00
2019-05-31 17:44:36 +00:00
2019-05-31 17:49:49 +00:00
2019-05-30 16:40:49 +00:00
2019-06-03 15:31:57 +00:00
2019-06-03 15:31:57 +00:00
2019-06-03 15:31:57 +00:00
2019-06-03 15:31:57 +00:00