OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 var overallTestStartTime = window.performance.now(); | 5 var overallTestStartTime = window.performance.now(); |
6 var kUseIndex = true; | 6 var kUseIndex = true; |
7 var kDontUseIndex = false; | 7 var kDontUseIndex = false; |
8 var kReadKeysOnly = true; | 8 var kReadKeysOnly = true; |
9 var kReadDataToo = false; | 9 var kReadDataToo = false; |
10 var kWriteToo = true; | 10 var kWriteToo = true; |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 // Walk through many cursors into the same object store, round-robin, until | 86 // Walk through many cursors into the same object store, round-robin, until |
87 // you've reached the end of each of them. | 87 // you've reached the end of each of them. |
88 [testWalkingMultipleCursors, 50], | 88 [testWalkingMultipleCursors, 50], |
89 // Open an object store cursor, then continue(key) to the last value. | 89 // Open an object store cursor, then continue(key) to the last value. |
90 [testCursorSeeks, 2000, 10, 4, kDontUseIndex], | 90 [testCursorSeeks, 2000, 10, 4, kDontUseIndex], |
91 // Open an index key cursor, then continue(key) to the last value. | 91 // Open an index key cursor, then continue(key) to the last value. |
92 [testCursorSeeks, 2000, 10, 4, kUseIndex], | 92 [testCursorSeeks, 2000, 10, 4, kUseIndex], |
93 ]; | 93 ]; |
94 | 94 |
95 var currentTest = 0; | 95 var currentTest = 0; |
| 96 var done = false; |
96 | 97 |
97 function test() { | 98 function test() { |
98 runNextTest(); | 99 runNextTest(); |
99 } | 100 } |
100 | 101 |
| 102 var testFilter; |
| 103 |
101 function runNextTest() { | 104 function runNextTest() { |
102 var filter = window.location.hash.slice(1); | 105 var filter = testFilter | window.location.hash.slice(1); |
103 var test, f; | 106 var test, f; |
104 while (currentTest < tests.length) { | 107 while (currentTest < tests.length) { |
105 test = tests[currentTest]; | 108 test = tests[currentTest]; |
106 f = test.shift(); | 109 f = test.shift(); |
107 if (!filter || f.name == filter) | 110 if (!filter || f.name == filter) |
108 break; | 111 break; |
109 ++currentTest; | 112 ++currentTest; |
110 } | 113 } |
111 | 114 |
112 if (currentTest < tests.length) { | 115 if (currentTest < tests.length) { |
113 test.push(runNextTest); | 116 test.push(runNextTest); |
114 f.apply(null, test); | 117 f.apply(null, test); |
115 ++currentTest; | 118 ++currentTest; |
116 } else { | 119 } else { |
117 onAllTestsComplete(); | 120 onAllTestsComplete(); |
118 } | 121 } |
119 } | 122 } |
120 | 123 |
121 function onAllTestsComplete() { | 124 function onAllTestsComplete() { |
122 var overallDuration = window.performance.now() - overallTestStartTime; | 125 var overallDuration = window.performance.now() - overallTestStartTime; |
123 automation.addResult("OverallTestDuration", overallDuration); | 126 automation.addResult("OverallTestDuration", overallDuration); |
124 automation.setDone(); | 127 automation.setDone(); |
| 128 done = true; |
125 } | 129 } |
126 | 130 |
127 // This is the only test that includes database creation and deletion in its | 131 // This is the only test that includes database creation and deletion in its |
128 // results; the others just test specific operations. To see only the | 132 // results; the others just test specific operations. To see only the |
129 // creation/deletion without the specific operations used to build up the data | 133 // creation/deletion without the specific operations used to build up the data |
130 // in the object stores here, subtract off the results of | 134 // in the object stores here, subtract off the results of |
131 // testCreateKeysInStores. | 135 // testCreateKeysInStores. |
132 function testCreateAndDeleteDatabase( | 136 function testCreateAndDeleteDatabase( |
133 numKeys, numStores, payloadLength, onTestComplete) { | 137 numKeys, numStores, payloadLength, onTestComplete) { |
134 var testName = getDisplayName(arguments); | 138 var testName = getDisplayName(arguments); |
(...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
579 request.onerror = onError; | 583 request.onerror = onError; |
580 request.onsuccess = function() { | 584 request.onsuccess = function() { |
581 var cursor = request.result; | 585 var cursor = request.result; |
582 if (cursor && first) { | 586 if (cursor && first) { |
583 first = false; | 587 first = false; |
584 cursor.continue(getKey(numKeys - 1)); | 588 cursor.continue(getKey(numKeys - 1)); |
585 } | 589 } |
586 }; | 590 }; |
587 } | 591 } |
588 } | 592 } |
OLD | NEW |