1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/docshell/test/unit/test_privacy_transition.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,23 @@ 1.4 +var gNotifications = 0; 1.5 + 1.6 +var observer = { 1.7 + QueryInterface: function(iid) { 1.8 + if (Ci.nsIPrivacyTransitionObserver.equals(iid) || 1.9 + Ci.nsISupportsWeakReference.equals(iid) || 1.10 + Ci.nsISupports.equals(iid)) 1.11 + return this; 1.12 + throw Cr.NS_ERROR_NO_INTERFACE; 1.13 + }, 1.14 + 1.15 + privateModeChanged: function(enabled) { 1.16 + gNotifications++; 1.17 + } 1.18 +} 1.19 + 1.20 +function run_test() { 1.21 + var docshell = Cc["@mozilla.org/docshell;1"].createInstance(Ci.nsIDocShell); 1.22 + docshell.addWeakPrivacyTransitionObserver(observer); 1.23 + docshell.QueryInterface(Ci.nsILoadContext).usePrivateBrowsing = true; 1.24 + docshell.QueryInterface(Ci.nsILoadContext).usePrivateBrowsing = false; 1.25 + do_check_eq(gNotifications, 2); 1.26 +} 1.27 \ No newline at end of file