mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Unit test bustage fix from bug 672681 for apps without private browser and that don't have places enabled by default. r=unit-test only bustage fix
This commit is contained in:
parent
988d99bd9a
commit
caf3d730aa
@ -124,40 +124,36 @@ add_test(function test_dh_addDownload_referrer()
|
||||
});
|
||||
});
|
||||
|
||||
add_test(function test_dh_addDownload_privateBrowsing()
|
||||
{
|
||||
if (!("@mozilla.org/privatebrowsing;1" in Cc)) {
|
||||
todo(false, "PB service is not available, bail out");
|
||||
run_next_test();
|
||||
return;
|
||||
}
|
||||
if ("@mozilla.org/privatebrowsing;1" in Cc) {
|
||||
add_test(function test_dh_addDownload_privateBrowsing()
|
||||
{
|
||||
waitForOnVisit(function DHAD_onVisit(aURI) {
|
||||
// We should only receive the notification for the non-private URI. This
|
||||
// test is based on the assumption that visit notifications are received
|
||||
// in the same order of the addDownload calls, which is currently true
|
||||
// because database access is serialized on the same worker thread.
|
||||
do_check_true(aURI.equals(DOWNLOAD_URI));
|
||||
|
||||
waitForOnVisit(function DHAD_onVisit(aURI) {
|
||||
// We should only receive the notification for the non-private URI. This
|
||||
// test is based on the assumption that visit notifications are received in
|
||||
// the same order of the addDownload calls, which is currently true because
|
||||
// database access is serialized on the same worker thread.
|
||||
do_check_true(aURI.equals(DOWNLOAD_URI));
|
||||
uri_in_db(DOWNLOAD_URI, true);
|
||||
uri_in_db(PRIVATE_URI, false);
|
||||
|
||||
uri_in_db(DOWNLOAD_URI, true);
|
||||
uri_in_db(PRIVATE_URI, false);
|
||||
waitForClearHistory(run_next_test);
|
||||
});
|
||||
|
||||
waitForClearHistory(run_next_test);
|
||||
let pb = Cc["@mozilla.org/privatebrowsing;1"]
|
||||
.getService(Ci.nsIPrivateBrowsingService);
|
||||
Services.prefs.setBoolPref("browser.privatebrowsing.keep_current_session",
|
||||
true);
|
||||
pb.privateBrowsingEnabled = true;
|
||||
gDownloadHistory.addDownload(PRIVATE_URI, REFERRER_URI, Date.now() * 1000);
|
||||
|
||||
// The addDownload functions calls CanAddURI synchronously, thus we can
|
||||
// exit Private Browsing Mode immediately.
|
||||
pb.privateBrowsingEnabled = false;
|
||||
Services.prefs.clearUserPref("browser.privatebrowsing.keep_current_session");
|
||||
gDownloadHistory.addDownload(DOWNLOAD_URI, REFERRER_URI, Date.now() * 1000);
|
||||
});
|
||||
|
||||
let pb = Cc["@mozilla.org/privatebrowsing;1"]
|
||||
.getService(Ci.nsIPrivateBrowsingService);
|
||||
Services.prefs.setBoolPref("browser.privatebrowsing.keep_current_session",
|
||||
true);
|
||||
pb.privateBrowsingEnabled = true;
|
||||
gDownloadHistory.addDownload(PRIVATE_URI, REFERRER_URI, Date.now() * 1000);
|
||||
|
||||
// The addDownload functions calls CanAddURI synchronously, thus we can exit
|
||||
// Private Browsing Mode immediately.
|
||||
pb.privateBrowsingEnabled = false;
|
||||
Services.prefs.clearUserPref("browser.privatebrowsing.keep_current_session");
|
||||
gDownloadHistory.addDownload(DOWNLOAD_URI, REFERRER_URI, Date.now() * 1000);
|
||||
});
|
||||
}
|
||||
|
||||
add_test(function test_dh_addDownload_disabledHistory()
|
||||
{
|
||||
@ -177,9 +173,10 @@ add_test(function test_dh_addDownload_disabledHistory()
|
||||
Services.prefs.setBoolPref("places.history.enabled", false);
|
||||
gDownloadHistory.addDownload(PRIVATE_URI, REFERRER_URI, Date.now() * 1000);
|
||||
|
||||
// The addDownload functions calls CanAddURI synchronously, thus we can reset
|
||||
// the preference immediately.
|
||||
Services.prefs.clearUserPref("places.history.enabled");
|
||||
// The addDownload functions calls CanAddURI synchronously, thus we can set
|
||||
// the preference back to true immediately (not all apps enable places by
|
||||
// default).
|
||||
Services.prefs.setBoolPref("places.history.enabled", true);
|
||||
gDownloadHistory.addDownload(DOWNLOAD_URI, REFERRER_URI, Date.now() * 1000);
|
||||
});
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user