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

Unified Diff: content/test/data/indexeddb/invalid_schema.js

Issue 11196029: Test for destroying leveldb directory when we detect a schema downgrade (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add some comments, improve var names Created 8 years, 2 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: content/test/data/indexeddb/invalid_schema.js
diff --git a/content/test/data/indexeddb/invalid_schema.js b/content/test/data/indexeddb/invalid_schema.js
new file mode 100644
index 0000000000000000000000000000000000000000..6802517e1f590caf81a5c7f15a572f5f68690861
--- /dev/null
+++ b/content/test/data/indexeddb/invalid_schema.js
@@ -0,0 +1,28 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+function test() {
+ request = webkitIndexedDB.open('database-basics');
+ request.onsuccess = onSuccess;
+ request.onerror = unexpectedErrorCallback;
+ request.onblocked = unexpectedBlockedCallback;
+ request.onupgradeneeded = upgradeNeeded;
jsbell 2012/10/17 23:44:14 Nit: maybe put onupgradeneeded before onsuccess to
+}
+
+var gotUpgradeNeeded = false;
+function upgradeNeeded() {
+ gotUpgradeNeeded = true;
+}
+
+
jsbell 2012/10/17 23:44:14 Nit: remove one blank line
+function onSuccess(event) {
+ db = event.target.result;
+ debug("The pre-existing leveldb has an objectStore in 'database-basics',");
+ debug("ensure that it was blown away");
+ shouldBe("db.objectStoreNames.length", "0");
+ debug("We should have gotten an upgradeneeded event because the new empty");
+ debug("database doesn't have a version.");
+ shouldBeTrue("gotUpgradeNeeded");
+ done();
+}

Powered by Google App Engine
This is Rietveld 408576698