test_get_idle.js (810B)
1 /* Any copyright is dedicated to the Public Domain. 2 * http://creativecommons.org/publicdomain/zero/1.0/ 3 */ 4 5 function run_test() { 6 print("Init the fake idle service and check its identity."); 7 let fakeIdleService = Cc["@mozilla.org/widget/useridleservice;1"].getService( 8 Ci.nsIUserIdleService 9 ); 10 try { 11 fakeIdleService.QueryInterface(Ci.nsIFactory); 12 } catch (ex) { 13 do_throw("The fake idle service implements nsIFactory."); 14 } 15 // We need at least one PASS, thus sanity check the idle time. 16 Assert.equal(fakeIdleService.idleTime, 0); 17 18 print("Init the real idle service and check its identity."); 19 let realIdleService = do_get_idle(); 20 try { 21 realIdleService.QueryInterface(Ci.nsIFactory); 22 do_throw("The real idle service does not implement nsIFactory."); 23 } catch (ex) {} 24 }