From 11e3ce5c5f3d738fc774e121690ab4ae7bb2e1d0 Mon Sep 17 00:00:00 2001 From: Ehsan Akhgari Date: Tue, 12 Oct 2010 18:30:41 -0400 Subject: [PATCH] Bug 603632 - Reduce the dependency between browser-chrome private browsing tests; r=dolske a=NPOTB --- .../privatebrowsing/test/browser/Makefile.in | 1 + .../components/privatebrowsing/test/browser/head.js | 11 +++++++++++ 2 files changed, 12 insertions(+) create mode 100644 browser/components/privatebrowsing/test/browser/head.js diff --git a/browser/components/privatebrowsing/test/browser/Makefile.in b/browser/components/privatebrowsing/test/browser/Makefile.in index 9db58108fd2c..d5ab89e4e769 100644 --- a/browser/components/privatebrowsing/test/browser/Makefile.in +++ b/browser/components/privatebrowsing/test/browser/Makefile.in @@ -45,6 +45,7 @@ include $(DEPTH)/config/autoconf.mk include $(topsrcdir)/config/rules.mk _BROWSER_TEST_FILES = \ + head.js \ browser_console_clear.js \ browser_privatebrowsing_certexceptionsui.js \ browser_privatebrowsing_commandline_toggle.js \ diff --git a/browser/components/privatebrowsing/test/browser/head.js b/browser/components/privatebrowsing/test/browser/head.js new file mode 100644 index 000000000000..3ac83cf5156b --- /dev/null +++ b/browser/components/privatebrowsing/test/browser/head.js @@ -0,0 +1,11 @@ +// Make sure that we clean up after each test if it times out, for example. +registerCleanupFunction(function() { + var pb = Cc["@mozilla.org/privatebrowsing;1"]. + getService(Ci.nsIPrivateBrowsingService); + ok(!pb.privateBrowsingEnabled, "Private browsing should be terminated after finishing the test"); + pb.privateBrowsingEnabled = false; + try { + Services.prefs.clearUserPref("browser.privatebrowsing.keep_current_session"); + } catch(e) {} +}); +