Bug 799526 - Split the private browsing browser-chrome test suite into three buckets to make it easier to transition to per-window private browsing; r=jdm
authorEhsan Akhgari <ehsan@mozilla.com>
Tue, 09 Oct 2012 09:27:44 -0400
changeset 110084 06eb83abf17f70e8cbae0d738bda4f2042421414
parent 110055 3fca49e8a93a4cb34a1a3ce37ce78c0fd6b3f0ee
child 110085 b7d112dee89c5033c6f19ff86183987d4ad0b79b
push id93
push usernmatsakis@mozilla.com
push dateWed, 31 Oct 2012 21:26:57 +0000
reviewersjdm
bugs799526
milestone19.0a1
Bug 799526 - Split the private browsing browser-chrome test suite into three buckets to make it easier to transition to per-window private browsing; r=jdm
browser/components/privatebrowsing/test/browser/Makefile.in
browser/components/privatebrowsing/test/browser/browser_console_clear.js
browser/components/privatebrowsing/test/browser/browser_privatebrowsing_beforeunload.js
browser/components/privatebrowsing/test/browser/browser_privatebrowsing_certexceptionsui.js
browser/components/privatebrowsing/test/browser/browser_privatebrowsing_commandline_toggle.js
browser/components/privatebrowsing/test/browser/browser_privatebrowsing_concurrent.js
browser/components/privatebrowsing/test/browser/browser_privatebrowsing_concurrent_page.html
browser/components/privatebrowsing/test/browser/browser_privatebrowsing_cookieacceptdialog.js
browser/components/privatebrowsing/test/browser/browser_privatebrowsing_crh.js
browser/components/privatebrowsing/test/browser/browser_privatebrowsing_downloadmonitor.js
browser/components/privatebrowsing/test/browser/browser_privatebrowsing_fastswitch.js
browser/components/privatebrowsing/test/browser/browser_privatebrowsing_findbar.js
browser/components/privatebrowsing/test/browser/browser_privatebrowsing_forgetthissite.js
browser/components/privatebrowsing/test/browser/browser_privatebrowsing_geoprompt.js
browser/components/privatebrowsing/test/browser/browser_privatebrowsing_geoprompt_page.html
browser/components/privatebrowsing/test/browser/browser_privatebrowsing_import.js
browser/components/privatebrowsing/test/browser/browser_privatebrowsing_lastpbcontextexited.js
browser/components/privatebrowsing/test/browser/browser_privatebrowsing_localStorage.js
browser/components/privatebrowsing/test/browser/browser_privatebrowsing_localStorage_before_after.js
browser/components/privatebrowsing/test/browser/browser_privatebrowsing_localStorage_before_after_page.html
browser/components/privatebrowsing/test/browser/browser_privatebrowsing_localStorage_before_after_page2.html
browser/components/privatebrowsing/test/browser/browser_privatebrowsing_localStorage_page1.html
browser/components/privatebrowsing/test/browser/browser_privatebrowsing_localStorage_page2.html
browser/components/privatebrowsing/test/browser/browser_privatebrowsing_newwindow_stopcmd.js
browser/components/privatebrowsing/test/browser/browser_privatebrowsing_openLocationLastURL.js
browser/components/privatebrowsing/test/browser/browser_privatebrowsing_opendir.js
browser/components/privatebrowsing/test/browser/browser_privatebrowsing_openlocation.js
browser/components/privatebrowsing/test/browser/browser_privatebrowsing_pageinfo.js
browser/components/privatebrowsing/test/browser/browser_privatebrowsing_placestitle.js
browser/components/privatebrowsing/test/browser/browser_privatebrowsing_popupblocker.js
browser/components/privatebrowsing/test/browser/browser_privatebrowsing_popupmode.js
browser/components/privatebrowsing/test/browser/browser_privatebrowsing_protocolhandler.js
browser/components/privatebrowsing/test/browser/browser_privatebrowsing_protocolhandler_page.html
browser/components/privatebrowsing/test/browser/browser_privatebrowsing_searchbar.js
browser/components/privatebrowsing/test/browser/browser_privatebrowsing_sslsite_transition.js
browser/components/privatebrowsing/test/browser/browser_privatebrowsing_theming.js
browser/components/privatebrowsing/test/browser/browser_privatebrowsing_transition.js
browser/components/privatebrowsing/test/browser/browser_privatebrowsing_ui.js
browser/components/privatebrowsing/test/browser/browser_privatebrowsing_urlbarfocus.js
browser/components/privatebrowsing/test/browser/browser_privatebrowsing_urlbarundo.js
browser/components/privatebrowsing/test/browser/browser_privatebrowsing_viewsource.js
browser/components/privatebrowsing/test/browser/browser_privatebrowsing_windowtitle.js
browser/components/privatebrowsing/test/browser/browser_privatebrowsing_windowtitle_page.html
browser/components/privatebrowsing/test/browser/browser_privatebrowsing_zoom.js
browser/components/privatebrowsing/test/browser/browser_privatebrowsing_zoomrestore.js
browser/components/privatebrowsing/test/browser/ctxmenu-image.png
browser/components/privatebrowsing/test/browser/ctxmenu.html
browser/components/privatebrowsing/test/browser/global/Makefile.in
browser/components/privatebrowsing/test/browser/global/browser_privatebrowsing_certexceptionsui.js
browser/components/privatebrowsing/test/browser/global/browser_privatebrowsing_cookieacceptdialog.js
browser/components/privatebrowsing/test/browser/global/browser_privatebrowsing_crh.js
browser/components/privatebrowsing/test/browser/global/browser_privatebrowsing_geoprompt.js
browser/components/privatebrowsing/test/browser/global/browser_privatebrowsing_geoprompt_page.html
browser/components/privatebrowsing/test/browser/global/browser_privatebrowsing_localStorage.js
browser/components/privatebrowsing/test/browser/global/browser_privatebrowsing_localStorage_before_after.js
browser/components/privatebrowsing/test/browser/global/browser_privatebrowsing_localStorage_before_after_page.html
browser/components/privatebrowsing/test/browser/global/browser_privatebrowsing_localStorage_before_after_page2.html
browser/components/privatebrowsing/test/browser/global/browser_privatebrowsing_localStorage_page1.html
browser/components/privatebrowsing/test/browser/global/browser_privatebrowsing_localStorage_page2.html
browser/components/privatebrowsing/test/browser/global/browser_privatebrowsing_openLocationLastURL.js
browser/components/privatebrowsing/test/browser/global/browser_privatebrowsing_opendir.js
browser/components/privatebrowsing/test/browser/global/browser_privatebrowsing_openlocation.js
browser/components/privatebrowsing/test/browser/global/browser_privatebrowsing_placestitle.js
browser/components/privatebrowsing/test/browser/global/browser_privatebrowsing_popupblocker.js
browser/components/privatebrowsing/test/browser/global/browser_privatebrowsing_protocolhandler.js
browser/components/privatebrowsing/test/browser/global/browser_privatebrowsing_protocolhandler_page.html
browser/components/privatebrowsing/test/browser/global/browser_privatebrowsing_sslsite_transition.js
browser/components/privatebrowsing/test/browser/global/browser_privatebrowsing_theming.js
browser/components/privatebrowsing/test/browser/global/browser_privatebrowsing_ui.js
browser/components/privatebrowsing/test/browser/global/browser_privatebrowsing_urlbarfocus.js
browser/components/privatebrowsing/test/browser/global/browser_privatebrowsing_windowtitle.js
browser/components/privatebrowsing/test/browser/global/browser_privatebrowsing_windowtitle_page.html
browser/components/privatebrowsing/test/browser/global/browser_privatebrowsing_zoom.js
browser/components/privatebrowsing/test/browser/global/browser_privatebrowsing_zoomrestore.js
browser/components/privatebrowsing/test/browser/global/ctxmenu-image.png
browser/components/privatebrowsing/test/browser/global/ctxmenu.html
browser/components/privatebrowsing/test/browser/global/head.js
browser/components/privatebrowsing/test/browser/global/popup.html
browser/components/privatebrowsing/test/browser/global/title.sjs
browser/components/privatebrowsing/test/browser/head.js
browser/components/privatebrowsing/test/browser/obsolete/Makefile.in
browser/components/privatebrowsing/test/browser/obsolete/browser_console_clear.js
browser/components/privatebrowsing/test/browser/obsolete/browser_privatebrowsing_beforeunload.js
browser/components/privatebrowsing/test/browser/obsolete/browser_privatebrowsing_commandline_toggle.js
browser/components/privatebrowsing/test/browser/obsolete/browser_privatebrowsing_downloadmonitor.js
browser/components/privatebrowsing/test/browser/obsolete/browser_privatebrowsing_fastswitch.js
browser/components/privatebrowsing/test/browser/obsolete/browser_privatebrowsing_findbar.js
browser/components/privatebrowsing/test/browser/obsolete/browser_privatebrowsing_forgetthissite.js
browser/components/privatebrowsing/test/browser/obsolete/browser_privatebrowsing_import.js
browser/components/privatebrowsing/test/browser/obsolete/browser_privatebrowsing_newwindow_stopcmd.js
browser/components/privatebrowsing/test/browser/obsolete/browser_privatebrowsing_pageinfo.js
browser/components/privatebrowsing/test/browser/obsolete/browser_privatebrowsing_popupmode.js
browser/components/privatebrowsing/test/browser/obsolete/browser_privatebrowsing_searchbar.js
browser/components/privatebrowsing/test/browser/obsolete/browser_privatebrowsing_transition.js
browser/components/privatebrowsing/test/browser/obsolete/browser_privatebrowsing_urlbarundo.js
browser/components/privatebrowsing/test/browser/obsolete/browser_privatebrowsing_viewsource.js
browser/components/privatebrowsing/test/browser/obsolete/head.js
browser/components/privatebrowsing/test/browser/obsolete/staller.sjs
browser/components/privatebrowsing/test/browser/perwindow/Makefile.in
browser/components/privatebrowsing/test/browser/perwindow/browser_privatebrowsing_concurrent.js
browser/components/privatebrowsing/test/browser/perwindow/browser_privatebrowsing_concurrent_page.html
browser/components/privatebrowsing/test/browser/perwindow/browser_privatebrowsing_lastpbcontextexited.js
browser/components/privatebrowsing/test/browser/perwindow/head.js
browser/components/privatebrowsing/test/browser/popup.html
browser/components/privatebrowsing/test/browser/staller.sjs
browser/components/privatebrowsing/test/browser/title.sjs
--- a/browser/components/privatebrowsing/test/browser/Makefile.in
+++ b/browser/components/privatebrowsing/test/browser/Makefile.in
@@ -5,70 +5,28 @@
 DEPTH		= @DEPTH@
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 relativesrcdir  = @relativesrcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
-MOCHITEST_BROWSER_FILES =  \
-		head.js \
-		browser_console_clear.js \
-		browser_privatebrowsing_certexceptionsui.js \
-		browser_privatebrowsing_commandline_toggle.js \
-		browser_privatebrowsing_concurrent.js \
-		browser_privatebrowsing_concurrent_page.html \
-		browser_privatebrowsing_crh.js \
-		browser_privatebrowsing_fastswitch.js \
-		browser_privatebrowsing_findbar.js \
-		browser_privatebrowsing_forgetthissite.js \
-		browser_privatebrowsing_geoprompt.js \
-		browser_privatebrowsing_geoprompt_page.html \
-		browser_privatebrowsing_import.js \
-		browser_privatebrowsing_lastpbcontextexited.js \
-		browser_privatebrowsing_localStorage.js \
-		browser_privatebrowsing_localStorage_before_after.js \
-		browser_privatebrowsing_localStorage_before_after_page.html \
-		browser_privatebrowsing_localStorage_before_after_page2.html \
-		browser_privatebrowsing_localStorage_page1.html \
-		browser_privatebrowsing_localStorage_page2.html \
-		browser_privatebrowsing_newwindow_stopcmd.js \
-		browser_privatebrowsing_opendir.js \
-		browser_privatebrowsing_openlocation.js \
-		browser_privatebrowsing_openLocationLastURL.js \
-		browser_privatebrowsing_pageinfo.js \
-		browser_privatebrowsing_placestitle.js \
-		browser_privatebrowsing_popupblocker.js \
-		browser_privatebrowsing_popupmode.js \
-		browser_privatebrowsing_protocolhandler.js \
-		browser_privatebrowsing_protocolhandler_page.html \
-		browser_privatebrowsing_searchbar.js \
-		browser_privatebrowsing_sslsite_transition.js \
-		browser_privatebrowsing_theming.js \
-		browser_privatebrowsing_transition.js \
-		browser_privatebrowsing_ui.js \
-		browser_privatebrowsing_urlbarfocus.js \
-		browser_privatebrowsing_urlbarundo.js \
-		browser_privatebrowsing_viewsource.js \
-		browser_privatebrowsing_windowtitle.js \
-		browser_privatebrowsing_windowtitle_page.html \
-		browser_privatebrowsing_zoom.js \
-		browser_privatebrowsing_zoomrestore.js \
-		ctxmenu.html \
-		ctxmenu-image.png \
-		popup.html \
-		staller.sjs \
-		title.sjs \
-		$(NULL)
+MODULE		= test_privatebrowsing
 
