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

Unified Diff: content/test/data/blob_storage/common.js

Issue 2516713002: [BlobStorage] Implementing disk. (Closed)
Patch Set: file flushing, stack track on reader error Created 4 years 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
Index: content/test/data/blob_storage/common.js
diff --git a/content/test/data/indexeddb/common.js b/content/test/data/blob_storage/common.js
similarity index 56%
copy from content/test/data/indexeddb/common.js
copy to content/test/data/blob_storage/common.js
index 15133e90ef461b31c49f73d6725678e6a086573e..0ceb992b361ea61f82dc07c576e773e64aa50937 100644
--- a/content/test/data/indexeddb/common.js
+++ b/content/test/data/blob_storage/common.js
@@ -1,17 +1,15 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-function debug(message)
-{
+function debug(message) {
var span = document.createElement("span");
span.appendChild(document.createTextNode(message));
span.appendChild(document.createElement("br"));
document.getElementById('status').appendChild(span);
}
-function done(message)
-{
+function done(message) {
if (document.location.hash == '#fail')
return;
if (message)
@@ -21,68 +19,38 @@ function done(message)
document.location.hash = '#pass';
}
-function fail(message)
-{
+function fail(message) {
debug('FAILED: ' + message);
document.location.hash = '#fail';
}
-function getLog()
-{
+function getLog() {
return "" + document.getElementById('status').innerHTML;
}
-function unexpectedUpgradeNeededCallback(e)
-{
- fail('unexpectedUpgradeNeededCallback' +
- ' (oldVersion: ' + e.oldVersion + ' newVersion: ' + e.newVersion + ')');
-}
-
-function unexpectedAbortCallback(e)
-{
- fail('unexpectedAbortCallback' +
- ' (' + e.target.error.name + ': ' + e.target.error.message + ')');
-}
-
-function unexpectedSuccessCallback()
-{
- fail('unexpectedSuccessCallback');
-}
-
-function unexpectedCompleteCallback()
-{
- fail('unexpectedCompleteCallback');
-}
-
-function unexpectedErrorCallback(e)
-{
- fail('unexpectedErrorCallback' +
- ' (' + e.target.error.name + ': ' + e.target.error.message + ')');
-}
-
-function unexpectedBlockedCallback(e)
-{
- fail('unexpectedBlockedCallback' +
- ' (oldVersion: ' + e.oldVersion + ' newVersion: ' + e.newVersion + ')');
-}
-
-function deleteAllObjectStores(db)
-{
- objectStoreNames = db.objectStoreNames;
- for (var i = 0; i < objectStoreNames.length; ++i)
- db.deleteObjectStore(objectStoreNames[i]);
-}
-
// The following functions are based on
// WebKit/LayoutTests/fast/js/resources/js-test-pre.js
// so that the tests will look similar to the existing layout tests.
-function stringify(v)
-{
+function stringify(v) {
if (v === 0 && 1/v < 0)
return "-0";
else return "" + v;
}
+function areArraysEqual(a, b) {
+ try {
+ if (a.length !== b.length)
+ return false;
+ for (var i = 0; i < a.length; i++) {
+ if (a[i] !== b[i])
+ return false;
+ }
+ } catch (ex) {
+ return false;
+ }
+ return true;
+}
+
function isResultCorrect(_actual, _expected)
{
if (_expected === 0)
@@ -94,6 +62,7 @@ function isResultCorrect(_actual, _expected)
if (Object.prototype.toString.call(_expected) ==
Object.prototype.toString.call([]))
return areArraysEqual(_actual, _expected);
+
pwnall 2016/12/01 23:28:49 Unnecessary change?
dmurph 2016/12/02 01:11:34 Done.
return false;
}
@@ -125,30 +94,13 @@ function shouldBeTrue(_a) { shouldBe(_a, "true"); }
function shouldBeFalse(_a) { shouldBe(_a, "false"); }
function shouldBeNaN(_a) { shouldBe(_a, "NaN"); }
function shouldBeNull(_a) { shouldBe(_a, "null"); }
-function shouldBeEqualToString(a, b)
-{
+function shouldBeEqualToString(a, b) {
var unevaledString = '"' + b.replace(/\\/g, "\\\\").replace(/"/g, "\"") + '"';
shouldBe(a, unevaledString);
}
-function indexedDBTest(upgradeCallback, optionalOpenCallback) {
- dbname = self.location.pathname.substring(
- 1 + self.location.pathname.lastIndexOf("/"));
- var deleteRequest = indexedDB.deleteDatabase(dbname);
- deleteRequest.onerror = unexpectedErrorCallback;
- deleteRequest.onblocked = unexpectedBlockedCallback;
- deleteRequest.onsuccess = function() {
- var openRequest = indexedDB.open(dbname);
- openRequest.onerror = unexpectedErrorCallback;
- openRequest.onupgradeneeded = upgradeCallback;
- openRequest.onblocked = unexpectedBlockedCallback;
- if (optionalOpenCallback)
- openRequest.onsuccess = optionalOpenCallback;
- };
-}
-
if (typeof String.prototype.startsWith !== 'function') {
String.prototype.startsWith = function (str) {
return this.indexOf(str) === 0;
};
-}
+}

Powered by Google App Engine
This is Rietveld 408576698