PageRenderTime 38ms CodeModel.GetById 1ms RepoModel.GetById 0ms app.codeStats 0ms

/third_party/WebKit/LayoutTests/imported/web-platform-tests/IndexedDB/idbkeyrange_incorrect.htm

https://gitlab.com/jonnialva90/iridium-browser
HTML | 92 lines | 78 code | 13 blank | 1 comment | 0 complexity | 0aed97df4d84a4c46b2614bd5235c639 MD5 | raw file
  1. <!DOCTYPE html>
  2. <!-- Submitted from TestTWF Paris -->
  3. <html>
  4. <head>
  5. <meta charset=utf-8>
  6. <title id='desc'>IDBKeyRange Tests - Incorrect</title>
  7. <link rel=help href="http://dvcs.w3.org/hg/IndexedDB/raw-file/tip/Overview.html#range-concept">
  8. <link rel=assert title="If the lower key is greater than the upper key, then a DOMException of type DataError must be thrown.">
  9. <link rel=author href="mailto:chrcharles67@gmail.com" title="Christophe CHARLES">
  10. <script src="../../../resources/testharness.js"></script>
  11. <script src="../../../resources/testharnessreport.js"></script>
  12. <script src="support.js"></script>
  13. <script type="text/javascript">
  14. // TypeError: bound requires more than 0 arguments
  15. test( function() {
  16. assert_throws(new TypeError(), function() {
  17. IDBKeyRange.bound();
  18. });
  19. }, "IDBKeyRange.bound() - bound requires more than 0 arguments.");
  20. // Null parameters
  21. test( function() {
  22. assert_throws("DataError", function() {
  23. IDBKeyRange.bound(null, null);
  24. });
  25. }, "IDBKeyRange.bound(null, null) - null parameters are incorrect.");
  26. // // Null parameter
  27. test( function() {
  28. assert_throws("DataError", function() {
  29. IDBKeyRange.bound(1, null);
  30. });
  31. assert_throws("DataError", function() {
  32. IDBKeyRange.bound(null, 1);
  33. });
  34. }, "IDBKeyRange.bound(1, null / null, 1) - null parameter is incorrect.");
  35. // bound incorrect
  36. test( function() {
  37. var lowerBad = Math.floor(Math.random()*31) + 5;
  38. var upper = lowerBad - 1;
  39. assert_throws("DataError", function() {
  40. IDBKeyRange.bound(lowerBad, upper);
  41. });
  42. assert_throws("DataError", function() {
  43. IDBKeyRange.bound('b', 'a');
  44. });
  45. }, "IDBKeyRange.bound(lower, upper / lower > upper) - 'lower' is greater than 'upper'."
  46. );
  47. test( function() {
  48. assert_throws("DataError", function() {
  49. IDBKeyRange.bound('a', 1);
  50. });
  51. assert_throws("DataError", function() {
  52. IDBKeyRange.bound(new Date(), 1);
  53. });
  54. assert_throws("DataError", function() {
  55. IDBKeyRange.bound([1, 2], 1);
  56. });
  57. }, "IDBKeyRange.bound(DOMString/Date/Array, 1) - A DOMString, Date and Array are greater than a float.");
  58. // ReferenceError: the variable is not defined
  59. test( function() {
  60. var goodVariable = 1;
  61. assert_throws(new ReferenceError(), function() {
  62. IDBKeyRange.bound(noExistingVariable, 1);
  63. });
  64. assert_throws(new ReferenceError(), function() {
  65. IDBKeyRange.bound(goodVariable, noExistingVariable);
  66. });
  67. }, "IDBKeyRange.bound(noExistingVariable, 1 / goodVariable, noExistingVariable) - noExistingVariable is not defined.");
  68. // Valid type key error
  69. test( function() {
  70. assert_throws("DataError", function() {
  71. IDBKeyRange.bound(true, 1);
  72. });
  73. }, "IDBKeyRange.bound(true, 1) - boolean is not a valid key type.");
  74. </script>
  75. </head>
  76. <body>
  77. <div id="log"></div>
  78. </body>
  79. </html>