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

Unified Diff: chrome/test/data/indexeddb/perf_shared.js

Issue 10828119: Reorder declaration vs. usage, build padToWidth on top of stringOfLength. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/test/data/indexeddb/perf_test.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/data/indexeddb/perf_shared.js
diff --git a/chrome/test/data/indexeddb/perf_shared.js b/chrome/test/data/indexeddb/perf_shared.js
index 6fc6e315b3c208f54c6eefdffe06be673556cc3a..f335b0b5855b290d422efaa4a7305e481d37394a 100644
--- a/chrome/test/data/indexeddb/perf_shared.js
+++ b/chrome/test/data/indexeddb/perf_shared.js
@@ -193,12 +193,20 @@ function getDisplayName(args) {
function padToWidth(s, width) {
s = String(s);
assert(s.length <= width);
- while (s.length < width) {
- s = "0" + s;
+ if (s.length < width) {
+ s = stringOfLength(width - s.length, '0') + s;
}
return s;
}
+function stringOfLength(n, c) {
+ if (c == null)
+ c = 'X';
+ assert(n > 0);
+ assert(n == Math.floor(n));
+ return new Array(n + 1).join(c);
+}
+
function getSimpleKey(i) {
return "key " + padToWidth(i, 10);
}
@@ -334,10 +342,3 @@ function getValuesFromCursor(
}
request.onerror = onError;
}
-
-
-function stringOfLength(n) {
- assert(n > 0);
- assert(n == Math.floor(n));
- return new Array(n + 1).join('0');
-}
« no previous file with comments | « no previous file | chrome/test/data/indexeddb/perf_test.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698