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

Side by Side Diff: LayoutTests/fast/js/webidl-type-mapping.html

Issue 16951005: Add support for byte and octet Web IDL types to the bindings generator (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Take Kentaro's feedback into consideration Created 7 years, 6 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 | Annotate | Revision Log
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <script src="resources/js-test-pre.js"></script> 2 <script src="resources/js-test-pre.js"></script>
3 <script> 3 <script>
4 description("Exercise WebIDL type conversions."); 4 description("Exercise WebIDL type conversions.");
5 5
6 quiet = true; 6 quiet = true;
7 evalAndLog("converter = window.internals.typeConversions()"); 7 evalAndLog("converter = window.internals.typeConversions()");
8 debug(""); 8 debug("");
9 9
10 function verifyAttribute(attribute) 10 function verifyAttribute(attribute)
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after
318 convertThrows(type, "-Number.MAX_VALUE"); 318 convertThrows(type, "-Number.MAX_VALUE");
319 convert(type, "1.99", "1"); 319 convert(type, "1.99", "1");
320 convertThrows(type, "-1.99"); 320 convertThrows(type, "-1.99");
321 convertThrows(type, "Infinity"); 321 convertThrows(type, "Infinity");
322 convertThrows(type, "-Infinity"); 322 convertThrows(type, "-Infinity");
323 convertThrows(type, "NaN"); 323 convertThrows(type, "NaN");
324 testNonNumericToNumericEnforceRange(type); 324 testNonNumericToNumericEnforceRange(type);
325 convertThrows(type, "{valueOf:function(){throw new Error('custom');}}"); 325 convertThrows(type, "{valueOf:function(){throw new Error('custom');}}");
326 debug(""); 326 debug("");
327 327
328 type = "testByte";
329 verifyAttribute(type);
330 convert(type, "0");
331 convert(type, "-1");
332 convert(type, "1");
333 convert(type, "0x7F");
334 convert(type, "0x80", "-0x80");
335 convert(type, "-0x7F");
336 convert(type, "-0x80");
337 convert(type, "-0x81", "0x7F");
338 convert(type, "Number.MIN_VALUE", "0");
339 convert(type, "-Number.MIN_VALUE", "0");
340 convert(type, "Number.MAX_VALUE", "0");
341 convert(type, "-Number.MAX_VALUE", "0");
342 convert(type, "1.99", "1");
343 convert(type, "-1.99", "-1");
344 convert(type, "Infinity", "0");
345 convert(type, "-Infinity", "0");
346 convert(type, "NaN", "0");
347 testNonNumericToNumeric(type);
348 convertThrows(type, "{valueOf:function(){throw new Error('custom');}}");
349 debug("");
350
351 type = "testEnforceRangeByte";
352 verifyAttribute(type);
353 convert(type, "0");
354 convert(type, "-1");
355 convert(type, "1");
356 convert(type, "0x7F");
357 convertThrows(type, "0x80");
358 convert(type, "-0x7F");
359 convert(type, "-0x80");
360 convertThrows(type, "-0x81");
361 convert(type, "Number.MIN_VALUE", "0");
362 convert(type, "-Number.MIN_VALUE", "0");
363 convertThrows(type, "Number.MAX_VALUE");
364 convertThrows(type, "-Number.MAX_VALUE");
365 convert(type, "1.99", "1");
366 convert(type, "-1.99", "-1");
367 convertThrows(type, "Infinity");
368 convertThrows(type, "-Infinity");
369 convertThrows(type, "NaN");
370 testNonNumericToNumericEnforceRange(type);
371 convertThrows(type, "{valueOf:function(){throw new Error('custom');}}");
372 debug("");
373
374 type = "testOctet";
375 verifyAttribute(type);
376 convert(type, "0");
377 convert(type, "-1", "0xFF");
378 convert(type, "1");
379 convert(type, "0x7F");
380 convert(type, "0x80");
381 convert(type, "0xFF");
382 convert(type, "0x100", "0");
383 convert(type, "0x101", "1");
384 convert(type, "-0x80", "0x80");
385 convert(type, "-0x81", "0x7F");
386 convert(type, "Number.MAX_VALUE", "0");
387 convert(type, "Number.MIN_VALUE", "0");
388 convert(type, "-Number.MAX_VALUE", "0");
389 convert(type, "-Number.MIN_VALUE", "0");
390 convert(type, "1.99", "1");
391 convert(type, "-1.99", "0xFF");
392 convert(type, "Infinity", "0");
393 convert(type, "-Infinity", "0");
394 convert(type, "NaN", "0");
395 testNonNumericToNumeric(type);
396 convertThrows(type, "{valueOf:function(){throw new Error('custom');}}");
397 debug("");
398
399 type = "testEnforceRangeOctet";
400 verifyAttribute(type);
401 convert(type, "0");
402 convertThrows(type, "-1");
403 convert(type, "1");
404 convert(type, "0x7F");
405 convert(type, "0x80");
406 convert(type, "0xFF");
407 convertThrows(type, "0x100");
408 convertThrows(type, "0x101");
409 convertThrows(type, "-0x80");
410 convertThrows(type, "-0x81");
411 convertThrows(type, "Number.MAX_VALUE");
412 convert(type, "Number.MIN_VALUE", "0");
413 convertThrows(type, "-Number.MAX_VALUE");
414 convert(type, "-Number.MIN_VALUE", "0");
415 convert(type, "1.99", "1");
416 convertThrows(type, "-1.99");
417 convertThrows(type, "Infinity");
418 convertThrows(type, "-Infinity");
419 convertThrows(type, "NaN");
420 testNonNumericToNumericEnforceRange(type);
421 convertThrows(type, "{valueOf:function(){throw new Error('custom');}}");
422 debug("");
423
328 </script> 424 </script>
329 <script src="resources/js-test-post.js"></script> 425 <script src="resources/js-test-post.js"></script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698