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

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

Issue 2062203004: IDBObserver: Lifetime Management: Adding Observer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Final architechture 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 635e3ae3faf6bbe2ad9fd28923d194d6580abae0..341ab497675544661efaf9699b51aea687819b87 100644
--- a/third_party/WebKit/LayoutTests/storage/indexeddb/resources/observer.js
+++ b/third_party/WebKit/LayoutTests/storage/indexeddb/resources/observer.js
@@ -5,22 +5,31 @@ if (this.importScripts) {
function callback(){};
async_test(function(t) {
- var description = 'observers constructor test';
- var dbname = location.pathname + ' - ' + description;
- var openRequest = indexedDB.open(dbname);
- var obs1 = new IDBObserver(callback, {transaction: true, values: true});
- openRequest.onupgradeneeded = t.step_func(function() {
- var db = openRequest.result;
- db.createObjectStore('store');
- });
- openRequest.onsuccess = t.step_func(function() {
- var db = openRequest.result;
- var tx = db.transaction('store', 'readwrite');
- obs1.observe(db, tx);
- t.done();
- });
+ 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});
-}, 'observers constructor test');
+ openRequest.onupgradeneeded = t.step_func(function() {
+ var db = openRequest.result;
+ db.createObjectStore('store');
+ });
+ openRequest.onsuccess = t.step_func(function() {
+ var db = openRequest.result;
+ var tx = db.transaction('store', 'readwrite');
+ 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();
+ });
+ });
+}, 'observer addition and removal test');
done();

Powered by Google App Engine
This is Rietveld 408576698