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

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

Issue 2601983002: [IndexedDB] Adding transaction and value support to observers (Closed)
Patch Set: added comments and bug link 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/LayoutTests/storage/indexeddb/observer-transaction-test.html
diff --git a/third_party/WebKit/LayoutTests/storage/indexeddb/observer-transaction-test.html b/third_party/WebKit/LayoutTests/storage/indexeddb/observer-transaction-test.html
new file mode 100644
index 0000000000000000000000000000000000000000..7e21e960493596abbffd343cdca85852b516dc63
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/storage/indexeddb/observer-transaction-test.html
@@ -0,0 +1,49 @@
+<html>
+<title>IndexedDB: Observer Constructor Tests</title>
+<meta name=timeout content=long>
+<script src="../../resources/testharness.js"></script>
+<script src="../../resources/testharnessreport.js"></script>
+<script src="resources/testharness-helpers.js"></script>
+<script>
+
+indexeddb_test(function(t, db) {
+ db.createObjectStore("store");
+}, function(t, db) {
+ var kKey = 'key';
+ var kNumIters = 20;
+ var callback_number = 1;
+
+ var callbackFunction = function(changes) {
+ assert_true(changes.records.has('store'), "Store not in changes");
+ // Read the value using the transaction.
+ var os = changes.transaction.objectStore('store');
+ var req = os.get(kKey);
+ var expected_value = callback_number;
+ callback_number++;
+ req.onsuccess = t.step_func(function() {
+ assert_equals(req.result, expected_value);
+ if (req.result == kNumIters) {
+ t.done();
+ }
+ });
+ }
+
+ var obs = new IDBObserver(callbackFunction);
+ var txn = db.transaction(['store'], 'readonly');
+ obs.observe(db, txn, { transaction: true, operationTypes: ['put'] });
+
+ txn.oncomplete = t.step_func(function() {
+ var name_dict = {
+ db_name: db.name,
+ num_iters: kNumIters,
+ incrementing_actions: true,
+ key: kKey
+ };
+ var hash_string = encodeURIComponent(JSON.stringify(name_dict));
+ var url = 'resources/observer-actions.js#' + hash_string;
+ new Worker(url);
+ });
+}, 'IndexedDB Observers: Transaction data consistancy.');
+
+</script>
+</html>

Powered by Google App Engine
This is Rietveld 408576698