| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 | 5 |
| 6 // The file runs a series of Media Source Entensions (MSE) operations on a | 6 // The file runs a series of Media Source Entensions (MSE) operations on a |
| 7 // video tag. The test takes several URL parameters described in | 7 // video tag. The test takes several URL parameters described in |
| 8 //loadTestParams() function. | 8 //loadTestParams() function. |
| 9 | 9 |
| 10 (function() { | 10 (function() { |
| (...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 368 function checkForCurrentTimeChange() { | 368 function checkForCurrentTimeChange() { |
| 369 if (testDone) | 369 if (testDone) |
| 370 return; | 370 return; |
| 371 | 371 |
| 372 if (mediaElement.readyState < mediaElement.HAVE_METADATA || | 372 if (mediaElement.readyState < mediaElement.HAVE_METADATA || |
| 373 mediaElement.currentTime <= 0) { | 373 mediaElement.currentTime <= 0) { |
| 374 listener = window.requestAnimationFrame(checkForCurrentTimeChange); | 374 listener = window.requestAnimationFrame(checkForCurrentTimeChange); |
| 375 return; | 375 return; |
| 376 } | 376 } |
| 377 | 377 |
| 378 var testEndTime = getPerfTimestamp(); |
| 378 for (var i = 0; i < appenders.length; ++i) { | 379 for (var i = 0; i < appenders.length; ++i) { |
| 379 appenders[i].onPlaybackStarted(mediaSource); | 380 appenders[i].onPlaybackStarted(mediaSource); |
| 380 } | 381 } |
| 381 | 382 |
| 382 var testEndTime = getPerfTimestamp(); | |
| 383 | |
| 384 testDone = true; | 383 testDone = true; |
| 385 window.clearInterval(listener); | 384 window.clearInterval(listener); |
| 386 window.clearTimeout(timeout); | 385 window.clearTimeout(timeout); |
| 387 | 386 |
| 388 var stats = {}; | 387 var stats = {}; |
| 389 stats.total = testEndTime - testStartTime; | 388 stats.total = testEndTime - testStartTime; |
| 390 stats.sourceOpen = mediaSourceOpenEndTime - mediaSourceOpenStartTime; | 389 stats.sourceOpen = mediaSourceOpenEndTime - mediaSourceOpenStartTime; |
| 391 stats.maxXHRLoadDuration = appenders[0].getXHRLoadDuration(); | 390 stats.maxXHRLoadDuration = appenders[0].getXHRLoadDuration(); |
| 392 stats.maxAppendDuration = appenders[0].getAppendDuration(); | 391 stats.maxAppendDuration = appenders[0].getAppendDuration(); |
| 393 | 392 |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 520 | 519 |
| 521 if (testParams.doNotWaitForBodyOnLoad) { | 520 if (testParams.doNotWaitForBodyOnLoad) { |
| 522 startTest(); | 521 startTest(); |
| 523 } | 522 } |
| 524 } | 523 } |
| 525 | 524 |
| 526 window["setupTest"] = setupTest; | 525 window["setupTest"] = setupTest; |
| 527 window.__testDone = false; | 526 window.__testDone = false; |
| 528 window.__testMetrics = {}; | 527 window.__testMetrics = {}; |
| 529 })(); | 528 })(); |
| OLD | NEW |