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

Side by Side Diff: third_party/WebKit/LayoutTests/imported/web-platform-tests/IndexedDB/idbcursor-direction.htm

Issue 1984023002: Move web-platform-tests to wpt (part 1 of 2) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <title>IDBCursor.direction</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
10 function cursor_direction(constant, dir)
11 {
12 var db,
13 t = async_test(document.title + " - " + dir),
14 expected = dir ? dir : "next";
15
16 var open_rq = createdb(t);
17
18 open_rq.onupgradeneeded = function(e) {
19 db = e.target.result;
20 var objStore = db.createObjectStore("test");
21
22 objStore.add("data", "key");
23 };
24
25 open_rq.onsuccess = t.step_func(function(e) {
26 var cursor_rq, count = 0;
27 var os = db.transaction("test")
28 .objectStore("test");
29 if (dir)
30 cursor_rq = os.openCursor(undefined, dir);
31 else
32 cursor_rq = os.openCursor();
33
34 cursor_rq.onsuccess = t.step_func(function(e) {
35 var cursor = e.target.result;
36
37 assert_equals(cursor.direction, constant, 'direction constant');
38 assert_equals(cursor.direction, expected, 'direction');
39 assert_readonly(cursor, 'direction');
40
41 count++;
42 if (count >= 2)
43 t.done();
44 });
45
46 var cursor_rq2 = db.transaction("test")
47 .objectStore("test")
48 .openCursor(undefined, constant);
49
50 cursor_rq2.onsuccess = t.step_func(function(e) {
51 var cursor = e.target.result;
52
53 assert_equals(cursor.direction, constant, 'direction constant (s econd try)');
54 assert_equals(cursor.direction, expected, 'direction (second try )');
55 assert_readonly(cursor, 'direction');
56
57 count++;
58 if (count >= 2)
59 t.done();
60 });
61
62 });
63 }
64
65 cursor_direction("next");
66 cursor_direction("next", "next");
67 cursor_direction("prev", "prev");
68 cursor_direction("nextunique", "nextunique");
69 cursor_direction("prevunique", "prevunique");
70
71 </script>
72
73 <div id="log"></div>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698