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

Unified Diff: LayoutTests/imported/web-platform-tests/IndexedDB/idbcursor_advance_index.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 side-by-side diff with in-line comments
Download patch
Index: LayoutTests/imported/web-platform-tests/IndexedDB/idbcursor_advance_index.htm
diff --git a/LayoutTests/imported/web-platform-tests/IndexedDB/idbcursor_advance_index.htm b/LayoutTests/imported/web-platform-tests/IndexedDB/idbcursor_advance_index.htm
new file mode 100644
index 0000000000000000000000000000000000000000..a4290514c66ebcccf757e291c26dca035a4b26bc
--- /dev/null
+++ b/LayoutTests/imported/web-platform-tests/IndexedDB/idbcursor_advance_index.htm
@@ -0,0 +1,57 @@
+<!DOCTYPE html>
+<title>IDBCursor.advance() - index - iterate cursor number of times specified by count </title>
+<link rel="author" title="Microsoft" href="http://www.microsoft.com">
+<script src=../../../resources/testharness.js></script>
+<script src=../../../resources/testharnessreport.js></script>
+<script src=support.js></script>
+
+<script>
+ var db,
+ count = 0,
+ t = async_test(),
+ records = [ { pKey: "primaryKey_0", iKey: "indexKey_0" },
+ { pKey: "primaryKey_1", iKey: "indexKey_1" },
+ { pKey: "primaryKey_2", iKey: "indexKey_2" },
+ { pKey: "primaryKey_3", iKey: "indexKey_3" }];
+
+ var open_rq = createdb(t);
+ open_rq.onupgradeneeded = function(e) {
+ db = event.target.result;
+ var store = db.createObjectStore("test", {keyPath:"pKey"});
+ store.createIndex("idx", "iKey");
+
+ for(var i = 0; i < records.length; i++) {
+ store.add(records[i]);
+ }
+ };
+
+ open_rq.onsuccess = function (e) {
+ var cursor_rq = db.transaction("test")
+ .objectStore("test")
+ .index("idx")
+ .openCursor();
+
+ cursor_rq.onsuccess = t.step_func(function(e) {
+ var cursor = e.target.result;
+ assert_true(cursor instanceof IDBCursor);
+
+ switch(count) {
+ case 0:
+ count += 3;
+ cursor.advance(3);
+ break;
+ case 3:
+ var record = cursor.value;
+ assert_equals(record.pKey, records[count].pKey, "record.pKey");
+ assert_equals(record.iKey, records[count].iKey, "record.iKey");
+ t.done();
+ break;
+ default:
+ assert_unreached("unexpected count");
+ break;
+ }
+ });
+ }
+</script>
+
+<div id=log></div>

Powered by Google App Engine
This is Rietveld 408576698