-# Disabled until bug 564934 is fixed:
-#		browser_privatebrowsing_downloadmonitor.js \
+# We have three category of browser-chrome tests:
+#  global: these tests focus on the global PB service implementation.
+#  perwindow: these tests focus on the per-window PB implementation.
+#  obsolete: these tests focus on the global mode, but the functionality
+#            that they are testing is specific to the global mode, and
+#            will never have a per-window counterpart.
+#
+# As a transition plan, we have divided the existing tests into the
+# global and obsolete categories, and we'll then focus on rewriting the
+# global tests to test the per-window mode.
 
-# Turn off private browsing tests that perma-timeout on Linux.
-ifneq (Linux,$(OS_ARCH))
-MOCHITEST_BROWSER_FILES += \
-		browser_privatebrowsing_beforeunload.js \
-		browser_privatebrowsing_cookieacceptdialog.js \
-		$(NULL)
+ifdef MOZ_PER_WINDOW_PRIVATE_BROWSING
+DIRS += perwindow
+else
+DIRS += global obsolete
 endif
 
 include $(topsrcdir)/config/rules.mk
copy from browser/components/privatebrowsing/test/browser/Makefile.in
copy to browser/components/privatebrowsing/test/browser/global/Makefile.in
--- a/browser/components/privatebrowsing/test/browser/Makefile.in
+++ b/browser/components/privatebrowsing/test/browser/global/Makefile.in
@@ -7,68 +7,47 @@ topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 relativesrcdir  = @relativesrcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 MOCHITEST_BROWSER_FILES =  \
 		head.js \
