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

Side by Side Diff: third_party/WebKit/LayoutTests/storage/indexeddb/empty-transaction-order.html

Issue 2083203002: IndexedDB: Ensure transactions without requests commit in the same order (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Review feedback Created 4 years, 6 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
« no previous file with comments | « content/browser/indexed_db/indexed_db_transaction.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <title>IndexedDB: Commit ordering of empty transactions</title>
3 <script src='../../resources/testharness.js'></script>
4 <script src='../../resources/testharnessreport.js'></script>
5 <script src='resources/testharness-helpers.js'></script>
6 <script>
7
8 function expect(t, expected) {
9 var results = [];
10 return result => {
11 results.push(result);
12 if (results.length === expected.length) {
13 assert_array_equals(results, expected);
14 t.done();
15 }
16 };
17 }
18
19 indexeddb_test(
20 (t, db) => {
21 db.createObjectStore('store');
22 },
23 (t, db) => {
24 var saw = expect(t, ['rq1.onsuccess',
25 'rq2.onsuccess',
26 'tx1.oncomplete',
27 'tx2.oncomplete']);
28
29 var tx1 = db.transaction('store', 'readwrite');
30 tx1.onabort = t.unreached_func('transaction should commit');
31 tx1.oncomplete = t.step_func(() => saw('tx1.oncomplete'));
32
33 var store = tx1.objectStore('store');
34 var rq1 = store.put('a', 1);
35 rq1.onerror = t.unreached_func('put should succeed');
36 rq1.onsuccess = t.step_func(() => {
37 saw('rq1.onsuccess');
38
39 var tx2 = db.transaction('store', 'readonly');
40 tx2.onabort = t.unreached_func('transaction should commit');
41 tx2.oncomplete = t.step_func(() => saw('tx2.oncomplete'));
42
43 var rq2 = store.put('b', 2);
44 rq2.onsuccess = t.step_func(() => saw('rq2.onsuccess'));
45 rq2.onerror = t.unreached_func('request should succeed');
46 });
47
48 },
49 'Transactions without requests complete in the expected order');
50
51 indexeddb_test(
52 (t, db) => {
53 db.createObjectStore('store');
54 },
55 (t, db) => {
56 var saw = expect(t, ['rq1.onsuccess',
57 'rq2.onsuccess',
58 'tx1.oncomplete',
59 'tx2.oncomplete',
60 'tx3.oncomplete']);
61 var tx1 = db.transaction('store', 'readwrite');
62 tx1.onabort = t.unreached_func('transaction should commit');
63 tx1.oncomplete = t.step_func(() => saw('tx1.oncomplete'));
64
65 var store = tx1.objectStore('store');
66 var rq1 = store.put('a', 1);
67 rq1.onerror = t.unreached_func('put should succeed');
68 rq1.onsuccess = t.step_func(() => {
69 saw('rq1.onsuccess');
70
71 var tx2 = db.transaction('store', 'readonly');
72 tx2.onabort = t.unreached_func('transaction should commit');
73 tx2.oncomplete = t.step_func(() => saw('tx2.oncomplete'));
74
75 var tx3 = db.transaction('store', 'readonly');
76 tx3.onabort = t.unreached_func('transaction should commit');
77 tx3.oncomplete = t.step_func(() => saw('tx3.oncomplete'));
78
79 var rq2 = store.put('b', 2);
80 rq2.onsuccess = t.step_func(() => saw('rq2.onsuccess'));
81 rq2.onerror = t.unreached_func('request should succeed');
82 });
83 },
84 'Multiple transactions without requests complete in the expected order');
85 </script>
OLDNEW
« no previous file with comments | « content/browser/indexed_db/indexed_db_transaction.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698