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

Side by Side Diff: third_party/WebKit/LayoutTests/media/media-fragments/media-fragments.js

Issue 2259203002: Remove video-test.js file (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix Created 4 years, 4 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 1 var video = null;
2 var consoleDiv = null;
2 var currentTest = null; 3 var currentTest = null;
3 var fragmentEndTime; 4 var fragmentEndTime;
4 var testData = 5 var testData =
5 { 6 {
6 // http://www.w3.org/2008/WebVideo/Fragments/TC/ua-test-cases 7 // http://www.w3.org/2008/WebVideo/Fragments/TC/ua-test-cases
7 8
8 TC0001 : { start: null, end: null, valid: false, description: "#t=,", fr agment: "t=,", comment: "Syntax error, not allowed according to the ABNF. The me dia fragment is ignored."}, 9 TC0001 : { start: null, end: null, valid: false, description: "#t=,", fr agment: "t=,", comment: "Syntax error, not allowed according to the ABNF. The me dia fragment is ignored."},
9 TC0002 : { start: null, end: null, valid: false, description: "#t=a,a an d a >= 0", fragment: "t=3,3", comment: "Invalid semantics: start must be smaller than end. The media fragment is ignored."}, 10 TC0002 : { start: null, end: null, valid: false, description: "#t=a,a an d a >= 0", fragment: "t=3,3", comment: "Invalid semantics: start must be smaller than end. The media fragment is ignored."},
10 TC0003 : { start: null, end: null, valid: false, description: "#t=a,b an d a > b", fragment: "t=7,3", comment: "Invalid semantics: the requested interval 's start is beyond its end. The media fragment is ignored."}, 11 TC0003 : { start: null, end: null, valid: false, description: "#t=a,b an d a > b", fragment: "t=7,3", comment: "Invalid semantics: the requested interval 's start is beyond its end. The media fragment is ignored."},
11 TC0004 : { start: null, end: null, valid: true, description: "#t=a,b and a = 0, b = e", fragment: "t=0,9.97", comment: "The media is requested from 0 to e."}, 12 TC0004 : { start: null, end: null, valid: true, description: "#t=a,b and a = 0, b = e", fragment: "t=0,9.97", comment: "The media is requested from 0 to e."},
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 TC0087 : { start: 3, end: 7, valid: true, description: "Rubbish after &" , fragment: "t=3,7&foo", comment: "Rubbish after & is ignored."}, 69 TC0087 : { start: 3, end: 7, valid: true, description: "Rubbish after &" , fragment: "t=3,7&foo", comment: "Rubbish after & is ignored."},
69 TC0088 : { start: 3, end: 7, valid: true, description: "Sprinkling &", f ragment: "t=3,7&&", comment: "Sprinkling & is OK."}, 70 TC0088 : { start: 3, end: 7, valid: true, description: "Sprinkling &", f ragment: "t=3,7&&", comment: "Sprinkling & is OK."},
70 TC0089 : { start: 3, end: 7, valid: true, description: "Sprinkling &", f ragment: "&t=3,7", comment: "Sprinkling & is OK."}, 71 TC0089 : { start: 3, end: 7, valid: true, description: "Sprinkling &", f ragment: "&t=3,7", comment: "Sprinkling & is OK."},
71 TC0090 : { start: 3, end: 7, valid: true, description: "Sprinkling &", f ragment: "&&t=3,7", comment: "Sprinkling & is OK."}, 72 TC0090 : { start: 3, end: 7, valid: true, description: "Sprinkling &", f ragment: "&&t=3,7", comment: "Sprinkling & is OK."},
72 TC0091 : { start: 3, end: 7, valid: true, description: "Sprinkling &", f ragment: "&t=3,7&", comment: "Sprinkling & is OK."}, 73 TC0091 : { start: 3, end: 7, valid: true, description: "Sprinkling &", f ragment: "&t=3,7&", comment: "Sprinkling & is OK."},
73 TC0092 : { start: null, end: null, valid: false, description: "Incorrect percent encoding", fragment: "t%3d10", comment: "UA knows that this is an inval id media fragment, so it will play the entire media resource."}, 74 TC0092 : { start: null, end: null, valid: false, description: "Incorrect percent encoding", fragment: "t%3d10", comment: "UA knows that this is an inval id media fragment, so it will play the entire media resource."},
74 TC0093 : { start: null, end: null, valid: false, description: "Incorrect percent encoding", fragment: "t=10%26", comment: "UA knows that this is an inva lid media fragment, so it will play the entire media resource."}, 75 TC0093 : { start: null, end: null, valid: false, description: "Incorrect percent encoding", fragment: "t=10%26", comment: "UA knows that this is an inva lid media fragment, so it will play the entire media resource."},
75 TC0094 : { start: null, end: null, valid: false, description: "Trailing comma", fragment: "t=3,7,", comment: "UA knows that this is an invalid media fra gment, so it will play the entire media resource."} 76 TC0094 : { start: null, end: null, valid: false, description: "Trailing comma", fragment: "t=3,7,", comment: "UA knows that this is an invalid media fra gment, so it will play the entire media resource."}
76 }; 77 };
77 78
79 logConsole();
80 if (window.testRunner) {
81 testRunner.dumpAsText();
82 testRunner.waitUntilDone();
83 }
84
85 function logConsole()
86 {
87 if (!consoleDiv && document.body) {
88 consoleDiv = document.createElement('div');
89 document.body.appendChild(consoleDiv);
90 }
91 return consoleDiv;
92 }
93
94 function testExpected(testFuncString, expected, comparison)
95 {
96 try {
97 var observed = eval(testFuncString);
98 } catch (ex) {
99 consoleWrite(ex);
100 return;
101 }
102
103 if (comparison === undefined)
104 comparison = '==';
105
106 var success = false;
107 switch (comparison)
108 {
109 case '<': success = observed < expected; break;
110 case '<=': success = observed <= expected; break;
111 case '>': success = observed > expected; break;
112 case '>=': success = observed >= expected; break;
113 case '!=': success = observed != expected; break;
114 case '==': success = observed == expected; break;
115 case '===': success = observed === expected; break;
116 }
117
118 reportExpected(success, testFuncString, comparison, expected, observed)
119 }
120
121 var testNumber = 0;
122
123 function reportExpected(success, testFuncString, comparison, expected, obser ved)
124 {
125 testNumber++;
126
127 var msg = "Test " + testNumber;
128
129 msg = "EXPECTED (<em>" + testFuncString + " </em>" + comparison + " '<em >" + expected + "</em>')";
130
131 if (!success)
132 msg += ", OBSERVED '<em>" + observed + "</em>'";
133
134 logResult(success, msg);
135 }
136
137 function run(testFuncString)
138 {
139 consoleWrite("RUN(" + testFuncString + ")");
140 try {
141 eval(testFuncString);
142 } catch (ex) {
143 consoleWrite(ex);
144 }
145 }
146
147 function waitForEventOnce(eventName, func, endit, doNotLog)
148 {
149 waitForEvent(eventName, func, endit, true, null, doNotLog)
150 }
151
152 function waitForEvent(eventName, func, endit, oneTimeOnly, doNotLog)
153 {
154 function _eventCallback(event)
155 {
156 if (oneTimeOnly)
157 video.removeEventListener(eventName, _eventCallback, true);
158
159 if (!doNotLog)
160 consoleWrite("EVENT(" + eventName + ")");
161
162 if (func)
163 func(event);
164
165 if (endit)
166 endTest();
167 }
168
169 video.addEventListener(eventName, _eventCallback, true);
170 }
171
172 var testEnded = false;
173
174 function endTest()
175 {
176 consoleWrite("END OF TEST");
177 testEnded = true;
178 if (window.testRunner)
179 testRunner.notifyDone();
180 }
181
182 function logResult(success, text)
183 {
184 if (success)
185 consoleWrite(text + " <span style='color:green'>OK</span>");
186 else
187 consoleWrite(text + " <span style='color:red'>FAIL</span>");
188 }
189
190 function consoleWrite(text)
191 {
192 if (testEnded)
193 return;
194 var span = document.createElement("span");
195 logConsole().appendChild(span);
196 span.innerHTML = text + '<br>';
197 }
198
78 function pause() 199 function pause()
79 { 200 {
80 const maximumStopDelta = 0.5; 201 const maximumStopDelta = 0.5;
81 var delta = Math.abs(video.currentTime - fragmentEndTime).toFixed(2); 202 var delta = Math.abs(video.currentTime - fragmentEndTime).toFixed(2);
82 reportExpected((delta <= maximumStopDelta), ("video.currentTime - fragme ntEndTime"), "<=", maximumStopDelta, delta); 203 reportExpected((delta <= maximumStopDelta), ("video.currentTime - fragme ntEndTime"), "<=", maximumStopDelta, delta);
83 204
84 endTest(); 205 endTest();
85 } 206 }
86 207
87 function canplaythrough() 208 function canplaythrough()
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 244
124 var fileName = location.href.split('/').pop(); 245 var fileName = location.href.split('/').pop();
125 currentTest = fileName.substring(0, fileName.lastIndexOf(".")); 246 currentTest = fileName.substring(0, fileName.lastIndexOf("."));
126 247
127 var info = testData[currentTest]; 248 var info = testData[currentTest];
128 consoleWrite("<br>Title: <b>" + currentTest + "</b>"); 249 consoleWrite("<br>Title: <b>" + currentTest + "</b>");
129 consoleWrite("Fragment: '<i>" + info.fragment + "</i>'"); 250 consoleWrite("Fragment: '<i>" + info.fragment + "</i>'");
130 consoleWrite("Comment: <i>" + info.comment + "</i>"); 251 consoleWrite("Comment: <i>" + info.comment + "</i>");
131 url = findMediaFile("video", "../content/counting") + "#" + info.fragmen t; 252 url = findMediaFile("video", "../content/counting") + "#" + info.fragmen t;
132 video.src = url; 253 video.src = url;
133 } 254 }
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/media/media-fragments/TC0094.html ('k') | third_party/WebKit/LayoutTests/media/video-test.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698