-		browser_console_clear.js \
 		browser_privatebrowsing_certexceptionsui.js \
-		browser_privatebrowsing_commandline_toggle.js \
-		browser_privatebrowsing_concurrent.js \
-		browser_privatebrowsing_concurrent_page.html \
 		browser_privatebrowsing_crh.js \
-		browser_privatebrowsing_fastswitch.js \
-		browser_privatebrowsing_findbar.js \
-		browser_privatebrowsing_forgetthissite.js \
 		browser_privatebrowsing_geoprompt.js \
 		browser_privatebrowsing_geoprompt_page.html \
-		browser_privatebrowsing_import.js \
-		browser_privatebrowsing_lastpbcontextexited.js \
 		browser_privatebrowsing_localStorage.js \
 		browser_privatebrowsing_localStorage_before_after.js \
 		browser_privatebrowsing_localStorage_before_after_page.html \
 		browser_privatebrowsing_localStorage_before_after_page2.html \
 		browser_privatebrowsing_localStorage_page1.html \
 		browser_privatebrowsing_localStorage_page2.html \
-		browser_privatebrowsing_newwindow_stopcmd.js \
 		browser_privatebrowsing_opendir.js \
 		browser_privatebrowsing_openlocation.js \
 		browser_privatebrowsing_openLocationLastURL.js \
-		browser_privatebrowsing_pageinfo.js \
 		browser_privatebrowsing_placestitle.js \
 		browser_privatebrowsing_popupblocker.js \
-		browser_privatebrowsing_popupmode.js \
 		browser_privatebrowsing_protocolhandler.js \
 		browser_privatebrowsing_protocolhandler_page.html \
-		browser_privatebrowsing_searchbar.js \
 		browser_privatebrowsing_sslsite_transition.js \
 		browser_privatebrowsing_theming.js \
