Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <html> | 2 <html> |
| 3 <head> | 3 <head> |
| 4 <script src="/w3c/resources/testharness.js"></script> | 4 <script src="/w3c/resources/testharness.js"></script> |
| 5 <script src="/w3c/resources/testharnessreport.js"></script> | 5 <script src="/w3c/resources/testharnessreport.js"></script> |
| 6 <script src="mediasource-util.js"></script> | 6 <script src="mediasource-util.js"></script> |
| 7 <link rel='stylesheet' href='/w3c/resources/testharness.css'> | 7 <link rel='stylesheet' href='/w3c/resources/testharness.css'> |
| 8 </head> | 8 </head> |
| 9 <body> | 9 <body> |
| 10 <div id="log"></div> | 10 <div id="log"></div> |
| (...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 338 test.waitForExpectedEvents(function() | 338 test.waitForExpectedEvents(function() |
| 339 { | 339 { |
| 340 assert_false(sourceBuffer.updating, "updating attribute is fals e"); | 340 assert_false(sourceBuffer.updating, "updating attribute is fals e"); |
| 341 test.done(); | 341 test.done(); |
| 342 }); | 342 }); |
| 343 }, "Test appending a neutered ArrayBuffer."); | 343 }, "Test appending a neutered ArrayBuffer."); |
| 344 | 344 |
| 345 mediasource_testafterdataloaded(function(test, mediaElement, mediaSour ce, segmentInfo, sourceBuffer, mediaData) | 345 mediasource_testafterdataloaded(function(test, mediaElement, mediaSour ce, segmentInfo, sourceBuffer, mediaData) |
| 346 { | 346 { |
| 347 var initSegment = MediaSourceUtil.extractSegmentData(mediaData, se gmentInfo.init); | 347 var initSegment = MediaSourceUtil.extractSegmentData(mediaData, se gmentInfo.init); |
| 348 var halfIndex = (initSegment.length + 1) / 2; | |
| 349 var partialInitSegment = initSegment.subarray(0, halfIndex); | |
| 350 var remainingInitSegment = initSegment.subarray(halfIndex); | |
| 351 var mediaSegment = MediaSourceUtil.extractSegmentData(mediaData, s egmentInfo.media[0]); | |
| 352 | |
| 353 test.expectEvent(sourceBuffer, "updateend", "partialInitSegment ap pend ended."); | |
|
wolenetz
2014/07/26 00:07:14
eek! :) there's lots of " vs ' inconsistency in th
prabhur1
2014/07/28 21:36:48
Done.
| |
| 354 sourceBuffer.appendBuffer(partialInitSegment); | |
| 355 | |
| 356 test.waitForExpectedEvents(function() | |
| 357 { | |
| 358 test.expectEvent(sourceBuffer, "updateend", "remainingInitSegm ent append ended."); | |
|
wolenetz
2014/07/26 00:07:14
Also, verify the init segment received algorithm h
prabhur1
2014/07/28 21:36:48
Done.
| |
| 359 sourceBuffer.appendBuffer(remainingInitSegment); | |
|
wolenetz
2014/07/26 00:07:15
Also, expect loadedmetadata event on media element
prabhur1
2014/07/28 21:36:48
Done.
| |
| 360 }); | |
| 361 | |
| 362 test.waitForExpectedEvents(function() | |
| 363 { | |
| 364 test.expectEvent(sourceBuffer, "updateend", "mediaSegment appe nd ended."); | |
|
wolenetz
2014/07/26 00:07:14
Also, verify the init segment received algorithm H
prabhur1
2014/07/28 21:36:48
Done.
| |
| 365 test.expectEvent(mediaElement, "loadeddata", "loadeddata fired ."); | |
| 366 sourceBuffer.appendBuffer(mediaSegment); | |
| 367 }); | |
| 368 | |
| 369 test.waitForExpectedEvents(function() | |
| 370 { | |
| 371 assert_equals(sourceBuffer.updating, false); | |
|
wolenetz
2014/07/26 00:07:15
Also verify HAVE_CURRENT_DATA readyState, though t
prabhur1
2014/07/28 21:36:47
Done.
prabhur1
2014/07/28 21:36:48
It appears to be responding with HAVE_ENOUGH_DATA
wolenetz
2014/07/29 22:33:20
Acknowledged.
| |
| 372 test.done(); | |
| 373 }); | |
| 374 }, "Test appendBuffer with partial init segments."); | |
| 375 | |
| 376 mediasource_testafterdataloaded(function(test, mediaElement, mediaSour ce, segmentInfo, sourceBuffer, mediaData) | |
| 377 { | |
| 378 var initSegment = MediaSourceUtil.extractSegmentData(mediaData, se gmentInfo.init); | |
| 379 var mediaSegment = MediaSourceUtil.extractSegmentData(mediaData, s egmentInfo.media[0]); | |
| 380 var halfIndex = (mediaSegment.length + 1) / 2; | |
| 381 var partialMediaSegment = mediaSegment.subarray(0, halfIndex); | |
| 382 var remainingMediaSegment = mediaSegment.subarray(halfIndex); | |
| 383 | |
| 384 test.expectEvent(sourceBuffer, "updateend", "InitSegment append en ded."); | |
|
wolenetz
2014/07/26 00:07:14
nit: also expect loadedmetadata?
prabhur1
2014/07/28 21:36:48
Done.
| |
| 385 sourceBuffer.appendBuffer(initSegment); | |
| 386 | |
| 387 test.waitForExpectedEvents(function() | |
| 388 { | |
| 389 test.expectEvent(sourceBuffer, "updateend", "partial media seg ment append ended."); | |
|
wolenetz
2014/07/26 00:07:14
verify HAVE_METADATA readyState and non-NaN durati
prabhur1
2014/07/28 21:36:48
Done.
| |
| 390 sourceBuffer.appendBuffer(partialMediaSegment); | |
| 391 }); | |
| 392 | |
| 393 test.waitForExpectedEvents(function() | |
| 394 { | |
| 395 test.expectEvent(sourceBuffer, "updateend", "mediaSegment appe nd ended."); | |
|
wolenetz
2014/07/26 00:07:14
// Aside: we cannot assume HAVE_CURRENT_DATA at th
prabhur1
2014/07/28 21:36:48
Done.
| |
| 396 test.expectEvent(mediaElement, "loadeddata", "loadeddata fired ."); | |
| 397 sourceBuffer.appendBuffer(remainingMediaSegment); | |
| 398 }); | |
| 399 | |
| 400 test.waitForExpectedEvents(function() | |
| 401 { | |
| 402 assert_equals(sourceBuffer.updating, false); | |
|
wolenetz
2014/07/26 00:07:14
verify >= HAVE_CURRENT_DATA element readyState (bu
prabhur1
2014/07/28 21:36:48
Done.
| |
| 403 test.done(); | |
| 404 }); | |
| 405 }, "Test appendBuffer with partial media segments."); | |
| 406 | |
| 407 mediasource_testafterdataloaded(function(test, mediaElement, mediaSour ce, segmentInfo, sourceBuffer, mediaData) | |
| 408 { | |
| 409 var initSegment = MediaSourceUtil.extractSegmentData(mediaData, se gmentInfo.init); | |
| 348 var partialInitSegment = initSegment.subarray(0, initSegment.lengt h / 2); | 410 var partialInitSegment = initSegment.subarray(0, initSegment.lengt h / 2); |
| 349 var mediaSegment = MediaSourceUtil.extractSegmentData(mediaData, s egmentInfo.media[0]); | 411 var mediaSegment = MediaSourceUtil.extractSegmentData(mediaData, s egmentInfo.media[0]); |
| 350 | 412 |
| 351 test.expectEvent(sourceBuffer, "updateend", "partialInitSegment ap pend ended."); | 413 test.expectEvent(sourceBuffer, "updateend", "partialInitSegment ap pend ended."); |
| 352 sourceBuffer.appendBuffer(partialInitSegment); | 414 sourceBuffer.appendBuffer(partialInitSegment); |
| 353 | 415 |
| 354 test.waitForExpectedEvents(function() | 416 test.waitForExpectedEvents(function() |
| 355 { | 417 { |
| 356 // Call abort to reset the parser. | 418 // Call abort to reset the parser. |
| 357 sourceBuffer.abort(); | 419 sourceBuffer.abort(); |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 408 { | 470 { |
| 409 test.expectEvent(sourceBuffer, "updateend", "Append ended."); | 471 test.expectEvent(sourceBuffer, "updateend", "Append ended."); |
| 410 | 472 |
| 411 assert_equals(sourceBuffer.buffered.length, 1, "sourceBuffer.b uffered has 1 range"); | 473 assert_equals(sourceBuffer.buffered.length, 1, "sourceBuffer.b uffered has 1 range"); |
| 412 assert_equals(sourceBuffer.buffered.length, partialBufferedRan ges.length, "sourceBuffer.buffered and partialBufferedRanges are the same length ."); | 474 assert_equals(sourceBuffer.buffered.length, partialBufferedRan ges.length, "sourceBuffer.buffered and partialBufferedRanges are the same length ."); |
| 413 assert_equals(sourceBuffer.buffered.start(0), partialBufferedR anges.start(0), "sourceBuffer.buffered and partialBufferedRanges start times mat ch."); | 475 assert_equals(sourceBuffer.buffered.start(0), partialBufferedR anges.start(0), "sourceBuffer.buffered and partialBufferedRanges start times mat ch."); |
| 414 assert_greater_than(sourceBuffer.buffered.end(0), partialBuffe redRanges.end(0), "sourceBuffer.buffered has a higher end time than partialBuffe redRanges."); | 476 assert_greater_than(sourceBuffer.buffered.end(0), partialBuffe redRanges.end(0), "sourceBuffer.buffered has a higher end time than partialBuffe redRanges."); |
| 415 test.done(); | 477 test.done(); |
| 416 }); | 478 }); |
| 417 }, "Test abort in the middle of a media segment."); | 479 }, "Test abort in the middle of a media segment."); |
| 480 | |
| 481 mediasource_testafterdataloaded(function(test, mediaElement, mediaSour ce, segmentInfo, sourceBuffer, mediaData) | |
| 482 { | |
| 483 test.expectEvent(mediaSource.activeSourceBuffers, "removesourcebuf fer", "SourceBuffer removed."); | |
|
wolenetz
2014/07/26 00:07:14
I think this line is actually testing non-complian
prabhur1
2014/07/28 21:36:47
New test added to mediasource-removesourcebuffer.h
prabhur1
2014/07/28 21:36:48
Done.
| |
| 484 mediaSource.removeSourceBuffer(sourceBuffer); | |
| 485 test.waitForExpectedEvents(function() | |
| 486 { | |
| 487 assert_throws("InvalidStateError", | |
| 488 function() { sourceBuffer.abort(); }, | |
| 489 "sourceBuffer.abort() throws an exception for InvalidState Error."); | |
| 490 | |
| 491 test.done(); | |
| 492 }); | |
| 418 | 493 |
|
wolenetz
2014/07/26 00:07:14
nit: remove empty line.
prabhur1
2014/07/28 21:36:47
Done.
| |
| 494 }, "Test abort after removing sourcebuffer."); | |
| 495 | |
| 496 mediasource_testafterdataloaded(function(test, mediaElement, mediaSour ce, segmentInfo, sourceBuffer, mediaData) | |
| 497 { | |
| 498 test.expectEvent(mediaSource, 'sourceended', "source ended"); | |
| 499 | |
| 500 assert_equals(mediaSource.readyState, 'open', "readyState is open. "); | |
| 501 mediaSource.endOfStream(); | |
| 502 | |
| 503 test.waitForExpectedEvents(function() | |
| 504 { | |
| 505 assert_equals(mediaSource.readyState, 'ended', "readyState is ended."); | |
| 506 assert_throws("InvalidStateError", | |
| 507 function() { sourceBuffer.abort(); }, | |
| 508 "sourceBuffer.abort() throws an exception for InvalidState Error."); | |
| 509 | |
| 510 test.done(); | |
| 511 }); | |
| 512 | |
| 513 }, "Test abort after readyState is ended."); | |
| 514 | |
| 515 mediasource_testafterdataloaded(function(test, mediaElement, mediaSour ce, segmentInfo, sourceBuffer, mediaData) | |
| 516 { | |
| 517 test.failOnEvent(mediaElement, "error"); | |
|
wolenetz
2014/07/26 00:07:13
This is already done in mediasource_testafterdatal
prabhur1
2014/07/28 21:36:48
Done.
| |
| 518 | |
| 519 test.expectEvent(sourceBuffer, "updatestart", "Append started."); | |
| 520 test.expectEvent(sourceBuffer, "updateend", "Append ended."); | |
| 521 sourceBuffer.appendBuffer(mediaData); | |
| 522 | |
| 523 test.waitForExpectedEvents(function() | |
| 524 { | |
| 525 assert_false(sourceBuffer.updating, "updating attribute is fal se"); | |
| 526 sourceBuffer.abort(); | |
| 527 assert_equals(sourceBuffer.appendWindowStart, 0, "appendWindow Start is reset to 0"); | |
|
wolenetz
2014/07/26 00:07:14
Improve this test by setting non-default appendwin
prabhur1
2014/07/28 21:36:47
Done.
| |
| 528 assert_equals(sourceBuffer.appendWindowEnd, Number.POSITIVE_IN FINITY, | |
| 529 "appendWindowEnd is reset to +INFINITY"); | |
|
wolenetz
2014/07/26 00:07:15
nit: indentation
prabhur1
2014/07/28 21:36:48
Done.
| |
| 530 test.done(); | |
| 531 }); | |
| 532 }, "Test abort after appendBuffer."); | |
|
wolenetz
2014/07/26 00:07:15
nit: s/ffer/ffer update ends/
prabhur1
2014/07/28 21:36:48
Done.
| |
| 533 | |
| 419 mediasource_test(function(test, mediaElement, mediaSource) | 534 mediasource_test(function(test, mediaElement, mediaSource) |
| 420 { | 535 { |
| 421 var sourceBuffer = mediaSource.addSourceBuffer(MediaSourceUtil.VID EO_ONLY_TYPE); | 536 var sourceBuffer = mediaSource.addSourceBuffer(MediaSourceUtil.VID EO_ONLY_TYPE); |
| 422 | 537 |
| 423 test.expectEvent(sourceBuffer, "updatestart", "Append started."); | 538 test.expectEvent(sourceBuffer, "updatestart", "Append started."); |
| 424 test.expectEvent(sourceBuffer, "update", "Append success."); | 539 test.expectEvent(sourceBuffer, "update", "Append success."); |
| 425 test.expectEvent(sourceBuffer, "updateend", "Append ended."); | 540 test.expectEvent(sourceBuffer, "updateend", "Append ended."); |
| 426 | 541 |
| 427 assert_throws( { name: "TypeError"} , | 542 assert_throws( { name: "TypeError"} , |
| 428 function() { sourceBuffer.appendBuffer(null); }, | 543 function() { sourceBuffer.appendBuffer(null); }, |
| 429 "appendBuffer(null) throws an exception."); | 544 "appendBuffer(null) throws an exception."); |
| 430 test.done(); | 545 test.done(); |
| 431 }, "Test appending null."); | 546 }, "Test appending null."); |
| 432 | 547 |
| 433 mediasource_testafterdataloaded(function(test, mediaElement, mediaSour ce, segmentInfo, sourceBuffer, mediaData) | 548 mediasource_testafterdataloaded(function(test, mediaElement, mediaSour ce, segmentInfo, sourceBuffer, mediaData) |
| 434 { | 549 { |
| 435 mediaSource.removeSourceBuffer(sourceBuffer); | 550 mediaSource.removeSourceBuffer(sourceBuffer); |
| 436 | 551 |
| 437 assert_throws( { name: "InvalidStateError"} , | 552 assert_throws( { name: "InvalidStateError"} , |
| 438 function() { sourceBuffer.appendBuffer(mediaData); }, | 553 function() { sourceBuffer.appendBuffer(mediaData); }, |
| 439 "appendBuffer() throws an exception when called after removeSo urceBuffer()."); | 554 "appendBuffer() throws an exception when called after removeSo urceBuffer()."); |
| 440 test.done(); | 555 test.done(); |
| 441 }, "Test appending after removeSourceBuffer()."); | 556 }, "Test appending after removeSourceBuffer()."); |
| 442 </script> | 557 </script> |
| 443 </body> | 558 </body> |
| 444 </html> | 559 </html> |
| OLD | NEW |