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

Side by Side Diff: third_party/WebKit/LayoutTests/storage/indexeddb/observer-transaction-test.html

Issue 2601983002: [IndexedDB] Adding transaction and value support to observers (Closed)
Patch Set: Moved transaction creation to SendObservations Created 3 years, 11 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 <html>
2 <title>IndexedDB: Observer Constructor Tests</title>
3 <meta name=timeout content=long>
4 <script src="../../resources/testharness.js"></script>
5 <script src="../../resources/testharnessreport.js"></script>
6 <script src="resources/testharness-helpers.js"></script>
7 <script>
8
9 indexeddb_test(function(t, db) {
10 db.createObjectStore("store");
11 }, function(t, db) {
12 var kKey = 'key';
13 var kNumIters = 20;
14 var callback_number = 1;
15
16 var callbackFunction = function(changes) {
17 assert_true(changes.records.has('store'), "Store not in changes");
18 // Read the value using the transaction.
19 var os = changes.transaction.objectStore('store');
20 var req = os.get(kKey);
21 var expected_value = callback_number;
22 callback_number++;
23 req.onsuccess = t.step_func(function() {
24 assert_equals(req.result, expected_value);
25 if (req.result == kNumIters) {
26 t.done();
27 }
28 });
29 }
30
31 var obs = new IDBObserver(callbackFunction);
32 var txn = db.transaction(['store'], 'readonly');
33 obs.observe(db, txn, { transaction: true, operationTypes: ['put'] });
34
35 txn.oncomplete = t.step_func(function() {
36 var name_dict = {
37 db_name: db.name,
38 num_iters: kNumIters,
39 incrementing_actions: true,
40 key: kKey
41 };
42 var hash_string = encodeURIComponent(JSON.stringify(name_dict));
43 var url = 'resources/observer-actions.js#' + hash_string;
44 new Worker(url);
45 });
46 }, 'IndexedDB Observers: Transaction data consistancy.');
47
48 </script>
49 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698