Chromium Code Reviews| 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> |
| 11 <script> | 11 <script> |
| 12 | 12 |
| 13 var testType = 'get'; | 13 var testType = 'get'; |
| 14 | 14 |
| 15 function test() { | 15 function test() { |
| 16 testType = location.hash.substring(1); | 16 testType = location.hash.substring(1); |
| 17 if (testType == 'testCommon') { | 17 if (testType == 'testCommon') { |
| 18 fail('"testCommon" is a reserved test name'); | 18 fail('"testCommon" is a reserved test name'); |
| 19 return; | 19 return; |
| 20 } | 20 } |
| 21 indexedDBTest(upgradeCallback, openCallback); | 21 indexedDBTest(upgradeCallback, openCallback); |
| 22 } | 22 } |
| 23 | 23 |
| 24 var numObjectsWrittenToDb = 500; | 24 var numObjectsWrittenToDb = 5; |
| 25 var numTransactions = 0; | 25 var numTransactions = 0; |
| 26 var numTransactionErrors = 0; | 26 var numTransactionErrors = 0; |
| 27 var numTransactionAborts = 0; | 27 var numTransactionAborts = 0; |
| 28 var numKeys = 0; | 28 var numKeys = 0; |
| 29 var transaction; | 29 var transaction; |
| 30 var request; | 30 var request; |
| 31 var db; | 31 var db; |
| 32 var objectStore; | 32 var objectStore; |
| 33 | 33 |
| 34 function upgradeCallback() { | 34 function upgradeCallback() { |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 103 var tests = { | 103 var tests = { |
| 104 // Common setup tasks for the other tests in this object | 104 // Common setup tasks for the other tests in this object |
| 105 testCommon: function(mode) { | 105 testCommon: function(mode) { |
| 106 transaction = db.transaction('storeName', mode); | 106 transaction = db.transaction('storeName', mode); |
| 107 db.onclose = databaseClosed; | 107 db.onclose = databaseClosed; |
| 108 transaction.onabort = transactionAbort; | 108 transaction.onabort = transactionAbort; |
| 109 transaction.onerror = transactionError; | 109 transaction.onerror = transactionError; |
| 110 objectStore = transaction.objectStore('storeName'); | 110 objectStore = transaction.objectStore('storeName'); |
| 111 }, | 111 }, |
| 112 get: function() { | 112 get: function() { |
| 113 testXhr("/corrupt/test/corruptdb?storeName", function() { | 113 testXhr("/corrupt/test/fail?class=LevelDBTransaction&method=Get&instNum=1", function() { |
|
jsbell
2014/06/19 21:08:47
Wrap this so it's less than 80 chars?
| |
| 114 tests.testCommon('readonly'); | 114 tests.testCommon('readonly'); |
| 115 request = objectStore.get('key-0'); | 115 request = objectStore.get('key-0'); |
| 116 request.onsuccess = unexpectedSuccessCallback; | 116 request.onsuccess = unexpectedSuccessCallback; |
| 117 request.onerror = requestError; | 117 request.onerror = requestError; |
| 118 }); | 118 }); |
| 119 }, | 119 }, |
| 120 iterate: function() { | 120 iterate: function() { |
| 121 testXhr("/corrupt/test/corruptdb?storeName", function() { | 121 testXhr("/corrupt/test/corruptdb?storeName", function() { |
| 122 tests.testCommon('readonly'); | 122 tests.testCommon('readonly'); |
| 123 request = objectStore.openCursor(); | 123 request = objectStore.openCursor(); |
| (...skipping 26 matching lines...) Expand all Loading... | |
| 150 else | 150 else |
| 151 fail('Unknown test: "' + testType + '"'); | 151 fail('Unknown test: "' + testType + '"'); |
| 152 } | 152 } |
| 153 | 153 |
| 154 </script> | 154 </script> |
| 155 </head> | 155 </head> |
| 156 <body onLoad="test()"> | 156 <body onLoad="test()"> |
| 157 <div id="status">Starting...</div> | 157 <div id="status">Starting...</div> |
| 158 </body> | 158 </body> |
| 159 </html> | 159 </html> |
| OLD | NEW |