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

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: added copyright header Created 8 years, 5 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
« no previous file with comments | « chrome/test/data/indexeddb/perf_test.html ('k') | chrome/test/perf/indexeddb_uitest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 var overallTestStartTime = Date.now();
6
7 function testCreateKeysInStores(
8 numKeys, numStores, payloadLength, onTestComplete) {
9 var testName = "testCreateKeysInStores_" + numKeys + "_" + numStores + "_" +
10 payloadLength;
11 assert(numKeys >= 0);
12 assert(numStores >= 1);
13 var objectStoreNames = [];
14 for (var i=0; i < numStores; ++i) {
15 objectStoreNames.push("store " + i);
16 }
17 var value = stringOfLength(payloadLength);
18 var start;
19
20 function onCreated(db) {
21 automation.setStatus("Constructing transaction.");
22 start = Date.now(); // Ignore the setup time for this test.
23 var transaction = getTransaction(db, objectStoreNames, "readwrite",
24 function() { onTransactionComplete(db); });
25 for (var i in objectStoreNames) {
26 var os = transaction.objectStore(objectStoreNames[i]);
27 assert(os);
28 for (var j = 0; j < numKeys; ++j) {
29 os.put("key " + j, value);
30 }
31 }
32 }
33 function onTransactionComplete(db) {
34 var duration = Date.now() - start;
35 // Ignore the cleanup time for this test.
36 automation.addResult(testName, duration);
37 automation.setStatus("Deleting.");
38 deleteDatabase(db, onDeleted);
39 }
40 function onDeleted() {
41 automation.setStatus("Deleted.");
42 onTestComplete();
43 }
44 automation.setStatus("Creating.");
45 createDatabase(testName, objectStoreNames, onCreated, onError);
46 }
47
48 var tests = [
49 [testCreateKeysInStores, 1, 1, 1],
50 [testCreateKeysInStores, 100, 1, 1],
51 [testCreateKeysInStores, 1, 100, 1],
52 [testCreateKeysInStores, 100, 1, 100000]
53 ];
54
55 var currentTest = 0;
56
57 function runNextTest() {
58 if (currentTest < tests.length) {
59 var test = tests[currentTest++].slice();
60 var f = test.shift();
61 test.push(runNextTest);
62 f.apply(null, test);
63 } else {
64 onAllTestsComplete();
65 }
66 }
67
68 function onAllTestsComplete() {
69 var overallDuration = Date.now() - overallTestStartTime;
70 automation.addResult("OverallTestDuration", overallDuration);
71 automation.setDone();
72 }
73
74 function test() {
75 runNextTest();
76 }
OLDNEW
« no previous file with comments | « chrome/test/data/indexeddb/perf_test.html ('k') | chrome/test/perf/indexeddb_uitest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698