gpu: fix CopyTextureCHROMIUM for GL_ARB_texture_rectangle
[chromium-blink-merge.git] / chrome / test / data / media / html / media_constrained_network.html
blobeba2b117f6dc78b325d84bf33311acf6bc5663d3
1 <!-- Used by media_constrained_network_perf to record perf metrics. -->
2 <!DOCTYPE html>
3 <html lang="en-US">
4 <head>
5 <title>Constrained Video Test</title>
6 </head>
8 <body>
9 <video controls/>
10 </body>
12 <script type="text/javascript">
13 var video = document.querySelector('video');
15 // Tracks time when page load completes and src= is set.
16 var loadTime;
18 // Tracks time when playback starts.
19 var startTime;
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
23 // controller will poll for these values until they are each >= 0.
24 var epp = -1, ttp = -1;
26 // Video play progress to calculate percentage of video played.
27 var vpp = -1;
29 // String to keep track of video events fired.
30 var eventsMsg = '';
32 // A flag to end the test if error or abort events get fired.
33 var endTest = false;
35 video.addEventListener('playing', function(event) {
36 startTime = new Date().getTime();
37 ttp = Math.max(0, startTime - loadTime);
38 logEvent(event);
39 }, false);
41 video.addEventListener('ended', setEPP, false);
42 video.addEventListener('error', end, false);
44 var events = ['loadstart', 'progress', 'suspend', 'waiting', 'emptied',
45 'stalled', 'play', 'pause', 'loadedmetadata', 'loadeddata',
46 'waiting', 'canplay', 'canplaythrough', 'seeking', 'seeked',
47 'ratechange', 'durationchange', 'volumechange'];
49 var len = events.length;
50 for (var i = 0; i < len; i++) {
51 video.addEventListener(events[i], logEvent, false);
54 function end(evt) {
55 logEvent(evt);
56 endTest = true;
59 function logEvent(evt) {
60 var d = new Date();
61 eventsMsg += d.toLocaleTimeString() + '.' + d.getMilliseconds() + ' ' +
62 evt.target + ' ' + evt.type + ' event fired.\n';
65 function setEPP(evt) {
66 playTime = new Date().getTime() - startTime;
67 durMs = video.duration * 1000;
69 epp = Math.max(0, (playTime - durMs) * 100 / durMs);
70 logEvent(evt);
73 function calculateProgress() {
74 if (!isNaN(video.duration))
75 vpp = (video.currentTime / video.duration) * 100;
77 if (window.domAutomationController)
78 window.domAutomationController.send(vpp);
81 // Called by the PyAuto controller to initiate testing.
82 function startTest(src) {
83 loadTime = new Date().getTime();
84 epp = ttp = vpp = -1;
85 eventsMsg = '';
86 endTest = false;
88 video.src = src;
89 video.play();
91 if (window.domAutomationController)
92 window.domAutomationController.send(true);
94 </script>
95 </html>