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

Unified Diff: third_party/WebKit/LayoutTests/storage/indexeddb/resources/observer.js

Issue 2125213002: [IndexedDB] Propogating changes to observers : Renderer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@lifetime
Patch Set: Implements IDBObserverChanges IDL records map Created 4 years, 5 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/resources/observer.js
diff --git a/third_party/WebKit/LayoutTests/storage/indexeddb/resources/observer.js b/third_party/WebKit/LayoutTests/storage/indexeddb/resources/observer.js
index 341ab497675544661efaf9699b51aea687819b87..b54380d7df9b5d4deda99d910cf92435cc17e171 100644
--- a/third_party/WebKit/LayoutTests/storage/indexeddb/resources/observer.js
+++ b/third_party/WebKit/LayoutTests/storage/indexeddb/resources/observer.js
@@ -2,15 +2,22 @@ if (this.importScripts) {
importScripts('../../../resources/testharness.js');
}
-function callback(){};
+function callback1(changes){
+ console.log('changes fired 1 ' + changes.records );
+ for(var objStore in changes.records ) {
+ console.log(objStore);
+ for(var i in changes.records[objStore]) {
+ console.log(changes.records[objStore][i].type);
+ }
+ }
+};
async_test(function(t) {
- var description = 'observer addition and removal test';
+ var description = 'observer changes test';
var dbname = location.pathname + ' - ' + description;
var openRequest = indexedDB.open(dbname);
- var obs1 = new IDBObserver(callback, {transaction: true, values: true});
- var obs2 = new IDBObserver(callback, {transaction: true, values: true});
-
+ var obs1 = new IDBObserver(callback1, {transaction: true, values: true});
+ var obs2 = new IDBObserver(callback2, {transaction: true, values: true});
openRequest.onupgradeneeded = t.step_func(function() {
var db = openRequest.result;
db.createObjectStore('store');
@@ -18,18 +25,21 @@ async_test(function(t) {
openRequest.onsuccess = t.step_func(function() {
var db = openRequest.result;
var tx = db.transaction('store', 'readwrite');
+ obs1.observe(db, tx);
+ obs1.observe(db, tx);
+ obs2.observe(db, tx);
var store = tx.objectStore('store');
- var put_request = store.put(1,1);
- obs1.observe(db, tx);
- obs1.unobserve(db);
- obs1.observe(db, tx);
- obs2.observe(db, tx);
- tx.oncomplete = t.step_func(function(){
- obs1.unobserve(db);
- t.done();
- });
+ var put_request = store.put(1,1);
+ tx.oncomplete = t.step_func(function(){
+ var tx2 = db.transaction('store', 'readwrite');
+ var store2 = tx2.objectStore('store');
+ store2.put(2,2);
+ store2.put(3,3);
+ tx2.oncomplete = t.step_func(function(){
});
-}, 'observer addition and removal test');
+ });
+ });
+}, 'observer changes test');
done();

Powered by Google App Engine
This is Rietveld 408576698