Skip to content

Commit

Permalink
More IE11 test fixes
Browse files Browse the repository at this point in the history
- IE11 timer resolution seems to be 15ms minimum.  This stretches
  timing for Task tests to 15ms increments, which fixes Task test
  failures.
- Extend karma timeout to accommodate BrowserStack latency.
- Fix assertion caused by SBM abort() race.

Related to issue #251

Change-Id: Ie2bd1e629ecaaf3a96bc7deaad3c24976a0952cf
  • Loading branch information
joeyparrish committed Feb 2, 2016
1 parent b78d3bf commit 86931f9
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 13 deletions.
4 changes: 2 additions & 2 deletions karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ module.exports = function(config) {
'/assets/': '/base/assets/'
},

// do not panic about "no activity" unless a test takes longer than 60s.
browserNoActivityTimeout: 60000,
// do not panic about "no activity" unless a test takes longer than 70s.
browserNoActivityTimeout: 70000,

// don't capture the client's console logs
client: { captureConsole: false },
Expand Down
12 changes: 7 additions & 5 deletions lib/media/source_buffer_manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -627,11 +627,13 @@ shaka.media.SourceBufferManager.prototype.clearAfter_ = function(timestamp) {
*/
shaka.media.SourceBufferManager.prototype.abort_ = function() {
shaka.log.v1(this.logPrefix_(), 'abort_');
shaka.asserts.assert(this.operationPromise_);

// See {@link http://www.w3.org/TR/media-source/#widl-SourceBuffer-abort-void}
if (this.mediaSource_.readyState == 'open') {
this.sourceBuffer_.abort();
// Due to a race caused by Promise polyfills, operationPromise_ might be null
// when abort_ is called. In this case, the operation is already aborted.
if (this.operationPromise_) {
// See http://www.w3.org/TR/media-source/#widl-SourceBuffer-abort-void
if (this.mediaSource_.readyState == 'open') {
this.sourceBuffer_.abort();
}
}
};

Expand Down
12 changes: 6 additions & 6 deletions spec/task_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,30 +125,30 @@ describe('Task', function() {

setTimeout(function() {
expect(stages).toEqual([0]);
}, 10);
}, 15);
setTimeout(function() {
expect(stages).toEqual([0]);
p0.resolve();
}, 20);
}, 30);

setTimeout(function() {
expect(stages).toEqual([0, 1]);
}, 30);
}, 45);
setTimeout(function() {
expect(stages).toEqual([0, 1]);
p1.resolve();
}, 40);
}, 60);

setTimeout(function() {
expect(stages).toEqual([0, 1, 2]);
// We've run the final stage, but it's not done until p2 is resolved.
expect(complete).toBe(false);
}, 50);
}, 75);
setTimeout(function() {
expect(stages).toEqual([0, 1, 2]);
expect(complete).toBe(false);
p2.resolve();
}, 60);
}, 90);

t.getPromise().then(function() {
complete = true;
Expand Down

0 comments on commit 86931f9

Please sign in to comment.