diff -r 000000000000 -r 6474c204b198 dom/system/gonk/tests/marionette/test_fakevolume.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dom/system/gonk/tests/marionette/test_fakevolume.js Wed Dec 31 06:09:35 2014 +0100 @@ -0,0 +1,29 @@ +/* Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ */ + +MARIONETTE_TIMEOUT = 10000; + +let Cc = SpecialPowers.Cc; +let Ci = SpecialPowers.Ci; + +let volumeService = Cc["@mozilla.org/telephony/volume-service;1"].getService(Ci.nsIVolumeService); +ok(volumeService, "Should have volume service"); + +let volName = "fake"; +let mountPoint = "/data/fake/storage"; +volumeService.createFakeVolume(volName, mountPoint); + +let vol = volumeService.getVolumeByName(volName); +ok(vol, "volume shouldn't be null"); + +is(volName, vol.name, "name"); +is(mountPoint, vol.mountPoint, "moutnPoint"); +is(Ci.nsIVolume.STATE_INIT, vol.state, "state"); + + +let oldMountGen = vol.mountGeneration; +volumeService.SetFakeVolumeState(volName, Ci.nsIVolume.STATE_MOUNTED); +is(Ci.nsIVolume.STATE_MOUNTED, vol.state, "state"); +ok(vol.mountGeneration > oldMountGen, "mount generation should be incremented"); + +finish();