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

Side by Side Diff: LayoutTests/imported/web-platform-tests/IndexedDB/idbcursor_continue_index4.htm

Issue 560893005: First checked-in import of the W3C's test suites. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: add new expectations for newly failing w3c tests Created 6 years, 3 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
(Empty)
1 <!DOCTYPE html>
2 <title>IDBCursor.continue() - index - attempt to iterate to the next record when the direction is set for the previous record</title>
3 <link rel="author" title="Microsoft" href="http://www.microsoft.com">
4 <link rel=help href="http://dvcs.w3.org/hg/IndexedDB/raw-file/tip/Overview.html# widl-IDBCursor-continue-void-any-key">
5 <link rel=assert title="The parameter is greater than or equal to this cursor's position and this cursor's direction is 'prev' or 'prevunique'.">
6 <script src="../../../resources/testharness.js"></script>
7 <script src="../../../resources/testharnessreport.js"></script>
8 <script src="support.js"></script>
9
10 <script>
11
12 var db,
13 t = async_test(),
14 records = [ { pKey: "primaryKey_0", iKey: "indexKey_0" },
15 { pKey: "primaryKey_1", iKey: "indexKey_1" },
16 { pKey: "primaryKey_2", iKey: "indexKey_2" } ];
17
18 var open_rq = createdb(t);
19 open_rq.onupgradeneeded = function(e) {
20 db = e.target.result;
21 var objStore = db.createObjectStore("test", { keyPath: "pKey" });
22
23 objStore.createIndex("index", "iKey");
24
25 for (var i = 0; i < records.length; i++)
26 objStore.add(records[i]);
27 };
28
29 open_rq.onsuccess = function(e) {
30 var count = 0,
31 cursor_rq = db.transaction("test")
32 .objectStore("test")
33 .index("index")
34 .openCursor(undefined, "prev"); // XXX Fx issues w undef ined
35
36 cursor_rq.onsuccess = t.step_func(function(e) {
37 var cursor = e.target.result,
38 record = cursor.value;
39
40 switch(count) {
41 case 0:
42 assert_equals(record.pKey, records[2].pKey, "first pKey");
43 assert_equals(record.iKey, records[2].iKey, "first iKey");
44 cursor.continue();
45 break;
46
47 case 1:
48 assert_equals(record.pKey, records[1].pKey, "second pKey");
49 assert_equals(record.iKey, records[1].iKey, "second iKey");
50 assert_throws("DataError",
51 function() { cursor.continue("indexKey_2"); });
52 t.done();
53 break;
54
55 default:
56 assert_unreached("Unexpected count value: " + count);
57 }
58
59 count++;
60 });
61 };
62
63 </script>
64
65 <div id="log"></div>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698