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

Side by Side Diff: LayoutTests/imported/web-platform-tests/IndexedDB/idbcursor_delete_objectstore.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.delete() - object store - remove a record from the object store </title>
3 <link rel="author" title="Microsoft" href="http://www.microsoft.com">
4 <script src="../../../resources/testharness.js"></script>
5 <script src="../../../resources/testharnessreport.js"></script>
6 <script src="support.js"></script>
7
8 <script>
9
10 var db,
11 count = 0,
12 t = async_test(),
13 records = [ { pKey: "primaryKey_0" },
14 { pKey: "primaryKey_1" } ];
15
16 var open_rq = createdb(t);
17 open_rq.onupgradeneeded = function(e) {
18 db = e.target.result;
19
20 var objStore = db.createObjectStore("test", { keyPath: "pKey" });
21
22 for (var i = 0; i < records.length; i++)
23 objStore.add(records[i]);
24 };
25
26 open_rq.onsuccess = t.step_func(CursorDeleteRecord);
27
28
29 function CursorDeleteRecord(e) {
30 var txn = db.transaction("test", "readwrite"),
31 cursor_rq = txn.objectStore("test").openCursor();
32
33 cursor_rq.onsuccess = t.step_func(function(e) {
34 var cursor = e.target.result;
35
36 assert_true(cursor != null, "cursor exist");
37 cursor.delete();
38 });
39
40 txn.oncomplete = t.step_func(VerifyRecordWasDeleted);
41 }
42
43
44 function VerifyRecordWasDeleted(e) {
45 var cursor_rq = db.transaction("test")
46 .objectStore("test")
47 .openCursor();
48
49 cursor_rq.onsuccess = t.step_func(function(e) {
50 var cursor = e.target.result;
51
52 if (!cursor) {
53 assert_equals(count, 1, 'count');
54 t.done();
55 }
56
57 assert_equals(cursor.value.pKey, records[1].pKey);
58 count++;
59 cursor.continue();
60 });
61 }
62
63 </script>
64
65 <div id="log"></div>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698