-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for offline data with an online license request #878
Changes from 4 commits
a232333
58b6508
27939d8
417c390
123c1ce
46a0ed7
b378ef1
6e8a467
b393ab0
b27de0a
b3fad61
d72445e
9f6201c
626be94
917d178
8086e41
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -869,6 +869,43 @@ describe('Storage', function() { | |
}).catch(fail).then(done); | ||
}); | ||
}); // describe('default track selection callback') | ||
|
||
describe('temporary license', function(){ | ||
|
||
beforeEach(function(){ | ||
storage.configure({ isPersistentLicense: false }); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This doesn't configure DRM, so the tests below are all exercising clear content paths. See the |
||
}); | ||
|
||
it('stores basic manifests', function(done) { | ||
var originalUri = 'fake://foobar'; | ||
storage.store(originalUri) | ||
.then(function(data) { | ||
expect(data).toBeTruthy(); | ||
// Since we are using a memory DB, it will always be the first one. | ||
expect(data.offlineUri).toBe('offline:0'); | ||
expect(data.originalManifestUri).toBe(originalUri); | ||
expect(data.duration).toBe(0); // There are no segments. | ||
expect(data.size).toEqual(0); | ||
expect(data.tracks).toEqual(tracks); | ||
}) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You should also load the content again and verify that is has There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I have added a new 'stores drm info' test (along with the additions to Is this what you meant? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Kind of. I was thinking of putting checks for Since the feature under test is that we do temporary licenses instead of persistent licenses, I think all three of these could be one test. In my opinion, the test above ("stores basic manifest") is irrelevant, and these other two should be combined into "does not store offline sessions"). There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok, that makes sense. As this creates a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Either way. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Dropped down to the single test inside the |
||
.catch(fail) | ||
.then(done); | ||
}); | ||
|
||
it('does not store offline sessions', function(done) { | ||
storage.store('') | ||
.then(function(data) { | ||
expect(data.offlineUri).toBe('offline:0'); | ||
return fakeStorageEngine.get('manifest', 0); | ||
}) | ||
.then(function(manifestDb) { | ||
expect(manifestDb).toBeTruthy(); | ||
expect(manifestDb.sessionIds.length).toEqual(0); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also verify that |
||
}) | ||
.catch(fail) | ||
.then(done); | ||
}); | ||
}); // describe('temporary license') | ||
}); // describe('store') | ||
|
||
describe('remove', function() { | ||
|
@@ -963,6 +1000,24 @@ describe('Storage', function() { | |
.then(done); | ||
}); | ||
|
||
it('will delete content with a temporary license', function(done){ | ||
storage.configure({ isPersistentLicense: false }); | ||
var manifestId = 0; | ||
createAndInsertSegments(manifestId, 5) | ||
.then(function(refs) { | ||
var manifest = createManifest(manifestId); | ||
manifest.periods[0].streams.push({segments: refs}); | ||
return fakeStorageEngine.insert('manifest', manifest); | ||
}) | ||
.then(function() { | ||
expectDatabaseCount(1, 5); | ||
return removeManifest(manifestId); | ||
}) | ||
.then(function() { expectDatabaseCount(0, 0); }) | ||
.catch(fail) | ||
.then(done); | ||
}); | ||
|
||
it('will not delete other manifest\'s segments', function(done) { | ||
var manifestId1 = 1; | ||
var manifestId2 = 2; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please change these
it()
calls todrm_it()
. We only run DRM tests with the --drm flag, anddrm_it()
does the filtering for us.We do it this way so that tests can still be run without solid network connectivity. --drm enables DRM tests (some networking required for licensing) and --external enables external asset tests (solid network required to pull content from the internet).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed. Thanks.