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

Unified Diff: third_party/WebKit/LayoutTests/storage/indexeddb/resources/generic-idb-operations.js

Issue 2601983002: [IndexedDB] Adding transaction and value support to observers (Closed)
Patch Set: added comments and bug link 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/storage/indexeddb/resources/generic-idb-operations.js
diff --git a/third_party/WebKit/LayoutTests/storage/indexeddb/resources/generic-idb-operations.js b/third_party/WebKit/LayoutTests/storage/indexeddb/resources/generic-idb-operations.js
index e1974e111b82546ae6342ff979148e820aa12ead..8b076729ec1425fc18177af5c469a1ce1e791ded 100644
--- a/third_party/WebKit/LayoutTests/storage/indexeddb/resources/generic-idb-operations.js
+++ b/third_party/WebKit/LayoutTests/storage/indexeddb/resources/generic-idb-operations.js
@@ -2,31 +2,31 @@ if (this.importScripts) {
importScripts('../../../resources/testharness.js');
}
-function compareChanges(actual, expected) {
+function assertChangesEqual(actual, expected) {
assert_equals(actual.database.name, expected.dbName, 'The change record database should be the same as the database being acted on');
var stores = Object.keys(expected.records);
assert_equals(actual.records.size, stores.length, 'Incorrect number of objectStores recorded by observer');
+ var storeNamesString = Array.from(actual.records.keys()).join(", ");
for (var i in stores) {
var key = stores[i];
- assert_true(actual.records.has(key));
- var actual_obsv = actual.records.get(key);
- var expected_obsv = expected.records[key];
- assert_equals(actual_obsv.length, expected_obsv.length, 'Number of observations recorded for objectStore '+ key + ' should match observed operations');
- for (var j in expected_obsv)
- compareObservations(actual_obsv[j], expected_obsv[j]);
+ assert_true(actual.records.has(key), "Store '" + key + "' not found in changes. Stores: " + storeNamesString);
+ var actualObsv = actual.records.get(key);
+ var expectedObsv = expected.records[key];
+ assert_equals(actualObsv.length, expectedObsv.length, 'Number of observations recorded for objectStore '+ key + ' should match observed operations');
+ for (var j in expectedObsv)
+ assertObservationsEqual(actualObsv[j], expectedObsv[j]);
}
}
-function compareObservations(actual, expected) {
+function assertObservationsEqual(actual, expected) {
assert_equals(actual.type, expected.type);
- assert_not_equals(actual.type, 'kDelete');
- if (actual.type == 'clear') {
+ if (actual.type === 'clear') {
assert_equals(actual.key, undefined, 'clear operation has no key');
assert_equals(actual.value, null, 'clear operation has no value');
return;
}
- if (actual.type == 'delete') {
+ if (actual.type === 'delete') {
assert_equals(actual.key.lower, expected.key.lower, 'Observed operation key lower bound should match operation performed');
assert_equals(actual.key.upper, expected.key.upper, 'Observed operation key upper bound should match operation performed');
assert_equals(actual.key.lower_open, expected.key.lower_open, 'Observed operation key lower open should match operation performed');
@@ -37,8 +37,11 @@ function compareObservations(actual, expected) {
}
assert_equals(actual.key.lower, expected.key, 'Observed operation key lower bound should match operation performed');
assert_equals(actual.key.upper, expected.key, 'Observed operation key upper bound should match operation performed');
- // TODO(dmurph): Value needs to be updated, once returned correctly. Issue crbug.com/609934.
- assert_equals(actual.value, null, 'Put/Add operation value does not match');
+ if (expected.value != undefined) {
+ assert_equals(actual.value, expected.value, 'Put/Add operation value does not match');
+ } else {
+ assert_equals(actual.value, null, 'Put/Add operation has unexpected value');
+ }
}
function countCallbacks(actual, expected) {

Powered by Google App Engine
This is Rietveld 408576698