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

Unified Diff: third_party/WebKit/LayoutTests/storage/indexeddb/clone-before-keypath-eval.html

Issue 2667403003: Upstream a couple of IndexedDB layout tests to WPT. (Closed)
Patch Set: 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/clone-before-keypath-eval.html
diff --git a/third_party/WebKit/LayoutTests/storage/indexeddb/clone-before-keypath-eval.html b/third_party/WebKit/LayoutTests/storage/indexeddb/clone-before-keypath-eval.html
deleted file mode 100644
index e7ae292d39a7ac603f67c9bd7c5a4d2e122edc0f..0000000000000000000000000000000000000000
--- a/third_party/WebKit/LayoutTests/storage/indexeddb/clone-before-keypath-eval.html
+++ /dev/null
@@ -1,146 +0,0 @@
-<!DOCTYPE html>
-<script src="../../resources/testharness.js"></script>
-<script src="../../resources/testharnessreport.js"></script>
-<script>
-
-function indexeddb_test(upgrade_func, body_func, 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() {
- upgrade_func(t, openRequest.result);
- });
- openRequest.onsuccess = t.step_func(function() {
- body_func(t, openRequest.result);
- });
- openRequest.onerror = t.unreached_func('open failed');
- });
- }, description);
-}
-
-function ProbeObject() {
- this.id_count = 0;
- this.invalid_id_count = 0;
- this.prop_count = 0;
- Object.defineProperties(this, {
- id: {
- enumerable: true,
- get: function() {
- ++this.id_count;
- return 1000 + this.id_count;
- }},
- invalid_id: {
- enumerable: true,
- get: function() {
- ++this.invalid_id_count;
- return {};
- }},
- prop: {
- enumerable: true,
- get: function() {
- ++this.prop_count;
- return 2000 + this.prop_count;
- }}
- });
-}
-
-indexeddb_test(
- function(t, connection) {
- connection.createObjectStore(
- 'store', {keyPath: 'id', autoIncrement: true});
- },
- function(t, connection) {
- var trans = connection.transaction('store', 'readwrite');
- var store = trans.objectStore('store');
- var obj = new ProbeObject();
- store.put(obj);
- assert_equals(
- obj.id_count, 1,
- 'put() operation should access primary key property once');
- assert_equals(
- obj.prop_count, 1,
- 'put() operation should access other properties once');
- t.done();
- }, 'Key generator and key path validity check operates on a clone');
-
-indexeddb_test(
- function(t, connection) {
- connection.createObjectStore(
- 'store', {keyPath: 'invalid_id', autoIncrement: true});
- },
- function(t, connection) {
- var trans = connection.transaction('store', 'readwrite');
- var store = trans.objectStore('store');
- var obj = new ProbeObject();
- assert_throws('DataError', function() { store.put(obj); },
- 'put() should throw if primary key cannot be injected');
- assert_equals(
- obj.invalid_id_count, 1,
- 'put() operation should access primary key property once');
- assert_equals(
- obj.prop_count, 1,
- 'put() operation should access other properties once');
- t.done();
- }, 'Failing key path validity check operates on a clone');
-
-indexeddb_test(
- function(t, connection) {
- var store = connection.createObjectStore('store');
- store.createIndex('index', 'prop');
- },
- function(t, connection) {
- var trans = connection.transaction('store', 'readwrite');
- var store = trans.objectStore('store');
- var obj = new ProbeObject();
- store.put(obj, 'key');
- assert_equals(
- obj.prop_count, 1, 'put() should access index key property once');
- assert_equals(
- obj.id_count, 1,
- 'put() operation should access other properties once');
- t.done();
- }, 'Index key path evaluations operate on a clone');
-
-indexeddb_test(
- function(t, connection) {
- var store = connection.createObjectStore('store', {keyPath: 'id'});
- store.createIndex('index', 'prop');
- },
- function(t, connection) {
- var trans = connection.transaction('store', 'readwrite');
- var store = trans.objectStore('store');
- var obj = new ProbeObject();
- store.put(obj);
- assert_equals(
- obj.id_count, 1, 'put() should access primary key property once');
- assert_equals(
- obj.prop_count, 1, 'put() should access index key property once');
- t.done();
- }, 'Store and index key path evaluations operate the same clone');
-
-indexeddb_test(
- function(t, connection) {
- var store = connection.createObjectStore('store', {keyPath: 'id'});
- store.createIndex('index', 'prop');
- },
- function(t, connection) {
- var trans = connection.transaction('store', 'readwrite');
- var store = trans.objectStore('store');
- store.put(new ProbeObject());
-
- store.openCursor().onsuccess = t.step_func(function(event) {
- var cursor = event.target.result;
-
- var obj = new ProbeObject();
- cursor.update(obj);
- assert_equals(
- obj.id_count, 1, 'put() should access primary key property once');
- assert_equals(
- obj.prop_count, 1, 'put() should access index key property once');
-
- t.done();
- });
- }, 'Cursor update checks and keypath evaluations operate on a clone');
-</script>

Powered by Google App Engine
This is Rietveld 408576698