/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
- <!DOCTYPE html>
- <!-- Submitted from TestTWF Paris -->
- <html>
- <head>
- <meta charset=utf-8>
- <title id='desc'>IDBKeyRange Tests - Incorrect</title>
- <link rel=help href="http://dvcs.w3.org/hg/IndexedDB/raw-file/tip/Overview.html#range-concept">
- <link rel=assert title="If the lower key is greater than the upper key, then a DOMException of type DataError must be thrown.">
- <link rel=author href="mailto:chrcharles67@gmail.com" title="Christophe CHARLES">
- <script src="../../../resources/testharness.js"></script>
- <script src="../../../resources/testharnessreport.js"></script>
- <script src="support.js"></script>
- <script type="text/javascript">
- // TypeError: bound requires more than 0 arguments
- test( function() {
- assert_throws(new TypeError(), function() {
- IDBKeyRange.bound();
- });
- }, "IDBKeyRange.bound() - bound requires more than 0 arguments.");
- // Null parameters
- test( function() {
- assert_throws("DataError", function() {
- IDBKeyRange.bound(null, null);
- });
- }, "IDBKeyRange.bound(null, null) - null parameters are incorrect.");
- // // Null parameter
- test( function() {
- assert_throws("DataError", function() {
- IDBKeyRange.bound(1, null);
- });
- assert_throws("DataError", function() {
- IDBKeyRange.bound(null, 1);
- });
- }, "IDBKeyRange.bound(1, null / null, 1) - null parameter is incorrect.");
- // bound incorrect
- test( function() {
- var lowerBad = Math.floor(Math.random()*31) + 5;
- var upper = lowerBad - 1;
- assert_throws("DataError", function() {
- IDBKeyRange.bound(lowerBad, upper);
- });
- assert_throws("DataError", function() {
- IDBKeyRange.bound('b', 'a');
- });
- }, "IDBKeyRange.bound(lower, upper / lower > upper) - 'lower' is greater than 'upper'."
- );
- test( function() {
- assert_throws("DataError", function() {
- IDBKeyRange.bound('a', 1);
- });
- assert_throws("DataError", function() {
- IDBKeyRange.bound(new Date(), 1);
- });
- assert_throws("DataError", function() {
- IDBKeyRange.bound([1, 2], 1);
- });
- }, "IDBKeyRange.bound(DOMString/Date/Array, 1) - A DOMString, Date and Array are greater than a float.");
- // ReferenceError: the variable is not defined
- test( function() {
- var goodVariable = 1;
- assert_throws(new ReferenceError(), function() {
- IDBKeyRange.bound(noExistingVariable, 1);
- });
- assert_throws(new ReferenceError(), function() {
- IDBKeyRange.bound(goodVariable, noExistingVariable);
- });
- }, "IDBKeyRange.bound(noExistingVariable, 1 / goodVariable, noExistingVariable) - noExistingVariable is not defined.");
- // Valid type key error
- test( function() {
- assert_throws("DataError", function() {
- IDBKeyRange.bound(true, 1);
- });
- }, "IDBKeyRange.bound(true, 1) - boolean is not a valid key type.");
- </script>
- </head>
- <body>
- <div id="log"></div>
- </body>
- </html>