1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
6 request
= indexedDB
.open('database-basics');
7 request
.onupgradeneeded
= upgradeNeeded
;
8 request
.onsuccess
= onSuccess
;
9 request
.onerror
= unexpectedErrorCallback
;
10 request
.onblocked
= unexpectedBlockedCallback
;
13 var gotUpgradeNeeded
= false;
14 function upgradeNeeded(evt
) {
16 shouldBe("event.dataLoss", "'total'");
17 gotUpgradeNeeded
= true;
20 function onSuccess(event
) {
21 db
= event
.target
.result
;
22 debug("The pre-existing leveldb has an objectStore in 'database-basics',");
23 debug("ensure that it was blown away");
24 shouldBe("db.objectStoreNames.length", "0");
25 debug("We should have gotten an upgradeneeded event because the new empty");
26 debug("database doesn't have a version.");
27 shouldBeTrue("gotUpgradeNeeded");