| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <html> | 2 <html> |
| 3 <!-- | 3 <!-- |
| 4 Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 5 Use of this source code is governed by a BSD-style license that can be |
| 6 found in the LICENSE file. | 6 found in the LICENSE file. |
| 7 --> | 7 --> |
| 8 <head> | 8 <head> |
| 9 <title>IDB test that db's corrupted while open are properly handled Part 1 / 2</
title> | 9 <title>IDB test that db's corrupted while open are properly handled Part 1 / 2</
title> |
| 10 <script type="text/javascript" src="common.js"></script> | 10 <script type="text/javascript" src="common.js"></script> |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 // Get an object. Probably shouldn't get this far, but won't call this
an error. | 160 // Get an object. Probably shouldn't get this far, but won't call this
an error. |
| 161 cursor.continue(); | 161 cursor.continue(); |
| 162 } else { | 162 } else { |
| 163 // Got the last object. We shouldn't get this far. | 163 // Got the last object. We shouldn't get this far. |
| 164 fail("Should *not* have been able to iterate over database."); | 164 fail("Should *not* have been able to iterate over database."); |
| 165 } | 165 } |
| 166 }; | 166 }; |
| 167 }); | 167 }); |
| 168 }, | 168 }, |
| 169 failGetBlobJournal: function() { | 169 failGetBlobJournal: function() { |
| 170 // Get() #1 the actual get, #2 is for the journal. | 170 // Get() #1 is the put (GetNewVersionNumber) |
| 171 testXhr("/corrupt/test/fail?class=LevelDBTransaction&method=Get&instNum=2",
function() { | 171 // Get() #2 is the blob key generator (GetBlobKeyGeneratorCurrentNumber) |
| 172 // Get() #3 is the journal (GetPrimaryBlobJournal) |
| 173 testXhr("/corrupt/test/fail?class=LevelDBTransaction&method=Get&instNum=3",
function() { |
| 172 tests.testCommon('readwrite'); | 174 tests.testCommon('readwrite'); |
| 173 request.onsuccess = unexpectedSuccessCallback; | 175 request = objectStore.put({blob: new Blob(['abc'])}, 'key-0'); |
| 174 request.onerror = requestError; | 176 request.onerror = requestError; |
| 175 db.onclose = function databaseClosed(event) { | 177 db.onclose = function databaseClosed(event) { |
| 176 shouldBe("numTransactionErrors", "0"); | 178 shouldBe("numTransactionErrors", "0"); |
| 177 shouldBe("numTransactionAborts", "1"); | 179 shouldBe("numTransactionAborts", "1"); |
| 178 | 180 |
| 179 done("Closed as expected"); | 181 done("Closed as expected"); |
| 180 }; | 182 }; |
| 181 request = objectStore.get('key-0'); | |
| 182 }); | 183 }); |
| 183 }, | 184 }, |
| 184 clearObjectStore: function() { | 185 clearObjectStore: function() { |
| 185 testXhr("/corrupt/test/corruptdb?storeName", function() { | 186 testXhr("/corrupt/test/corruptdb?storeName", function() { |
| 186 tests.testCommon('readwrite'); | 187 tests.testCommon('readwrite'); |
| 187 request = objectStore.clear(); | 188 request = objectStore.clear(); |
| 188 request.onerror = requestError; | 189 request.onerror = requestError; |
| 189 request.onsuccess = unexpectedSuccessCallback | 190 request.onsuccess = unexpectedSuccessCallback |
| 190 }); | 191 }); |
| 191 } | 192 } |
| 192 }; | 193 }; |
| 193 | 194 |
| 194 function openCallback() { | 195 function openCallback() { |
| 195 if (testType in tests) | 196 if (testType in tests) |
| 196 tests[testType](); | 197 tests[testType](); |
| 197 else | 198 else |
| 198 fail('Unknown test: "' + testType + '"'); | 199 fail('Unknown test: "' + testType + '"'); |
| 199 } | 200 } |
| 200 | 201 |
| 201 </script> | 202 </script> |
| 202 </head> | 203 </head> |
| 203 <body onLoad="test()"> | 204 <body onLoad="test()"> |
| 204 <div id="status">Starting...</div> | 205 <div id="status">Starting...</div> |
| 205 </body> | 206 </body> |
| 206 </html> | 207 </html> |
| OLD | NEW |