| OLD | NEW | 
| (Empty) |  | 
 |   1 <!--  | 
 |   2 Test converted from WebKit: | 
 |   3 http://trac.webkit.org/browser/trunk/LayoutTests/storage/indexeddb/cursor-overlo
    ads.html | 
 |   4  --> | 
 |   5  | 
 |   6 <!DOCTYPE html> | 
 |   7 <!--  Submitted from TestTWF Paris  --> | 
 |   8 <meta charset=utf-8> | 
 |   9 <title>Validate the overloads of IDBObjectStore.openCursor(), IDBIndex.openCurso
    r() and IDBIndex.openKeyCursor()</title> | 
 |  10 <link rel=author href="mailto:romain.huet@gmail.com" title="Romain Huet"> | 
 |  11  | 
 |  12 <script src=../../../resources/testharness.js></script> | 
 |  13 <script src=../../../resources/testharnessreport.js></script> | 
 |  14 <script src=support.js></script> | 
 |  15  | 
 |  16 <script> | 
 |  17  | 
 |  18     var db, trans, store, index; | 
 |  19     var t = async_test(); | 
 |  20  | 
 |  21     var request = createdb(t); | 
 |  22     request.onupgradeneeded = function(e) { | 
 |  23         db = request.result; | 
 |  24         store = db.createObjectStore('store'); | 
 |  25         index = store.createIndex('index', 'value'); | 
 |  26         store.put({value: 0}, 0); | 
 |  27         trans = request.transaction; | 
 |  28         trans.oncomplete = verifyOverloads; | 
 |  29     }; | 
 |  30  | 
 |  31     function verifyOverloads() { | 
 |  32         trans = db.transaction('store'); | 
 |  33         store = trans.objectStore('store'); | 
 |  34         index = store.index('index'); | 
 |  35  | 
 |  36         checkCursorDirection("store.openCursor()", "next"); | 
 |  37         checkCursorDirection("store.openCursor(0)", "next"); | 
 |  38         checkCursorDirection("store.openCursor(0, 'next')", "next"); | 
 |  39         checkCursorDirection("store.openCursor(0, 'nextunique')", "nextunique"); | 
 |  40         checkCursorDirection("store.openCursor(0, 'prev')", "prev"); | 
 |  41         checkCursorDirection("store.openCursor(0, 'prevunique')", "prevunique"); | 
 |  42  | 
 |  43         checkCursorDirection("store.openCursor(IDBKeyRange.only(0))", "next"); | 
 |  44         checkCursorDirection("store.openCursor(IDBKeyRange.only(0), 'next')", "n
    ext"); | 
 |  45         checkCursorDirection("store.openCursor(IDBKeyRange.only(0), 'nextunique'
    )", "nextunique"); | 
 |  46         checkCursorDirection("store.openCursor(IDBKeyRange.only(0), 'prev')", "p
    rev"); | 
 |  47         checkCursorDirection("store.openCursor(IDBKeyRange.only(0), 'prevunique'
    )", "prevunique"); | 
 |  48  | 
 |  49         checkCursorDirection("index.openCursor()", "next"); | 
 |  50         checkCursorDirection("index.openCursor(0)", "next"); | 
 |  51         checkCursorDirection("index.openCursor(0, 'next')", "next"); | 
 |  52         checkCursorDirection("index.openCursor(0, 'nextunique')", "nextunique"); | 
 |  53         checkCursorDirection("index.openCursor(0, 'prev')", "prev"); | 
 |  54         checkCursorDirection("index.openCursor(0, 'prevunique')", "prevunique"); | 
 |  55  | 
 |  56         checkCursorDirection("index.openCursor(IDBKeyRange.only(0))", "next"); | 
 |  57         checkCursorDirection("index.openCursor(IDBKeyRange.only(0), 'next')", "n
    ext"); | 
 |  58         checkCursorDirection("index.openCursor(IDBKeyRange.only(0), 'nextunique'
    )", "nextunique"); | 
 |  59         checkCursorDirection("index.openCursor(IDBKeyRange.only(0), 'prev')", "p
    rev"); | 
 |  60         checkCursorDirection("index.openCursor(IDBKeyRange.only(0), 'prevunique'
    )", "prevunique"); | 
 |  61  | 
 |  62         checkCursorDirection("index.openKeyCursor()", "next"); | 
 |  63         checkCursorDirection("index.openKeyCursor(0)", "next"); | 
 |  64         checkCursorDirection("index.openKeyCursor(0, 'next')", "next"); | 
 |  65         checkCursorDirection("index.openKeyCursor(0, 'nextunique')", "nextunique
    "); | 
 |  66         checkCursorDirection("index.openKeyCursor(0, 'prev')", "prev"); | 
 |  67         checkCursorDirection("index.openKeyCursor(0, 'prevunique')", "prevunique
    "); | 
 |  68  | 
 |  69         checkCursorDirection("index.openKeyCursor(IDBKeyRange.only(0))", "next")
    ; | 
 |  70         checkCursorDirection("index.openKeyCursor(IDBKeyRange.only(0), 'next')",
     "next"); | 
 |  71         checkCursorDirection("index.openKeyCursor(IDBKeyRange.only(0), 'nextuniq
    ue')", "nextunique"); | 
 |  72         checkCursorDirection("index.openKeyCursor(IDBKeyRange.only(0), 'prev')",
     "prev"); | 
 |  73         checkCursorDirection("index.openKeyCursor(IDBKeyRange.only(0), 'prevuniq
    ue')", "prevunique"); | 
 |  74  | 
 |  75         t.done(); | 
 |  76     } | 
 |  77  | 
 |  78     function checkCursorDirection(statement, direction) { | 
 |  79         request = eval(statement); | 
 |  80         request.onsuccess = function(event) { | 
 |  81             assert_not_equals(event.target.result, null, "Check the result is no
    t null") | 
 |  82             assert_equals(event.target.result.direction, direction, "Check the r
    esult direction"); | 
 |  83         }; | 
 |  84     } | 
 |  85  | 
 |  86 </script> | 
 |  87  | 
 |  88 <div id=log></div> | 
| OLD | NEW |