[SyncFS] Build indexes from FileTracker entries on disk.
[chromium-blink-merge.git] / content / test / data / indexeddb / corrupted_open_db_recovery.html
blobb1f7deed5aa838ba5ae7a297b1046048a549fa53
1 <!DOCTYPE html>
2 <html>
3 <!--
4 Copyright 2014 The Chromium Authors. All rights reserved.
5 Use of this source code is governed by a BSD-style license that can be
6 found in the LICENSE file.
7 -->
8 <head>
9 <title>IDB test that db's corrupted while open are properly handled Part 2 / 2</title>
10 <script type="text/javascript" src="common.js"></script>
11 <script>
13 function test() {
14 dbname = "corrupted_open_db_detection.html";
15 request = webkitIndexedDB.open(dbname);
16 request.onupgradeneeded = upgradeNeeded;
17 request.onsuccess = onSuccess;
18 request.onerror = unexpectedErrorCallback;
19 request.onblocked = unexpectedBlockedCallback;
22 var gotUpgradeNeeded = false;
23 function upgradeNeeded(evt) {
24 event = evt;
25 shouldBe("event.dataLoss", "'total'");
26 shouldBeTrue('event.dataLossMessage.startsWith("IndexedDB (database was corrupt): ")');
27 gotUpgradeNeeded = true;
30 function onSuccess(event) {
31 db = event.target.result;
32 debug("The pre-existing leveldb has an objectStore in 'database-basics',");
33 debug("ensure that it was blown away");
34 shouldBe("db.objectStoreNames.length", "0");
35 debug("We should have gotten an upgradeneeded event because the new empty");
36 debug("database doesn't have a version.");
37 shouldBeTrue("gotUpgradeNeeded");
38 done();
41 </script>
42 </head>
43 <body onLoad="test()">
44 <div id="status">Starting...</div>
45 </body>
46 </html>