summaryrefslogtreecommitdiffstats
path: root/content/test/data
diff options
context:
space:
mode:
authordgrogan@chromium.org <dgrogan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-08-07 23:53:08 +0000
committerdgrogan@chromium.org <dgrogan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-08-07 23:53:08 +0000
commitd51f69bd45eb9ad37530235d4876a8bcd6eaf11f (patch)
tree5b4fe1f72fdc38484e6262eb6b339ba489085bd6 /content/test/data
parent8f6405117ee8c09845cbf2eec254bfb878d97257 (diff)
downloadchromium_src-d51f69bd45eb9ad37530235d4876a8bcd6eaf11f.zip
chromium_src-d51f69bd45eb9ad37530235d4876a8bcd6eaf11f.tar.gz
chromium_src-d51f69bd45eb9ad37530235d4876a8bcd6eaf11f.tar.bz2
IndexedDB browser test for migrating from leveldb schema v0 to v1.
It doesn't check that the integer version was actually added to leveldb though, which is unfortunate. It ensures that opening a v0 database doesn't fail an assert, which is what would happen if you opened an unmigrated database with code that expects to find a stored integer version. BUG=108223 Review URL: https://chromiumcodereview.appspot.com/10826159 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@150458 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/test/data')
-rw-r--r--content/test/data/indexeddb/common.js5
-rw-r--r--content/test/data/indexeddb/migration_test.html10
-rw-r--r--content/test/data/indexeddb/migration_test.js22
3 files changed, 37 insertions, 0 deletions
diff --git a/content/test/data/indexeddb/common.js b/content/test/data/indexeddb/common.js
index 95f5396..11d2adc 100644
--- a/content/test/data/indexeddb/common.js
+++ b/content/test/data/indexeddb/common.js
@@ -52,6 +52,11 @@ function unexpectedErrorCallback()
fail('unexpectedErrorCallback');
}
+function unexpectedBlockedCallback()
+{
+ fail('unexpectedBlockedCallback');
+}
+
function deleteAllObjectStores(db)
{
objectStoreNames = db.objectStoreNames;
diff --git a/content/test/data/indexeddb/migration_test.html b/content/test/data/indexeddb/migration_test.html
new file mode 100644
index 0000000..5fbd483
--- /dev/null
+++ b/content/test/data/indexeddb/migration_test.html
@@ -0,0 +1,10 @@
+<html>
+ <head>
+ <title>IndexedDB migration test</title>
+ <script type="text/javascript" src="common.js"></script>
+ <script type="text/javascript" src="migration_test.js"></script>
+ </head>
+ <body onLoad="test()">
+ <div id="status">Starting...</div>
+ </body>
+</html>
diff --git a/content/test/data/indexeddb/migration_test.js b/content/test/data/indexeddb/migration_test.js
new file mode 100644
index 0000000..04de436
--- /dev/null
+++ b/content/test/data/indexeddb/migration_test.js
@@ -0,0 +1,22 @@
+// 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('open-close-version-test1');
+ request.onsuccess = openTest2;
+ request.onerror = unexpectedErrorCallback;
+ request.onblocked = unexpectedBlockedCallback;
+}
+
+function openTest2(event) {
+ db = event.target.result;
+ debug("Ensure that the existing leveldb files are used. If they are not, " +
+ "this script will create a new database that has no object stores");
+ shouldBe("db.objectStoreNames.length", "1");
+ shouldBeEqualToString("typeof db.version", "string");
+ request = webkitIndexedDB.open('open-close-version-test2');
+ request.onsuccess = done;
+ request.onerror = unexpectedErrorCallback;
+ request.onblocked = unexpectedBlockedCallback;
+}