-		browser_privatebrowsing_transition.js \
 		browser_privatebrowsing_ui.js \
 		browser_privatebrowsing_urlbarfocus.js \
-		browser_privatebrowsing_urlbarundo.js \
-		browser_privatebrowsing_viewsource.js \
 		browser_privatebrowsing_windowtitle.js \
 		browser_privatebrowsing_windowtitle_page.html \
 		browser_privatebrowsing_zoom.js \
 		browser_privatebrowsing_zoomrestore.js \
 		ctxmenu.html \
 		ctxmenu-image.png \
 		popup.html \
-		staller.sjs \
 		title.sjs \
 		$(NULL)
 
-# Disabled until bug 564934 is fixed:
-#		browser_privatebrowsing_downloadmonitor.js \
-
 # Turn off private browsing tests that perma-timeout on Linux.
 ifneq (Linux,$(OS_ARCH))
 MOCHITEST_BROWSER_FILES += \
-		browser_privatebrowsing_beforeunload.js \
 		browser_privatebrowsing_cookieacceptdialog.js \
 		$(NULL)
 endif
 
 include $(topsrcdir)/config/rules.mk
rename from browser/components/privatebrowsing/test/browser/browser_privatebrowsing_certexceptionsui.js
rename to browser/components/privatebrowsing/test/browser/global/browser_privatebrowsing_certexceptionsui.js
rename from browser/components/privatebrowsing/test/browser/browser_privatebrowsing_cookieacceptdialog.js
rename to browser/components/privatebrowsing/test/browser/global/browser_privatebrowsing_cookieacceptdialog.js
rename from browser/components/privatebrowsing/test/browser/browser_privatebrowsing_crh.js
rename to browser/components/privatebrowsing/test/browser/global/browser_privatebrowsing_crh.js
rename from browser/components/privatebrowsing/test/browser/browser_privatebrowsing_geoprompt.js
rename to browser/components/privatebrowsing/test/browser/global/browser_privatebrowsing_geoprompt.js
--- a/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_geoprompt.js
+++ b/browser/components/privatebrowsing/test/browser/global/browser_privatebrowsing_geoprompt.js
@@ -6,17 +6,17 @@
 // control inside the private browsing mode.
 
 function test() {
   // initialization
   let pb = Cc["@mozilla.org/privatebrowsing;1"].
            getService(Ci.nsIPrivateBrowsingService);
 
   const testPageURL = "http://mochi.test:8888/browser/" +
-    "browser/components/privatebrowsing/test/browser/browser_privatebrowsing_geoprompt_page.html";
+    "browser/components/privatebrowsing/test/browser/global/browser_privatebrowsing_geoprompt_page.html";
   waitForExplicitFinish();
 
   gBrowser.selectedTab = gBrowser.addTab();
   gBrowser.selectedBrowser.addEventListener("load", function () {
     gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true);
 
     let notification = PopupNotifications.getNotification("geolocation");
     ok(notification, "Notification should exist");
rename from browser/components/privatebrowsing/test/browser/browser_privatebrowsing_geoprompt_page.html
rename to browser/components/privatebrowsing/test/browser/global/browser_privatebrowsing_geoprompt_page.html
rename from browser/components/privatebrowsing/test/browser/browser_privatebrowsing_localStorage.js
rename to browser/components/privatebrowsing/test/browser/global/browser_privatebrowsing_localStorage.js
--- a/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_localStorage.js
+++ b/browser/components/privatebrowsing/test/browser/global/browser_privatebrowsing_localStorage.js
@@ -7,20 +7,20 @@ function test() {
            getService(Ci.nsIPrivateBrowsingService);
   waitForExplicitFinish();
   pb.privateBrowsingEnabled = true;
   let tab = gBrowser.selectedTab = gBrowser.addTab();
   let browser = gBrowser.selectedBrowser;
   browser.addEventListener('load', function() {
     browser.removeEventListener('load', arguments.callee, true);
     let tab2 = gBrowser.selectedTab = gBrowser.addTab();
-    browser.contentWindow.location = 'http://mochi.test:8888/browser/browser/components/privatebrowsing/test/browser/' +
+    browser.contentWindow.location = 'http://mochi.test:8888/browser/browser/components/privatebrowsing/test/browser/global/' +
                      'browser_privatebrowsing_localStorage_page2.html';
     browser.addEventListener('load', function() {
       browser.removeEventListener('load', arguments.callee, true);
       is(browser.contentWindow.document.title, '2', "localStorage should contain 2 items");
       pb.privateBrowsingEnabled = false;
       finish();
     }, true);
   }, true);
-  browser.loadURI('http://mochi.test:8888/browser/browser/components/privatebrowsing/test/browser/' +
+  browser.loadURI('http://mochi.test:8888/browser/browser/components/privatebrowsing/test/browser/global/' +
                   'browser_privatebrowsing_localStorage_page1.html');
 }
rename from browser/components/privatebrowsing/test/browser/browser_privatebrowsing_localStorage_before_after.js
rename to browser/components/privatebrowsing/test/browser/global/browser_privatebrowsing_localStorage_before_after.js
--- a/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_localStorage_before_after.js
+++ b/browser/components/privatebrowsing/test/browser/global/browser_privatebrowsing_localStorage_before_after.js
@@ -6,19 +6,19 @@
 // allow any data to leak due to cached values.
 
 // Step 1: Load browser_privatebrowsing_localStorage_before_after_page.html in a private tab, causing a storage
 //   item to exist. Close the tab.
 // Step 2: Load the same page in a non-private tab, ensuring that the storage instance reports only one item
 //   existing.
 
 function test() {
-  let prefix = 'http://mochi.test:8888/browser/browser/components/privatebrowsing/test/browser/';
+  let prefix = 'http://mochi.test:8888/browser/browser/components/privatebrowsing/test/browser/global/';
   waitForExplicitFinish();
-  
+
   // We wait for a GC to ensure that all previous PB docshells in this test suite are destroyed
   // so that the PB localStorage instance is clean.
   Components.utils.schedulePreciseGC(function() {
     let tab = gBrowser.selectedTab = gBrowser.addTab();
     let browser = gBrowser.selectedBrowser;
     browser.docShell.QueryInterface(Ci.nsILoadContext).usePrivateBrowsing = true;
     browser.addEventListener('load', function() {
       browser.removeEventListener('load', arguments.callee, true);
rename from browser/components/privatebrowsing/test/browser/browser_privatebrowsing_localStorage_before_after_page.html
rename to browser/components/privatebrowsing/test/browser/global/browser_privatebrowsing_localStorage_before_after_page.html
rename from browser/components/privatebrowsing/test/browser/browser_privatebrowsing_localStorage_before_after_page2.html
rename to browser/components/privatebrowsing/test/browser/global/browser_privatebrowsing_localStorage_before_after_page2.html
rename from browser/components/privatebrowsing/test/browser/browser_privatebrowsing_localStorage_page1.html
rename to browser/components/privatebrowsing/test/browser/global/browser_privatebrowsing_localStorage_page1.html
rename from browser/components/privatebrowsing/test/browser/browser_privatebrowsing_localStorage_page2.html
rename to browser/components/privatebrowsing/test/browser/global/browser_privatebrowsing_localStorage_page2.html
rename from browser/components/privatebrowsing/test/browser/browser_privatebrowsing_openLocationLastURL.js
rename to browser/components/privatebrowsing/test/browser/global/browser_privatebrowsing_openLocationLastURL.js
rename from browser/components/privatebrowsing/test/browser/browser_privatebrowsing_opendir.js
rename to browser/components/privatebrowsing/test/browser/global/browser_privatebrowsing_opendir.js
rename from browser/components/privatebrowsing/test/browser/browser_privatebrowsing_openlocation.js
rename to browser/components/privatebrowsing/test/browser/global/browser_privatebrowsing_openlocation.js
rename from browser/components/privatebrowsing/test/browser/browser_privatebrowsing_placestitle.js
rename to browser/components/privatebrowsing/test/browser/global/browser_privatebrowsing_placestitle.js
--- a/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_placestitle.js
+++ b/browser/components/privatebrowsing/test/browser/global/browser_privatebrowsing_placestitle.js
@@ -9,17 +9,17 @@ function test() {
   // initialization
   let pb = Cc["@mozilla.org/privatebrowsing;1"].
            getService(Ci.nsIPrivateBrowsingService);
   let cm = Cc["@mozilla.org/cookiemanager;1"].
            getService(Ci.nsICookieManager);
   waitForExplicitFinish();
   ignoreAllUncaughtExceptions();
 
-  const TEST_URL = "http://mochi.test:8888/browser/browser/components/privatebrowsing/test/browser/title.sjs";
+  const TEST_URL = "http://mochi.test:8888/browser/browser/components/privatebrowsing/test/browser/global/title.sjs";
 
   function waitForCleanup(aCallback) {
     // delete all cookies
     cm.removeAll();
     // delete all history items
     waitForClearHistory(aCallback);
   }
 
rename from browser/components/privatebrowsing/test/browser/browser_privatebrowsing_popupblocker.js
rename to browser/components/privatebrowsing/test/browser/global/browser_privatebrowsing_popupblocker.js
--- a/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_popupblocker.js
+++ b/browser/components/privatebrowsing/test/browser/global/browser_privatebrowsing_popupblocker.js
@@ -8,17 +8,17 @@
 function test() {
   // initialization
   let pb = Cc["@mozilla.org/privatebrowsing;1"].
            getService(Ci.nsIPrivateBrowsingService);
 
   let oldPopupPolicy = gPrefService.getBoolPref("dom.disable_open_during_load");
   gPrefService.setBoolPref("dom.disable_open_during_load", true);
 
-  const TEST_URI = "http://mochi.test:8888/browser/browser/components/privatebrowsing/test/browser/popup.html";
+  const TEST_URI = "http://mochi.test:8888/browser/browser/components/privatebrowsing/test/browser/global/popup.html";
 
   waitForExplicitFinish();
 
   function testPopupBlockerMenuItem(expectedDisabled, callback) {
     gBrowser.addEventListener("DOMUpdatePageReport", function() {
       gBrowser.removeEventListener("DOMUpdatePageReport", arguments.callee, false);
       executeSoon(function() {
         let notification = gBrowser.getNotificationBox().getNotificationWithValue("popup-blocked");
rename from browser/components/privatebrowsing/test/browser/browser_privatebrowsing_protocolhandler.js
rename to browser/components/privatebrowsing/test/browser/global/browser_privatebrowsing_protocolhandler.js
--- a/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_protocolhandler.js
+++ b/browser/components/privatebrowsing/test/browser/global/browser_privatebrowsing_protocolhandler.js
@@ -6,17 +6,17 @@
 // inside the private browsing mode.
 
 function test() {
   // initialization
   let pb = Cc["@mozilla.org/privatebrowsing;1"].
            getService(Ci.nsIPrivateBrowsingService);
 
   const testPageURL = "http://example.com/browser/" +
-    "browser/components/privatebrowsing/test/browser/browser_privatebrowsing_protocolhandler_page.html";
+    "browser/components/privatebrowsing/test/browser/global/browser_privatebrowsing_protocolhandler_page.html";
   waitForExplicitFinish();
 
   const notificationValue = "Protocol Registration: testprotocol";
 
   gBrowser.selectedTab = gBrowser.addTab();
   gBrowser.selectedBrowser.addEventListener("load", function () {
     gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true);
 
rename from browser/components/privatebrowsing/test/browser/browser_privatebrowsing_protocolhandler_page.html
rename to browser/components/privatebrowsing/test/browser/global/browser_privatebrowsing_protocolhandler_page.html
rename from browser/components/privatebrowsing/test/browser/browser_privatebrowsing_sslsite_transition.js
rename to browser/components/privatebrowsing/test/browser/global/browser_privatebrowsing_sslsite_transition.js
rename from browser/components/privatebrowsing/test/browser/browser_privatebrowsing_theming.js
rename to browser/components/privatebrowsing/test/browser/global/browser_privatebrowsing_theming.js
rename from browser/components/privatebrowsing/test/browser/browser_privatebrowsing_ui.js
rename to browser/components/privatebrowsing/test/browser/global/browser_privatebrowsing_ui.js
rename from browser/components/privatebrowsing/test/browser/browser_privatebrowsing_urlbarfocus.js
rename to browser/components/privatebrowsing/test/browser/global/browser_privatebrowsing_urlbarfocus.js
rename from browser/components/privatebrowsing/test/browser/browser_privatebrowsing_windowtitle.js
rename to browser/components/privatebrowsing/test/browser/global/browser_privatebrowsing_windowtitle.js
--- a/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_windowtitle.js
+++ b/browser/components/privatebrowsing/test/browser/global/browser_privatebrowsing_windowtitle.js
@@ -7,17 +7,17 @@
 
 function test() {
   // initialization
   gPrefService.setBoolPref("browser.privatebrowsing.keep_current_session", true);
   let pb = Cc["@mozilla.org/privatebrowsing;1"].
            getService(Ci.nsIPrivateBrowsingService);
 
   const testPageURL = "http://mochi.test:8888/browser/" +
-    "browser/components/privatebrowsing/test/browser/browser_privatebrowsing_windowtitle_page.html";
+    "browser/components/privatebrowsing/test/browser/global/browser_privatebrowsing_windowtitle_page.html";
   waitForExplicitFinish();
   requestLongerTimeout(2);
 
   // initialization of expected titles
   let test_title = "Test title";
   let app_name = document.documentElement.getAttribute("title");
   const isOSX = ("nsILocalFileMac" in Ci);
   let page_with_title;
rename from browser/components/privatebrowsing/test/browser/browser_privatebrowsing_windowtitle_page.html
rename to browser/components/privatebrowsing/test/browser/global/browser_privatebrowsing_windowtitle_page.html
rename from browser/components/privatebrowsing/test/browser/browser_privatebrowsing_zoom.js
rename to browser/components/privatebrowsing/test/browser/global/browser_privatebrowsing_zoom.js
rename from browser/components/privatebrowsing/test/browser/browser_privatebrowsing_zoomrestore.js
rename to browser/components/privatebrowsing/test/browser/global/browser_privatebrowsing_zoomrestore.js
rename from browser/components/privatebrowsing/test/browser/ctxmenu-image.png
rename to browser/components/privatebrowsing/test/browser/global/ctxmenu-image.png
rename from browser/components/privatebrowsing/test/browser/ctxmenu.html
rename to browser/components/privatebrowsing/test/browser/global/ctxmenu.html
rename from browser/components/privatebrowsing/test/browser/head.js
rename to browser/components/privatebrowsing/test/browser/global/head.js
rename from browser/components/privatebrowsing/test/browser/popup.html
rename to browser/components/privatebrowsing/test/browser/global/popup.html
rename from browser/components/privatebrowsing/test/browser/title.sjs
rename to browser/components/privatebrowsing/test/browser/global/title.sjs
new file mode 100644
--- /dev/null
+++ b/browser/components/privatebrowsing/test/browser/obsolete/Makefile.in
@@ -0,0 +1,41 @@
+# 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/.
+
+DEPTH		= @DEPTH@
+topsrcdir	= @top_srcdir@
+srcdir		= @srcdir@
+VPATH		= @srcdir@
+relativesrcdir  = @relativesrcdir@
+
+include $(DEPTH)/config/autoconf.mk
+
+MOCHITEST_BROWSER_FILES =  \
+		head.js \
+		browser_console_clear.js \
+		browser_privatebrowsing_commandline_toggle.js \
+		browser_privatebrowsing_fastswitch.js \
+		browser_privatebrowsing_findbar.js \
+		browser_privatebrowsing_forgetthissite.js \
+		browser_privatebrowsing_import.js \
+		browser_privatebrowsing_newwindow_stopcmd.js \
+		browser_privatebrowsing_pageinfo.js \
+		browser_privatebrowsing_popupmode.js \
+		browser_privatebrowsing_searchbar.js \
+		browser_privatebrowsing_transition.js \
+		browser_privatebrowsing_urlbarundo.js \
+		browser_privatebrowsing_viewsource.js \
+		staller.sjs \
+		$(NULL)
+
+# Disabled until bug 564934 is fixed:
+#		browser_privatebrowsing_downloadmonitor.js \
+
+# Turn off private browsing tests that perma-timeout on Linux.
+ifneq (Linux,$(OS_ARCH))
+MOCHITEST_BROWSER_FILES += \
+		browser_privatebrowsing_beforeunload.js \
+		$(NULL)
+endif
+
+include $(topsrcdir)/config/rules.mk
rename from browser/components/privatebrowsing/test/browser/browser_console_clear.js
rename to browser/components/privatebrowsing/test/browser/obsolete/browser_console_clear.js
rename from browser/components/privatebrowsing/test/browser/browser_privatebrowsing_beforeunload.js
rename to browser/components/privatebrowsing/test/browser/obsolete/browser_privatebrowsing_beforeunload.js
rename from browser/components/privatebrowsing/test/browser/browser_privatebrowsing_commandline_toggle.js
rename to browser/components/privatebrowsing/test/browser/obsolete/browser_privatebrowsing_commandline_toggle.js
rename from browser/components/privatebrowsing/test/browser/browser_privatebrowsing_downloadmonitor.js
rename to browser/components/privatebrowsing/test/browser/obsolete/browser_privatebrowsing_downloadmonitor.js
--- a/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_downloadmonitor.js
+++ b/browser/components/privatebrowsing/test/browser/obsolete/browser_privatebrowsing_downloadmonitor.js
@@ -110,17 +110,17 @@ function addDownload(dm, aParams)
     aParams.resultFileName = "download.result";
   if (!("targetFile" in aParams)) {
     let dirSvc = Cc["@mozilla.org/file/directory_service;1"].
                  getService(Ci.nsIProperties);
     aParams.targetFile = dirSvc.get("ProfD", Ci.nsIFile);
     aParams.targetFile.append(aParams.resultFileName);
   }
   if (!("sourceURI" in aParams))
-    aParams.sourceURI = "http://mochi.test:8888/browser/browser/components/privatebrowsing/test/browser/staller.sjs";
+    aParams.sourceURI = "http://mochi.test:8888/browser/browser/components/privatebrowsing/test/browser/global/staller.sjs";
   if (!("downloadName" in aParams))
     aParams.downloadName = null;
   if (!("runBeforeStart" in aParams))
     aParams.runBeforeStart = function () {};
 
   const nsIWBP = Ci.nsIWebBrowserPersist;
   let persist = Cc["@mozilla.org/embedding/browser/nsWebBrowserPersist;1"]
                 .createInstance(Ci.nsIWebBrowserPersist);
rename from browser/components/privatebrowsing/test/browser/browser_privatebrowsing_fastswitch.js
rename to browser/components/privatebrowsing/test/browser/obsolete/browser_privatebrowsing_fastswitch.js
rename from browser/components/privatebrowsing/test/browser/browser_privatebrowsing_findbar.js
rename to browser/components/privatebrowsing/test/browser/obsolete/browser_privatebrowsing_findbar.js
rename from browser/components/privatebrowsing/test/browser/browser_privatebrowsing_forgetthissite.js
rename to browser/components/privatebrowsing/test/browser/obsolete/browser_privatebrowsing_forgetthissite.js
rename from browser/components/privatebrowsing/test/browser/browser_privatebrowsing_import.js
rename to browser/components/privatebrowsing/test/browser/obsolete/browser_privatebrowsing_import.js
--- a/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_import.js
+++ b/browser/components/privatebrowsing/test/browser/obsolete/browser_privatebrowsing_import.js
@@ -1,17 +1,15 @@
 /* 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 test makes sure that the "Import and Backup->Import From Another Browser"
 // menu item in the Places Organizer is disabled inside private browsing mode.
 
-// TEST_PATH=browser/components/privatebrowsing/test/browser/browser_privatebrowsing_import.js make -C $(OBJDIR) mochitest-browser-chrome
-
 let pb = Cc["@mozilla.org/privatebrowsing;1"].
          getService(Ci.nsIPrivateBrowsingService);
 
 function test() {
   waitForExplicitFinish();
   gPrefService.setBoolPref("browser.privatebrowsing.keep_current_session", true);
 
   // first test: open the library with PB disabled
rename from browser/components/privatebrowsing/test/browser/browser_privatebrowsing_newwindow_stopcmd.js
rename to browser/components/privatebrowsing/test/browser/obsolete/browser_privatebrowsing_newwindow_stopcmd.js
rename from browser/components/privatebrowsing/test/browser/browser_privatebrowsing_pageinfo.js
rename to browser/components/privatebrowsing/test/browser/obsolete/browser_privatebrowsing_pageinfo.js
rename from browser/components/privatebrowsing/test/browser/browser_privatebrowsing_popupmode.js
rename to browser/components/privatebrowsing/test/browser/obsolete/browser_privatebrowsing_popupmode.js
rename from browser/components/privatebrowsing/test/browser/browser_privatebrowsing_searchbar.js
rename to browser/components/privatebrowsing/test/browser/obsolete/browser_privatebrowsing_searchbar.js
rename from browser/components/privatebrowsing/test/browser/browser_privatebrowsing_transition.js
rename to browser/components/privatebrowsing/test/browser/obsolete/browser_privatebrowsing_transition.js
rename from browser/components/privatebrowsing/test/browser/browser_privatebrowsing_urlbarundo.js
rename to browser/components/privatebrowsing/test/browser/obsolete/browser_privatebrowsing_urlbarundo.js
rename from browser/components/privatebrowsing/test/browser/browser_privatebrowsing_viewsource.js
rename to browser/components/privatebrowsing/test/browser/obsolete/browser_privatebrowsing_viewsource.js
copy from browser/components/privatebrowsing/test/browser/head.js
copy to browser/components/privatebrowsing/test/browser/obsolete/head.js
--- a/browser/components/privatebrowsing/test/browser/head.js
+++ b/browser/components/privatebrowsing/test/browser/obsolete/head.js
@@ -18,23 +18,8 @@ registerCleanupFunction(function() {
  */
 function waitForClearHistory(aCallback) {
   Services.obs.addObserver(function observeCH(aSubject, aTopic, aData) {
     Services.obs.removeObserver(observeCH, PlacesUtils.TOPIC_EXPIRATION_FINISHED);
     aCallback();
   }, PlacesUtils.TOPIC_EXPIRATION_FINISHED, false);
   PlacesUtils.bhistory.removeAllPages();
 }
-
-/*
- * Function created to put a window in PB mode.
- * THIS IS DANGEROUS.  DO NOT DO THIS OUTSIDE OF TESTS!
- */
-function setPrivateWindow(aWindow, aEnable) {
-  return aWindow.QueryInterface(Ci.nsIInterfaceRequestor)
-                 .getInterface(Ci.nsIWebNavigation)
-                 .QueryInterface(Ci.nsIDocShellTreeItem)
-                 .treeOwner
-                 .QueryInterface(Ci.nsIInterfaceRequestor)
-                 .getInterface(Ci.nsIXULWindow)
-                 .docShell.QueryInterface(Ci.nsILoadContext)
-                 .usePrivateBrowsing = aEnable;
-} 
rename from browser/components/privatebrowsing/test/browser/staller.sjs
rename to browser/components/privatebrowsing/test/browser/obsolete/staller.sjs
new file mode 100644
--- /dev/null
+++ b/browser/components/privatebrowsing/test/browser/perwindow/Makefile.in
@@ -0,0 +1,20 @@
+# 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/.
+
+DEPTH		= @DEPTH@
+topsrcdir	= @top_srcdir@
+srcdir		= @srcdir@
+VPATH		= @srcdir@
+relativesrcdir  = @relativesrcdir@
+
+include $(DEPTH)/config/autoconf.mk
+
+MOCHITEST_BROWSER_FILES =  \
+		head.js \
+		browser_privatebrowsing_concurrent.js \
+		browser_privatebrowsing_concurrent_page.html \
+		browser_privatebrowsing_lastpbcontextexited.js \
+		$(NULL)
+
+include $(topsrcdir)/config/rules.mk
rename from browser/components/privatebrowsing/test/browser/browser_privatebrowsing_concurrent.js
rename to browser/components/privatebrowsing/test/browser/perwindow/browser_privatebrowsing_concurrent.js
--- a/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_concurrent.js
+++ b/browser/components/privatebrowsing/test/browser/perwindow/browser_privatebrowsing_concurrent.js
@@ -7,17 +7,17 @@
 // earlier private storage sessions aren't visible later.
 
 // Step 1: create new tab, load a page that sets test=value in non-private storage
 // Step 2: create a new tab, load a page that sets test2=value2 in private storage
 // Step 3: load a page in the tab from step 1 that checks the value of test2 is value2 and the total count in non-private storage is 1
 // Step 4: load a page in the tab from step 2 that checks the value of test is value and the total count in private storage is 1
 
 function test() {
-  let prefix = 'http://mochi.test:8888/browser/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_concurrent_page.html';
+  let prefix = 'http://mochi.test:8888/browser/browser/components/privatebrowsing/test/browser/perwindow/browser_privatebrowsing_concurrent_page.html';
   waitForExplicitFinish();
   gBrowser.selectedTab = gBrowser.addTab();
   let non_private_tab = gBrowser.selectedBrowser;
   non_private_tab.addEventListener('load', function() {
     non_private_tab.removeEventListener('load', arguments.callee, true);
     gBrowser.selectedTab = gBrowser.addTab();
     let private_tab = gBrowser.selectedBrowser;
     private_tab.docShell.QueryInterface(Ci.nsILoadContext).usePrivateBrowsing = true;
@@ -65,9 +65,9 @@ function test() {
         }, true);
         private_tab.loadURI(prefix + '?action=get&name=test');
       }, true);
       non_private_tab.loadURI(prefix + '?action=get&name=test2');
     }, true);
     private_tab.loadURI(prefix + '?action=set&name=test2&value=value2');
   }, true);
   non_private_tab.loadURI(prefix + '?action=set&name=test&value=value&initial=true');
-}
\ No newline at end of file
+}
rename from browser/components/privatebrowsing/test/browser/browser_privatebrowsing_concurrent_page.html
rename to browser/components/privatebrowsing/test/browser/perwindow/browser_privatebrowsing_concurrent_page.html
rename from browser/components/privatebrowsing/test/browser/browser_privatebrowsing_lastpbcontextexited.js
rename to browser/components/privatebrowsing/test/browser/perwindow/browser_privatebrowsing_lastpbcontextexited.js
new file mode 100644
--- /dev/null
+++ b/browser/components/privatebrowsing/test/browser/perwindow/head.js
@@ -0,0 +1,14 @@
+/*
+ * Function created to put a window in PB mode.
+ * THIS IS DANGEROUS.  DO NOT DO THIS OUTSIDE OF TESTS!
+ */
+function setPrivateWindow(aWindow, aEnable) {
+  return aWindow.QueryInterface(Ci.nsIInterfaceRequestor)
+                 .getInterface(Ci.nsIWebNavigation)
+                 .QueryInterface(Ci.nsIDocShellTreeItem)
+                 .treeOwner
+                 .QueryInterface(Ci.nsIInterfaceRequestor)
+                 .getInterface(Ci.nsIXULWindow)
+                 .docShell.QueryInterface(Ci.nsILoadContext)
+                 .usePrivateBrowsing = aEnable;
+}