| 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..e9b3cc6a5a4ae11cd284ae985a8bf1405c239f0f 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)
|
| @@ -125,30 +93,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;
|
| };
|
| -}
|
| +}
|
|
|