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

Side by Side Diff: chrome/test/data/indexeddb/perf_test.js

Issue 10575043: Initial checkin of a perf test suite for Indexed Database. This just has a (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove junk from other branch. Created 8 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 | Annotate | Revision Log
OLDNEW
(Empty)
1 var overallTestStartTime = Date.now();
2
3 function testCreateKeysInStores(
4 numKeys, numStores, payloadLength, onTestComplete) {
5 var testName = "testCreateKeysInStores_" + numKeys + "_" + numStores + "_" +
6 payloadLength;
7 assert(numKeys >= 0);
8 assert(numStores >= 1);
9 var objectStoreNames = [];
10 for (var i=0; i < numStores; ++i) {
11 objectStoreNames.push("store " + i);
12 }
13 var value = stringOfLength(payloadLength);
14 var start;
15
16 function onCreated(db) {
17 automation.setStatus("Constructing transaction.");
18 start = Date.now(); // Ignore the setup time for this test.
19 var transaction = getTransaction(db, objectStoreNames, "readwrite",
20 function() { onTransactionComplete(db); });
21 for (var i in objectStoreNames) {
22 var os = transaction.objectStore(objectStoreNames[i]);
23 assert(os);
24 for (var j = 0; j < numKeys; ++j) {
25 os.put("key " + j, value);
jsbell 2012/06/21 00:04:16 This is measuring three distinct things: * Time ta
26 }
27 }
28 }
29 function onTransactionComplete(db) {
30 var duration = Date.now() - start;
31 // Ignore the cleanup time for this test.
32 automation.addResult(testName, duration);
33 automation.setStatus("Deleting.");
34 deleteDatabase(db, onDeleted);
35 }
36 function onDeleted() {
37 automation.setStatus("Deleted.");
38 onTestComplete();
39 }
40 automation.setStatus("Creating.");
41 createDatabase(testName, objectStoreNames, onCreated, onError);
42 }
43
44 var tests = [
45 [testCreateKeysInStores, 1, 1, 1],
46 [testCreateKeysInStores, 100, 1, 1],
47 [testCreateKeysInStores, 1, 100, 1],
48 [testCreateKeysInStores, 100, 1, 100000]
49 ];
50
51 var currentTest = 0;
52
53 function runNextTest() {
54 if (currentTest < tests.length) {
55 var test = tests[currentTest++].slice();
56 var f = test.shift();
57 test.push(runNextTest);
58 f.apply(null, test);
59 } else {
60 onAllTestsComplete();
61 }
62 }
63
64 function onAllTestsComplete() {
65 var overallDuration = Date.now() - overallTestStartTime;
66 automation.addResult("OverallTestDuration", overallDuration);
67 automation.setDone();
68 }
69
70 function test() {
71 runNextTest();
72 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698