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

Side by Side Diff: content/test/data/indexeddb/corrupted_open_db_recovery.html

Issue 197333009: Handling LevelDB errors encountered after open. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 9 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 <!DOCTYPE html>
2 // Use of this source code is governed by a BSD-style license that can be 2 <html>
3 // found in the LICENSE file. 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>
4 12
5 function test() { 13 function test() {
6 request = webkitIndexedDB.open('database-basics'); 14 dbname = "corrupted_open_db_detection.html";
15 request = webkitIndexedDB.open(dbname);
7 request.onupgradeneeded = upgradeNeeded; 16 request.onupgradeneeded = upgradeNeeded;
8 request.onsuccess = onSuccess; 17 request.onsuccess = onSuccess;
9 request.onerror = unexpectedErrorCallback; 18 request.onerror = unexpectedErrorCallback;
10 request.onblocked = unexpectedBlockedCallback; 19 request.onblocked = unexpectedBlockedCallback;
11 } 20 }
12 21
13 var gotUpgradeNeeded = false; 22 var gotUpgradeNeeded = false;
14 function upgradeNeeded(evt) { 23 function upgradeNeeded(evt) {
15 event = evt; 24 event = evt;
16 shouldBe("event.dataLoss", "'total'"); 25 shouldBe("event.dataLoss", "'total'");
26 shouldBeTrue('event.dataLossMessage.startsWith("IndexedDB (database was corrup t): ")');
17 gotUpgradeNeeded = true; 27 gotUpgradeNeeded = true;
18 } 28 }
19 29
20 function onSuccess(event) { 30 function onSuccess(event) {
21 db = event.target.result; 31 db = event.target.result;
22 debug("The pre-existing leveldb has an objectStore in 'database-basics',"); 32 debug("The pre-existing leveldb has an objectStore in 'database-basics',");
23 debug("ensure that it was blown away"); 33 debug("ensure that it was blown away");
24 shouldBe("db.objectStoreNames.length", "0"); 34 shouldBe("db.objectStoreNames.length", "0");
25 debug("We should have gotten an upgradeneeded event because the new empty"); 35 debug("We should have gotten an upgradeneeded event because the new empty");
26 debug("database doesn't have a version."); 36 debug("database doesn't have a version.");
27 shouldBeTrue("gotUpgradeNeeded"); 37 shouldBeTrue("gotUpgradeNeeded");
28 done(); 38 done();
29 } 39 }
40
41 </script>
42 </head>
43 <body onLoad="test()">
44 <div id="status">Starting...</div>
45 </body>
46 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698