зеркало из https://github.com/mozilla/gecko-dev.git
Bug 928349 - Remove obsolete tests currently failing on comm-central. r=jcranmer
This commit is contained in:
Родитель
b8152a6414
Коммит
767ebee4ce
Двоичный файл не отображается.
Двоичный файл не отображается.
|
@ -56,25 +56,6 @@ var provider = {
|
|||
};
|
||||
dirSvc.QueryInterface(Ci.nsIDirectoryService).registerProvider(provider);
|
||||
|
||||
/**
|
||||
* Imports a download test file to use. Works with rdf and sqlite files.
|
||||
*
|
||||
* @param aFName
|
||||
* The name of the file to import. This file should be located in the
|
||||
* same directory as this file.
|
||||
*/
|
||||
function importDownloadsFile(aFName)
|
||||
{
|
||||
var file = do_get_file(aFName);
|
||||
var newFile = dirSvc.get("ProfD", Ci.nsIFile);
|
||||
if (/\.rdf$/i.test(aFName))
|
||||
file.copyTo(newFile, "downloads.rdf");
|
||||
else if (/\.sqlite$/i.test(aFName))
|
||||
file.copyTo(newFile, "downloads.sqlite");
|
||||
else
|
||||
do_throw("Unexpected filename!");
|
||||
}
|
||||
|
||||
var gDownloadCount = 0;
|
||||
/**
|
||||
* Adds a download to the DM, and starts it.
|
||||
|
|
|
@ -1,36 +0,0 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
// This tests that downloads in the scanning state are set to a completed state
|
||||
// upon service initialization.
|
||||
|
||||
importDownloadsFile("bug_401582_downloads.sqlite");
|
||||
|
||||
const nsIDownloadManager = Ci.nsIDownloadManager;
|
||||
const dm = Cc["@mozilla.org/download-manager;1"].getService(nsIDownloadManager);
|
||||
|
||||
function test_noScanningDownloads()
|
||||
{
|
||||
var stmt = dm.DBConnection.createStatement(
|
||||
"SELECT * " +
|
||||
"FROM moz_downloads " +
|
||||
"WHERE state = ?1");
|
||||
stmt.bindByIndex(0, nsIDownloadManager.DOWNLOAD_SCANNING);
|
||||
|
||||
do_check_false(stmt.executeStep());
|
||||
stmt.reset();
|
||||
stmt.finalize();
|
||||
}
|
||||
|
||||
var tests = [test_noScanningDownloads];
|
||||
|
||||
function run_test()
|
||||
{
|
||||
if (oldDownloadManagerDisabled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (var i = 0; i < tests.length; i++)
|
||||
tests[i]();
|
||||
}
|
|
@ -1,24 +0,0 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
// This file ensures that the download manager service can be instantiated with
|
||||
// a certain downloads.sqlite file that had incorrect data.
|
||||
|
||||
importDownloadsFile("bug_409179_downloads.sqlite");
|
||||
|
||||
function run_test()
|
||||
{
|
||||
if (oldDownloadManagerDisabled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
var caughtException = false;
|
||||
try {
|
||||
var dm = Cc["@mozilla.org/download-manager;1"].
|
||||
getService(Ci.nsIDownloadManager);
|
||||
} catch (e) {
|
||||
caughtException = true;
|
||||
}
|
||||
do_check_false(caughtException);
|
||||
}
|
|
@ -1,24 +0,0 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
// Make sure we remove old, now-unused downloads.rdf (pre-Firefox 3 storage)
|
||||
// when starting the download manager.
|
||||
|
||||
function run_test()
|
||||
{
|
||||
if (oldDownloadManagerDisabled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Create the downloads.rdf file
|
||||
importDownloadsFile("empty_downloads.rdf");
|
||||
|
||||
// Make sure it got created
|
||||
let rdfFile = dirSvc.get("DLoads", Ci.nsIFile);
|
||||
do_check_true(rdfFile.exists());
|
||||
|
||||
// Initialize the download manager, which will delete downloads.rdf
|
||||
Cc["@mozilla.org/download-manager;1"].getService(Ci.nsIDownloadManager);
|
||||
do_check_false(rdfFile.exists());
|
||||
}
|
|
@ -3,10 +3,7 @@ head = head_download_manager.js
|
|||
tail = tail_download_manager.js
|
||||
firefox-appdir = browser
|
||||
support-files =
|
||||
bug_401582_downloads.sqlite
|
||||
bug_409179_downloads.sqlite
|
||||
downloads_manifest.js
|
||||
empty_downloads.rdf
|
||||
test_downloads.manifest
|
||||
data/digest.chunk
|
||||
|
||||
|
@ -15,9 +12,7 @@ support-files =
|
|||
[test_bug_384744.js]
|
||||
[test_bug_395092.js]
|
||||
[test_bug_401430.js]
|
||||
[test_bug_401582.js]
|
||||
[test_bug_406857.js]
|
||||
[test_bug_409179.js]
|
||||
[test_bug_420230.js]
|
||||
[test_cancel_download_files_removed.js]
|
||||
# Bug 676989: test hangs consistently on Android
|
||||
|
@ -29,7 +24,6 @@ skip-if = os == "android"
|
|||
[test_guid.js]
|
||||
[test_history_expiration.js]
|
||||
[test_offline_support.js]
|
||||
[test_old_download_files_removed.js]
|
||||
[test_private_resume.js]
|
||||
[test_privatebrowsing.js]
|
||||
[test_privatebrowsing_cancel.js]
|
||||
|
|
Двоичные данные
toolkit/forgetaboutsite/test/unit/downloads.empty.sqlite
Двоичные данные
toolkit/forgetaboutsite/test/unit/downloads.empty.sqlite
Двоичный файл не отображается.
|
@ -1,137 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
* vim: sw=2 ts=2 sts=2
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
/**
|
||||
* Test added with bug 460086 to test the behavior of the new API that was added
|
||||
* to remove all traces of visiting a site.
|
||||
*/
|
||||
|
||||
Components.utils.import("resource://gre/modules/Services.jsm");
|
||||
Components.utils.import("resource://gre/modules/ForgetAboutSite.jsm");
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
//// Utility Functions
|
||||
|
||||
/**
|
||||
* Creates an nsIURI object for the given file.
|
||||
*
|
||||
* @param aFile
|
||||
* The nsIFile of the URI to create.
|
||||
* @returns an nsIURI representing aFile.
|
||||
*/
|
||||
function uri(aFile)
|
||||
{
|
||||
return Cc["@mozilla.org/network/io-service;1"].
|
||||
getService(Ci.nsIIOService).
|
||||
newFileURI(aFile);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks to ensure a URI string is in download history or not.
|
||||
*
|
||||
* @param aURIString
|
||||
* The string of the URI to check.
|
||||
* @param aIsActive
|
||||
* True if the URI should be actively downloaded, false otherwise.
|
||||
*/
|
||||
function check_active_download(aURIString, aIsActive)
|
||||
{
|
||||
let dm = Cc["@mozilla.org/download-manager;1"].
|
||||
getService(Ci.nsIDownloadManager);
|
||||
let enumerator = dm.activeDownloads;
|
||||
let found = false;
|
||||
while (enumerator.hasMoreElements()) {
|
||||
let dl = enumerator.getNext().QueryInterface(Ci.nsIDownload);
|
||||
if (dl.source.spec == aURIString)
|
||||
found = true;
|
||||
}
|
||||
let checker = aIsActive ? do_check_true : do_check_false;
|
||||
checker(found);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
//// Test Functions
|
||||
|
||||
let destFile = dirSvc.get("TmpD", Ci.nsIFile);
|
||||
destFile.append("dm-test-file");
|
||||
destFile = uri(destFile);
|
||||
let data = [
|
||||
{ source: "http://mozilla.org/direct_match",
|
||||
target: destFile.spec,
|
||||
removed: true
|
||||
},
|
||||
{ source: "http://www.mozilla.org/subdomain",
|
||||
target: destFile.spec,
|
||||
removed: true
|
||||
},
|
||||
{ source: "http://ilovemozilla.org/contains_domain",
|
||||
target: destFile.spec,
|
||||
removed: false
|
||||
},
|
||||
];
|
||||
|
||||
function makeGUID() {
|
||||
let guid = "";
|
||||
for (var i = 0; i < 12; i++)
|
||||
guid += Math.floor(Math.random() * 10);
|
||||
return guid;
|
||||
}
|
||||
|
||||
function run_test()
|
||||
{
|
||||
if (oldDownloadManagerDisabled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// We add this data to the database first, but we cannot instantiate the
|
||||
// download manager service, otherwise these downloads will not be placed in
|
||||
// the active downloads array.
|
||||
|
||||
// Copy the empty downloads database to our profile directory
|
||||
let downloads = do_get_file("downloads.empty.sqlite");
|
||||
downloads.copyTo(dirSvc.get("ProfD", Ci.nsIFile), "downloads.sqlite");
|
||||
|
||||
// Open the database
|
||||
let ss = Cc["@mozilla.org/storage/service;1"].
|
||||
getService(Ci.mozIStorageService);
|
||||
let file = dirSvc.get("ProfD", Ci.nsIFile);
|
||||
file.append("downloads.sqlite");
|
||||
let db = ss.openDatabase(file);
|
||||
|
||||
// Insert the data
|
||||
let stmt = db.createStatement(
|
||||
"INSERT INTO moz_downloads (source, target, state, autoResume, entityID, guid) " +
|
||||
"VALUES (:source, :target, :state, :autoResume, :entityID, :guid)"
|
||||
);
|
||||
for (let i = 0; i < data.length; i++) {
|
||||
stmt.params.source = data[i].source;
|
||||
stmt.params.target = data[i].target;
|
||||
stmt.params.state = Ci.nsIDownloadManager.DOWNLOAD_PAUSED;
|
||||
stmt.params.autoResume = 0; // DONT_RESUME is 0
|
||||
stmt.params.entityID = "foo" // just has to be non-null for our test
|
||||
stmt.params.guid = makeGUID();
|
||||
stmt.execute();
|
||||
stmt.reset();
|
||||
}
|
||||
stmt.finalize();
|
||||
stmt = null;
|
||||
db.close();
|
||||
db = null;
|
||||
|
||||
// Check to make sure it's all there
|
||||
for (let i = 0; i < data.length; i++)
|
||||
check_active_download(data[i].source, true);
|
||||
|
||||
// Dispatch the remove call
|
||||
ForgetAboutSite.removeDataFromDomain("mozilla.org");
|
||||
|
||||
// And check our data
|
||||
for (let i = 0; i < data.length; i++)
|
||||
check_active_download(data[i].source, !data[i].removed);
|
||||
|
||||
// Shutdown the download manager.
|
||||
Services.obs.notifyObservers(null, "quit-application", null);
|
||||
}
|
|
@ -1,7 +1,5 @@
|
|||
[DEFAULT]
|
||||
head = head_forgetaboutsite.js
|
||||
tail =
|
||||
support-files = downloads.empty.sqlite
|
||||
|
||||
[test_removeDataFromDomain.js]
|
||||
[test_removeDataFromDomain_activeDownloads.js]
|
||||
|
|
Загрузка…
Ссылка в новой задаче