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

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: IDBDatabase weakptr introduced on IDBObserver 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..d6860c5830cad387915faa0586b2f1b93cf56e44 100644
--- a/third_party/WebKit/LayoutTests/storage/indexeddb/resources/observer.js
+++ b/third_party/WebKit/LayoutTests/storage/indexeddb/resources/observer.js
@@ -2,15 +2,20 @@ if (this.importScripts) {
importScripts('../../../resources/testharness.js');
}
-function callback(){};
+function callback1(changes){
+ console.log('changes fired 1 ' + changes.records[0].type );
+};
+
+function callback2(changes){
+ console.log('changes fired 2 ' + changes.records[0].type );
+};
async_test(function(t) {
var description = 'observer addition and removal 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 +23,20 @@ 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');
+ var put_request2 = store2.put(2,2);
+ tx2.oncomplete = t.step_func(function(){
});
-}, 'observer addition and removal test');
+ });
+ });
+}, 'observer changes test');
done();

Powered by Google App Engine
This is Rietveld 408576698