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

Unified Diff: third_party/WebKit/LayoutTests/external/wpt/IndexedDB/support.js

Issue 2659513002: Upstream an assortment of IndexedDB tests to WPT. (Closed)
Patch Set: Rebased MANIFEST.json 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/external/wpt/IndexedDB/support.js
diff --git a/third_party/WebKit/LayoutTests/external/wpt/IndexedDB/support.js b/third_party/WebKit/LayoutTests/external/wpt/IndexedDB/support.js
index 814987393be25ee3794094cde6bfa487503deea5..4bfaf72caa590ee11ed28ec16ef52db3248e4df2 100644
--- a/third_party/WebKit/LayoutTests/external/wpt/IndexedDB/support.js
+++ b/third_party/WebKit/LayoutTests/external/wpt/IndexedDB/support.js
@@ -62,12 +62,14 @@ function createdb_for_multiple_tests(dbname, version) {
assert_unreached("unexpected open." + evt + " event");
}
- if (e.target.result + "" == "[object IDBDatabase]" && !this.db) {
- this.db = e.target.result;
-
- this.db.onerror = fail(test, "unexpected db.error");
- this.db.onabort = fail(test, "unexpected db.abort");
- this.db.onversionchange = fail(test, "unexpected db.versionchange");
+ if (e.target.result + '' == '[object IDBDatabase]' &&
+ !this.db) {
+ this.db = e.target.result;
+
+ this.db.onerror = fail(test, 'unexpected db.error');
+ this.db.onabort = fail(test, 'unexpected db.abort');
+ this.db.onversionchange =
+ fail(test, 'unexpected db.versionchange');
}
})
})
@@ -102,22 +104,27 @@ function assert_key_equals(actual, expected, description) {
assert_equals(indexedDB.cmp(actual, expected), 0, description);
}
-function indexeddb_test(upgrade_func, open_func, description) {
- async_test(function(t) {
- var dbname = document.location + '-' + t.name;
- var del = indexedDB.deleteDatabase(dbname);
- del.onerror = t.unreached_func('deleteDatabase should succeed');
- var open = indexedDB.open(dbname, 1);
- open.onerror = t.unreached_func('open should succeed');
- open.onupgradeneeded = t.step_func(function() {
- var db = open.result;
- var tx = open.transaction;
- upgrade_func(t, db, tx);
- });
- open.onsuccess = t.step_func(function() {
- var db = open.result;
- if (open_func)
- open_func(t, db);
- });
- }, description);
+function indexeddb_test(upgrade_func, open_func, description, options) {
+ async_test(function(t) {
+ var options = Object.assign({upgrade_will_abort: false}, options);
+ var dbname = document.location + '-' + t.name;
+ var del = indexedDB.deleteDatabase(dbname);
+ del.onerror = t.unreached_func('deleteDatabase should succeed');
+ var open = indexedDB.open(dbname, 1);
+ if (!options.upgrade_will_abort) {
+ open.onsuccess = t.unreached_func('open should not succeed');
+ } else {
+ open.onerror = t.unreached_func('open should succeed');
+ }
+ open.onupgradeneeded = t.step_func(function() {
+ var db = open.result;
+ var tx = open.transaction;
+ upgrade_func(t, db, tx);
+ });
+ open.onsuccess = t.step_func(function() {
+ var db = open.result;
+ if (open_func)
+ open_func(t, db);
+ });
+ }, description);
}

Powered by Google App Engine
This is Rietveld 408576698