Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(139)

Side by Side Diff: chrome/test/data/media/html/media_constrained_network.html

Issue 9127009: Constrained Network test does not fail fast under fatal conditions. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: and again... Created 8 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 <!-- Used by media_constrained_network_perf to record perf metrics. --> 1 <!-- Used by media_constrained_network_perf to record perf metrics. -->
2 <!DOCTYPE html> 2 <!DOCTYPE html>
3 <html lang="en-US"> 3 <html lang="en-US">
4 <head> 4 <head>
5 <title>Constrained Video Test</title> 5 <title>Constrained Video Test</title>
6 </head> 6 </head>
7 7
8 <body> 8 <body>
9 <video controls/> 9 <video controls/>
10 </body> 10 </body>
11 11
12 <script type="text/javascript"> 12 <script type="text/javascript">
13 var video = document.querySelector('video'); 13 var video = document.querySelector('video');
14 14
15 // Tracks time when page load completes and src= is set. 15 // Tracks time when page load completes and src= is set.
16 var loadTime; 16 var loadTime;
17 17
18 // Tracks time when playback starts. 18 // Tracks time when playback starts.
19 var startTime; 19 var startTime;
20 20
21 // Metrics to record. See media_constrained_network_perf for more details. 21 // Metrics to record. See media_constrained_network_perf for more details.
22 // Use -1 to indicate that we haven't recorded these values yet. The PyAuto 22 // Use -1 to indicate that we haven't recorded these values yet. The PyAuto
23 // controller will poll for these values until they are each >= 0. 23 // controller will poll for these values until they are each >= 0.
24 var extra_play_percentage = -1, time_to_playback = -1; 24 var epp = -1, ttp = -1;
25 25
26 video.addEventListener('playing', function(event) { 26 video.addEventListener('playing', function(event) {
27 startTime = new Date().getTime(); 27 startTime = new Date().getTime();
28 28
29 time_to_playback = Math.max(0, startTime - loadTime); 29 ttp = Math.max(0, startTime - loadTime);
30 }, false); 30 }, false);
31 31
32 video.addEventListener('ended', function(event) { 32 video.addEventListener('ended', function(event) {
33 playTime = new Date().getTime() - startTime; 33 playTime = new Date().getTime() - startTime;
34 durMs = video.duration * 1000; 34 durMs = video.duration * 1000;
35 35
36 extra_play_percentage = Math.max(0, (playTime - durMs) * 100 / durMs) 36 epp = Math.max(0, (playTime - durMs) * 100 / durMs)
37 }, false); 37 }, false);
38 38
39 // Called by the PyAuto controller to initiate testing. 39 // Called by the PyAuto controller to initiate testing.
40 function startTest(src) { 40 function startTest(src) {
41 loadTime = new Date().getTime(); 41 loadTime = new Date().getTime();
42 video.src = src 42 video.src = src
43 video.play(); 43 video.play();
44 44
45 if (window.domAutomationController) 45 if (window.domAutomationController)
46 window.domAutomationController.send(true); 46 window.domAutomationController.send(true);
47 } 47 }
48 </script> 48 </script>
49 </html> 49 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698