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

Side by Side Diff: LayoutTests/imported/web-platform-tests/IndexedDB/idbcursor-reused.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 is reused</title>
3 <link rel="author" href="mailto:odinho@opera.com" title="Odin Hørthe Omdal">
4 <meta rel=help href="http://dvcs.w3.org/hg/IndexedDB/raw-file/tip/Overview.html# widl-IDBCursor-continue-void-any-key">
5 <meta rel=assert title="Otherwise this method runs the steps for asynchronously executing a request. However, the steps are slightly modified such that instead of creating a new IDBRequest, it reuses the request originally created when this cursor was created. The done flag on the request is set to false before the req uest is returned. The steps are run with the cursor's source as source and the s teps for iterating a cursor as operation, using this cursor as cursor and the ke y parameter as key.">
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 var open_rq = createdb(async_test())
14
15 open_rq.onupgradeneeded = function(e) {
16 db = e.target.result
17 var os = db.createObjectStore("test")
18
19 os.add("data", "k")
20 os.add("data2", "k2")
21 }
22
23 open_rq.onsuccess = function(e) {
24 var cursor
25 var count = 0
26 var rq = db.transaction("test").objectStore("test").openCursor()
27
28 rq.onsuccess = this.step_func(function(e)
29 {
30 switch(count)
31 {
32 case 0:
33 cursor = e.target.result
34
35 assert_equals(cursor.value, "data", "prequisite cursor.v alue")
36 cursor.custom_cursor_value = 1
37 e.target.custom_request_value = 2
38
39 cursor.continue()
40 break
41
42 case 1:
43 assert_equals(cursor.value, "data2", "prequisite cursor. value")
44 assert_equals(cursor.custom_cursor_value, 1, "custom cur sor value")
45 assert_equals(e.target.custom_request_value, 2, "custom request value")
46
47 cursor.advance(1)
48 break
49
50 case 2:
51 assert_false(!!e.target.result, "got cursor")
52 assert_equals(cursor.custom_cursor_value, 1, "custom cur sor value")
53 assert_equals(e.target.custom_request_value, 2, "custom request value")
54 break
55 }
56 count++
57 })
58
59 rq.transaction.oncomplete = this.step_func(function() {
60 assert_equals(count, 3, "cursor callback runs")
61 assert_equals(rq.custom_request_value, 2, "variable placed on ol d IDBRequest")
62 assert_equals(cursor.custom_cursor_value, 1, "custom cursor valu e (transaction.complete)")
63 this.done()
64 })
65 }
66
67 </script>
68
69 <div id="log"></div>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698