1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/dom/system/gonk/tests/marionette/test_fakevolume.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,29 @@ 1.4 +/* Any copyright is dedicated to the Public Domain. 1.5 + * http://creativecommons.org/publicdomain/zero/1.0/ */ 1.6 + 1.7 +MARIONETTE_TIMEOUT = 10000; 1.8 + 1.9 +let Cc = SpecialPowers.Cc; 1.10 +let Ci = SpecialPowers.Ci; 1.11 + 1.12 +let volumeService = Cc["@mozilla.org/telephony/volume-service;1"].getService(Ci.nsIVolumeService); 1.13 +ok(volumeService, "Should have volume service"); 1.14 + 1.15 +let volName = "fake"; 1.16 +let mountPoint = "/data/fake/storage"; 1.17 +volumeService.createFakeVolume(volName, mountPoint); 1.18 + 1.19 +let vol = volumeService.getVolumeByName(volName); 1.20 +ok(vol, "volume shouldn't be null"); 1.21 + 1.22 +is(volName, vol.name, "name"); 1.23 +is(mountPoint, vol.mountPoint, "moutnPoint"); 1.24 +is(Ci.nsIVolume.STATE_INIT, vol.state, "state"); 1.25 + 1.26 + 1.27 +let oldMountGen = vol.mountGeneration; 1.28 +volumeService.SetFakeVolumeState(volName, Ci.nsIVolume.STATE_MOUNTED); 1.29 +is(Ci.nsIVolume.STATE_MOUNTED, vol.state, "state"); 1.30 +ok(vol.mountGeneration > oldMountGen, "mount generation should be incremented"); 1.31 + 1.32 +finish();