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

Side by Side Diff: LayoutTests/imported/web-platform-tests/IndexedDB/idbcursor_iterating_index2.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 - add next element, and iterate to it</title >
3 <link rel="author" href="mailto:odinho@opera.com" title="Odin Hørthe Omdal">
4 <script src="../../../resources/testharness.js"></script>
5 <script src="../../../resources/testharnessreport.js"></script>
6 <script src="support.js"></script>
7
8 <script>
9 var db,
10 count = 0,
11 t = async_test(document.title, {timeout: 10000}),
12 records = [ { pKey: "primaryKey_0", obj: { iKey: "iKey_0" }},
13 { pKey: "primaryKey_2", obj: { iKey: "iKey_2" }} ],
14
15 expected = [ [ "primaryKey_2", "iKey_2" ],
16 [ "primaryKey_1", "iKey_1" ],
17 [ "primaryKey_0", "iKey_0" ] ];
18
19 var open_rq = createdb(t);
20 open_rq.onupgradeneeded = function(e) {
21 db = e.target.result;
22 var objStore = db.createObjectStore("test", {keyPath:"pKey"});
23 objStore.createIndex("index", [ "pKey", "obj.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 cursor_rq = db.transaction("test", "readwrite")
31 .objectStore("test")
32 .index("index")
33 .openCursor(null, "prev");
34
35 cursor_rq.onsuccess = t.step_func(function(e) {
36 var cursor = e.target.result;
37 if (!cursor) {
38 assert_equals(count, 3, "cursor run count");
39 t.done();
40 }
41
42 if (count === 0) {
43 e.target.source.objectStore.add({ pKey: "primaryKey_1", obj: { i Key: "iKey_1" } });
44 }
45 assert_array_equals(cursor.key, expected[count], "primary key");
46
47 cursor.continue();
48 count++;
49 });
50 };
51 </script>
52
53 <div id="log"> </div>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698