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

Side by Side Diff: third_party/WebKit/LayoutTests/storage/indexeddb/idbcursor-delete-exception-order.html

Issue 2659513002: Upstream an assortment of IndexedDB tests to WPT. (Closed)
Patch Set: Rebased MANIFEST.json Created 3 years, 10 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>IndexedDB: IDBCursor delete() Exception Ordering</title>
3 <meta charset=utf-8>
4 <link rel="help" href="https://w3c.github.io/IndexedDB/#dom-idbcursor-delete">
5 <script src="../../resources/testharness.js"></script>
6 <script src="../../resources/testharnessreport.js"></script>
7 <script src="resources/testharness-helpers.js"></script>
8 <script>
9
10 indexeddb_test(
11 (t, db) => {
12 const s = db.createObjectStore('s');
13 s.put('value', 'key');
14 },
15 (t, db) => {
16 const s = db.transaction('s', 'readonly').objectStore('s');
17 const r = s.openCursor();
18 r.onsuccess = t.step_func(() => {
19 r.onsuccess = null;
20 const cursor = r.result;
21 setTimeout(t.step_func(() => {
22 assert_throws('TransactionInactiveError', () => {
23 cursor.delete();
24 }, '"Transaction inactive" check (TransactionInactivError) ' +
25 'should precede "read only" check (ReadOnlyError)');
26 t.done();
27 }), 0);
28 });
29 },
30 'IDBCursor.delete exception order: TransactionInactiveError vs. ReadOnlyError'
31 );
32
33 indexeddb_test(
34 (t, db) => {
35 const s = db.createObjectStore('s');
36 s.put('value', 'key');
37 },
38 (t, db) => {
39 const s = db.transaction('s', 'readonly').objectStore('s');
40 const r = s.openCursor();
41 r.onsuccess = t.step_func(() => {
42 r.onsuccess = null;
43 const cursor = r.result;
44 cursor.continue();
45 assert_throws('ReadOnlyError', () => {
46 cursor.delete();
47 }, '"Read only" check (ReadOnlyError) should precede ' +
48 '"got value flag" (InvalidStateError) check');
49 t.done();
50 });
51 },
52 'IDBCursor.delete exception order: ReadOnlyError vs. InvalidStateError #1'
53 );
54
55 indexeddb_test(
56 (t, db) => {
57 const s = db.createObjectStore('s');
58 s.put('value', 'key');
59 },
60 (t, db) => {
61 const s = db.transaction('s', 'readonly').objectStore('s');
62 const r = s.openKeyCursor();
63 r.onsuccess = t.step_func(() => {
64 r.onsuccess = null;
65 const cursor = r.result;
66 assert_throws('ReadOnlyError', () => {
67 cursor.delete();
68 }, '"Read only" check (ReadOnlyError) should precede ' +
69 '"key only flag" (InvalidStateError) check');
70 t.done();
71 });
72 },
73 'IDBCursor.delete exception order: ReadOnlyError vs. InvalidStateError #2'
74 );
75
76 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698