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

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

Issue 334303002: Using a mock LevelDBTransaction for corruption tests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: LevelDBTraceTansaction::s_class_name is now static Created 6 years, 6 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
« no previous file with comments | « content/content_tests.gypi ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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",
114 function() {
114 tests.testCommon('readonly'); 115 tests.testCommon('readonly');
115 request = objectStore.get('key-0'); 116 request = objectStore.get('key-0');
116 request.onsuccess = unexpectedSuccessCallback; 117 request.onsuccess = unexpectedSuccessCallback;
117 request.onerror = requestError; 118 request.onerror = requestError;
118 }); 119 });
119 }, 120 },
120 iterate: function() { 121 iterate: function() {
121 testXhr("/corrupt/test/corruptdb?storeName", function() { 122 testXhr("/corrupt/test/corruptdb?storeName", function() {
122 tests.testCommon('readonly'); 123 tests.testCommon('readonly');
123 request = objectStore.openCursor(); 124 request = objectStore.openCursor();
(...skipping 26 matching lines...) Expand all
150 else 151 else
151 fail('Unknown test: "' + testType + '"'); 152 fail('Unknown test: "' + testType + '"');
152 } 153 }
153 154
154 </script> 155 </script>
155 </head> 156 </head>
156 <body onLoad="test()"> 157 <body onLoad="test()">
157 <div id="status">Starting...</div> 158 <div id="status">Starting...</div>
158 </body> 159 </body>
159 </html> 160 </html>
OLDNEW
« no previous file with comments | « content/content_tests.gypi ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698