1// Copyright 2013 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. 4 5function test() { 6 request = webkitIndexedDB.open('database-basics'); 7 request.onupgradeneeded = upgradeNeeded; 8 request.onsuccess = onSuccess; 9 request.onerror = unexpectedErrorCallback; 10 request.onblocked = unexpectedBlockedCallback; 11} 12 13var gotUpgradeNeeded = false; 14function upgradeNeeded(evt) { 15 event = evt; 16 shouldBe("event.dataLoss", "'total'"); 17 shouldBe("event.dataLossMessage", "'missing files'"); 18 gotUpgradeNeeded = true; 19} 20 21function onSuccess(event) { 22 db = event.target.result; 23 debug("The pre-existing leveldb has an objectStore in 'database-basics',"); 24 debug("ensure that it was blown away"); 25 shouldBe("db.objectStoreNames.length", "0"); 26 debug("We should have gotten an upgradeneeded event because the new empty"); 27 debug("database doesn't have a version."); 28 shouldBeTrue("gotUpgradeNeeded"); 29 done(); 30} 31