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

Unified Diff: third_party/WebKit/LayoutTests/storage/indexeddb/delete-range-count.html

Issue 1996443003: Return number of values deleted by IDBObjectStore.delete(range) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: deleteRange count Created 4 years, 7 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
« no previous file with comments | « content/browser/indexed_db/leveldb/leveldb_transaction.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/LayoutTests/storage/indexeddb/delete-range-count.html
diff --git a/third_party/WebKit/LayoutTests/storage/indexeddb/delete-range-count.html b/third_party/WebKit/LayoutTests/storage/indexeddb/delete-range-count.html
new file mode 100644
index 0000000000000000000000000000000000000000..f535eda36fcc60b97d6b586a547cb177d085f3b5
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/storage/indexeddb/delete-range-count.html
@@ -0,0 +1,54 @@
+<!DOCTYPE html>
+<title>IndexedDB: Delete Range Count Tests</title>
+<script src="../../resources/testharness.js"></script>
+<script src="../../resources/testharnessreport.js"></script>
+<script>
+
+function delete_count(test, description) {
+ async_test(function(t) {
+ var dbname = location.pathname + ' - ' + description;
+ var deleteRequest = indexedDB.deleteDatabase(dbname);
+ deleteRequest.onsuccess = t.step_func(function() {
+ var openRequest = indexedDB.open(dbname);
+ openRequest.onupgradeneeded = t.step_func(function(e) {
+ var db = e.target.result;
+ var store = db.createObjectStore('store');
+ for (var i = 1; i <= 10; ++i) {
+ store.put(i, i);
+ }
+ });
+ openRequest.onsuccess = t.step_func(function(e) {
+ var db = e.target.result;
+ var trans1 = db.transaction('store', 'readwrite');
+ var store = trans1.objectStore('store');
+ deleteRequest1 = store.delete(IDBKeyRange.bound(
cmumford 2016/05/26 21:02:11 Nit: "var" before deleteRequest1.
+ test.first.lower,
+ test.first.upper));
+ deleteRequest1.onsuccess = t.step_func(function(e) {
+ var delete_count = e.target.result;
+ assert_equals(delete_count, test.first.expected, 'Delete Count');
+ var trans2 = db.transaction('store', 'readwrite');
+ store = trans2.objectStore('store');
+ deleteRequest2 = store.delete(IDBKeyRange.bound(
+ test.second.lower,
+ test.second.upper));
+ deleteRequest2.onsuccess = t.step_func(function(e) {
+ delete_count = e.target.result;
+ assert_equals(delete_count, test.second.expected, 'Some records already been deleted');
+ t.done();
+ });
+ });
+ });
+ openRequest.onerror = t.unreached_func('open failed');
+ });
+ }, description);
+}
+
+delete_count({ first: { lower: 3, upper: 4, expected: 2},
+ second: { lower: 1, upper: 5, expected: 3} },
+ 'Delete Range for Overlapping Intervals');
+delete_count({ first: { lower: 3, upper: 8, expected: 6},
+ second: { lower: 3, upper: 8, expected: 0} },
+ 'Delete Range for Repeated Intervals');
+
+</script>
« no previous file with comments | « content/browser/indexed_db/leveldb/leveldb_transaction.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698